diff --git a/.circleci/config.yml b/.circleci/config.yml index 0cedeb71686..8ae399c5c5f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -616,6 +616,24 @@ jobs: wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz rm dockerize-linux-amd64-v0.6.1.tar.gz + - run: + name: Start PostgreSQL Database + command: | + docker run -d \ + --name postgres-db \ + -e POSTGRES_USER=postgres \ + -e POSTGRES_PASSWORD=postgres \ + -e POSTGRES_DB=circle_test \ + -p 5432:5432 \ + postgres:14 + - run: + name: Wait for PostgreSQL to be ready + command: dockerize -wait tcp://localhost:5432 -timeout 1m + - run: + name: Set DATABASE_URL environment variable + command: | + echo 'export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/circle_test"' >> $BASH_ENV + source $BASH_ENV - run: name: Run Security Scans command: | @@ -658,18 +676,16 @@ jobs: working_directory: ~/project steps: - checkout - - run: - name: Install PostgreSQL - command: | - sudo apt-get update - sudo apt-get install postgresql postgresql-contrib - echo 'export PATH=/usr/lib/postgresql/*/bin:$PATH' >> $BASH_ENV - setup_google_dns - run: name: Show git commit hash command: | echo "Git commit hash: $CIRCLE_SHA1" - + - run: + name: Install PostgreSQL + command: | + sudo apt-get update + sudo apt-get install -y postgresql-14 postgresql-contrib-14 - restore_cache: keys: - v1-dependencies-{{ checksum ".circleci/requirements.txt" }} @@ -1025,6 +1041,49 @@ jobs: paths: - llm_responses_api_coverage.xml - llm_responses_api_coverage + ocr_testing: + docker: + - image: cimg/python:3.11 + auth: + username: ${DOCKERHUB_USERNAME} + password: ${DOCKERHUB_PASSWORD} + working_directory: ~/project + + steps: + - checkout + - setup_google_dns + - run: + name: Install Dependencies + command: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + pip install "pytest==7.3.1" + pip install "pytest-retry==1.6.3" + pip install "pytest-cov==5.0.0" + pip install "pytest-asyncio==0.21.1" + pip install "respx==0.22.0" + # Run pytest and generate JUnit XML report + - run: + name: Run tests + command: | + pwd + ls + python -m pytest -vv tests/ocr_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 + no_output_timeout: 120m + - run: + name: Rename the coverage files + command: | + mv coverage.xml ocr_coverage.xml + mv .coverage ocr_coverage + + # Store test results + - store_test_results: + path: test-results + - persist_to_workspace: + root: . + paths: + - ocr_coverage.xml + - ocr_coverage litellm_mapped_tests: docker: - image: cimg/python:3.11 @@ -2357,6 +2416,25 @@ jobs: pip install "pytest-mock==3.12.0" pip install "pytest-asyncio==0.21.1" pip install "assemblyai==0.37.0" + - run: + name: Install dockerize + command: | + wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz + sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz + rm dockerize-linux-amd64-v0.6.1.tar.gz + - run: + name: Start PostgreSQL Database + command: | + docker run -d \ + --name postgres-db \ + -e POSTGRES_USER=postgres \ + -e POSTGRES_PASSWORD=postgres \ + -e POSTGRES_DB=circle_test \ + -p 5432:5432 \ + postgres:14 + - run: + name: Wait for PostgreSQL to be ready + command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: name: Build Docker image command: docker build -t my-app:latest -f ./docker/Dockerfile.database . @@ -2367,10 +2445,11 @@ jobs: command: | docker run -d \ -p 4000:4000 \ - -e DATABASE_URL=$CLEAN_STORE_MODEL_IN_DB_DATABASE_URL \ + -e DATABASE_URL=postgresql://postgres:postgres@host.docker.internal:5432/circle_test \ -e STORE_MODEL_IN_DB="True" \ -e LITELLM_MASTER_KEY="sk-1234" \ -e LITELLM_LICENSE=$LITELLM_LICENSE \ + --add-host host.docker.internal:host-gateway \ --name my-app \ -v $(pwd)/litellm/proxy/example_config_yaml/store_model_db_config.yaml:/app/config.yaml \ my-app:latest \ @@ -2400,7 +2479,16 @@ jobs: python -m pytest -vv tests/store_model_in_db_tests -x --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 120m - # Clean up first container + - run: + name: Stop and remove containers + command: | + docker stop my-app || true + docker rm my-app || true + docker stop postgres-db || true + docker rm postgres-db || true + when: always + - store_test_results: + path: test-results proxy_build_from_pip_tests: # Change from docker to machine executor @@ -2588,6 +2676,8 @@ jobs: -e GEMINI_API_KEY=$GEMINI_API_KEY \ -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \ -e ASSEMBLYAI_API_KEY=$ASSEMBLYAI_API_KEY \ + -e AZURE_API_KEY_PASSHROUGH=$AZURE_API_KEY_PASSHROUGH \ + -e AZURE_API_BASE_PASSHROUGH=$AZURE_API_BASE_PASSHROUGH \ -e USE_DDTRACE=True \ -e DD_API_KEY=$DD_API_KEY \ -e DD_SITE=$DD_SITE \ @@ -2694,7 +2784,7 @@ jobs: python -m venv venv . venv/bin/activate pip install coverage - coverage combine llm_translation_coverage llm_responses_api_coverage mcp_coverage logging_coverage litellm_router_coverage local_testing_coverage litellm_assistants_api_coverage auth_ui_unit_tests_coverage langfuse_coverage caching_coverage litellm_proxy_unit_tests_coverage image_gen_coverage pass_through_unit_tests_coverage batches_coverage litellm_security_tests_coverage guardrails_coverage + coverage combine llm_translation_coverage llm_responses_api_coverage ocr_coverage mcp_coverage logging_coverage litellm_router_coverage local_testing_coverage litellm_assistants_api_coverage auth_ui_unit_tests_coverage langfuse_coverage caching_coverage litellm_proxy_unit_tests_coverage image_gen_coverage pass_through_unit_tests_coverage batches_coverage litellm_security_tests_coverage guardrails_coverage coverage xml - codecov/upload: file: ./coverage.xml @@ -3242,6 +3332,12 @@ workflows: only: - main - /litellm_.*/ + - ocr_testing: + filters: + branches: + only: + - main + - /litellm_.*/ - litellm_mapped_enterprise_tests: filters: branches: @@ -3291,6 +3387,7 @@ workflows: - google_generate_content_endpoint_testing - guardrails_testing - llm_responses_api_testing + - ocr_testing - litellm_mapped_tests - litellm_mapped_enterprise_tests - batches_testing @@ -3353,6 +3450,7 @@ workflows: - mcp_testing - google_generate_content_endpoint_testing - llm_responses_api_testing + - ocr_testing - litellm_mapped_tests - litellm_mapped_enterprise_tests - batches_testing diff --git a/.gitignore b/.gitignore index c2ac5137cbe..e1045032d46 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,5 @@ litellm_config.yaml .vscode/launch.json litellm/proxy/to_delete_loadtest_work/* update_model_cost_map.py +tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py +litellm/proxy/_experimental/out/guardrails/index.html diff --git a/MCP_SSL_CHANGES_SUMMARY.md b/MCP_SSL_CHANGES_SUMMARY.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/README.md b/README.md index c785ee82ffa..812b20e6986 100644 --- a/README.md +++ b/README.md @@ -347,6 +347,7 @@ curl 'http://0.0.0.0:4000/key/generate' \ | [Nebius AI Studio](https://docs.litellm.ai/docs/providers/nebius) | ✅ | ✅ | ✅ | ✅ | ✅ | | | [Heroku](https://docs.litellm.ai/docs/providers/heroku) | ✅ | ✅ | | | | | | [OVHCloud AI Endpoints](https://docs.litellm.ai/docs/providers/ovhcloud) | ✅ | ✅ | | | | | +| [CometAPI](https://docs.litellm.ai/docs/providers/cometapi) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | [**Read the Docs**](https://docs.litellm.ai/docs/) diff --git a/ci_cd/security_scans.sh b/ci_cd/security_scans.sh index 4255885bcbb..fbb2ef5c0d9 100755 --- a/ci_cd/security_scans.sh +++ b/ci_cd/security_scans.sh @@ -68,8 +68,11 @@ run_grype_scans() { # Allowlist of CVEs to be ignored in failure threshold/reporting # - CVE-2025-8869: Not applicable on Python >=3.13 (PEP 706 implemented); pip fallback unused; no OS-level fix + # - GHSA-4xh5-x5gv-qwph: GitHub Security Advisory alias for CVE-2025-8869 ALLOWED_CVES=( "CVE-2025-8869" + "GHSA-4xh5-x5gv-qwph" + "CVE-2025-8291" # no fix available as of Oct 11, 2025 ) # Build JSON array of allowlisted CVE IDs for jq @@ -77,6 +80,26 @@ run_grype_scans() { echo "Checking for vulnerabilities with CVSS score >= 4.0..." echo "Allowlisted CVEs (ignored in threshold): ${ALLOWED_CVES[*]}" + echo "" + + # Show all high-severity vulnerabilities for transparency + TOTAL_HIGH_SEVERITY=$(grype litellm:latest -o json | jq -r ' + .matches[] + | select(.vulnerability.cvss[]?.metrics.baseScore >= 4.0) + | .vulnerability.id' | wc -l) + + if [ "$TOTAL_HIGH_SEVERITY" -gt 0 ]; then + echo "Total vulnerabilities found with CVSS >= 4.0: $TOTAL_HIGH_SEVERITY" + echo "" + echo "All high-severity vulnerabilities (including allowlisted):" + grype litellm:latest -o json | jq --argjson allow "$ALLOWED_IDS_JSON" -r ' + ["Package", "Version", "Vulnerability ID", "CVSS Score", "Allowlisted"], + (.matches[] + | select(.vulnerability.cvss[]?.metrics.baseScore >= 4.0) + | [.artifact.name, .artifact.version, .vulnerability.id, .vulnerability.cvss[0].metrics.baseScore, (if (.vulnerability.id as $id | $allow | index($id)) then "YES" else "NO" end)]) + | @tsv' | column -t -s $'\t' + echo "" + fi HIGH_SEVERITY_COUNT=$(grype litellm:latest -o json | jq --argjson allow "$ALLOWED_IDS_JSON" -r ' .matches[] @@ -85,8 +108,17 @@ run_grype_scans() { | .vulnerability.id' | wc -l) if [ "$HIGH_SEVERITY_COUNT" -gt 0 ]; then - echo "ERROR: Found $HIGH_SEVERITY_COUNT vulnerabilities with CVSS score >= 4.0 in litellm:latest" + echo "" + echo "==========================================" + echo "ERROR: Security Scan Failed" + echo "==========================================" + echo "Found $HIGH_SEVERITY_COUNT non-allowlisted vulnerabilities with CVSS score >= 4.0 in litellm:latest" + echo "" + echo "These vulnerabilities are NOT in the allowlist and must be addressed." + echo "Current allowlisted CVEs: ${ALLOWED_CVES[*]}" + echo "" echo "Detailed vulnerability report:" + echo "" grype litellm:latest -o json | jq --argjson allow "$ALLOWED_IDS_JSON" -r ' ["Package", "Version", "Vulnerability ID", "CVSS Score", "Severity", "Fix Version", "Description"], (.matches[] @@ -94,6 +126,19 @@ run_grype_scans() { | select((.vulnerability.id as $id | $allow | index($id) | not)) | [.artifact.name, .artifact.version, .vulnerability.id, .vulnerability.cvss[0].metrics.baseScore, .vulnerability.severity, (.vulnerability.fix.versions[0] // "No fix available"), .vulnerability.description]) | @tsv' | column -t -s $'\t' + echo "" + echo "==========================================" + echo "Action Required:" + echo "==========================================" + echo "1. If a fix is available, update the package to the fixed version" + echo "2. If the vulnerability is not applicable or has no fix:" + echo " - Add the CVE/GHSA ID to ALLOWED_CVES array in ci_cd/security_scans.sh" + echo " - Add a comment explaining why it's safe to ignore" + echo "" + echo "Note: Some vulnerabilities may have multiple IDs (CVE-XXXX and GHSA-XXXX)." + echo "Add all relevant IDs to the allowlist if they refer to the same issue." + echo "==========================================" + echo "" exit 1 else echo "No high-severity vulnerabilities (CVSS >= 4.0) found in litellm:latest" diff --git a/cookbook/LiteLLM_CometAPI.ipynb b/cookbook/LiteLLM_CometAPI.ipynb new file mode 100644 index 00000000000..bdd916c5bfe --- /dev/null +++ b/cookbook/LiteLLM_CometAPI.ipynb @@ -0,0 +1,474 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "iFEmsVJI_2BR" + }, + "source": [ + "# LiteLLM CometAPI Cookbook" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "cBlUhCEP_xj4" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: litellm in /Users/xmx/.miniforge3/lib/python3.12/site-packages (1.78.2)\n", + "Requirement already satisfied: aiohttp>=3.10 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (3.11.18)\n", + "Requirement already satisfied: click in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (8.3.0)\n", + "Requirement already satisfied: fastuuid>=0.13.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (0.13.3)\n", + "Requirement already satisfied: httpx>=0.23.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (0.28.1)\n", + "Requirement already satisfied: importlib-metadata>=6.8.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (8.6.1)\n", + "Requirement already satisfied: jinja2<4.0.0,>=3.1.2 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (3.1.6)\n", + "Requirement already satisfied: jsonschema<5.0.0,>=4.22.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (4.25.1)\n", + "Requirement already satisfied: openai>=1.99.5 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (1.109.1)\n", + "Requirement already satisfied: pydantic<3.0.0,>=2.5.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (2.11.10)\n", + "Requirement already satisfied: python-dotenv>=0.2.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (1.1.1)\n", + "Requirement already satisfied: tiktoken>=0.7.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (0.12.0)\n", + "Requirement already satisfied: tokenizers in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from litellm) (0.22.1)\n", + "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from aiohttp>=3.10->litellm) (2.6.1)\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from aiohttp>=3.10->litellm) (1.4.0)\n", + "Requirement already satisfied: attrs>=17.3.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from aiohttp>=3.10->litellm) (25.3.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from aiohttp>=3.10->litellm) (1.6.0)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from aiohttp>=3.10->litellm) (6.6.3)\n", + "Requirement already satisfied: propcache>=0.2.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from aiohttp>=3.10->litellm) (0.3.1)\n", + "Requirement already satisfied: yarl<2.0,>=1.17.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from aiohttp>=3.10->litellm) (1.20.0)\n", + "Requirement already satisfied: anyio in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from httpx>=0.23.0->litellm) (4.11.0)\n", + "Requirement already satisfied: certifi in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from httpx>=0.23.0->litellm) (2025.10.5)\n", + "Requirement already satisfied: httpcore==1.* in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from httpx>=0.23.0->litellm) (1.0.9)\n", + "Requirement already satisfied: idna in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from httpx>=0.23.0->litellm) (3.10)\n", + "Requirement already satisfied: h11>=0.16 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from httpcore==1.*->httpx>=0.23.0->litellm) (0.16.0)\n", + "Requirement already satisfied: zipp>=3.20 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from importlib-metadata>=6.8.0->litellm) (3.21.0)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from jinja2<4.0.0,>=3.1.2->litellm) (3.0.3)\n", + "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from jsonschema<5.0.0,>=4.22.0->litellm) (2025.9.1)\n", + "Requirement already satisfied: referencing>=0.28.4 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from jsonschema<5.0.0,>=4.22.0->litellm) (0.36.2)\n", + "Requirement already satisfied: rpds-py>=0.7.1 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from jsonschema<5.0.0,>=4.22.0->litellm) (0.27.1)\n", + "Requirement already satisfied: distro<2,>=1.7.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from openai>=1.99.5->litellm) (1.9.0)\n", + "Requirement already satisfied: jiter<1,>=0.4.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from openai>=1.99.5->litellm) (0.11.0)\n", + "Requirement already satisfied: sniffio in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from openai>=1.99.5->litellm) (1.3.1)\n", + "Requirement already satisfied: tqdm>4 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from openai>=1.99.5->litellm) (4.67.1)\n", + "Requirement already satisfied: typing-extensions<5,>=4.11 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from openai>=1.99.5->litellm) (4.15.0)\n", + "Requirement already satisfied: annotated-types>=0.6.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from pydantic<3.0.0,>=2.5.0->litellm) (0.7.0)\n", + "Requirement already satisfied: pydantic-core==2.33.2 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from pydantic<3.0.0,>=2.5.0->litellm) (2.33.2)\n", + "Requirement already satisfied: typing-inspection>=0.4.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from pydantic<3.0.0,>=2.5.0->litellm) (0.4.2)\n", + "Requirement already satisfied: regex>=2022.1.18 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from tiktoken>=0.7.0->litellm) (2025.9.18)\n", + "Requirement already satisfied: requests>=2.26.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from tiktoken>=0.7.0->litellm) (2.32.2)\n", + "Requirement already satisfied: huggingface-hub<2.0,>=0.16.4 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from tokenizers->litellm) (0.25.2)\n", + "Requirement already satisfied: filelock in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from huggingface-hub<2.0,>=0.16.4->tokenizers->litellm) (3.15.4)\n", + "Requirement already satisfied: fsspec>=2023.5.0 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from huggingface-hub<2.0,>=0.16.4->tokenizers->litellm) (2025.9.0)\n", + "Requirement already satisfied: packaging>=20.9 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from huggingface-hub<2.0,>=0.16.4->tokenizers->litellm) (25.0)\n", + "Requirement already satisfied: pyyaml>=5.1 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from huggingface-hub<2.0,>=0.16.4->tokenizers->litellm) (6.0.3)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from requests>=2.26.0->tiktoken>=0.7.0->litellm) (3.4.0)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/xmx/.miniforge3/lib/python3.12/site-packages (from requests>=2.26.0->tiktoken>=0.7.0->litellm) (1.26.20)\n" + ] + } + ], + "source": [ + "!pip install litellm" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Completion" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "p-MQqWOT_1a7" + }, + "outputs": [], + "source": [ + "import os\n", + "\n", + "os.environ['COMETAPI_KEY'] = \"Your_CometAPI_Key_Here\"\n", + "api_key = os.getenv('COMETAPI_KEY')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Ze8JqMqWAARO", + "outputId": "64f3e836-69fa-4f8e-fb35-088a913bbe98" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "ModelResponse(id='msg_017L3DDDit8AkEgHRe2DQBc9', created=1760589916, model='claude-sonnet-4-5-20250929', object='chat.completion', system_fingerprint=None, choices=[Choices(finish_reason='stop', index=0, message=Message(content='I\\'ll create a simple Python script that says hi.\\n\\n\\nhello.py\\n#!/usr/bin/env python3\\n\"\"\"\\nA simple script that says hi!\\n\"\"\"\\n\\ndef say_hi(name=None):\\n \"\"\"Say hi to someone, or just say hi generally.\"\"\"\\n if name:\\n print(f\"Hi, {name}!\")\\n else:\\n print(\"Hi!\")\\n\\nif __name__ == \"__main__\":\\n # Say hi generally\\n say_hi()\\n \\n # Say hi to someone specific\\n say_hi(\"World\")\\n\\n\\n\\nI\\'ve created a simple Python script called `hello.py` that:\\n\\n1. Defines a `say_hi()` function that can optionally take a name parameter\\n2. Prints \"Hi!\" if no name is provided\\n3. Prints \"Hi, [name]!\" if a name is provided\\n4. Demonstrates both usages when run\\n\\nYou can run it with:\\n```bash\\npython hello.py\\n```\\n\\nThis will output:\\n```\\nHi!\\nHi, World!\\n```\\n\\nWould you like me to create versions in other programming languages, or modify this in any way?', role='assistant', tool_calls=None, function_call=None, provider_specific_fields=None), provider_specific_fields={})], usage=Usage(completion_tokens=290, prompt_tokens=26, total_tokens=316, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetailsWrapper(audio_tokens=None, cached_tokens=None, text_tokens=None, image_tokens=None, cached_tokens_details={})))" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from litellm import completion\n", + "response = completion(\n", + " model=\"cometapi/claude-sonnet-4-5-20250929\",\n", + " messages=[{\"role\": \"user\", \"content\": \"write code for saying hi\"}]\n", + ")\n", + "response" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "-LnhELrnAM_J", + "outputId": "d51c7ab7-d761-4bd1-f849-1534d9df4cd0" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "ModelResponse(id='chatcmpl-CRA9Uo6nsQ9C7kMJv1J4kyNDFJym7', created=1760589916, model='gpt-5-chat-latest', object='chat.completion', system_fingerprint='fp_2da73a467a', choices=[Choices(finish_reason='stop', index=0, message=Message(content='Sure! I can help you write a simple code that prints out \"Hi\" in different programming languages. \\n\\nHere’s an example in **Python**:\\n\\n```python\\n# Simple Python program to say \"Hi\"\\nprint(\"Hi\")\\n```\\n\\nExample in **JavaScript**:\\n\\n```javascript\\n// Simple JavaScript program to say \"Hi\"\\nconsole.log(\"Hi\");\\n```\\n\\nExample in **C**:\\n\\n```c\\n#include \\n\\nint main() {\\n printf(\"Hi\\\\n\");\\n return 0;\\n}\\n```\\n\\nExample in **Java**:\\n\\n```java\\npublic class SayHi {\\n public static void main(String[] args) {\\n System.out.println(\"Hi\");\\n }\\n}\\n```\\n\\nWhich language would you like me to focus on, or do you want me to make it interactive so the program greets the user by name?', role='assistant', tool_calls=None, function_call=None, provider_specific_fields={'refusal': None}, annotations=[]), provider_specific_fields={})], usage=Usage(completion_tokens=174, prompt_tokens=12, total_tokens=186, completion_tokens_details=CompletionTokensDetailsWrapper(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0, text_tokens=None), prompt_tokens_details=PromptTokensDetailsWrapper(audio_tokens=0, cached_tokens=0, text_tokens=None, image_tokens=None)))" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response = completion(\n", + " model=\"cometapi/gpt-5-chat-latest\",\n", + " messages=[{\"role\": \"user\", \"content\": \"write code for saying hi\"}]\n", + ")\n", + "response" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dJBOUYdwCEn1", + "outputId": "ffa18679-ec15-4dad-fe2b-68665cdf36b0" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "ModelResponse(id='02176058998406949c23b3bf3d52941de23f13565a086747738f0', created=1760589991, model='deepseek-v3.2-exp', object='chat.completion', system_fingerprint=None, choices=[Choices(finish_reason='stop', index=0, message=Message(content='Here are several ways to say \"hi\" in different programming languages:\\n\\n## Python\\n```python\\nprint(\"Hi!\")\\n```\\n\\n## JavaScript (Browser)\\n```javascript\\nconsole.log(\"Hi!\");\\n// or\\nalert(\"Hi!\");\\n```\\n\\n## JavaScript (Node.js)\\n```javascript\\nconsole.log(\"Hi!\");\\n```\\n\\n## Java\\n```java\\npublic class Hello {\\n public static void main(String[] args) {\\n System.out.println(\"Hi!\");\\n }\\n}\\n```\\n\\n## C\\n```c\\n#include \\n\\nint main() {\\n printf(\"Hi!\\\\n\");\\n return 0;\\n}\\n```\\n\\n## C++\\n```cpp\\n#include \\n\\nint main() {\\n std::cout << \"Hi!\" << std::endl;\\n return 0;\\n}\\n```\\n\\n## C#\\n```csharp\\nusing System;\\n\\nclass Program {\\n static void Main() {\\n Console.WriteLine(\"Hi!\");\\n }\\n}\\n```\\n\\n## PHP\\n```php\\n\\n```\\n\\n## Ruby\\n```ruby\\nputs \"Hi!\"\\n```\\n\\n## Go\\n```go\\npackage main\\n\\nimport \"fmt\"\\n\\nfunc main() {\\n fmt.Println(\"Hi!\")\\n}\\n```\\n\\n## Rust\\n```rust\\nfn main() {\\n println!(\"Hi!\");\\n}\\n```\\n\\n## Swift\\n```swift\\nprint(\"Hi!\")\\n```\\n\\n## Kotlin\\n```kotlin\\nfun main() {\\n println(\"Hi!\")\\n}\\n```\\n\\n## HTML (webpage)\\n```html\\n\\n\\n\\n Hi Page\\n\\n\\n

Hi!

\\n\\n\\n```\\n\\nThe Python version is probably the simplest if you\\'re just getting started!', role='assistant', tool_calls=None, function_call=None, provider_specific_fields={'refusal': None}), provider_specific_fields={})], usage=Usage(completion_tokens=347, prompt_tokens=10, total_tokens=357, completion_tokens_details=CompletionTokensDetailsWrapper(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=0, rejected_prediction_tokens=None, text_tokens=None), prompt_tokens_details=PromptTokensDetailsWrapper(audio_tokens=None, cached_tokens=0, text_tokens=None, image_tokens=None)), service_tier='default')" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response = completion(\n", + " model=\"cometapi/deepseek-v3.2-exp\",\n", + " messages=[{\"role\": \"user\", \"content\": \"write code for saying hi\"}]\n", + ")\n", + "response" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Streaming" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Streaming Responses" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I'm\n", + " doing\n", + " well\n", + " —\n", + " thanks\n", + " for\n", + " asking\n", + "!\n", + " How\n", + " can\n", + " I\n", + " help\n", + " you\n", + " today\n", + "?\n", + "\n" + ] + } + ], + "source": [ + "messages = [{\"role\": \"user\", \"content\": \"Hey, how's it going?\"}]\n", + "response = completion(model=\"cometapi/gpt-5-mini\", messages=messages, stream=True)\n", + "for part in response:\n", + " print(part.choices[0].delta.content or \"\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Async Completion" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ModelResponse(id='chatcmpl-CRAAkmfczlmCEnCM55D9CKexbRenn', created=1760589994, model='gpt-5-mini-2025-08-07', object='chat.completion', system_fingerprint=None, choices=[Choices(finish_reason='stop', index=0, message=Message(content=\"I'm doing well, thanks — how are you? How can I help today?\", role='assistant', tool_calls=None, function_call=None, provider_specific_fields={'refusal': None}, annotations=[]), provider_specific_fields={'content_filter_results': {'hate': {'filtered': False, 'severity': 'safe'}, 'protected_material_code': {'filtered': False, 'detected': False}, 'protected_material_text': {'filtered': False, 'detected': False}, 'self_harm': {'filtered': False, 'severity': 'safe'}, 'sexual': {'filtered': False, 'severity': 'safe'}, 'violence': {'filtered': False, 'severity': 'safe'}}})], usage=Usage(completion_tokens=26, prompt_tokens=12, total_tokens=38, completion_tokens_details=CompletionTokensDetailsWrapper(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0, text_tokens=None), prompt_tokens_details=PromptTokensDetailsWrapper(audio_tokens=0, cached_tokens=0, text_tokens=None, image_tokens=None)), prompt_filter_results=[{'prompt_index': 0, 'content_filter_results': {'hate': {'filtered': False, 'severity': 'safe'}, 'jailbreak': {'filtered': False, 'detected': False}, 'self_harm': {'filtered': False, 'severity': 'safe'}, 'sexual': {'filtered': False, 'severity': 'safe'}, 'violence': {'filtered': False, 'severity': 'safe'}}}])\n" + ] + } + ], + "source": [ + "from litellm import acompletion\n", + "import asyncio\n", + "\n", + "async def test_get_response():\n", + " user_message = \"Hello, how are you?\"\n", + " messages = [{\"content\": user_message, \"role\": \"user\"}]\n", + " response = await acompletion(model=\"cometapi/gpt-5-mini\", messages=messages)\n", + " return response\n", + "\n", + "response = await test_get_response()\n", + "print(response)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Async Streaming" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "test acompletion + streaming\n", + "response: \n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content='Hi', role='assistant', function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' —', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' I', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content='’m', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' doing', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' well', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=',', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' thanks', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content='!', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' How', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' are', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' you', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content='?', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' What', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' can', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' I', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' help', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' you', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' with', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content=' today', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(provider_specific_fields=None, content='?', role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None, citations=None)\n", + "ModelResponseStream(id='chatcmpl-CRAAl9VMDBB5skZt638Qx86K9h1Hb', created=1760589996, model='gpt-5-mini', object='chat.completion.chunk', system_fingerprint=None, choices=[StreamingChoices(finish_reason='stop', index=0, delta=Delta(provider_specific_fields=None, content=None, role=None, function_call=None, tool_calls=None, audio=None), logprobs=None)], provider_specific_fields=None)\n" + ] + } + ], + "source": [ + "from litellm import acompletion\n", + "import asyncio, os, traceback\n", + "\n", + "async def completion_call():\n", + " try:\n", + " print(\"test acompletion + streaming\")\n", + " response = await acompletion(\n", + " model=\"cometapi/gpt-5-mini\", \n", + " messages=[{\"content\": \"Hello, how are you?\", \"role\": \"user\"}], \n", + " stream=True\n", + " )\n", + " print(f\"response: {response}\")\n", + " async for chunk in response:\n", + " print(chunk)\n", + " except:\n", + " print(f\"error occurred: {traceback.format_exc()}\")\n", + " pass\n", + "\n", + "await completion_call()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Embedding" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "EmbeddingResponse(model='text-embedding-3-small', data=[{'object': 'embedding', 'index': 0, 'embedding': [-0.018048199, 0.0047550877, -0.013976435, -0.021936804, -0.038773336, -0.03708264, 0.03854791, -0.0007172257, 0.026473511, -0.0027438616, -0.019823432, -0.011947598, -0.013426959, -0.0059914105, 0.020485623, 0.04269012, -0.028276922, -0.015216281, -0.03325039, 0.045057096, 0.0037477135, 0.015793936, -0.005188329, -0.0071713766, 0.008446445, 0.0070938864, 0.0027632343, 0.025656339, 0.022091785, -0.026797561, -0.029840818, -0.0542714, 0.017907308, -0.03454659, -0.014582269, 0.0429719, 0.03575826, 0.007939235, -0.010123054, -0.029587213, 0.018921727, 0.022556728, 0.019598005, 0.008819807, 0.01655475, 0.043310042, -0.034321167, 0.004441604, 0.032686826, 0.047226828, -0.0043253684, 0.006681779, 0.008995921, 0.06593721, 0.0066078105, -0.023190739, -0.00777721, 0.049875587, -0.028023317, -0.019386668, -0.0013252605, 0.009214303, -0.0055828253, -0.007432026, -0.01199691, 0.0054384116, -0.024247425, 0.047255006, -0.013743965, 0.012799991, 0.009883538, -0.005579303, -0.012616833, -0.014709071, -0.004473305, -0.022204498, 0.010454148, -0.02202134, 0.034631126, 0.0097567355, 0.041478455, -0.010750021, -0.0005340668, -0.041450277, -0.04516981, 0.014709071, -0.06142869, 0.021640932, -0.0008752884, -0.0012671428, -0.045254346, -0.004216178, -0.028220564, -0.011074071, 0.010693664, -0.0029481545, -0.039590508, -0.030178957, -0.019062618, -0.03539194, 0.019978413, 0.019161243, -0.025924034, 0.0058329077, -0.029305428, 0.028840488, 0.02731886, -0.0008048426, -0.056582022, 0.003043256, -0.08459125, -0.012560476, 0.00081100664, 0.0015771041, 0.015188103, -0.0049206354, 0.046888687, -0.027107522, 0.019245777, -0.011412211, 0.039336905, -0.018611765, 0.0429719, -0.04302826, -0.018132735, -0.0074883825, -0.02035882, -0.073038146, -0.042380158, 0.04485985, 0.03361671, -0.033842135, -0.0017259207, -0.0017091898, -0.049199305, -0.024148801, -0.044803493, 0.040943068, -0.03093977, 0.045057096, -0.0186963, -0.014053926, -0.009848315, -0.0070480965, -0.0060054995, -0.02813603, -0.022105874, 0.010235767, -0.004476827, 0.027220234, -0.026290352, 0.0216832, -0.05559578, 0.042464696, 0.0253182, -0.0031594916, 0.02266944, -0.030798879, -0.02896729, -0.0005891025, 0.004061197, -0.042295624, -0.008383043, 0.017146494, -0.025797231, -0.046522368, 0.044127215, 0.021105545, -0.04302826, 0.024430584, -0.014934498, -0.01556851, -0.075743265, -0.022415835, -0.028586883, 0.032743182, 0.03539194, -0.0034483192, -0.04669144, 0.051932603, 0.021626843, 0.03127791, 0.015610777, -0.016470214, -0.0056744046, -0.012743635, 0.060132485, 0.017428277, -0.0039942735, -0.017118316, 0.025106862, 0.008974788, 0.018513141, 0.0016035212, -0.0049593803, 0.0017514573, 0.031221554, -0.034856554, -0.011461522, 0.04621241, 0.044239927, 0.034715664, -0.0121941585, -0.012053267, -0.08526753, -0.011813751, -0.025769053, 0.0125182085, -0.0046670306, 0.038266126, 0.1187997, 0.005787118, -0.030038064, -0.054553185, -0.041506633, -0.024078354, 0.0071854657, -0.013391736, 0.03192601, -0.059625275, 0.0023458432, 0.027924692, 0.09163582, 0.030967949, 0.017639615, 0.01489223, 0.029559033, 0.042943723, 0.0003306547, 0.0047198646, 0.029897174, 0.00012603184, 0.0046811197, -0.0427183, 0.01789322, 0.018175002, -0.0081857955, 0.02581132, 0.009890582, 0.03840702, -0.094453655, -0.01076411, 0.06858598, 0.041647524, 0.033532172, 0.007467249, -0.008235107, -0.030967949, 0.0151317455, 0.027361127, 0.011834885, 0.008707094, 0.008178751, -0.022458103, 0.02844599, 0.003605061, -0.02399382, 0.05212985, 0.06041427, -0.023317542, -0.013335379, -0.044099037, -0.040802173, -0.0047656544, -0.023909286, 0.017315563, 0.017428277, 0.00736158, -0.0016070436, -0.055454887, -0.038012523, -0.020626513, 0.018273626, 0.03260229, -0.016991513, 0.038463376, -0.022458103, -0.0109613575, -0.021810003, 0.04846667, -0.042521052, 0.008601425, -0.019259866, -0.0040048403, -0.03308132, -0.02499415, 0.026783472, -0.032884073, 0.021824092, 0.013145176, -0.009186125, -0.01769597, 0.03240504, -0.015343083, -0.012539342, 0.03578644, -0.012299826, 0.011898286, 0.035730083, 0.058441788, 0.032010544, 0.048720278, 0.012926794, -0.0015207474, -0.03313768, 0.014540002, 0.020189751, 0.00029058868, 0.011531969, -0.022514459, 0.019752987, -0.037956167, 0.005272864, -0.042295624, -0.08521117, -0.03494109, 0.053313337, 0.029981708, -0.008150573, -0.053200625, 0.059681635, -0.035476476, 0.034828376, 0.00087881065, 0.025712697, 0.018668123, 0.03212326, 0.008474623, 0.017836861, 0.004910068, 0.016174342, -0.059681635, 0.04004136, 0.00753065, 0.008150573, -0.038012523, 0.0051178834, 0.012525253, 0.022119964, 0.030235313, 0.008242152, -0.01835816, -0.003150686, 0.010714797, -0.0033162334, -0.028882755, -0.06836055, 0.056159347, 0.013624207, 0.0077349427, 0.0066183778, 0.018583586, -0.008883208, -0.046550546, 0.046945043, -0.07393985, -0.017343743, 0.029530855, -0.010982491, 0.008129438, 0.009700378, -0.024613742, -0.0030097943, 0.0078053884, -0.006438741, 0.04770586, -0.008221018, 0.01654066, 0.02498006, -0.015793936, -0.010827511, 0.02399382, 0.03192601, 0.022923045, -0.029192716, 0.006724046, -0.04601516, 0.038519733, 0.031531516, 0.019443026, 0.000109466084, 0.03525105, -0.027248414, -0.038125236, 0.011771483, -0.007467249, 0.010285079, 0.01670973, -0.007861745, 0.026868006, 0.052327096, 0.026374886, -0.03905512, 0.031193376, -0.053566944, 0.04257741, -0.004670553, 0.0168788, 0.035166513, -0.057878222, 0.07095295, -0.009749691, -0.0137510095, -0.02151413, -0.02431787, 0.010073741, -0.05176353, -0.02083785, 0.003959051, -0.02682574, 0.062104966, -0.011461522, 0.04170388, 0.0076363184, 0.026177637, 0.0144413775, 0.014821785, -0.00046890447, 0.0050544823, 0.00032228927, -0.038970586, -0.011355854, -0.056300238, -0.04302826, -0.003545182, 0.04021043, 0.0051108385, -0.048438493, 0.00252548, -0.07692675, -0.0012433673, 0.0054278444, 0.029305428, -0.016188432, -0.003263399, -0.046156053, 6.031917e-05, 0.060977835, -0.016611107, -0.010637308, -0.012602744, 0.016442036, -0.051509928, -0.016991513, 0.0019407802, 0.019161243, 0.045282524, 0.031869654, -0.036941748, -0.035814617, -0.017850952, -0.027192056, -0.049734693, -0.020964652, 0.0228526, -0.025050506, 0.023472521, 0.025740875, -0.017738238, -0.009813092, -0.030883415, -0.012405495, -0.03277136, -0.029502677, 0.016780175, -0.04421175, -0.0020816717, 0.010341435, 0.059230782, -0.041901127, -0.04119667, 0.025924034, 0.02334572, -0.0008435878, 0.020654691, -0.022753974, 0.010700708, -0.013856677, -0.0121941585, -0.011391076, 0.006590199, 0.0050227814, -0.007960369, 0.0008418266, -0.0198657, 0.10781016, -0.0384352, -0.019147152, 0.0057237167, -0.0038181592, -0.047424074, -0.009341106, 0.018499052, -0.016906979, 0.005642704, -0.01837225, -0.038125236, -0.024895526, -0.010285079, -0.055708494, 0.014173684, -0.019724809, 0.00024215724, 0.04500074, 0.048804812, 0.009777869, -0.006572588, 0.008277375, 0.012328005, -0.012609788, 0.026079014, -0.012990195, 0.017963665, -0.007312268, -0.0015682983, 0.05446865, -0.01258161, 0.00035376972, -0.011299497, -0.036321826, -0.0071854657, 0.012969062, 0.026558045, -0.051819887, -0.0029146927, -0.044606246, -0.010383703, -0.03919601, 0.013624207, 0.0030978515, 0.0121941585, -0.0022225631, 0.0512845, -0.0029780937, -0.025191398, -0.015751667, -0.021006921, 0.0039520063, 0.04418357, 0.020570157, 0.00083390146, 0.020541979, -0.004807922, -0.0114263, -0.036152754, 0.018428607, -0.032658648, -0.002035882, 0.013828499, 0.03144698, -0.0003275727, -0.029756282, 0.008488712, 0.0041879993, 0.027826069, 0.0007273523, -0.018949905, -0.0029023646, 0.007861745, 0.011398122, 0.0125322975, 0.014976765, 0.006318983, -0.0066536004, -0.042915545, 0.025867676, -0.015272637, 0.034602948, 0.050241902, 0.014582269, 0.005987888, 0.015244459, -0.050213724, -0.003212326, 0.01315222, -0.022866689, -0.004772699, 0.035673723, -0.024796901, -0.00699174, -0.002072866, 0.022077696, 0.021147812, 0.005093227, -0.039618686, -0.0049241576, 0.012264604, -0.062104966, -0.0022613083, -0.004339458, 0.065486364, -0.0033320836, 0.02944632, 0.017498722, 0.0033039053, -0.020260196, -0.0154980635, -0.05460954, -0.03626547, 0.0072629564, 0.0028900367, 1.2954037e-05, 0.01769597, -0.0045930627, 0.022260854, 0.0027192058, -0.0010566862, -0.0005212985, 0.012158935, -0.0017312041, -0.035110157, -0.0036032998, -0.02317665, -0.01639977, 0.010327346, 0.018259536, -0.011095204, -0.00061904197, -0.023134382, -0.011989865, 0.0025924034, 0.0056708823, 0.03110884, -0.013462181, -0.021105545, 0.010376658, -0.010017385, -0.025106862, 0.026093103, 0.018456785, -0.02134506, 0.0066993902, 0.011891241, -0.010017385, -0.012687278, -0.017132405, 0.04717047, 0.012475941, -0.018752657, -0.008657781, 0.005276386, -0.02582541, 0.02913636, -0.0193444, -0.01101067, 0.029305428, 0.011736261, 0.043140974, 0.02135915, 0.00089422066, 0.009827181, 0.013638296, 0.013884856, -0.014004614, 0.010285079, 0.008108305, -0.04035132, -0.02978446, 0.008481667, -0.022289034, 0.01621661, -0.0057941624, -0.019090796, -0.01852723, -0.022923045, 0.0077208537, -0.039985005, -0.017428277, -0.009460864, 0.018301804, 0.0014397348, 0.04815671, -0.012187114, 0.018879458, 0.021739556, 0.018414518, -0.013462181, -0.06368295, 0.0057096276, 0.013088819, 0.0061640027, 0.031193376, -0.008728228, -0.019245777, 0.010735931, 0.012454808, 0.0397314, -0.017597347, 0.012278693, 0.0130465515, -0.025473181, -0.03215144, -0.0053292206, -0.0027068777, 0.014068015, -0.028079674, 0.016498392, 0.015159924, -0.009207259, -0.02334572, -0.0013710503, 0.008488712, 0.0012231142, 0.0020464489, -0.025149131, -0.021063277, -0.014427288, -0.035222873, 0.051030897, 0.016103897, 0.0063401167, -0.03093977, -0.004684642, -0.0070199184, -0.008495756, -0.0038674714, -0.012222337, -0.022556728, 0.0036015387, -0.040943068, -0.011362898, 0.016794264, 0.017766416, -0.014194817, 0.0011755633, -0.039759576, 0.011384032, -0.0006318103, 0.008298509, 0.04449353, 0.0004838742, 0.016935157, -0.011341765, 0.016864711, -0.00027892113, 0.0009140335, -0.031306088, -0.049452912, -0.0068367594, -0.00011216283, -0.005079138, -0.014420244, 0.01803411, 0.03984411, -0.026276262, -0.0011077593, -0.00063313113, -0.006301372, -0.019992502, 0.0064316965, -0.024289692, 0.0120039545, 0.0068649375, -0.017724149, -0.015667133, -0.0036490895, -0.007953324, 0.024627833, 0.024402406, 0.021810003, -0.015977094, 0.010524594, -0.0060054995, 0.0414221, -0.048551206, 0.01472316, 0.015427617, 0.0029217373, 0.012666144, 0.0048995013, 0.007326357, -0.04187295, -0.0064176074, -0.00674518, 0.0047762212, -0.053059734, -0.09541172, 0.022063607, 0.029530855, 0.01556851, 0.011292453, -0.0038709936, -0.0055370354, -0.016005272, -0.0035170037, -0.0572583, 0.038632445, 0.007981502, -0.005434889, -0.023895197, 0.0021380284, -0.0015084195, 0.016117986, 0.005434889, -0.014694982, -0.007104453, 0.011595369, -0.055229463, 0.0036455672, 0.0027104, -0.010052607, -0.023697948, -0.016315235, -0.002757951, 0.039505973, 0.011095204, 0.0002681341, 0.058948997, -0.0074883825, 0.0050122146, 0.040604927, 0.012912705, -0.025078684, 0.040464036, -0.008925476, -0.00876345, -0.040633105, -0.009024099, 0.024796901, 0.03592733, 0.03626547, -0.029474499, -0.00055431994, 0.0010839839, 0.016737908, 0.013286067, -0.005441934, 0.0059420983, -0.0121941585, 0.015089478, -0.010186454, -0.03477202, -0.0076363184, -0.0087141385, 0.0018439173, 0.028065585, -0.022331301, 0.0029516767, -0.045789734, 0.0010672531, 0.018287715, -0.015948916, 0.04849485, 0.0057589393, 0.0066219, 0.002196146, -0.047255006, 0.012116668, 0.02085194, 0.025924034, -0.0036737456, -0.02877004, 0.016906979, -0.037336245, -0.016258877, 0.010883868, -0.003765325, -0.0049523357, -0.002613537, -0.03263047, 0.023204828, 0.0049946033, -0.007692675, -0.034236632, 0.034095738, 0.020133393, 0.019259866, -0.014103238, 0.024599653, 0.005889264, 0.02430378, 0.0111233825, -0.018780835, -0.00040550332, 0.020232018, 0.03806888, 0.009890582, 0.032376863, 0.031052483, 0.01871039, 0.03891423, -0.0009739124, 0.002759712, 0.017498722, -0.01158128, -0.0045578396, 0.02744566, 0.06497915, 0.024853257, 0.004709298, 0.016667463, -0.00066263025, -0.018132735, -0.013138131, -0.01124314, -0.0125182085, -0.0038111147, 0.03361671, -0.007270001, 0.0012011, -0.01771006, -0.00039999973, 0.024021998, 0.0027896515, 0.0024744067, 0.0013965869, -0.05939985, 0.0014150789, -0.0052517303, 0.052524347, 0.015779847, -0.03327857, 0.042633764, 0.0059420983, -0.023387987, 0.0039097387, -0.028023317, -0.011863063, 0.004378203, 0.02052789, -0.063626595, -0.014864052, 0.014293442, -0.00015938349, -0.007932191, -0.0010954313, 0.023528878, -0.007467249, 0.0059667546, 0.017132405, 0.005730761, -0.00020495309, -0.032038722, 0.0036631785, 0.042915545, -0.029925352, 0.015667133, 0.018935816, -0.0072065997, 0.01556851, -0.025473181, 0.017625526, -0.0026698937, -0.007446115, -0.008622559, -0.043422755, -0.020133393, -0.0039801844, 0.01489223, -0.021655021, 0.015357172, -0.03640636, -0.005663838, -0.028530527, 0.0022648307, -0.00043015933, 0.043591827, -0.015526242, 0.011870108, -0.02530411, -0.016315235, -0.00032316984, -0.030150779, -0.0052552526, 0.020372909, 0.0075024716, 0.0104330145, -0.00055608107, -0.026248084, -0.015202192, -0.03341946, 0.031559695, -0.0012046222, 0.07185466, -0.039590508, 0.022979401, 0.05810365, 0.014025748, -0.029756282, -0.022866689, 0.0073897582, 0.037618026, -0.004180955, -0.0051566283, 0.009728557, -0.03604004, 0.040633105, 0.0026963109, -0.0054172776, 0.034095738, -0.00595971, 0.040943068, -0.031390622, 0.055962097, 0.02117599, -0.012912705, -0.019626183, 0.055877563, 0.017343743, -0.0035416598, 0.013257889, -0.0186963, 0.01656884, -0.06396473, -0.0055405577, 0.020767406, -0.0046564634, 0.045085277, -0.009221348, 0.013645341, 0.008777539, 0.004730432, -0.018625854, -0.011067026, 0.021500042, -0.015047211, 0.004600107, -0.0014344514, -0.0023740216, -0.016188432, 0.006209792, 0.0011993388, 0.004180955, -0.017160583, 0.014497734, 0.015371261, 0.018259536, -0.028333278, -0.008390088, 0.041929305, 0.003923828, 0.02550136, -0.003300383, -0.008058993, -0.010418925, 0.058216363, 0.01885128, -0.02020384, 0.002858336, -0.009806047, -0.022274945, 0.0070445742, 0.026670758, 0.008213974, -0.035307407, -0.027713355, 0.042915545, -0.039675042, -0.0029217373, 0.012053267, -0.003853382, 0.01133472, -0.010073741, 0.005878697, 0.0070938864, -0.035673723, 0.024205158, 0.005896309, 0.030573452, 0.02416289, -0.0072911344, 0.01738601, 0.017005602, -0.02846008, 0.0030344503, 0.018794924, -0.0148076955, -0.0344057, 0.025430914, 0.033503994, -0.0050580045, 0.0077138087, 0.03243322, 0.01372283, -0.005441934, 0.0073404466, -0.0007832686, -0.04767768, 0.0070480965, 0.015145835, 0.026233995, -0.01670973, -0.019513471, -0.014849963, 0.007953324, -0.0032176094, 0.006572588, -0.0012477703, 0.004230267, 0.004476827, -0.021810003, -0.030009886, -0.019273955, -0.0030414949, -0.002918215, 0.060639694, 0.024641922, 0.010327346, 0.026558045, 0.018921727, -0.025867676, -0.016117986, 0.023881108, 0.025360467, 0.009770825, 0.03792799, -0.022429924, 0.033363104, -0.0018914682, 0.04040768, 0.018484963, 0.0070199184, -0.017583257, 0.016258877, 0.010954313, -0.008939565, -0.024148801, -0.02498006, -0.007889924, 0.02748793, 0.0307707, 0.029756282, 0.0051425393, 0.0045719286, -0.03046074, 0.013596028, 0.025684519, -0.0033197557, 0.006967084, 0.03677268, 0.0120039545, -0.0032792494, -0.0032211316, -0.02399382, -0.026924362, -0.013920079, -0.0042197, 0.025346378, -0.0027015943, -0.016991513, 0.0031594916, -0.007579962, 0.018978084, 0.017681882, 0.0126591, 0.028939111, 0.008833896, 0.10183637, 0.0059632324, -0.05196078, -0.023697948, 0.011045893, -0.008777539, -0.013807366, 0.019273955, -0.025346378, 0.0074742935, 0.009961028, -0.010813422, 0.018597675, 0.009636978, 0.014948587, 0.024064265, -0.008693005, -0.020570157, 0.014194817, -0.026219906, -0.02299349, 0.011067026, 0.032066904, 0.013391736, -0.05148175, -0.009489042, -0.03062981, -0.0012847543, 0.07286908, 0.026529867, -0.00025008238, 0.013638296, 0.016089808, 0.018654034, -0.0020394044, -0.024543297, 0.0147795165, -0.009601755, 0.0018791402, -0.040520392, -0.003360262, 0.02216223, 0.0137650985, 0.0059914105, 0.0048361, -0.0009844792, 0.016977424, -0.00934815, 0.024233336, -0.013088819, -0.017555078, -0.0050263037, 0.010595039, -0.027516108, 0.0071537653, -0.023247095, -0.0017655464, -0.015948916, 0.058160007, -0.025966302, 0.0121941585, -0.012384362, -0.0015612538, 0.009946939, 0.00628376, 0.011327676, 0.0109613575, 0.008601425, -0.018329982, 0.055680316, -0.012778858, -0.0100807855, -0.011067026, -0.0036490895, -0.01356785, 0.0073193125, -0.014272308, -0.027403394, -0.030742522, 0.02862915, 0.03062981, -0.014596358, 0.021697288, 0.0042408337, 0.027572464, 0.0019601528, -0.037138995, -0.031306088, 0.041929305, 0.017738238, 0.004857234, 0.008256241, 0.0118278405, 0.021753646, -0.00160176, -0.0018333505, -0.0047374764, 0.042239267, 0.0058329077, -0.026459422, 0.015075389, 0.021147812, -0.005212985, 0.01281408, 0.017738238, 0.008242152, -0.020372909, -0.011081115, -0.011017715, 0.007706764, 0.01834407, 0.01954165, 0.037477136, -0.010278034, 0.015808025, 0.00031590514, -0.017681882, -0.008967743, -0.020612424, -0.025416825, -0.0037970257, -0.029868996, 0.01720285, -0.0144554665, 0.026727116, 0.00414221, 0.0040154075, 0.05838543, 0.0005622451, -0.025219576, 0.004180955, -0.002932304, -0.0090663675, 0.011574236, 0.02450103, -0.012553431, -0.020612424, -0.032095082, 0.015526242, 0.008974788, 0.0053151315, -0.0003112821, -0.017935487, -0.0076222294, 0.03358853, 0.029474499, -0.011496745, -0.012835215, -0.020739228, -0.012482986, -0.037871633, 0.0052517303, -0.012926794, -0.0025237189, 0.0020323596, 0.045113456, -0.04835396, -0.027755624, -0.0079955915, 0.007896968, 0.0072559114, 0.015047211, -0.0014573464, -0.014032792, 0.021091456, -0.0046071517, -0.0065232757, -0.02582541, -0.035870973, -0.015343083, 0.03254593, -0.028431902, -0.003286294, 0.014328664, 0.008840941, 0.015948916, 0.012835215, 0.019400757, -0.012342094, -0.010693664, 0.004772699, -0.03254593, 0.010707753, -0.016822444, -0.0032827717, 0.021246437, -0.04485985, -0.04384543, -0.015906649, -0.009707424, 0.02299349, 0.019513471, -0.010151232, 0.018963994, -0.0057976847, 0.05739919, -0.019922055, -0.029108182, -0.0106232185, 0.021077367, 0.0036455672, -0.026614401, 0.04497256, -0.04446535, -0.0004556959, -0.004578973, 0.003962573, -0.004910068, 0.015089478, -0.0301226, 0.007664497, 0.008375999, 0.031982366, 0.006135824, 0.02152822, -0.015469885, -0.007210122, 0.034715664, -0.01233505, 0.0004490916, -0.0144413775, -0.003150686, -0.02003477, -0.027924692, -0.0015850292, -0.009376328, -0.0035997776, -0.03240504, -0.010912046, 0.0031999978, 0.022303123, -0.008988877, 0.00024633997, -0.0035698381, 0.0070974086, -0.002599448, -0.042267445, -0.016935157, -0.0002481011, -0.041393917, 0.014483645, 0.019006262, -0.02813603, 0.0072030774, -7.3032425e-05, 0.01802002, -0.017188761, 0.015991183, 0.020401087, 0.03542012, 0.04469078, 0.04071764, 0.011095204, -0.031390622, -0.03254593, 0.014187773, 0.016272966, -0.009721513, -0.026388975, -0.014849963, -0.005642704, -0.022556728, 0.0064457855, -0.043450933, 0.010834555, -0.015977094, 0.020880118, -0.02385293, -0.054806788, 0.03789981, 0.0013516777, -0.026431242, -0.015540331, 0.016695641, -0.037167173, -0.021190079, 0.023881108, -0.0045860177, 0.0064105624, -0.007763121, -0.013053596, 0.024472851, -0.0004962022, -0.00976378, 0.060019772, -0.0057624616, -0.04384543, 0.010313257, 0.0076715415, 0.0025888812, -0.03589915, 0.008791628, -0.012785902, 0.01042597, 0.015653044, 0.04767768, -0.009869449, 0.0064457855, -0.010947268, -0.0077349427, -0.032715004, -0.023867019, -0.011327676, -0.00046274049, -0.036998104, 0.013913034, 0.012250515, -0.009996251, 0.021204168, 0.020091126, -0.003740669, -0.0049769916, -0.0140891485, 0.024064265, 0.0038815604, 0.025684519, 0.041788414, -0.013553761, 0.006681779, -0.0050826604, -0.018175002, 0.008228063, -0.006230926, -0.018907638, 0.0154839745, -0.028713685, -0.015047211, -0.019682541, 0.02516322, 0.040802173, 0.007213644, 0.011743305, -0.015963005, -0.03818159, 0.01191942, -0.031728763, -0.011863063, 0.023881108, 0.0053116092, -0.020992832, -0.017991843, -0.00405063, -0.017780505, -0.0057659843, 0.02978446, 0.031165197, 0.0014221234, 0.021316882, 0.026008569, -0.0018544842, -0.032658648, 0.028474169, 0.013109953, 0.018076377, 0.0007991189, -0.0042373114, 0.028910933, -0.0029358263, 0.021866359, 0.024472851, -0.002576553, -0.033532172, 0.01920351, -0.0095665315, -0.03093977, 0.0034817809, 0.018654034, -0.0074038478, 0.021443684, 0.0038604268, -0.02745975, 0.031587873, 0.0061146906, 0.022711707, -0.019795254, -0.016991513, -0.04471896, -0.007875834, -0.0034941088, -0.043789074, 0.021091456, 0.024909616, -0.013194487, -0.0042690123, 0.027896514, -0.018414518, -0.023303451, -0.025797231, -0.009524264]}], object='list', usage=Usage(completion_tokens=0, prompt_tokens=3, total_tokens=3, completion_tokens_details=None, prompt_tokens_details=None))\n" + ] + } + ], + "source": [ + "import litellm\n", + "\n", + "\n", + "async def main():\n", + " response = await litellm.aembedding(\n", + " model=\"cometapi/text-embedding-3-small\", # The model name must include prefix \"openai\" + the model name from ai/ml api\n", + " api_key=api_key, # your aiml api-key\n", + " api_base=\"https://api.cometapi.com/v1\", # 👈 the URL has changed from v2 to v1\n", + " input=\"Your text string\",\n", + " )\n", + " print(response)\n", + "\n", + "await main()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "EmbeddingResponse(model='text-embedding-3-small', data=[{'object': 'embedding', 'index': 0, 'embedding': [-0.018048199, 0.0047550877, -0.013976435, -0.021936804, -0.038773336, -0.03708264, 0.03854791, -0.0007172257, 0.026473511, -0.0027438616, -0.019823432, -0.011947598, -0.013426959, -0.0059914105, 0.020485623, 0.04269012, -0.028276922, -0.015216281, -0.03325039, 0.045057096, 0.0037477135, 0.015793936, -0.005188329, -0.0071713766, 0.008446445, 0.0070938864, 0.0027632343, 0.025656339, 0.022091785, -0.026797561, -0.029840818, -0.0542714, 0.017907308, -0.03454659, -0.014582269, 0.0429719, 0.03575826, 0.007939235, -0.010123054, -0.029587213, 0.018921727, 0.022556728, 0.019598005, 0.008819807, 0.01655475, 0.043310042, -0.034321167, 0.004441604, 0.032686826, 0.047226828, -0.0043253684, 0.006681779, 0.008995921, 0.06593721, 0.0066078105, -0.023190739, -0.00777721, 0.049875587, -0.028023317, -0.019386668, -0.0013252605, 0.009214303, -0.0055828253, -0.007432026, -0.01199691, 0.0054384116, -0.024247425, 0.047255006, -0.013743965, 0.012799991, 0.009883538, -0.005579303, -0.012616833, -0.014709071, -0.004473305, -0.022204498, 0.010454148, -0.02202134, 0.034631126, 0.0097567355, 0.041478455, -0.010750021, -0.0005340668, -0.041450277, -0.04516981, 0.014709071, -0.06142869, 0.021640932, -0.0008752884, -0.0012671428, -0.045254346, -0.004216178, -0.028220564, -0.011074071, 0.010693664, -0.0029481545, -0.039590508, -0.030178957, -0.019062618, -0.03539194, 0.019978413, 0.019161243, -0.025924034, 0.0058329077, -0.029305428, 0.028840488, 0.02731886, -0.0008048426, -0.056582022, 0.003043256, -0.08459125, -0.012560476, 0.00081100664, 0.0015771041, 0.015188103, -0.0049206354, 0.046888687, -0.027107522, 0.019245777, -0.011412211, 0.039336905, -0.018611765, 0.0429719, -0.04302826, -0.018132735, -0.0074883825, -0.02035882, -0.073038146, -0.042380158, 0.04485985, 0.03361671, -0.033842135, -0.0017259207, -0.0017091898, -0.049199305, -0.024148801, -0.044803493, 0.040943068, -0.03093977, 0.045057096, -0.0186963, -0.014053926, -0.009848315, -0.0070480965, -0.0060054995, -0.02813603, -0.022105874, 0.010235767, -0.004476827, 0.027220234, -0.026290352, 0.0216832, -0.05559578, 0.042464696, 0.0253182, -0.0031594916, 0.02266944, -0.030798879, -0.02896729, -0.0005891025, 0.004061197, -0.042295624, -0.008383043, 0.017146494, -0.025797231, -0.046522368, 0.044127215, 0.021105545, -0.04302826, 0.024430584, -0.014934498, -0.01556851, -0.075743265, -0.022415835, -0.028586883, 0.032743182, 0.03539194, -0.0034483192, -0.04669144, 0.051932603, 0.021626843, 0.03127791, 0.015610777, -0.016470214, -0.0056744046, -0.012743635, 0.060132485, 0.017428277, -0.0039942735, -0.017118316, 0.025106862, 0.008974788, 0.018513141, 0.0016035212, -0.0049593803, 0.0017514573, 0.031221554, -0.034856554, -0.011461522, 0.04621241, 0.044239927, 0.034715664, -0.0121941585, -0.012053267, -0.08526753, -0.011813751, -0.025769053, 0.0125182085, -0.0046670306, 0.038266126, 0.1187997, 0.005787118, -0.030038064, -0.054553185, -0.041506633, -0.024078354, 0.0071854657, -0.013391736, 0.03192601, -0.059625275, 0.0023458432, 0.027924692, 0.09163582, 0.030967949, 0.017639615, 0.01489223, 0.029559033, 0.042943723, 0.0003306547, 0.0047198646, 0.029897174, 0.00012603184, 0.0046811197, -0.0427183, 0.01789322, 0.018175002, -0.0081857955, 0.02581132, 0.009890582, 0.03840702, -0.094453655, -0.01076411, 0.06858598, 0.041647524, 0.033532172, 0.007467249, -0.008235107, -0.030967949, 0.0151317455, 0.027361127, 0.011834885, 0.008707094, 0.008178751, -0.022458103, 0.02844599, 0.003605061, -0.02399382, 0.05212985, 0.06041427, -0.023317542, -0.013335379, -0.044099037, -0.040802173, -0.0047656544, -0.023909286, 0.017315563, 0.017428277, 0.00736158, -0.0016070436, -0.055454887, -0.038012523, -0.020626513, 0.018273626, 0.03260229, -0.016991513, 0.038463376, -0.022458103, -0.0109613575, -0.021810003, 0.04846667, -0.042521052, 0.008601425, -0.019259866, -0.0040048403, -0.03308132, -0.02499415, 0.026783472, -0.032884073, 0.021824092, 0.013145176, -0.009186125, -0.01769597, 0.03240504, -0.015343083, -0.012539342, 0.03578644, -0.012299826, 0.011898286, 0.035730083, 0.058441788, 0.032010544, 0.048720278, 0.012926794, -0.0015207474, -0.03313768, 0.014540002, 0.020189751, 0.00029058868, 0.011531969, -0.022514459, 0.019752987, -0.037956167, 0.005272864, -0.042295624, -0.08521117, -0.03494109, 0.053313337, 0.029981708, -0.008150573, -0.053200625, 0.059681635, -0.035476476, 0.034828376, 0.00087881065, 0.025712697, 0.018668123, 0.03212326, 0.008474623, 0.017836861, 0.004910068, 0.016174342, -0.059681635, 0.04004136, 0.00753065, 0.008150573, -0.038012523, 0.0051178834, 0.012525253, 0.022119964, 0.030235313, 0.008242152, -0.01835816, -0.003150686, 0.010714797, -0.0033162334, -0.028882755, -0.06836055, 0.056159347, 0.013624207, 0.0077349427, 0.0066183778, 0.018583586, -0.008883208, -0.046550546, 0.046945043, -0.07393985, -0.017343743, 0.029530855, -0.010982491, 0.008129438, 0.009700378, -0.024613742, -0.0030097943, 0.0078053884, -0.006438741, 0.04770586, -0.008221018, 0.01654066, 0.02498006, -0.015793936, -0.010827511, 0.02399382, 0.03192601, 0.022923045, -0.029192716, 0.006724046, -0.04601516, 0.038519733, 0.031531516, 0.019443026, 0.000109466084, 0.03525105, -0.027248414, -0.038125236, 0.011771483, -0.007467249, 0.010285079, 0.01670973, -0.007861745, 0.026868006, 0.052327096, 0.026374886, -0.03905512, 0.031193376, -0.053566944, 0.04257741, -0.004670553, 0.0168788, 0.035166513, -0.057878222, 0.07095295, -0.009749691, -0.0137510095, -0.02151413, -0.02431787, 0.010073741, -0.05176353, -0.02083785, 0.003959051, -0.02682574, 0.062104966, -0.011461522, 0.04170388, 0.0076363184, 0.026177637, 0.0144413775, 0.014821785, -0.00046890447, 0.0050544823, 0.00032228927, -0.038970586, -0.011355854, -0.056300238, -0.04302826, -0.003545182, 0.04021043, 0.0051108385, -0.048438493, 0.00252548, -0.07692675, -0.0012433673, 0.0054278444, 0.029305428, -0.016188432, -0.003263399, -0.046156053, 6.031917e-05, 0.060977835, -0.016611107, -0.010637308, -0.012602744, 0.016442036, -0.051509928, -0.016991513, 0.0019407802, 0.019161243, 0.045282524, 0.031869654, -0.036941748, -0.035814617, -0.017850952, -0.027192056, -0.049734693, -0.020964652, 0.0228526, -0.025050506, 0.023472521, 0.025740875, -0.017738238, -0.009813092, -0.030883415, -0.012405495, -0.03277136, -0.029502677, 0.016780175, -0.04421175, -0.0020816717, 0.010341435, 0.059230782, -0.041901127, -0.04119667, 0.025924034, 0.02334572, -0.0008435878, 0.020654691, -0.022753974, 0.010700708, -0.013856677, -0.0121941585, -0.011391076, 0.006590199, 0.0050227814, -0.007960369, 0.0008418266, -0.0198657, 0.10781016, -0.0384352, -0.019147152, 0.0057237167, -0.0038181592, -0.047424074, -0.009341106, 0.018499052, -0.016906979, 0.005642704, -0.01837225, -0.038125236, -0.024895526, -0.010285079, -0.055708494, 0.014173684, -0.019724809, 0.00024215724, 0.04500074, 0.048804812, 0.009777869, -0.006572588, 0.008277375, 0.012328005, -0.012609788, 0.026079014, -0.012990195, 0.017963665, -0.007312268, -0.0015682983, 0.05446865, -0.01258161, 0.00035376972, -0.011299497, -0.036321826, -0.0071854657, 0.012969062, 0.026558045, -0.051819887, -0.0029146927, -0.044606246, -0.010383703, -0.03919601, 0.013624207, 0.0030978515, 0.0121941585, -0.0022225631, 0.0512845, -0.0029780937, -0.025191398, -0.015751667, -0.021006921, 0.0039520063, 0.04418357, 0.020570157, 0.00083390146, 0.020541979, -0.004807922, -0.0114263, -0.036152754, 0.018428607, -0.032658648, -0.002035882, 0.013828499, 0.03144698, -0.0003275727, -0.029756282, 0.008488712, 0.0041879993, 0.027826069, 0.0007273523, -0.018949905, -0.0029023646, 0.007861745, 0.011398122, 0.0125322975, 0.014976765, 0.006318983, -0.0066536004, -0.042915545, 0.025867676, -0.015272637, 0.034602948, 0.050241902, 0.014582269, 0.005987888, 0.015244459, -0.050213724, -0.003212326, 0.01315222, -0.022866689, -0.004772699, 0.035673723, -0.024796901, -0.00699174, -0.002072866, 0.022077696, 0.021147812, 0.005093227, -0.039618686, -0.0049241576, 0.012264604, -0.062104966, -0.0022613083, -0.004339458, 0.065486364, -0.0033320836, 0.02944632, 0.017498722, 0.0033039053, -0.020260196, -0.0154980635, -0.05460954, -0.03626547, 0.0072629564, 0.0028900367, 1.2954037e-05, 0.01769597, -0.0045930627, 0.022260854, 0.0027192058, -0.0010566862, -0.0005212985, 0.012158935, -0.0017312041, -0.035110157, -0.0036032998, -0.02317665, -0.01639977, 0.010327346, 0.018259536, -0.011095204, -0.00061904197, -0.023134382, -0.011989865, 0.0025924034, 0.0056708823, 0.03110884, -0.013462181, -0.021105545, 0.010376658, -0.010017385, -0.025106862, 0.026093103, 0.018456785, -0.02134506, 0.0066993902, 0.011891241, -0.010017385, -0.012687278, -0.017132405, 0.04717047, 0.012475941, -0.018752657, -0.008657781, 0.005276386, -0.02582541, 0.02913636, -0.0193444, -0.01101067, 0.029305428, 0.011736261, 0.043140974, 0.02135915, 0.00089422066, 0.009827181, 0.013638296, 0.013884856, -0.014004614, 0.010285079, 0.008108305, -0.04035132, -0.02978446, 0.008481667, -0.022289034, 0.01621661, -0.0057941624, -0.019090796, -0.01852723, -0.022923045, 0.0077208537, -0.039985005, -0.017428277, -0.009460864, 0.018301804, 0.0014397348, 0.04815671, -0.012187114, 0.018879458, 0.021739556, 0.018414518, -0.013462181, -0.06368295, 0.0057096276, 0.013088819, 0.0061640027, 0.031193376, -0.008728228, -0.019245777, 0.010735931, 0.012454808, 0.0397314, -0.017597347, 0.012278693, 0.0130465515, -0.025473181, -0.03215144, -0.0053292206, -0.0027068777, 0.014068015, -0.028079674, 0.016498392, 0.015159924, -0.009207259, -0.02334572, -0.0013710503, 0.008488712, 0.0012231142, 0.0020464489, -0.025149131, -0.021063277, -0.014427288, -0.035222873, 0.051030897, 0.016103897, 0.0063401167, -0.03093977, -0.004684642, -0.0070199184, -0.008495756, -0.0038674714, -0.012222337, -0.022556728, 0.0036015387, -0.040943068, -0.011362898, 0.016794264, 0.017766416, -0.014194817, 0.0011755633, -0.039759576, 0.011384032, -0.0006318103, 0.008298509, 0.04449353, 0.0004838742, 0.016935157, -0.011341765, 0.016864711, -0.00027892113, 0.0009140335, -0.031306088, -0.049452912, -0.0068367594, -0.00011216283, -0.005079138, -0.014420244, 0.01803411, 0.03984411, -0.026276262, -0.0011077593, -0.00063313113, -0.006301372, -0.019992502, 0.0064316965, -0.024289692, 0.0120039545, 0.0068649375, -0.017724149, -0.015667133, -0.0036490895, -0.007953324, 0.024627833, 0.024402406, 0.021810003, -0.015977094, 0.010524594, -0.0060054995, 0.0414221, -0.048551206, 0.01472316, 0.015427617, 0.0029217373, 0.012666144, 0.0048995013, 0.007326357, -0.04187295, -0.0064176074, -0.00674518, 0.0047762212, -0.053059734, -0.09541172, 0.022063607, 0.029530855, 0.01556851, 0.011292453, -0.0038709936, -0.0055370354, -0.016005272, -0.0035170037, -0.0572583, 0.038632445, 0.007981502, -0.005434889, -0.023895197, 0.0021380284, -0.0015084195, 0.016117986, 0.005434889, -0.014694982, -0.007104453, 0.011595369, -0.055229463, 0.0036455672, 0.0027104, -0.010052607, -0.023697948, -0.016315235, -0.002757951, 0.039505973, 0.011095204, 0.0002681341, 0.058948997, -0.0074883825, 0.0050122146, 0.040604927, 0.012912705, -0.025078684, 0.040464036, -0.008925476, -0.00876345, -0.040633105, -0.009024099, 0.024796901, 0.03592733, 0.03626547, -0.029474499, -0.00055431994, 0.0010839839, 0.016737908, 0.013286067, -0.005441934, 0.0059420983, -0.0121941585, 0.015089478, -0.010186454, -0.03477202, -0.0076363184, -0.0087141385, 0.0018439173, 0.028065585, -0.022331301, 0.0029516767, -0.045789734, 0.0010672531, 0.018287715, -0.015948916, 0.04849485, 0.0057589393, 0.0066219, 0.002196146, -0.047255006, 0.012116668, 0.02085194, 0.025924034, -0.0036737456, -0.02877004, 0.016906979, -0.037336245, -0.016258877, 0.010883868, -0.003765325, -0.0049523357, -0.002613537, -0.03263047, 0.023204828, 0.0049946033, -0.007692675, -0.034236632, 0.034095738, 0.020133393, 0.019259866, -0.014103238, 0.024599653, 0.005889264, 0.02430378, 0.0111233825, -0.018780835, -0.00040550332, 0.020232018, 0.03806888, 0.009890582, 0.032376863, 0.031052483, 0.01871039, 0.03891423, -0.0009739124, 0.002759712, 0.017498722, -0.01158128, -0.0045578396, 0.02744566, 0.06497915, 0.024853257, 0.004709298, 0.016667463, -0.00066263025, -0.018132735, -0.013138131, -0.01124314, -0.0125182085, -0.0038111147, 0.03361671, -0.007270001, 0.0012011, -0.01771006, -0.00039999973, 0.024021998, 0.0027896515, 0.0024744067, 0.0013965869, -0.05939985, 0.0014150789, -0.0052517303, 0.052524347, 0.015779847, -0.03327857, 0.042633764, 0.0059420983, -0.023387987, 0.0039097387, -0.028023317, -0.011863063, 0.004378203, 0.02052789, -0.063626595, -0.014864052, 0.014293442, -0.00015938349, -0.007932191, -0.0010954313, 0.023528878, -0.007467249, 0.0059667546, 0.017132405, 0.005730761, -0.00020495309, -0.032038722, 0.0036631785, 0.042915545, -0.029925352, 0.015667133, 0.018935816, -0.0072065997, 0.01556851, -0.025473181, 0.017625526, -0.0026698937, -0.007446115, -0.008622559, -0.043422755, -0.020133393, -0.0039801844, 0.01489223, -0.021655021, 0.015357172, -0.03640636, -0.005663838, -0.028530527, 0.0022648307, -0.00043015933, 0.043591827, -0.015526242, 0.011870108, -0.02530411, -0.016315235, -0.00032316984, -0.030150779, -0.0052552526, 0.020372909, 0.0075024716, 0.0104330145, -0.00055608107, -0.026248084, -0.015202192, -0.03341946, 0.031559695, -0.0012046222, 0.07185466, -0.039590508, 0.022979401, 0.05810365, 0.014025748, -0.029756282, -0.022866689, 0.0073897582, 0.037618026, -0.004180955, -0.0051566283, 0.009728557, -0.03604004, 0.040633105, 0.0026963109, -0.0054172776, 0.034095738, -0.00595971, 0.040943068, -0.031390622, 0.055962097, 0.02117599, -0.012912705, -0.019626183, 0.055877563, 0.017343743, -0.0035416598, 0.013257889, -0.0186963, 0.01656884, -0.06396473, -0.0055405577, 0.020767406, -0.0046564634, 0.045085277, -0.009221348, 0.013645341, 0.008777539, 0.004730432, -0.018625854, -0.011067026, 0.021500042, -0.015047211, 0.004600107, -0.0014344514, -0.0023740216, -0.016188432, 0.006209792, 0.0011993388, 0.004180955, -0.017160583, 0.014497734, 0.015371261, 0.018259536, -0.028333278, -0.008390088, 0.041929305, 0.003923828, 0.02550136, -0.003300383, -0.008058993, -0.010418925, 0.058216363, 0.01885128, -0.02020384, 0.002858336, -0.009806047, -0.022274945, 0.0070445742, 0.026670758, 0.008213974, -0.035307407, -0.027713355, 0.042915545, -0.039675042, -0.0029217373, 0.012053267, -0.003853382, 0.01133472, -0.010073741, 0.005878697, 0.0070938864, -0.035673723, 0.024205158, 0.005896309, 0.030573452, 0.02416289, -0.0072911344, 0.01738601, 0.017005602, -0.02846008, 0.0030344503, 0.018794924, -0.0148076955, -0.0344057, 0.025430914, 0.033503994, -0.0050580045, 0.0077138087, 0.03243322, 0.01372283, -0.005441934, 0.0073404466, -0.0007832686, -0.04767768, 0.0070480965, 0.015145835, 0.026233995, -0.01670973, -0.019513471, -0.014849963, 0.007953324, -0.0032176094, 0.006572588, -0.0012477703, 0.004230267, 0.004476827, -0.021810003, -0.030009886, -0.019273955, -0.0030414949, -0.002918215, 0.060639694, 0.024641922, 0.010327346, 0.026558045, 0.018921727, -0.025867676, -0.016117986, 0.023881108, 0.025360467, 0.009770825, 0.03792799, -0.022429924, 0.033363104, -0.0018914682, 0.04040768, 0.018484963, 0.0070199184, -0.017583257, 0.016258877, 0.010954313, -0.008939565, -0.024148801, -0.02498006, -0.007889924, 0.02748793, 0.0307707, 0.029756282, 0.0051425393, 0.0045719286, -0.03046074, 0.013596028, 0.025684519, -0.0033197557, 0.006967084, 0.03677268, 0.0120039545, -0.0032792494, -0.0032211316, -0.02399382, -0.026924362, -0.013920079, -0.0042197, 0.025346378, -0.0027015943, -0.016991513, 0.0031594916, -0.007579962, 0.018978084, 0.017681882, 0.0126591, 0.028939111, 0.008833896, 0.10183637, 0.0059632324, -0.05196078, -0.023697948, 0.011045893, -0.008777539, -0.013807366, 0.019273955, -0.025346378, 0.0074742935, 0.009961028, -0.010813422, 0.018597675, 0.009636978, 0.014948587, 0.024064265, -0.008693005, -0.020570157, 0.014194817, -0.026219906, -0.02299349, 0.011067026, 0.032066904, 0.013391736, -0.05148175, -0.009489042, -0.03062981, -0.0012847543, 0.07286908, 0.026529867, -0.00025008238, 0.013638296, 0.016089808, 0.018654034, -0.0020394044, -0.024543297, 0.0147795165, -0.009601755, 0.0018791402, -0.040520392, -0.003360262, 0.02216223, 0.0137650985, 0.0059914105, 0.0048361, -0.0009844792, 0.016977424, -0.00934815, 0.024233336, -0.013088819, -0.017555078, -0.0050263037, 0.010595039, -0.027516108, 0.0071537653, -0.023247095, -0.0017655464, -0.015948916, 0.058160007, -0.025966302, 0.0121941585, -0.012384362, -0.0015612538, 0.009946939, 0.00628376, 0.011327676, 0.0109613575, 0.008601425, -0.018329982, 0.055680316, -0.012778858, -0.0100807855, -0.011067026, -0.0036490895, -0.01356785, 0.0073193125, -0.014272308, -0.027403394, -0.030742522, 0.02862915, 0.03062981, -0.014596358, 0.021697288, 0.0042408337, 0.027572464, 0.0019601528, -0.037138995, -0.031306088, 0.041929305, 0.017738238, 0.004857234, 0.008256241, 0.0118278405, 0.021753646, -0.00160176, -0.0018333505, -0.0047374764, 0.042239267, 0.0058329077, -0.026459422, 0.015075389, 0.021147812, -0.005212985, 0.01281408, 0.017738238, 0.008242152, -0.020372909, -0.011081115, -0.011017715, 0.007706764, 0.01834407, 0.01954165, 0.037477136, -0.010278034, 0.015808025, 0.00031590514, -0.017681882, -0.008967743, -0.020612424, -0.025416825, -0.0037970257, -0.029868996, 0.01720285, -0.0144554665, 0.026727116, 0.00414221, 0.0040154075, 0.05838543, 0.0005622451, -0.025219576, 0.004180955, -0.002932304, -0.0090663675, 0.011574236, 0.02450103, -0.012553431, -0.020612424, -0.032095082, 0.015526242, 0.008974788, 0.0053151315, -0.0003112821, -0.017935487, -0.0076222294, 0.03358853, 0.029474499, -0.011496745, -0.012835215, -0.020739228, -0.012482986, -0.037871633, 0.0052517303, -0.012926794, -0.0025237189, 0.0020323596, 0.045113456, -0.04835396, -0.027755624, -0.0079955915, 0.007896968, 0.0072559114, 0.015047211, -0.0014573464, -0.014032792, 0.021091456, -0.0046071517, -0.0065232757, -0.02582541, -0.035870973, -0.015343083, 0.03254593, -0.028431902, -0.003286294, 0.014328664, 0.008840941, 0.015948916, 0.012835215, 0.019400757, -0.012342094, -0.010693664, 0.004772699, -0.03254593, 0.010707753, -0.016822444, -0.0032827717, 0.021246437, -0.04485985, -0.04384543, -0.015906649, -0.009707424, 0.02299349, 0.019513471, -0.010151232, 0.018963994, -0.0057976847, 0.05739919, -0.019922055, -0.029108182, -0.0106232185, 0.021077367, 0.0036455672, -0.026614401, 0.04497256, -0.04446535, -0.0004556959, -0.004578973, 0.003962573, -0.004910068, 0.015089478, -0.0301226, 0.007664497, 0.008375999, 0.031982366, 0.006135824, 0.02152822, -0.015469885, -0.007210122, 0.034715664, -0.01233505, 0.0004490916, -0.0144413775, -0.003150686, -0.02003477, -0.027924692, -0.0015850292, -0.009376328, -0.0035997776, -0.03240504, -0.010912046, 0.0031999978, 0.022303123, -0.008988877, 0.00024633997, -0.0035698381, 0.0070974086, -0.002599448, -0.042267445, -0.016935157, -0.0002481011, -0.041393917, 0.014483645, 0.019006262, -0.02813603, 0.0072030774, -7.3032425e-05, 0.01802002, -0.017188761, 0.015991183, 0.020401087, 0.03542012, 0.04469078, 0.04071764, 0.011095204, -0.031390622, -0.03254593, 0.014187773, 0.016272966, -0.009721513, -0.026388975, -0.014849963, -0.005642704, -0.022556728, 0.0064457855, -0.043450933, 0.010834555, -0.015977094, 0.020880118, -0.02385293, -0.054806788, 0.03789981, 0.0013516777, -0.026431242, -0.015540331, 0.016695641, -0.037167173, -0.021190079, 0.023881108, -0.0045860177, 0.0064105624, -0.007763121, -0.013053596, 0.024472851, -0.0004962022, -0.00976378, 0.060019772, -0.0057624616, -0.04384543, 0.010313257, 0.0076715415, 0.0025888812, -0.03589915, 0.008791628, -0.012785902, 0.01042597, 0.015653044, 0.04767768, -0.009869449, 0.0064457855, -0.010947268, -0.0077349427, -0.032715004, -0.023867019, -0.011327676, -0.00046274049, -0.036998104, 0.013913034, 0.012250515, -0.009996251, 0.021204168, 0.020091126, -0.003740669, -0.0049769916, -0.0140891485, 0.024064265, 0.0038815604, 0.025684519, 0.041788414, -0.013553761, 0.006681779, -0.0050826604, -0.018175002, 0.008228063, -0.006230926, -0.018907638, 0.0154839745, -0.028713685, -0.015047211, -0.019682541, 0.02516322, 0.040802173, 0.007213644, 0.011743305, -0.015963005, -0.03818159, 0.01191942, -0.031728763, -0.011863063, 0.023881108, 0.0053116092, -0.020992832, -0.017991843, -0.00405063, -0.017780505, -0.0057659843, 0.02978446, 0.031165197, 0.0014221234, 0.021316882, 0.026008569, -0.0018544842, -0.032658648, 0.028474169, 0.013109953, 0.018076377, 0.0007991189, -0.0042373114, 0.028910933, -0.0029358263, 0.021866359, 0.024472851, -0.002576553, -0.033532172, 0.01920351, -0.0095665315, -0.03093977, 0.0034817809, 0.018654034, -0.0074038478, 0.021443684, 0.0038604268, -0.02745975, 0.031587873, 0.0061146906, 0.022711707, -0.019795254, -0.016991513, -0.04471896, -0.007875834, -0.0034941088, -0.043789074, 0.021091456, 0.024909616, -0.013194487, -0.0042690123, 0.027896514, -0.018414518, -0.023303451, -0.025797231, -0.009524264]}], object='list', usage=Usage(completion_tokens=0, prompt_tokens=3, total_tokens=3, completion_tokens_details=None, prompt_tokens_details=None))\n" + ] + } + ], + "source": [ + "import litellm\n", + "\n", + "\n", + "async def main():\n", + " response = await litellm.aembedding(\n", + " model=\"cometapi/text-embedding-3-small\", # The model name must include prefix \"cometapi/\" + the model name from CometAPI\n", + " api_key=api_key, # your CometAPI api-key\n", + " api_base=\"https://api.cometapi.com/v1\",\n", + " input=\"Your text string\",\n", + " )\n", + " print(response)\n", + "\n", + "\n", + "await main()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Async Image Generation" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ImageResponse(created=1760591151, background=None, data=[ImageObject(b64_json=None, revised_prompt=\"Generate an image of an adorable baby sea otter. It should be floating on its back in a calm, clear ocean, playfully grasping a colorful shell in its small paws. The sun is setting in the background, casting a peaceful orange and purple hue across the sky and reflecting upon the ocean waves. The otter's fur is a deep, rich brown and appears silky and wet, with glints of sunlight catching on it. Its eyes are bright, expressing joy and curiosity as it examines its newfound treasure.\", url='https://oaidalleapiprodscus.blob.core.windows.net/private/org-OKnsK88id12jfvnKByup1O0l/user-3GxuMyEg9YMU8LFCPHi31prf/img-7PUEF8Wb6thGDAuZWLJjSnfP.png?st=2025-10-16T04%3A05%3A51Z&se=2025-10-16T06%3A05%3A51Z&sp=r&sv=2024-08-04&sr=b&rscd=inline&rsct=image/png&skoid=38e27a3b-6174-4d3e-90ac-d7d9ad49543f&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2025-10-16T02%3A51%3A01Z&ske=2025-10-17T02%3A51%3A01Z&sks=b&skv=2024-08-04&sig=IZKG2VE%2B6VdOe5Tq0Zk/5bVyGK/oK/yO8g%2BDX4krpug%3D')], output_format=None, quality=None, size=None, usage=Usage(completion_tokens=0, prompt_tokens=0, total_tokens=0, completion_tokens_details=None, prompt_tokens_details=None, input_tokens=0, input_tokens_details={'image_tokens': 0, 'text_tokens': 0}, output_tokens=0))\n" + ] + } + ], + "source": [ + "import asyncio\n", + "\n", + "import litellm\n", + "\n", + "\n", + "async def main():\n", + " response = await litellm.aimage_generation(\n", + " model=\"cometapi/dall-e-3\", # The model name must include prefix \"cometapi/\" + the model name from CometAPI\n", + " api_key=api_key, # your cometapi api-key\n", + " api_base=\"https://api.cometapi.com/v1\",\n", + " prompt=\"A cute baby sea otter\",\n", + " )\n", + " print(response)\n", + "\n", + "\n", + "await main()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "base", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.8" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/docker-compose.yml b/docker-compose.yml index 366fbe51b5a..c268f9ba0ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: ######################################### ## Uncomment these lines to start proxy with a config.yaml file ## # volumes: - # - ./config.yaml:/app/config.yaml <<- this is missing in the docker-compose file currently + # - ./config.yaml:/app/config.yaml # command: # - "--config=/app/config.yaml" ############################################## diff --git a/docs/my-website/docs/adding_provider/new_rerank_provider.md b/docs/my-website/docs/adding_provider/new_rerank_provider.md index 84c363261cd..628c0994434 100644 --- a/docs/my-website/docs/adding_provider/new_rerank_provider.md +++ b/docs/my-website/docs/adding_provider/new_rerank_provider.md @@ -17,7 +17,7 @@ class YourProviderRerankConfig(BaseRerankConfig): # ... other supported params ] - def transform_rerank_request(self, model: str, optional_rerank_params: OptionalRerankParams, headers: dict) -> dict: + def transform_rerank_request(self, model: str, optional_rerank_params: Dict, headers: dict) -> dict: # Transform request to RerankRequest spec return rerank_request.model_dump(exclude_none=True) diff --git a/docs/my-website/docs/benchmarks.md b/docs/my-website/docs/benchmarks.md index 43ab82b8e61..47697355dbf 100644 --- a/docs/my-website/docs/benchmarks.md +++ b/docs/my-website/docs/benchmarks.md @@ -16,19 +16,17 @@ model_list: api_key: "test" ``` -### 1 Instance LiteLLM Proxy +### 2 Instance LiteLLM Proxy In these tests the baseline latency characteristics are measured against a fake-openai-endpoint. #### Performance Metrics -| Metric | Value | -|--------|-------| -| **Requests per Second (RPS)** | 475 | -| **End-to-End Latency P50 (ms)** | 100 | -| **LiteLLM Overhead P50 (ms)** | 3 | -| **LiteLLM Overhead P90 (ms)** | 17 | -| **LiteLLM Overhead P99 (ms)** | 31 | +| **Type** | **Name** | **Median (ms)** | **95%ile (ms)** | **99%ile (ms)** | **Average (ms)** | **Current RPS** | +| --- | --- | --- | --- | --- | --- | --- | +| POST | /chat/completions | 200 | 630 | 1200 | 262.46 | 1035.7 | +| Custom | LiteLLM Overhead Duration (ms) | 12 | 29 | 43 | 14.74 | 1035.7 | +| | Aggregated | 100 | 430 | 930 | 138.6 | 2071.4 | @@ -36,28 +34,32 @@ In these tests the baseline latency characteristics are measured against a fake- --> + +### 4 Instances + +| **Type** | **Name** | **Median (ms)** | **95%ile (ms)** | **99%ile (ms)** | **Average (ms)** | **Current RPS** | +| --- | --- | --- | --- | --- | --- | --- | +| POST | /chat/completions | 100 | 150 | 240 | 111.73 | 1170 | +| Custom | LiteLLM Overhead Duration (ms) | 2 | 8 | 13 | 3.32 | 1170 | +| | Aggregated | 77 | 130 | 180 | 57.53 | 2340 | + #### Key Findings -- Single instance: 475 RPS @ 100ms median latency -- LiteLLM adds 3ms P50 overhead, 17ms P90 overhead, 31ms P99 overhead -- 2 LiteLLM instances: 950 RPS @ 100ms latency -- 4 LiteLLM instances: 1900 RPS @ 100ms latency - -### 2 Instances - -**Adding 1 instance, will double the RPS and maintain the `100ms-110ms` median latency.** - -| Metric | Litellm Proxy (2 Instances) | -|--------|------------------------| -| Median Latency (ms) | 100 | -| RPS | 950 | - +- Doubling from 2 to 4 LiteLLM instances halves median latency: 200 ms → 100 ms. +- High-percentile latencies drop significantly: P95 630 ms → 150 ms, P99 1,200 ms → 240 ms. +- Setting workers equal to CPU count gives optimal performance. ## Machine Spec used for testing Each machine deploying LiteLLM had the following specs: -- 2 CPU -- 4GB RAM +- 4 CPU +- 8GB RAM + + +## Locust Settings + +- 1000 Users +- 500 user Ramp Up ## How to measure LiteLLM Overhead @@ -137,10 +139,3 @@ Using LangSmith has **no impact on latency, RPS compared to Basic Litellm Proxy* |--------|------------------------|---------------------| | RPS | 1133.2 | 1135 | | Median Latency (ms) | 140 | 132 | - - - -## Locust Settings - -- 2500 Users -- 100 user Ramp Up diff --git a/docs/my-website/docs/completion/input.md b/docs/my-website/docs/completion/input.md index 91d9cc72cf3..bdbd0b04929 100644 --- a/docs/my-website/docs/completion/input.md +++ b/docs/my-website/docs/completion/input.md @@ -180,11 +180,11 @@ def completion( - `function`: *object* - Required. -- `tool_choice`: *string or object (optional)* - Controls which (if any) function is called by the model. none means the model will not call a function and instead generates a message. auto means the model can pick between generating a message or calling a function. Specifying a particular function via `{"type: "function", "function": {"name": "my_function"}}` forces the model to call that function. +- `tool_choice`: *string or object (optional)* - Controls which (if any) function is called by the model. none means the model will not call a function and instead generates a message. auto means the model can pick between generating a message or calling a function. Specifying a particular function via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that function. - `none` is the default when no functions are present. `auto` is the default if functions are present. -- `parallel_tool_calls`: *boolean (optional)* - Whether to enable parallel function calling during tool use.. OpenAI default is true. +- `parallel_tool_calls`: *boolean (optional)* - Whether to enable parallel function calling during tool use. OpenAI default is true. - `frequency_penalty`: *number or null (optional)* - It is used to penalize new tokens based on their frequency in the text so far. diff --git a/docs/my-website/docs/embedding/supported_embedding.md b/docs/my-website/docs/embedding/supported_embedding.md index 1fd5a03e652..e63d9403665 100644 --- a/docs/my-website/docs/embedding/supported_embedding.md +++ b/docs/my-website/docs/embedding/supported_embedding.md @@ -266,7 +266,59 @@ print(response) | Titan Embeddings - G1 | `embedding(model="amazon.titan-embed-text-v1", input=input)` | | Cohere Embeddings - English | `embedding(model="cohere.embed-english-v3", input=input)` | | Cohere Embeddings - Multilingual | `embedding(model="cohere.embed-multilingual-v3", input=input)` | +| TwelveLabs Marengo (Async) | `embedding(model="bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0", input=input, input_type="text")` | [Async Invoke Docs](../providers/bedrock_embedding#async-invoke-embedding) | +## TwelveLabs Bedrock Embedding Models + +TwelveLabs Marengo models support multimodal embeddings (text, image, video, audio) and require the `input_type` parameter to specify the input format. + +### Usage + +```python +from litellm import embedding +import os + +# Set AWS credentials +os.environ["AWS_ACCESS_KEY_ID"] = "" +os.environ["AWS_SECRET_ACCESS_KEY"] = "" +os.environ["AWS_REGION_NAME"] = "us-east-1" + +# Text embedding +response = embedding( + model="bedrock/us.twelvelabs.marengo-embed-2-7-v1:0", + input=["Hello world from LiteLLM!"], + input_type="text" # Required parameter +) + +# Image embedding (base64) +response = embedding( + model="bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0", + input=["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ..."], + input_type="image", # Required parameter + output_s3_uri="s3://your-bucket/async-invoke-output/" +) + +# Video embedding (S3 URL) +response = embedding( + model="bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0", + input=["s3://your-bucket/video.mp4"], + input_type="video", # Required parameter + output_s3_uri="s3://your-bucket/async-invoke-output/" +) +``` + +### Required Parameters + +| Parameter | Description | Values | +|-----------|-------------|--------| +| `input_type` | Type of input content | `"text"`, `"image"`, `"video"`, `"audio"` | + +### Supported Models + +| Model Name | Function Call | Notes | +|------------|---------------|-------| +| TwelveLabs Marengo 2.7 (Sync) | `embedding(model="bedrock/us.twelvelabs.marengo-embed-2-7-v1:0", input=input, input_type="text")` | Text embeddings only | +| TwelveLabs Marengo 2.7 (Async) | `embedding(model="bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0", input=input, input_type="text/image/video/audio")` | All input types, requires `output_s3_uri` | ## Cohere Embedding Models https://docs.cohere.com/reference/embed diff --git a/docs/my-website/docs/mcp.md b/docs/my-website/docs/mcp.md index 50bd5aefa76..6b0ed067c55 100644 --- a/docs/my-website/docs/mcp.md +++ b/docs/my-website/docs/mcp.md @@ -2,7 +2,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import Image from '@theme/IdealImage'; -# /mcp - Model Context Protocol +# MCP Overview LiteLLM Proxy provides an MCP Gateway that allows you to use a fixed endpoint for all MCP tools and control MCP access by Key, Team. @@ -23,6 +23,43 @@ LiteLLM Proxy provides an MCP Gateway that allows you to use a fixed endpoint fo ## Adding your MCP +### Prerequisites + +To store MCP servers in the database, you need to enable database storage: + +**Environment Variable:** +```bash +export STORE_MODEL_IN_DB=True +``` + +**OR in config.yaml:** +```yaml +general_settings: + store_model_in_db: true +``` + +#### Fine-grained Database Storage Control + +By default, when `store_model_in_db` is `true`, all object types (models, MCPs, guardrails, vector stores, etc.) are stored in the database. If you want to store only specific object types, use the `supported_db_objects` setting. + +**Example: Store only MCP servers in the database** + +```yaml title="config.yaml" showLineNumbers +general_settings: + store_model_in_db: true + supported_db_objects: ["mcp"] # Only store MCP servers in DB + +model_list: + - model_name: gpt-4o + litellm_params: + model: openai/gpt-4o + api_key: sk-xxxxxxx +``` + +**See all available object types:** [Config Settings - supported_db_objects](./proxy/config_settings.md#general_settings---reference) + +If `supported_db_objects` is not set, all object types are loaded from the database (default behavior). + @@ -209,8 +246,203 @@ litellm_settings: -## MCP Tool Filtering +## 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. + +### Benefits + +- **Rapid Integration**: Convert existing APIs to MCP tools without writing custom MCP server code +- **Automatic Tool Generation**: LiteLLM automatically generates MCP tools from your OpenAPI spec +- **Unified Interface**: Use the same MCP interface for both native MCP servers and OpenAPI-based APIs +- **Easy Testing**: Test and iterate on API integrations quickly + +### Configuration + +Add your OpenAPI-based MCP server to your `config.yaml`: + +```yaml title="config.yaml - OpenAPI to MCP" showLineNumbers +model_list: + - model_name: gpt-4o + litellm_params: + model: openai/gpt-4o + api_key: sk-xxxxxxx + +mcp_servers: + # OpenAPI Spec Example - Petstore API + petstore_mcp: + url: "https://petstore.swagger.io/v2" + spec_path: "/path/to/openapi.json" + auth_type: "none" + + # OpenAPI Spec with API Key Authentication + my_api_mcp: + url: "http://0.0.0.0:8090" + spec_path: "/path/to/openapi.json" + auth_type: "api_key" + auth_value: "your-api-key-here" + + # OpenAPI Spec with Bearer Token + secured_api_mcp: + url: "https://api.example.com" + spec_path: "/path/to/openapi.json" + auth_type: "bearer_token" + auth_value: "your-bearer-token" +``` + +### Configuration Parameters + +| Parameter | Required | Description | +|-----------|----------|-------------| +| `url` | Yes | The base URL of your API endpoint | +| `spec_path` | Yes | Path or URL to your OpenAPI specification file (JSON or YAML) | +| `auth_type` | No | Authentication type: `none`, `api_key`, `bearer_token`, `basic`, `authorization` | +| `auth_value` | No | Authentication value (required if `auth_type` is set) | +| `description` | No | Optional description for the MCP server | +| `allowed_tools` | No | List of specific tools to allow (see [MCP Tool Filtering](#mcp-tool-filtering)) | +| `disallowed_tools` | No | List of specific tools to block (see [MCP Tool Filtering](#mcp-tool-filtering)) | + +### Usage Example + +Once configured, you can use the OpenAPI-based MCP server just like any other MCP server: + + + + +```python title="Using OpenAPI-based MCP Server" showLineNumbers +from fastmcp import Client +import asyncio + +# Standard MCP configuration +config = { + "mcpServers": { + "petstore": { + "url": "http://localhost:4000/petstore_mcp/mcp", + "headers": { + "x-litellm-api-key": "Bearer sk-1234" + } + } + } +} + +# Create a client that connects to the server +client = Client(config) + +async def main(): + async with client: + # List available tools generated from OpenAPI spec + tools = await client.list_tools() + print(f"Available tools: {[tool.name for tool in tools]}") + + # Example: Get a pet by ID (from Petstore API) + response = await client.call_tool( + name="getpetbyid", + arguments={"petId": "1"} + ) + print(f"Response:\n{response}\n") + + # Example: Find pets by status + response = await client.call_tool( + name="findpetsbystatus", + arguments={"status": "available"} + ) + print(f"Response:\n{response}\n") + +if __name__ == "__main__": + asyncio.run(main()) +``` + + + + + +```json title="Cursor MCP Configuration for OpenAPI Server" showLineNumbers +{ + "mcpServers": { + "Petstore": { + "url": "http://localhost:4000/petstore_mcp/mcp", + "headers": { + "x-litellm-api-key": "Bearer $LITELLM_API_KEY" + } + } + } +} +``` + + + + + +```bash title="Using OpenAPI MCP Server with OpenAI" showLineNumbers +curl --location 'https://api.openai.com/v1/responses' \ +--header 'Content-Type: application/json' \ +--header "Authorization: Bearer $OPENAI_API_KEY" \ +--data '{ + "model": "gpt-4o", + "tools": [ + { + "type": "mcp", + "server_label": "petstore", + "server_url": "http://localhost:4000/petstore_mcp/mcp", + "require_approval": "never", + "headers": { + "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY" + } + } + ], + "input": "Find all available pets in the petstore", + "tool_choice": "required" +}' +``` + + + + +### How It Works + +1. **Spec Loading**: LiteLLM loads your OpenAPI specification from the provided `spec_path` +2. **Tool Generation**: Each API endpoint in the spec becomes an MCP tool +3. **Parameter Mapping**: OpenAPI parameters are automatically mapped to MCP tool parameters +4. **Request Handling**: When a tool is called, LiteLLM converts the MCP request to the appropriate HTTP request +5. **Response Translation**: API responses are converted back to MCP format + +### OpenAPI Spec Requirements + +Your OpenAPI specification should follow standard OpenAPI/Swagger conventions: +- **Supported versions**: OpenAPI 3.0.x, OpenAPI 3.1.x, Swagger 2.0 +- **Required fields**: `paths`, `info` sections should be properly defined +- **Operation IDs**: Each operation should have a unique `operationId` (this becomes the tool name) +- **Parameters**: Request parameters should be properly documented with types and descriptions + +### Example OpenAPI Spec Structure + +```yaml title="sample-openapi.yaml" showLineNumbers +openapi: 3.0.0 +info: + title: My API + version: 1.0.0 +paths: + /pets/{petId}: + get: + operationId: getPetById + summary: Get a pet by ID + parameters: + - name: petId + in: path + required: true + schema: + type: integer + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object +``` + +## Allow/Disallow MCP Tools + Control which tools are available from your MCP servers. You can either allow only specific tools or block dangerous ones. @@ -269,210 +501,118 @@ mcp_servers: - If you specify both `allowed_tools` and `disallowed_tools`, the allowed list takes priority - Tool names are case-sensitive -## Using your MCP +--- -### Use on LiteLLM UI +## Allow/Disallow MCP Tool Parameters -Follow this walkthrough to use your MCP on LiteLLM UI +Control which parameters are allowed for specific MCP tools using the `allowed_params` configuration. This provides fine-grained control over tool usage by restricting the parameters that can be passed to each tool. - +### Configuration -### Use with Responses API +`allowed_params` is a dictionary that maps tool names to lists of allowed parameter names. When configured, only the specified parameters will be accepted for that tool - any other parameters will be rejected with a 403 error. -Replace `http://localhost:4000` with your LiteLLM Proxy base URL. - -Demo Video Using Responses API with LiteLLM Proxy: [Demo video here](https://www.loom.com/share/34587e618c5c47c0b0d67b4e4d02718f?sid=2caf3d45-ead4-4490-bcc1-8d6dd6041c02) - - - - - -```bash title="cURL Example" showLineNumbers -curl --location 'http://localhost:4000/v1/responses' \ ---header 'Content-Type: application/json' \ ---header "Authorization: Bearer sk-1234" \ ---data '{ - "model": "gpt-5", - "input": [ - { - "role": "user", - "content": "give me TLDR of what BerriAI/litellm repo is about", - "type": "message" - } - ], - "tools": [ - { - "type": "mcp", - "server_label": "litellm", - "server_url": "litellm_proxy", - "require_approval": "never" - } - ], - "stream": true, - "tool_choice": "required" -}' +```yaml title="config.yaml with allowed_params" showLineNumbers +mcp_servers: + deepwiki_mcp: + url: https://mcp.deepwiki.com/mcp + transport: "http" + auth_type: "none" + allowed_params: + # Tool name: list of allowed parameters + read_wiki_contents: ["status"] + + my_api_mcp: + url: "https://my-api-server.com" + auth_type: "api_key" + auth_value: "my-key" + allowed_params: + # Using unprefixed tool name + getpetbyid: ["status"] + # Using prefixed tool name (both formats work) + my_api_mcp-findpetsbystatus: ["status", "limit"] + # Another tool with multiple allowed params + create_issue: ["title", "body", "labels"] ``` - - +### How It Works -```python title="Python SDK Example" showLineNumbers -""" -Use LiteLLM Proxy MCP Gateway to call MCP tools. +1. **Tool-specific filtering**: Each tool can have its own list of allowed parameters +2. **Flexible naming**: Tool names can be specified with or without the server prefix (e.g., both `"getpetbyid"` and `"my_api_mcp-getpetbyid"` work) +3. **Whitelist approach**: Only parameters in the allowed list are permitted +4. **Unlisted tools**: If `allowed_params` is not set, all parameters are allowed +5. **Error handling**: Requests with disallowed parameters receive a 403 error with details about which parameters are allowed -When using LiteLLM Proxy, you can use the same MCP tools across all your LLM providers. -""" -import openai +### Example Request Behavior -client = openai.OpenAI( - api_key="sk-1234", # paste your litellm proxy api key here - base_url="http://localhost:4000" # paste your litellm proxy base url here -) -print("Making API request to Responses API with MCP tools") +With the configuration above, here's how requests would be handled: -response = client.responses.create( - model="gpt-5", - input=[ - { - "role": "user", - "content": "give me TLDR of what BerriAI/litellm repo is about", - "type": "message" - } - ], - tools=[ - { - "type": "mcp", - "server_label": "litellm", - "server_url": "litellm_proxy", - "require_approval": "never" - } - ], - stream=True, - tool_choice="required" -) - -for chunk in response: - print("response chunk: ", chunk) -``` - - - - -#### Specifying MCP Tools - -You can specify which MCP tools are available by using the `allowed_tools` parameter. This allows you to restrict access to specific tools within an MCP server. - -To get the list of allowed tools when using LiteLLM MCP Gateway, you can naigate to the LiteLLM UI on MCP Servers > MCP Tools > Click the Tool > Copy Tool Name. - - - - -```bash title="cURL Example with allowed_tools" showLineNumbers -curl --location 'http://localhost:4000/v1/responses' \ ---header 'Content-Type: application/json' \ ---header "Authorization: Bearer sk-1234" \ ---data '{ - "model": "gpt-5", - "input": [ - { - "role": "user", - "content": "give me TLDR of what BerriAI/litellm repo is about", - "type": "message" - } - ], - "tools": [ - { - "type": "mcp", - "server_label": "litellm", - "server_url": "litellm_proxy/mcp", - "require_approval": "never", - "allowed_tools": ["GitMCP-fetch_litellm_documentation"] - } - ], - "stream": true, - "tool_choice": "required" -}' -``` - - - - -```python title="Python SDK Example with allowed_tools" showLineNumbers -import openai - -client = openai.OpenAI( - api_key="sk-1234", - base_url="http://localhost:4000" -) - -response = client.responses.create( - model="gpt-5", - input=[ - { - "role": "user", - "content": "give me TLDR of what BerriAI/litellm repo is about", - "type": "message" - } - ], - tools=[ - { - "type": "mcp", - "server_label": "litellm", - "server_url": "litellm_proxy/mcp", - "require_approval": "never", - "allowed_tools": ["GitMCP-fetch_litellm_documentation"] - } - ], - stream=True, - tool_choice="required" -) - -print(response) -``` - - - - -### Use with Cursor IDE - -Use tools directly from Cursor IDE with LiteLLM MCP: - -**Setup Instructions:** - -1. **Open Cursor Settings**: Use `⇧+⌘+J` (Mac) or `Ctrl+Shift+J` (Windows/Linux) -2. **Navigate to MCP Tools**: Go to the "MCP Tools" tab and click "New MCP Server" -3. **Add Configuration**: Copy and paste the JSON configuration below, then save with `Cmd+S` or `Ctrl+S` - -```json title="Basic Cursor MCP Configuration" showLineNumbers +**✅ Allowed Request:** +```json { - "mcpServers": { - "LiteLLM": { - "url": "litellm_proxy", - "headers": { - "x-litellm-api-key": "Bearer $LITELLM_API_KEY" - } - } + "tool": "read_wiki_contents", + "arguments": { + "status": "active" } } ``` -#### How it works when server_url="litellm_proxy" +**❌ Rejected Request:** +```json +{ + "tool": "read_wiki_contents", + "arguments": { + "status": "active", + "limit": 10 // This parameter is not allowed + } +} +``` -When server_url="litellm_proxy", LiteLLM bridges non-MCP providers to your MCP tools. +**Error Response:** +```json +{ + "error": "Parameters ['limit'] are not allowed for tool read_wiki_contents. Allowed parameters: ['status']. Contact proxy admin to allow these parameters." +} +``` -- Tool Discovery: LiteLLM fetches MCP tools and converts them to OpenAI-compatible definitions -- LLM Call: Tools are sent to the LLM with your input; LLM selects which tools to call -- Tool Execution: LiteLLM automatically parses arguments, routes calls to MCP servers, executes tools, and retrieves results -- Response Integration: Tool results are sent back to LLM for final response generation -- Output: Complete response combining LLM reasoning with tool execution results +### Use Cases -This enables MCP tool usage with any LiteLLM-supported provider, regardless of native MCP support. +- **Security**: Prevent users from accessing sensitive parameters or dangerous operations +- **Cost control**: Restrict expensive parameters (e.g., limiting result counts) +- **Compliance**: Enforce parameter usage policies for regulatory requirements +- **Staged rollouts**: Gradually enable parameters as tools are tested +- **Multi-tenant isolation**: Different parameter access for different user groups -#### Auto-execution for require_approval: "never" +### Combining with Tool Filtering -Setting require_approval: "never" triggers automatic tool execution, returning the final response in a single API call without additional user interaction. +`allowed_params` works alongside `allowed_tools` and `disallowed_tools` for complete control: +```yaml title="Combined filtering example" showLineNumbers +mcp_servers: + github_mcp: + url: "https://api.githubcopilot.com/mcp" + auth_type: oauth2 + authorization_url: https://github.com/login/oauth/authorize + token_url: https://github.com/login/oauth/access_token + client_id: os.environ/GITHUB_OAUTH_CLIENT_ID + client_secret: os.environ/GITHUB_OAUTH_CLIENT_SECRET + scopes: ["public_repo", "user:email"] + # Only allow specific tools + allowed_tools: ["create_issue", "list_issues", "search_issues"] + # Block dangerous operations + disallowed_tools: ["delete_repo"] + # Restrict parameters per tool + allowed_params: + create_issue: ["title", "body", "labels"] + list_issues: ["state", "sort", "perPage"] + search_issues: ["query", "sort", "order", "perPage"] +``` +This configuration ensures that: +1. Only the three listed tools are available +2. The `delete_repo` tool is explicitly blocked +3. Each tool can only use its specified parameters + +--- ## MCP Server Access Control @@ -1064,6 +1204,8 @@ mcp_servers: scopes: ["public_repo", "user:email"] ``` +[**See Claude Code Tutorial**](./tutorials/claude_responses_api#connecting-mcp-servers) + ## Using your MCP with client side credentials Use this if you want to pass a client side authentication token to LiteLLM to then pass to your MCP to auth to your MCP. @@ -1452,221 +1594,6 @@ curl --location '/v1/responses' \ }' ``` - - -## MCP Cost Tracking - -LiteLLM provides two ways to track costs for MCP tool calls: - -| Method | When to Use | What It Does | -|--------|-------------|--------------| -| **Config-based Cost Tracking** | Simple cost tracking with fixed costs per tool/server | Automatically tracks costs based on configuration | -| **Custom Post-MCP Hook** | Dynamic cost tracking with custom logic | Allows custom cost calculations and response modifications | - -### Config-based Cost Tracking - -Configure fixed costs for MCP servers directly in your config.yaml: - -```yaml title="config.yaml" showLineNumbers -model_list: - - model_name: gpt-4o - litellm_params: - model: openai/gpt-4o - api_key: sk-xxxxxxx - -mcp_servers: - zapier_server: - url: "https://actions.zapier.com/mcp/sk-xxxxx/sse" - mcp_info: - mcp_server_cost_info: - # Default cost for all tools in this server - default_cost_per_query: 0.01 - # Custom cost for specific tools - tool_name_to_cost_per_query: - send_email: 0.05 - create_document: 0.03 - - expensive_api_server: - url: "https://api.expensive-service.com/mcp" - mcp_info: - mcp_server_cost_info: - default_cost_per_query: 1.50 -``` - -### Custom Post-MCP Hook - -Use this when you need dynamic cost calculation or want to modify the MCP response before it's returned to the user. - -#### 1. Create a custom MCP hook file - -```python title="custom_mcp_hook.py" showLineNumbers -from typing import Optional -from litellm.integrations.custom_logger import CustomLogger -from litellm.types.mcp import MCPPostCallResponseObject - - -class CustomMCPCostTracker(CustomLogger): - """ - Custom handler for MCP cost tracking and response modification - """ - - async def async_post_mcp_tool_call_hook( - self, - kwargs, - response_obj: MCPPostCallResponseObject, - start_time, - end_time - ) -> Optional[MCPPostCallResponseObject]: - """ - Called after each MCP tool call. - Modify costs and response before returning to user. - """ - - # Extract tool information from kwargs - tool_name = kwargs.get("name", "") - server_name = kwargs.get("server_name", "") - - # Calculate custom cost based on your logic - custom_cost = 42.00 - - # Set the response cost - response_obj.hidden_params.response_cost = custom_cost - - - - return response_obj - - -# Create instance for LiteLLM to use -custom_mcp_cost_tracker = CustomMCPCostTracker() -``` - -#### 2. Configure in config.yaml - -```yaml title="config.yaml" showLineNumbers -model_list: - - model_name: gpt-4o - litellm_params: - model: openai/gpt-4o - api_key: sk-xxxxxxx - -# Add your custom MCP hook -callbacks: - - custom_mcp_hook.custom_mcp_cost_tracker - -mcp_servers: - zapier_server: - url: "https://actions.zapier.com/mcp/sk-xxxxx/sse" -``` - -#### 3. Start the proxy - -```shell -$ litellm --config /path/to/config.yaml -``` - -When MCP tools are called, your custom hook will: -1. Calculate costs based on your custom logic -2. Modify the response if needed -3. Track costs in LiteLLM's logging system - -## MCP Guardrails - -LiteLLM supports applying guardrails to MCP tool calls to ensure security and compliance. You can configure guardrails to run before or during MCP calls to validate inputs and block or mask sensitive information. - -### Supported MCP Guardrail Modes - -MCP guardrails support the following modes: - -- `pre_mcp_call`: Run **before** MCP call, on **input**. Use this mode when you want to apply validation/masking/blocking for MCP requests -- `during_mcp_call`: Run **during** MCP call execution. Use this mode for real-time monitoring and intervention - -### Configuration Examples - -Configure guardrails to run before MCP tool calls to validate and sanitize inputs: - -```yaml title="config.yaml" showLineNumbers -guardrails: - - guardrail_name: "mcp-input-validation" - litellm_params: - guardrail: presidio # or other supported guardrails - mode: "pre_mcp_call" # or during_mcp_call - pii_entities_config: - CREDIT_CARD: "BLOCK" # Will block requests containing credit card numbers - EMAIL_ADDRESS: "MASK" # Will mask email addresses - PHONE_NUMBER: "MASK" # Will mask phone numbers - default_on: true -``` - - -### Usage Examples - -#### Testing Pre-MCP Call Guardrails - -Test your MCP guardrails with a request that includes sensitive information: - -```bash title="Test MCP Guardrail" showLineNumbers -curl http://localhost:4000/chat/completions \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer sk-1234" \ - -d '{ - "model": "gpt-3.5-turbo", - "messages": [ - {"role": "user", "content": "My credit card is 4111-1111-1111-1111 and my email is john@example.com"} - ], - "guardrails": ["mcp-input-validation"] - }' -``` - -The request will be processed as follows: -1. Credit card number will be blocked (request rejected) -2. Email address will be masked (e.g., replaced with ``) - -#### Using with MCP Tools - -When using MCP tools, guardrails will be applied to the tool inputs: - -```python title="Python Example with MCP Guardrails" showLineNumbers -import openai - -client = openai.OpenAI( - api_key="your-api-key", - base_url="http://localhost:4000" -) - -# This request will trigger MCP guardrails -response = client.chat.completions.create( - model="gpt-3.5-turbo", - messages=[ - {"role": "user", "content": "Send an email to 555-123-4567 with my SSN 123-45-6789"} - ], - tools=[{"type": "mcp", "server_label": "litellm", "server_url": "litellm_proxy"}], - guardrails=["mcp-input-validation"] -) -``` - -### Supported Guardrail Providers - -MCP guardrails work with all LiteLLM-supported guardrail providers: - -- **Presidio**: PII detection and masking -- **Bedrock**: AWS Bedrock guardrails -- **Lakera**: Content moderation -- **Aporia**: Custom guardrails -- **Custom**: Your own guardrail implementations - -## MCP Permission Management - -LiteLLM supports managing permissions for MCP Servers by Keys, Teams, Organizations (entities) on LiteLLM. When a MCP client attempts to list tools, LiteLLM will only return the tools the entity has permissions to access. - -When Creating a Key, Team, or Organization, you can select the allowed MCP Servers that the entity has access to. - - - - ## LiteLLM Proxy - Walk through MCP Gateway LiteLLM exposes an MCP Gateway for admins to add all their MCP servers to LiteLLM. The key benefits of using LiteLLM Proxy with MCP are: diff --git a/docs/my-website/docs/mcp_control.md b/docs/my-website/docs/mcp_control.md new file mode 100644 index 00000000000..484cb13708c --- /dev/null +++ b/docs/my-website/docs/mcp_control.md @@ -0,0 +1,45 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import Image from '@theme/IdealImage'; + +# MCP Permission Management + +Control which MCP servers and tools can be accessed by specific keys, teams, or organizations in LiteLLM. When a client attempts to list or call tools, LiteLLM enforces access controls based on configured permissions. + +## Overview + +LiteLLM provides fine-grained permission management for MCP servers, allowing you to: + +- **Restrict MCP access by entity**: Control which keys, teams, or organizations can access specific MCP servers +- **Tool-level filtering**: Automatically filter available tools based on entity permissions +- **Centralized control**: Manage all MCP permissions from the LiteLLM Admin UI or API + +This ensures that only authorized entities can discover and use MCP tools, providing an additional security layer for your MCP infrastructure. + +:::info Related Documentation +- [MCP Overview](./mcp.md) - Learn about MCP in LiteLLM +- [MCP Cost Tracking](./mcp_cost.md) - Track costs for MCP tool calls +- [MCP Guardrails](./mcp_guardrail.md) - Apply security guardrails to MCP calls +- [Using MCP](./mcp_usage.md) - How to use MCP with LiteLLM +::: + +## How It Works + +LiteLLM supports managing permissions for MCP Servers by Keys, Teams, Organizations (entities) on LiteLLM. When a MCP client attempts to list tools, LiteLLM will only return the tools the entity has permissions to access. + +When Creating a Key, Team, or Organization, you can select the allowed MCP Servers that the entity has access to. + + + + +## Set Allowed Tools for a Key, Team, or Organization + +Control which tools different teams can access from the same MCP server. For example, give your Engineering team access to `list_repositories`, `create_issue`, and `search_code`, while Sales only gets `search_code` and `close_issue`. + + +This video shows how to set allowed tools for a Key, Team, or Organization. + + diff --git a/docs/my-website/docs/mcp_cost.md b/docs/my-website/docs/mcp_cost.md new file mode 100644 index 00000000000..4f5d65fe019 --- /dev/null +++ b/docs/my-website/docs/mcp_cost.md @@ -0,0 +1,121 @@ + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import Image from '@theme/IdealImage'; + +# MCP Cost Tracking + +LiteLLM provides two ways to track costs for MCP tool calls: + +| Method | When to Use | What It Does | +|--------|-------------|--------------| +| **Config-based Cost Tracking** | Simple cost tracking with fixed costs per tool/server | Automatically tracks costs based on configuration | +| **Custom Post-MCP Hook** | Dynamic cost tracking with custom logic | Allows custom cost calculations and response modifications | + +### Config-based Cost Tracking + +Configure fixed costs for MCP servers directly in your config.yaml: + +```yaml title="config.yaml" showLineNumbers +model_list: + - model_name: gpt-4o + litellm_params: + model: openai/gpt-4o + api_key: sk-xxxxxxx + +mcp_servers: + zapier_server: + url: "https://actions.zapier.com/mcp/sk-xxxxx/sse" + mcp_info: + mcp_server_cost_info: + # Default cost for all tools in this server + default_cost_per_query: 0.01 + # Custom cost for specific tools + tool_name_to_cost_per_query: + send_email: 0.05 + create_document: 0.03 + + expensive_api_server: + url: "https://api.expensive-service.com/mcp" + mcp_info: + mcp_server_cost_info: + default_cost_per_query: 1.50 +``` + +### Custom Post-MCP Hook + +Use this when you need dynamic cost calculation or want to modify the MCP response before it's returned to the user. + +#### 1. Create a custom MCP hook file + +```python title="custom_mcp_hook.py" showLineNumbers +from typing import Optional +from litellm.integrations.custom_logger import CustomLogger +from litellm.types.mcp import MCPPostCallResponseObject + + +class CustomMCPCostTracker(CustomLogger): + """ + Custom handler for MCP cost tracking and response modification + """ + + async def async_post_mcp_tool_call_hook( + self, + kwargs, + response_obj: MCPPostCallResponseObject, + start_time, + end_time + ) -> Optional[MCPPostCallResponseObject]: + """ + Called after each MCP tool call. + Modify costs and response before returning to user. + """ + + # Extract tool information from kwargs + tool_name = kwargs.get("name", "") + server_name = kwargs.get("server_name", "") + + # Calculate custom cost based on your logic + custom_cost = 42.00 + + # Set the response cost + response_obj.hidden_params.response_cost = custom_cost + + + + return response_obj + + +# Create instance for LiteLLM to use +custom_mcp_cost_tracker = CustomMCPCostTracker() +``` + +#### 2. Configure in config.yaml + +```yaml title="config.yaml" showLineNumbers +model_list: + - model_name: gpt-4o + litellm_params: + model: openai/gpt-4o + api_key: sk-xxxxxxx + +# Add your custom MCP hook +callbacks: + - custom_mcp_hook.custom_mcp_cost_tracker + +mcp_servers: + zapier_server: + url: "https://actions.zapier.com/mcp/sk-xxxxx/sse" +``` + +#### 3. Start the proxy + +```shell +$ litellm --config /path/to/config.yaml +``` + +When MCP tools are called, your custom hook will: +1. Calculate costs based on your custom logic +2. Modify the response if needed +3. Track costs in LiteLLM's logging system + diff --git a/docs/my-website/docs/mcp_guardrail.md b/docs/my-website/docs/mcp_guardrail.md new file mode 100644 index 00000000000..f71ea2fe5ef --- /dev/null +++ b/docs/my-website/docs/mcp_guardrail.md @@ -0,0 +1,88 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import Image from '@theme/IdealImage'; + +# MCP Guardrails + +LiteLLM supports applying guardrails to MCP tool calls to ensure security and compliance. You can configure guardrails to run before or during MCP calls to validate inputs and block or mask sensitive information. + +### Supported MCP Guardrail Modes + +MCP guardrails support the following modes: + +- `pre_mcp_call`: Run **before** MCP call, on **input**. Use this mode when you want to apply validation/masking/blocking for MCP requests +- `during_mcp_call`: Run **during** MCP call execution. Use this mode for real-time monitoring and intervention + +### Configuration Examples + +Configure guardrails to run before MCP tool calls to validate and sanitize inputs: + +```yaml title="config.yaml" showLineNumbers +guardrails: + - guardrail_name: "mcp-input-validation" + litellm_params: + guardrail: presidio # or other supported guardrails + mode: "pre_mcp_call" # or during_mcp_call + pii_entities_config: + CREDIT_CARD: "BLOCK" # Will block requests containing credit card numbers + EMAIL_ADDRESS: "MASK" # Will mask email addresses + PHONE_NUMBER: "MASK" # Will mask phone numbers + default_on: true +``` + + +### Usage Examples + +#### Testing Pre-MCP Call Guardrails + +Test your MCP guardrails with a request that includes sensitive information: + +```bash title="Test MCP Guardrail" showLineNumbers +curl http://localhost:4000/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "gpt-3.5-turbo", + "messages": [ + {"role": "user", "content": "My credit card is 4111-1111-1111-1111 and my email is john@example.com"} + ], + "guardrails": ["mcp-input-validation"] + }' +``` + +The request will be processed as follows: +1. Credit card number will be blocked (request rejected) +2. Email address will be masked (e.g., replaced with ``) + +#### Using with MCP Tools + +When using MCP tools, guardrails will be applied to the tool inputs: + +```python title="Python Example with MCP Guardrails" showLineNumbers +import openai + +client = openai.OpenAI( + api_key="your-api-key", + base_url="http://localhost:4000" +) + +# This request will trigger MCP guardrails +response = client.chat.completions.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "user", "content": "Send an email to 555-123-4567 with my SSN 123-45-6789"} + ], + tools=[{"type": "mcp", "server_label": "litellm", "server_url": "litellm_proxy"}], + guardrails=["mcp-input-validation"] +) +``` + +### Supported Guardrail Providers + +MCP guardrails work with all LiteLLM-supported guardrail providers: + +- **Presidio**: PII detection and masking +- **Bedrock**: AWS Bedrock guardrails +- **Lakera**: Content moderation +- **Aporia**: Custom guardrails +- **Custom**: Your own guardrail implementations \ No newline at end of file diff --git a/docs/my-website/docs/mcp_usage.md b/docs/my-website/docs/mcp_usage.md new file mode 100644 index 00000000000..ef9d8a5ed1b --- /dev/null +++ b/docs/my-website/docs/mcp_usage.md @@ -0,0 +1,209 @@ + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import Image from '@theme/IdealImage'; + +# Using your MCP + +This document covers how to use LiteLLM as an MCP Gateway. You can see how to use it with Responses API, Cursor IDE, and OpenAI SDK. + +### Use on LiteLLM UI + +Follow this walkthrough to use your MCP on LiteLLM UI + + + +### Use with Responses API + +Replace `http://localhost:4000` with your LiteLLM Proxy base URL. + +Demo Video Using Responses API with LiteLLM Proxy: [Demo video here](https://www.loom.com/share/34587e618c5c47c0b0d67b4e4d02718f?sid=2caf3d45-ead4-4490-bcc1-8d6dd6041c02) + + + + + +```bash title="cURL Example" showLineNumbers +curl --location 'http://localhost:4000/v1/responses' \ +--header 'Content-Type: application/json' \ +--header "Authorization: Bearer sk-1234" \ +--data '{ + "model": "gpt-5", + "input": [ + { + "role": "user", + "content": "give me TLDR of what BerriAI/litellm repo is about", + "type": "message" + } + ], + "tools": [ + { + "type": "mcp", + "server_label": "litellm", + "server_url": "litellm_proxy", + "require_approval": "never" + } + ], + "stream": true, + "tool_choice": "required" +}' +``` + + + + +```python title="Python SDK Example" showLineNumbers +""" +Use LiteLLM Proxy MCP Gateway to call MCP tools. + +When using LiteLLM Proxy, you can use the same MCP tools across all your LLM providers. +""" +import openai + +client = openai.OpenAI( + api_key="sk-1234", # paste your litellm proxy api key here + base_url="http://localhost:4000" # paste your litellm proxy base url here +) +print("Making API request to Responses API with MCP tools") + +response = client.responses.create( + model="gpt-5", + input=[ + { + "role": "user", + "content": "give me TLDR of what BerriAI/litellm repo is about", + "type": "message" + } + ], + tools=[ + { + "type": "mcp", + "server_label": "litellm", + "server_url": "litellm_proxy", + "require_approval": "never" + } + ], + stream=True, + tool_choice="required" +) + +for chunk in response: + print("response chunk: ", chunk) +``` + + + + +#### Specifying MCP Tools + +You can specify which MCP tools are available by using the `allowed_tools` parameter. This allows you to restrict access to specific tools within an MCP server. + +To get the list of allowed tools when using LiteLLM MCP Gateway, you can naigate to the LiteLLM UI on MCP Servers > MCP Tools > Click the Tool > Copy Tool Name. + + + + +```bash title="cURL Example with allowed_tools" showLineNumbers +curl --location 'http://localhost:4000/v1/responses' \ +--header 'Content-Type: application/json' \ +--header "Authorization: Bearer sk-1234" \ +--data '{ + "model": "gpt-5", + "input": [ + { + "role": "user", + "content": "give me TLDR of what BerriAI/litellm repo is about", + "type": "message" + } + ], + "tools": [ + { + "type": "mcp", + "server_label": "litellm", + "server_url": "litellm_proxy/mcp", + "require_approval": "never", + "allowed_tools": ["GitMCP-fetch_litellm_documentation"] + } + ], + "stream": true, + "tool_choice": "required" +}' +``` + + + + +```python title="Python SDK Example with allowed_tools" showLineNumbers +import openai + +client = openai.OpenAI( + api_key="sk-1234", + base_url="http://localhost:4000" +) + +response = client.responses.create( + model="gpt-5", + input=[ + { + "role": "user", + "content": "give me TLDR of what BerriAI/litellm repo is about", + "type": "message" + } + ], + tools=[ + { + "type": "mcp", + "server_label": "litellm", + "server_url": "litellm_proxy/mcp", + "require_approval": "never", + "allowed_tools": ["GitMCP-fetch_litellm_documentation"] + } + ], + stream=True, + tool_choice="required" +) + +print(response) +``` + + + + +### Use with Cursor IDE + +Use tools directly from Cursor IDE with LiteLLM MCP: + +**Setup Instructions:** + +1. **Open Cursor Settings**: Use `⇧+⌘+J` (Mac) or `Ctrl+Shift+J` (Windows/Linux) +2. **Navigate to MCP Tools**: Go to the "MCP Tools" tab and click "New MCP Server" +3. **Add Configuration**: Copy and paste the JSON configuration below, then save with `Cmd+S` or `Ctrl+S` + +```json title="Basic Cursor MCP Configuration" showLineNumbers +{ + "mcpServers": { + "LiteLLM": { + "url": "litellm_proxy", + "headers": { + "x-litellm-api-key": "Bearer $LITELLM_API_KEY" + } + } + } +} +``` + +#### How it works when server_url="litellm_proxy" + +When server_url="litellm_proxy", LiteLLM bridges non-MCP providers to your MCP tools. + +- Tool Discovery: LiteLLM fetches MCP tools and converts them to OpenAI-compatible definitions +- LLM Call: Tools are sent to the LLM with your input; LLM selects which tools to call +- Tool Execution: LiteLLM automatically parses arguments, routes calls to MCP servers, executes tools, and retrieves results +- Response Integration: Tool results are sent back to LLM for final response generation +- Output: Complete response combining LLM reasoning with tool execution results + +This enables MCP tool usage with any LiteLLM-supported provider, regardless of native MCP support. + +#### Auto-execution for require_approval: "never" + +Setting require_approval: "never" triggers automatic tool execution, returning the final response in a single API call without additional user interaction. diff --git a/docs/my-website/docs/observability/posthog_integration.md b/docs/my-website/docs/observability/posthog_integration.md index 7e6a0e1076b..899972b2b48 100644 --- a/docs/my-website/docs/observability/posthog_integration.md +++ b/docs/my-website/docs/observability/posthog_integration.md @@ -55,6 +55,26 @@ curl --location 'http://0.0.0.0:4000/chat/completions' \ }' ``` +### Team-Based Logging + +Configure different PostHog credentials per team using the team callback settings: + +```bash +curl -X POST 'http://localhost:4000/team/{team_id}/callback' \ + -H 'Authorization: Bearer sk-1234' \ + -H 'Content-Type: application/json' \ + -d '{ + "callback_name": "posthog", + "callback_type": "success", + "callback_vars": { + "posthog_api_key": "ph_team_specific_key", + "posthog_api_url": "https://custom.posthog.com" + } + }' +``` + +Now all requests from that team will be logged to their specific PostHog project. + ## Usage with LiteLLM Python SDK ### Quick Start @@ -142,6 +162,31 @@ response = client.chat.completions.create( ) ``` +#### Per-Request Credentials + +You can override PostHog credentials on a per-request basis: + +```python +import litellm + +litellm.success_callback = ["posthog"] + +# Use custom PostHog credentials for this specific request +response = litellm.completion( + model="gpt-3.5-turbo", + messages=[ + {"role": "user", "content": "Hello world"} + ], + posthog_api_key="ph_custom_project_key", + posthog_api_url="https://custom.posthog.com" +) +``` + +This is useful when you need to: +- Log different teams/projects to separate PostHog instances +- Use different PostHog projects for staging vs production +- Route logs based on customer or tenant + #### Disable Logging for Specific Calls Use the `no-log` flag to prevent logging for specific calls: diff --git a/docs/my-website/docs/ocr.md b/docs/my-website/docs/ocr.md new file mode 100644 index 00000000000..d966097b326 --- /dev/null +++ b/docs/my-website/docs/ocr.md @@ -0,0 +1,257 @@ +# /ocr + +:::tip + +LiteLLM follows the [Mistral API request/response for the OCR API](https://docs.mistral.ai/capabilities/vision/#optical-character-recognition-ocr) + +::: + +## **LiteLLM Python SDK Usage** +### Quick Start + +```python +from litellm import ocr +import os + +os.environ["MISTRAL_API_KEY"] = "sk-.." + +response = ocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "document_url", + "document_url": "https://arxiv.org/pdf/2201.04234" + } +) + +# Access extracted text +for page in response.pages: + print(f"Page {page.index}:") + print(page.markdown) +``` + +### Async Usage + +```python +from litellm import aocr +import os, asyncio + +os.environ["MISTRAL_API_KEY"] = "sk-.." + +async def test_async_ocr(): + response = await aocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "document_url", + "document_url": "https://arxiv.org/pdf/2201.04234" + } + ) + + # Access extracted text + for page in response.pages: + print(f"Page {page.index}:") + print(page.markdown) + +asyncio.run(test_async_ocr()) +``` + +### Using Base64 Encoded Documents + +```python +import base64 +from litellm import ocr + +# Encode PDF to base64 +with open("document.pdf", "rb") as f: + base64_pdf = base64.b64encode(f.read()).decode('utf-8') + +response = ocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "document_url", + "document_url": f"data:application/pdf;base64,{base64_pdf}" + } +) +``` + +### Optional Parameters + +```python +response = ocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "document_url", + "document_url": "https://example.com/doc.pdf" + }, + # Optional Mistral parameters + pages=[0, 1, 2], # Only process specific pages + include_image_base64=True, # Include extracted images + image_limit=10, # Max images to return + image_min_size=100 # Min image size to include +) +``` + +## **LiteLLM Proxy Usage** + +LiteLLM provides a Mistral API compatible `/ocr` endpoint for OCR calls. + +**Setup** + +Add this to your litellm proxy config.yaml + +```yaml +model_list: + - model_name: mistral-ocr + litellm_params: + model: mistral/mistral-ocr-latest + api_key: os.environ/MISTRAL_API_KEY +``` + +Start litellm + +```bash +litellm --config /path/to/config.yaml + +# RUNNING on http://0.0.0.0:4000 +``` + +Test request + +```bash +curl http://0.0.0.0:4000/v1/ocr \ + -H "Authorization: Bearer sk-1234" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "mistral-ocr", + "document": { + "type": "document_url", + "document_url": "https://arxiv.org/pdf/2201.04234" + } + }' +``` + + +## **Request/Response Format** + +:::info + +LiteLLM follows the **Mistral OCR API specification**. + +See the [official Mistral OCR documentation](https://docs.mistral.ai/capabilities/vision/#optical-character-recognition-ocr) for complete details. + +::: + +### Example Request + +```python +{ + "model": "mistral/mistral-ocr-latest", + "document": { + "type": "document_url", + "document_url": "https://arxiv.org/pdf/2201.04234" + }, + "pages": [0, 1, 2], # Optional: specific pages to process + "include_image_base64": True, # Optional: include extracted images + "image_limit": 10, # Optional: max images to return + "image_min_size": 100 # Optional: min image size in pixels +} +``` + +### Request Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `model` | string | Yes | The OCR model to use (e.g., `"mistral/mistral-ocr-latest"`) | +| `document` | object | Yes | Document to process. Must contain `type` and URL field | +| `document.type` | string | Yes | Either `"document_url"` for PDFs/docs or `"image_url"` for images | +| `document.document_url` | string | Conditional | URL to the document (required if `type` is `"document_url"`) | +| `document.image_url` | string | Conditional | URL to the image (required if `type` is `"image_url"`) | +| `pages` | array | No | List of specific page indices to process (0-indexed) | +| `include_image_base64` | boolean | No | Whether to include extracted images as base64 strings | +| `image_limit` | integer | No | Maximum number of images to return | +| `image_min_size` | integer | No | Minimum size (in pixels) for images to include | + +#### Document Format Examples + +**For PDFs and documents:** +```json +{ + "type": "document_url", + "document_url": "https://example.com/document.pdf" +} +``` + +**For images:** +```json +{ + "type": "image_url", + "image_url": "https://example.com/image.png" +} +``` + +**For base64-encoded content:** +```json +{ + "type": "document_url", + "document_url": "data:application/pdf;base64,JVBERi0xLjQKJ..." +} +``` + +### Response Format + +The response follows Mistral's OCR format with the following structure: + +```json +{ + "pages": [ + { + "index": 0, + "markdown": "# Document Title\n\nExtracted text content...", + "dimensions": { + "dpi": 200, + "height": 2200, + "width": 1700 + }, + "images": [ + { + "image_base64": "base64string...", + "bbox": { + "x": 100, + "y": 200, + "width": 300, + "height": 400 + } + } + ] + } + ], + "model": "mistral-ocr-2505-completion", + "usage_info": { + "pages_processed": 29, + "doc_size_bytes": 3002783 + }, + "document_annotation": null, + "object": "ocr" +} +``` + +#### Response Fields + +| Field | Type | Description | +|-------|------|-------------| +| `pages` | array | List of processed pages with extracted content | +| `pages[].index` | integer | Page number (0-indexed) | +| `pages[].markdown` | string | Extracted text in Markdown format | +| `pages[].dimensions` | object | Page dimensions (dpi, height, width in pixels) | +| `pages[].images` | array | Extracted images from the page (if `include_image_base64=true`) | +| `model` | string | The model used for OCR processing | +| `usage_info` | object | Processing statistics (pages processed, document size) | +| `document_annotation` | object | Optional document-level annotations | +| `object` | string | Always `"ocr"` for OCR responses | + + +## **Supported Providers** + +| Provider | Link to Usage | +|-------------|--------------------| +| Mistral AI | [Usage](#quick-start) | + diff --git a/docs/my-website/docs/providers/bedrock_embedding.md b/docs/my-website/docs/providers/bedrock_embedding.md index 95ee8d3d228..cd492084711 100644 --- a/docs/my-website/docs/providers/bedrock_embedding.md +++ b/docs/my-website/docs/providers/bedrock_embedding.md @@ -8,6 +8,182 @@ | Cohere | `bedrock/cohere.*` | [Cohere Embeddings](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-cohere-embed.html) | | TwelveLabs | `bedrock/us.twelvelabs.*` | [TwelveLabs](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-twelvelabs.html) | +## Async Invoke Support + +LiteLLM supports AWS Bedrock's async-invoke feature for embedding models that require asynchronous processing, particularly useful for large media files (video, audio) or when you need to process embeddings in the background. + +### Supported Models + +| Provider | Async Invoke Route | Use Case | +|----------|-------------------|----------| +| TwelveLabs Marengo | `bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0` | Video, audio, image, and text embeddings | + +### Required Parameters + +When using async-invoke, you must provide: + +| Parameter | Description | Required | +|-----------|-------------|----------| +| `output_s3_uri` | S3 URI where the embedding results will be stored | ✅ Yes | +| `input_type` | Type of input: `"text"`, `"image"`, `"video"`, or `"audio"` | ✅ Yes | +| `aws_region_name` | AWS region for the request | ✅ Yes | + +### Usage + +#### Basic Async Invoke + +```python +from litellm import embedding + +# Text embedding with async-invoke +response = embedding( + model="bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0", + input=["Hello world from LiteLLM async invoke!"], + aws_region_name="us-east-1", + input_type="text", + output_s3_uri="s3://your-bucket/async-invoke-output/" +) + +print(f"Job submitted! Invocation ARN: {response._hidden_params._invocation_arn}") +``` + +#### Video/Audio Embedding + +```python +# Video embedding (requires async-invoke) +response = embedding( + model="bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0", + input=["s3://your-bucket/video.mp4"], # S3 URL for video + aws_region_name="us-east-1", + input_type="video", + output_s3_uri="s3://your-bucket/async-invoke-output/" +) + +print(f"Video embedding job submitted! ARN: {response._hidden_params._invocation_arn}") +``` + +#### Image Embedding with Base64 + +```python +import base64 + +# Load and encode image +with open("image.jpg", "rb") as img_file: + img_data = base64.b64encode(img_file.read()).decode('utf-8') + img_base64 = f"data:image/jpeg;base64,{img_data}" + +response = embedding( + model="bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0", + input=[img_base64], + aws_region_name="us-east-1", + input_type="image", + output_s3_uri="s3://your-bucket/async-invoke-output/" +) +``` + +### Retrieving Job Information + +#### Getting Job ID and Invocation ARN + +The async-invoke response includes the invocation ARN in the hidden parameters: + +```python +response = embedding( + model="bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0", + input=["Hello world"], + aws_region_name="us-east-1", + input_type="text", + output_s3_uri="s3://your-bucket/async-invoke-output/" +) + +# Access invocation ARN +invocation_arn = response._hidden_params._invocation_arn +print(f"Invocation ARN: {invocation_arn}") + +# Extract job ID from ARN (last part after the last slash) +job_id = invocation_arn.split("/")[-1] +print(f"Job ID: {job_id}") +``` + +#### Checking Job Status + +Use LiteLLM's `retrieve_batch` function to check if your job is still processing: + +```python +from litellm import retrieve_batch + +def check_async_job_status(invocation_arn, aws_region_name="us-east-1"): + """Check the status of an async invoke job using LiteLLM batch API""" + try: + response = retrieve_batch( + batch_id=invocation_arn, + custom_llm_provider="bedrock", + aws_region_name=aws_region_name + ) + return response + except Exception as e: + print(f"Error checking job status: {e}") + return None + +# Check status +status = check_async_job_status(invocation_arn, "us-east-1") +if status: + print(f"Job Status: {status.status}") + print(f"Output Location: {status.output_file_id}") +``` + +**Note:** The actual embedding results are stored in S3. The `output_file_id` from the batch status can be used to locate the results file in your S3 bucket. + +### Error Handling + +#### Common Errors + +| Error | Cause | Solution | +|-------|-------|----------| +| `ValueError: output_s3_uri cannot be empty` | Missing S3 output URI | Provide a valid S3 URI | +| `ValueError: Input type 'video' requires async_invoke route` | Using video/audio without async-invoke | Use `bedrock/async_invoke/` model prefix | +| `ValueError: input_type is required` | Missing input type parameter | Specify `input_type` parameter | + +#### Example Error Handling + +```python +try: + response = embedding( + model="bedrock/async_invoke/us.twelvelabs.marengo-embed-2-7-v1:0", + input=["Hello world"], + aws_region_name="us-east-1", + input_type="text", + output_s3_uri="s3://your-bucket/output/" # Required for async-invoke + ) + print("Job submitted successfully!") + +except ValueError as e: + if "output_s3_uri cannot be empty" in str(e): + print("Error: Please provide a valid S3 output URI") + elif "requires async_invoke route" in str(e): + print("Error: Use async_invoke model for video/audio inputs") + else: + print(f"Error: {e}") +except Exception as e: + print(f"Unexpected error: {e}") +``` + +### Best Practices + +1. **Use async-invoke for large files**: Video and audio files are better processed asynchronously +2. **Use LiteLLM batch API**: Use `retrieve_batch()` instead of direct Bedrock API calls for status checking +3. **Monitor job status**: Check job status periodically using the batch API to know when results are ready +4. **Handle errors gracefully**: Implement proper error handling for network issues and job failures +5. **Set appropriate timeouts**: Consider the processing time for large files +6. **Use S3 for large inputs**: For video/audio, use S3 URLs instead of base64 encoding + +### Limitations + +- Async-invoke is currently only supported for TwelveLabs Marengo models +- Results are stored in S3 and must be retrieved separately using the output file ID +- Job status checking requires using LiteLLM's `retrieve_batch()` function +- No built-in polling mechanism in LiteLLM (must implement your own status checking loop) + ### API keys This can be set as env variables or passed as **params to litellm.embedding()** ```python @@ -89,6 +265,7 @@ print(response) | TwelveLabs Marengo Embed 2.7 | `embedding(model="bedrock/us.twelvelabs.marengo-embed-2-7-v1:0", input=input)` | Supports multimodal input (text, video, audio, image) | | Cohere Embeddings - English | `embedding(model="bedrock/cohere.embed-english-v3", input=input)` | [here](https://github.com/BerriAI/litellm/blob/f5905e100068e7a4d61441d7453d7cf5609c2121/litellm/llms/bedrock/embed/cohere_transformation.py#L18) | Cohere Embeddings - Multilingual | `embedding(model="bedrock/cohere.embed-multilingual-v3", input=input)` | [here](https://github.com/BerriAI/litellm/blob/f5905e100068e7a4d61441d7453d7cf5609c2121/litellm/llms/bedrock/embed/cohere_transformation.py#L18) +| Cohere Embed v4 | `embedding(model="bedrock/cohere.embed-v4:0", input=input)` | Supports text and image input, configurable dimensions (256, 512, 1024, 1536), 128k context length | ### Advanced - [Drop Unsupported Params](https://docs.litellm.ai/docs/completion/drop_params#openai-proxy-usage) diff --git a/docs/my-website/docs/providers/cometapi.md b/docs/my-website/docs/providers/cometapi.md index 1245bacfad4..a7f6e65519d 100644 --- a/docs/my-website/docs/providers/cometapi.md +++ b/docs/my-website/docs/providers/cometapi.md @@ -1,6 +1,10 @@ # CometAPI LiteLLM supports all AI models from [CometAPI](https://www.cometapi.com/). CometAPI provides access to 500+ AI models through a unified API interface, including cutting-edge models like GPT-5, Claude Opus 4.1, and various other state-of-the-art language models. + + Open In Colab + + ## Authentication To use CometAPI models, you need to obtain an API key from [CometAPI Token Console](https://api.cometapi.com/console/token). CometAPI offers free tokens for new users - you can get your free API key instantly by registering. diff --git a/docs/my-website/docs/providers/nvidia_nim.md b/docs/my-website/docs/providers/nvidia_nim.md index 270b356c917..9dbfc80f4e4 100644 --- a/docs/my-website/docs/providers/nvidia_nim.md +++ b/docs/my-website/docs/providers/nvidia_nim.md @@ -15,8 +15,8 @@ https://docs.api.nvidia.com/nim/reference/ | Description | Nvidia NIM is a platform that provides a simple API for deploying and using AI models. LiteLLM supports all models from [Nvidia NIM](https://developer.nvidia.com/nim/) | | Provider Route on LiteLLM | `nvidia_nim/` | | Provider Doc | [Nvidia NIM Docs ↗](https://developer.nvidia.com/nim/) | -| API Endpoint for Provider | https://integrate.api.nvidia.com/v1/ | -| Supported OpenAI Endpoints | `/chat/completions`, `/completions`, `/responses`, `/embeddings` | +| API Endpoint for Provider | https://integrate.api.nvidia.com/v1/ (chat/embeddings), https://ai.api.nvidia.com/v1/ (rerank) | +| Supported OpenAI Endpoints | `/chat/completions`, `/completions`, `/responses`, `/embeddings`, `/rerank` | ## API Key ```python diff --git a/docs/my-website/docs/providers/nvidia_nim_rerank.md b/docs/my-website/docs/providers/nvidia_nim_rerank.md new file mode 100644 index 00000000000..7373014a960 --- /dev/null +++ b/docs/my-website/docs/providers/nvidia_nim_rerank.md @@ -0,0 +1,261 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Nvidia NIM - Rerank + +Use Nvidia NIM Rerank models through LiteLLM. + +| Property | Details | +|----------|---------| +| Description | Nvidia NIM provides high-performance reranking models for semantic search and retrieval-augmented generation (RAG) | +| Provider Doc | [Nvidia NIM Rerank API ↗](https://docs.api.nvidia.com/nim/reference/nvidia-llama-3_2-nv-rerankqa-1b-v2-infer) | +| Supported Endpoint | `/rerank` | + +## Overview + +Nvidia NIM rerank models help you: +- Reorder search results by relevance to a query +- Improve RAG (Retrieval-Augmented Generation) accuracy +- Filter and rank large document sets efficiently + +**Supported Models:** +- All Nvidia NIM rerank models on their platform + +:::tip + +See the full list of LiteLLM supported Nvidia NIM rerank models on [Nvidia NIM](https://models.litellm.ai) + +::: + +## Usage + +### LiteLLM Python SDK + + + + +```python +import litellm +import os + +os.environ['NVIDIA_NIM_API_KEY'] = "nvapi-..." + +response = litellm.rerank( + model="nvidia_nim/nvidia/llama-3_2-nv-rerankqa-1b-v2", + query="What is the GPU memory bandwidth of H100 SXM?", + documents=[ + "The Hopper GPU is paired with the Grace CPU using NVIDIA's ultra-fast chip-to-chip interconnect, delivering 900GB/s of bandwidth.", + "A100 provides up to 20X higher performance over the prior generation.", + "Accelerated servers with H100 deliver 3 terabytes per second (TB/s) of memory bandwidth per GPU." + ], + top_n=3, +) + +print(response) +``` + + + + +```python +import litellm +import os + +os.environ['NVIDIA_NIM_API_KEY'] = "nvapi-..." + +response = litellm.rerank( + model="nvidia_nim/nvidia/nv-rerankqa-mistral-4b-v3", + query="What is the GPU memory bandwidth of H100 SXM?", + documents=[ + "The Hopper GPU is paired with the Grace CPU using NVIDIA's ultra-fast chip-to-chip interconnect, delivering 900GB/s of bandwidth.", + "A100 provides up to 20X higher performance over the prior generation.", + "Accelerated servers with H100 deliver 3 terabytes per second (TB/s) of memory bandwidth per GPU." + ], + top_n=3, +) + +print(response) +``` + + + + +**Response:** +```json +{ + "results": [ + { + "index": 2, + "relevance_score": 6.828125, + "document": { + "text": "Accelerated servers with H100 deliver 3 terabytes per second (TB/s) of memory bandwidth per GPU." + } + }, + { + "index": 0, + "relevance_score": -1.564453125, + "document": { + "text": "The Hopper GPU is paired with the Grace CPU using NVIDIA's ultra-fast chip-to-chip interconnect, delivering 900GB/s of bandwidth." + } + } + ] +} +``` + + +## Usage with LiteLLM Proxy + +### 1. Setup Config + +Add Nvidia NIM rerank models to your proxy configuration: + +```yaml +model_list: + - model_name: nvidia-rerank + litellm_params: + model: nvidia_nim/nvidia/llama-3_2-nv-rerankqa-1b-v2 + api_key: os.environ/NVIDIA_NIM_API_KEY +``` + +### 2. Start Proxy + +```bash +litellm --config /path/to/config.yaml +``` + +### 3. Make Rerank Requests + +```bash +curl -X POST http://0.0.0.0:4000/rerank \ + -H "Authorization: Bearer sk-1234" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "nvidia-rerank", + "query": "What is the GPU memory bandwidth of H100?", + "documents": [ + "H100 delivers 3TB/s memory bandwidth", + "A100 has 2TB/s memory bandwidth", + "V100 offers 900GB/s memory bandwidth" + ], + "top_n": 2 + }' +``` + +## API Parameters + +### Required Parameters + +| Parameter | Type | Description | +|-----------|------|-------------| +| `model` | string | The Nvidia NIM rerank model name with `nvidia_nim/` prefix | +| `query` | string | The search query to rank documents against | +| `documents` | array | List of documents to rank (1-1000 documents) | + +### Optional Parameters + +| Parameter | Type | Default | Description | +|-----------|------|---------|-------------| +| `top_n` | integer | All documents | Number of top-ranked documents to return | + +### Nvidia-Specific Parameters + +**`truncate`**: Controls how text is truncated if it exceeds the model's context window +- `"NONE"`: No truncation (request may fail if too long) +- `"END"`: Truncate from the end of the text + +```python +response = litellm.rerank( + model="nvidia_nim/nvidia/llama-3_2-nv-rerankqa-1b-v2", + query="GPU performance", + documents=["High performance computing", "Fast GPU processing"], + top_n=2, + truncate="END", # Nvidia-specific parameter +) +``` + +## Authentication + +Set your Nvidia NIM API key: + + + + +```bash +export NVIDIA_NIM_API_KEY="nvapi-..." +``` + + + + +```python +import os +os.environ['NVIDIA_NIM_API_KEY'] = "nvapi-..." + +# Or pass directly +response = litellm.rerank( + model="nvidia_nim/nvidia/llama-3_2-nv-rerankqa-1b-v2", + query="test", + documents=["doc1"], + api_key="nvapi-...", +) +``` + + + + +## API Endpoint + +The rerank endpoint uses a different base URL than chat/embeddings: + +- **Chat/Embeddings:** `https://integrate.api.nvidia.com/v1/` +- **Rerank:** `https://ai.api.nvidia.com/v1/` + +LiteLLM automatically uses the correct endpoint for rerank requests. + +### Custom API Base URL + +You can override the default base URL in several ways: + +**Option 1: Environment Variable** + +```bash +export NVIDIA_NIM_API_BASE="https://your-custom-endpoint.com" +``` + +**Option 2: Pass as parameter** + +```python +response = litellm.rerank( + model="nvidia_nim/nvidia/llama-3_2-nv-rerankqa-1b-v2", + query="test", + documents=["doc1"], + api_base="https://your-custom-endpoint.com", +) +``` + +**Option 3: Full URL (including model path)** + +If you have the complete endpoint URL, you can pass it directly: + +```python +response = litellm.rerank( + model="nvidia_nim/nvidia/llama-3_2-nv-rerankqa-1b-v2", + query="test", + documents=["doc1"], + api_base="https://your-custom-endpoint.com/v1/retrieval/nvidia/llama-3_2-nv-rerankqa-1b-v2/reranking", +) +``` + +LiteLLM will detect the full URL (by checking for `/retrieval/` in the path) and use it as-is. + +### How do I get an API key? + +Get your Nvidia NIM API key from [Nvidia's website](https://developer.nvidia.com/nim/). + +## Related Documentation + +- [Nvidia NIM - Main Documentation](./nvidia_nim) +- [Nvidia NIM Chat Completions](./nvidia_nim#sample-usage) +- [LiteLLM Rerank Endpoint](../rerank) +- [Nvidia NIM Official Docs ↗](https://docs.api.nvidia.com/nim/reference/) + diff --git a/docs/my-website/docs/providers/oci.md b/docs/my-website/docs/providers/oci.md index 6fc1835154a..1f52fba04f3 100644 --- a/docs/my-website/docs/providers/oci.md +++ b/docs/my-website/docs/providers/oci.md @@ -6,18 +6,27 @@ LiteLLM supports the following models for OCI on-demand GenAI API. Check the [OCI Models List](https://docs.oracle.com/en-us/iaas/Content/generative-ai/pretrained-models.htm) to see if the model is available for your region. +## Supported Models + +### Meta Llama Models - `meta.llama-4-maverick-17b-128e-instruct-fp8` - `meta.llama-4-scout-17b-16e-instruct` - `meta.llama-3.3-70b-instruct` - `meta.llama-3.2-90b-vision-instruct` - `meta.llama-3.1-405b-instruct` +### xAI Grok Models - `xai.grok-4` - `xai.grok-3` - `xai.grok-3-fast` - `xai.grok-3-mini` - `xai.grok-3-mini-fast` +### Cohere Models +- `cohere.command-latest` +- `cohere.command-a-03-2025` +- `cohere.command-plus-latest` + ## Authentication LiteLLM uses OCI signing key authentication. Follow the [official Oracle tutorial](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm) to create a signing key and obtain the following parameters: @@ -44,6 +53,7 @@ response = completion( oci_user=, oci_fingerprint=, oci_tenancy=, + oci_serving_mode="ON_DEMAND", # Optional, default is "ON_DEMAND". Other option is "DEDICATED" # Provide either the private key string OR the path to the key file: # Option 1: pass the private key as a string oci_key=, @@ -71,6 +81,7 @@ response = completion( oci_user=, oci_fingerprint=, oci_tenancy=, + oci_serving_mode="ON_DEMAND", # Optional, default is "ON_DEMAND". Other option is "DEDICATED" # Provide either the private key string OR the path to the key file: # Option 1: pass the private key as a string oci_key=, @@ -81,3 +92,24 @@ response = completion( for chunk in response: print(chunk["choices"][0]["delta"]["content"]) # same as openai format ``` + +## Usage Examples by Model Type + +### Using Cohere Models + +```python +from litellm import completion + +messages = [{"role": "user", "content": "Explain quantum computing"}] +response = completion( + model="oci/cohere.command-latest", + messages=messages, + oci_region="us-chicago-1", + oci_user=, + oci_fingerprint=, + oci_tenancy=, + oci_key=, + oci_compartment_id=, +) +print(response) +``` \ No newline at end of file diff --git a/docs/my-website/docs/providers/openai.md b/docs/my-website/docs/providers/openai.md index d820215948c..3fad78dc80e 100644 --- a/docs/my-website/docs/providers/openai.md +++ b/docs/my-website/docs/providers/openai.md @@ -171,6 +171,7 @@ os.environ["OPENAI_BASE_URL"] = "https://your_host/v1" # OPTIONAL | gpt-5-2025-08-07 | `response = completion(model="gpt-5-2025-08-07", messages=messages)` | | gpt-5-mini-2025-08-07 | `response = completion(model="gpt-5-mini-2025-08-07", messages=messages)` | | gpt-5-nano-2025-08-07 | `response = completion(model="gpt-5-nano-2025-08-07", messages=messages)` | +| gpt-5-pro | `response = completion(model="gpt-5-pro", messages=messages)` | | gpt-4.1 | `response = completion(model="gpt-4.1", messages=messages)` | | gpt-4.1-mini | `response = completion(model="gpt-4.1-mini", messages=messages)` | | gpt-4.1-nano | `response = completion(model="gpt-4.1-nano", messages=messages)` | @@ -338,6 +339,72 @@ curl -X POST 'http://0.0.0.0:4000/chat/completions' \ | fine tuned `gpt-3.5-turbo-1106` | `response = completion(model="ft:gpt-3.5-turbo-1106", messages=messages)` | | fine tuned `gpt-3.5-turbo-0613` | `response = completion(model="ft:gpt-3.5-turbo-0613", messages=messages)` | +## Getting Reasoning Content in `/chat/completions` + +GPT-5 models return reasoning content when called via the Responses API. You can call these models via the `/chat/completions` endpoint by using the `openai/responses/` prefix. + + + +```python +response = litellm.completion( + model="openai/responses/gpt-5-mini", # tells litellm to call the model via the Responses API + messages=[{"role": "user", "content": "What is the capital of France?"}], + reasoning_effort="low", +) +``` + + + +```bash +curl -X POST 'http://0.0.0.0:4000/chat/completions' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer sk-1234' \ +-d '{ + "model": "openai/responses/gpt-5-mini", + "messages": [{"role": "user", "content": "What is the capital of France?"}], + "reasoning_effort": "low" +}' +``` + + + +Expected Response: +```json +{ + "id": "chatcmpl-6382a222-43c9-40c4-856b-22e105d88075", + "created": 1760146746, + "model": "gpt-5-mini", + "object": "chat.completion", + "system_fingerprint": null, + "choices": [ + { + "finish_reason": "stop", + "index": 0, + "message": { + "content": "Paris", + "role": "assistant", + "tool_calls": null, + "function_call": null, + "reasoning_content": "**Identifying the capital**\n\nThe user wants me to think of the capital of France and write it down. That's pretty straightforward: it's Paris. There aren't any safety issues to consider here. I think it would be best to keep it concise, so maybe just \"Paris\" would suffice. I feel confident that I should just stick to that without adding anything else. So, let's write it down!", + "provider_specific_fields": null + } + } + ], + "usage": { + "completion_tokens": 7, + "prompt_tokens": 18, + "total_tokens": 25, + "completion_tokens_details": null, + "prompt_tokens_details": { + "audio_tokens": null, + "cached_tokens": 0, + "text_tokens": null, + "image_tokens": null + } + } +} + +``` ## OpenAI Chat Completion to Responses API Bridge @@ -749,4 +816,24 @@ In your logs you should see the forwarded org id ```bash LiteLLM:DEBUG: utils.py:255 - Request to litellm: LiteLLM:DEBUG: utils.py:255 - litellm.acompletion(... organization='my-special-org',) +``` + +## GPT-5 Pro Special Notes + +GPT-5 Pro is OpenAI's most advanced reasoning model with unique characteristics: + +- **Responses API Only**: GPT-5 Pro is only available through the `/v1/responses` endpoint +- **No Streaming**: Does not support streaming responses +- **High Reasoning**: Designed for complex reasoning tasks with highest effort reasoning +- **Context Window**: 400,000 tokens input, 272,000 tokens output +- **Pricing**: $15.00 input / $120.00 output per 1M tokens (Standard), $7.50 input / $60.00 output (Batch) +- **Tools**: Supports Web Search, File Search, Image Generation, MCP (but not Code Interpreter or Computer Use) +- **Modalities**: Text and Image input, Text output only + +```python +# GPT-5 Pro usage example +response = completion( + model="gpt-5-pro", + messages=[{"role": "user", "content": "Solve this complex reasoning problem..."}] +) ``` \ No newline at end of file diff --git a/docs/my-website/docs/providers/openai/responses_api.md b/docs/my-website/docs/providers/openai/responses_api.md index e96a2f95225..8d91ca674b7 100644 --- a/docs/my-website/docs/providers/openai/responses_api.md +++ b/docs/my-website/docs/providers/openai/responses_api.md @@ -37,6 +37,29 @@ for event in response: print(event) ``` +#### Image Generation with Streaming +```python showLineNumbers title="OpenAI Streaming Image Generation" +import litellm +import base64 + +# Streaming image generation with partial images +stream = litellm.responses( + model="gpt-4.1", # Use an actual image generation model + input="Generate a gorgeous image of a river made of white owl feathers", + stream=True, + tools=[{"type": "image_generation", "partial_images": 2}], + +) + +for event in stream: + if event.type == "response.image_generation_call.partial_image": + idx = event.partial_image_index + image_base64 = event.partial_image_b64 + image_bytes = base64.b64decode(image_base64) + with open(f"river{idx}.png", "wb") as f: + f.write(image_bytes) +``` + #### GET a Response ```python showLineNumbers title="Get Response by ID" import litellm @@ -150,6 +173,33 @@ for event in response: print(event) ``` +#### Image Generation with Streaming +```python showLineNumbers title="OpenAI Proxy Streaming Image Generation" +from openai import OpenAI +import base64 + +# Initialize client with your proxy URL +client = OpenAI(api_key="sk-1234", base_url="http://localhost:4000") + +stream = client.responses.create( + model="gpt-4.1", + input="Draw a gorgeous image of a river made of white owl feathers, snaking its way through a serene winter landscape", + stream=True, + tools=[{"type": "image_generation", "partial_images": 2}], +) + + +for event in stream: + print(f"event: {event}") + if event.type == "response.image_generation_call.partial_image": + idx = event.partial_image_index + image_base64 = event.partial_image_b64 + image_bytes = base64.b64decode(image_base64) + with open(f"river{idx}.png", "wb") as f: + f.write(image_bytes) + +``` + #### GET a Response ```python showLineNumbers title="Get Response by ID with OpenAI SDK" from openai import OpenAI diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md index 943823c6386..3b6562b51ae 100644 --- a/docs/my-website/docs/providers/vertex.md +++ b/docs/my-website/docs/providers/vertex.md @@ -191,7 +191,7 @@ print(json.loads(completion.choices[0].message.content)) model_list: - model_name: gemini-2.5-pro litellm_params: - model: vertex_ai/gemini-1.5-pro + model: vertex_ai/gemini-2.5-pro vertex_project: "project-id" vertex_location: "us-central1" vertex_credentials: "/path/to/service_account.json" # [OPTIONAL] Do this OR `!gcloud auth application-default login` - run this to add vertex credentials to your env @@ -277,7 +277,7 @@ except JSONSchemaValidationError as e: model_list: - model_name: gemini-2.5-pro litellm_params: - model: vertex_ai/gemini-1.5-pro + model: vertex_ai/gemini-2.5-pro vertex_project: "project-id" vertex_location: "us-central1" vertex_credentials: "/path/to/service_account.json" # [OPTIONAL] Do this OR `!gcloud auth application-default login` - run this to add vertex credentials to your env @@ -621,6 +621,163 @@ curl -X POST 'http://0.0.0.0:4000/chat/completions' \ +#### **Google Maps** + +Use Google Maps to provide location-based context to your Gemini models. + +[**Relevant Vertex AI Docs**](https://ai.google.dev/gemini-api/docs/grounding#google-maps) + + + + +**Basic Usage - Enable Widget Only** + +```python showLineNumbers +from litellm import completion + +## SETUP ENVIRONMENT +# !gcloud auth application-default login - run this to add vertex credentials to your env + +tools = [{"googleMaps": {"enableWidget": "ENABLE_WIDGET"}}] # 👈 ADD GOOGLE MAPS + +resp = litellm.completion( + model="vertex_ai/gemini-2.0-flash", + messages=[{"role": "user", "content": "What restaurants are nearby?"}], + tools=tools, +) + +print(resp) +``` + +**With Location Data** + +You can specify a location to ground the model's responses with location-specific information: + +```python showLineNumbers +from litellm import completion + +## SETUP ENVIRONMENT +# !gcloud auth application-default login - run this to add vertex credentials to your env + +tools = [{ + "googleMaps": { + "enableWidget": "ENABLE_WIDGET", + "latitude": 37.7749, # San Francisco latitude + "longitude": -122.4194, # San Francisco longitude + "languageCode": "en_US" # Optional: language for results + } +}] # 👈 ADD GOOGLE MAPS WITH LOCATION + +resp = litellm.completion( + model="vertex_ai/gemini-2.0-flash", + messages=[{"role": "user", "content": "What restaurants are nearby?"}], + tools=tools, +) + +print(resp) +``` + + + + + + + +**Basic Usage - Enable Widget Only** + +```python showLineNumbers +from openai import OpenAI + +client = OpenAI( + api_key="sk-1234", # pass litellm proxy key, if you're using virtual keys + base_url="http://0.0.0.0:4000/v1/" # point to litellm proxy +) + +response = client.chat.completions.create( + model="gemini-2.0-flash", + messages=[{"role": "user", "content": "What restaurants are nearby?"}], + tools=[{"googleMaps": {"enableWidget": "ENABLE_WIDGET"}}], +) + +print(response) +``` + +**With Location Data** + +```python showLineNumbers +from openai import OpenAI + +client = OpenAI( + api_key="sk-1234", # pass litellm proxy key, if you're using virtual keys + base_url="http://0.0.0.0:4000/v1/" # point to litellm proxy +) + +response = client.chat.completions.create( + model="gemini-2.0-flash", + messages=[{"role": "user", "content": "What restaurants are nearby?"}], + tools=[{ + "googleMaps": { + "enableWidget": "ENABLE_WIDGET", + "latitude": 37.7749, # San Francisco latitude + "longitude": -122.4194, # San Francisco longitude + "languageCode": "en_US" # Optional: language for results + } + }], +) + +print(response) +``` + + + +**Basic Usage - Enable Widget Only** + +```bash showLineNumbers +curl http://localhost:4000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "gemini-2.0-flash", + "messages": [ + {"role": "user", "content": "What restaurants are nearby?"} + ], + "tools": [ + { + "googleMaps": {"enableWidget": "ENABLE_WIDGET"} + } + ] + }' +``` + +**With Location Data** + +```bash showLineNumbers +curl http://localhost:4000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "gemini-2.0-flash", + "messages": [ + {"role": "user", "content": "What restaurants are nearby?"} + ], + "tools": [ + { + "googleMaps": { + "enableWidget": "ENABLE_WIDGET", + "latitude": 37.7749, + "longitude": -122.4194, + "languageCode": "en_US" + } + } + ] + }' +``` + + + + + + #### **Moving from Vertex AI SDK to LiteLLM (GROUNDING)** @@ -824,11 +981,158 @@ curl http://0.0.0.0:4000/v1/chat/completions \ ### **Context Caching** -Use Vertex AI context caching is supported by calling provider api directly. (Unified Endpoint support coming soon.). +#### Unified Endpoint + +Use Vertex AI context caching in the same way as [**Google AI Studio - Context Caching**](../providers/gemini.md#context-caching) + + +##### Example usage + + + + +```python +from litellm import completion + +for _ in range(2): + resp = completion( + model="vertex_ai/gemini-2.5-pro", + messages=[ + # System Message + { + "role": "system", + "content": [ + { + "type": "text", + "text": "Here is the full text of a complex legal agreement" * 4000, + "cache_control": {"type": "ephemeral"}, # 👈 KEY CHANGE + } + ], + }, + # marked for caching with the cache_control parameter, so that this checkpoint can read from the previous cache. + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What are the key terms and conditions in this agreement?", + "cache_control": {"type": "ephemeral"}, + } + ], + }] + ) + + print(resp.usage) # 👈 2nd usage block will be less, since cached tokens used +``` + + + + +```python +from litellm import completion + +# Cache for 2 hours (7200 seconds) +resp = completion( + model="vertex_ai/gemini-2.5-pro", + messages=[ + { + "role": "system", + "content": [ + { + "type": "text", + "text": "Here is the full text of a complex legal agreement" * 4000, + "cache_control": { + "type": "ephemeral", + "ttl": "7200s" # 👈 Cache for 2 hours + }, + } + ], + }, + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What are the key terms and conditions in this agreement?", + "cache_control": { + "type": "ephemeral", + "ttl": "3600s" # 👈 This TTL will be ignored (first one is used) + }, + } + ], + } + ] +) + +print(resp.usage) +``` + + + + +1. Setup config.yaml + +```yaml +model_list: + - model_name: gemini-2.5-pro + litellm_params: + model: vertex_ai/gemini-2.5-pro + vertex_project: "project-id" + vertex_location: "us-central1" + vertex_credentials: "/path/to/service_account.json" +``` + +2. Start proxy + +```bash +litellm --config /path/to/config.yaml +``` + +3. Test it! + +```bash + +curl -X POST 'http://0.0.0.0:4000/chat/completions' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer sk-1234' \ +-d '{ + "model": "gemini-2.5-flash", + "messages": [ + { + "role": "system", + "content": [ + { + "type": "text", + "text": "Long cache message (must be >= 1024 tokens)", + "cache_control": { + "type": "ephemeral", + "ttl": "7200s" + } + } + ] + }, + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What is the text about?" + } + ] + } + ] +}' + +``` + + + + +#### Calling provider api directly [**Go straight to provider**](../pass_through/vertex_ai.md#context-caching) -#### 1. Create the Cache +##### 1. Create the Cache First, create the cache by sending a `POST` request to the `cachedContents` endpoint via the LiteLLM proxy. @@ -854,7 +1158,7 @@ curl http://0.0.0.0:4000/vertex_ai/v1/projects/{project_id}/locations/{location} -#### 2. Get the Cache Name from the Response +##### 2. Get the Cache Name from the Response Vertex AI will return a response containing the `name` of the cached content. This name is the identifier for your cached data. @@ -873,7 +1177,7 @@ Vertex AI will return a response containing the `name` of the cached content. Th } ``` -#### 3. Use the Cached Content +##### 3. Use the Cached Content Use the `name` from the response as `cachedContent` or `cached_content` in subsequent API calls to reuse the cached information. This is passed in the body of your request to `/chat/completions`. diff --git a/docs/my-website/docs/providers/vertex_batch.md b/docs/my-website/docs/providers/vertex_batch.md index 4eaa0d69d4b..046c60f2ebd 100644 --- a/docs/my-website/docs/providers/vertex_batch.md +++ b/docs/my-website/docs/providers/vertex_batch.md @@ -1,7 +1,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -## **Batch APIs** +# Vertex Batch APIs Just add the following Vertex env vars to your environment. diff --git a/docs/my-website/docs/providers/vertex_partner.md b/docs/my-website/docs/providers/vertex_partner.md index 856f054b8e6..48a116eb7a8 100644 --- a/docs/my-website/docs/providers/vertex_partner.md +++ b/docs/my-website/docs/providers/vertex_partner.md @@ -16,7 +16,6 @@ import TabItem from '@theme/TabItem'; | AI21 (Jamba) | `vertex_ai/jamba-*` | [Vertex AI - AI21 Models](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/ai21) | | Qwen | `vertex_ai/qwen/*` | [Vertex AI - Qwen Models](https://cloud.google.com/vertex-ai/generative-ai/docs/maas/qwen) | | OpenAI (GPT-OSS) | `vertex_ai/openai/gpt-oss-*` | [Vertex AI - GPT-OSS Models](https://console.cloud.google.com/vertex-ai/publishers/openai/model-garden/) | -| Model Garden | `vertex_ai/openai/{MODEL_ID}` or `vertex_ai/{MODEL_ID}` | [Vertex Model Garden](https://cloud.google.com/model-garden?hl=en) | ## Vertex AI - Anthropic (Claude) @@ -793,112 +792,3 @@ curl http://0.0.0.0:4000/v1/chat/completions \ - -## Model Garden - -:::tip - -All OpenAI compatible models from Vertex Model Garden are supported. - -::: - -#### Using Model Garden - -**Almost all Vertex Model Garden models are OpenAI compatible.** - - - - - -| Property | Details | -|----------|---------| -| Provider Route | `vertex_ai/openai/{MODEL_ID}` | -| Vertex Documentation | [Model Garden LiteLLM Inference](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/open-models/use-cases/model_garden_litellm_inference.ipynb), [Vertex Model Garden](https://cloud.google.com/model-garden?hl=en) | -| Supported Operations | `/chat/completions`, `/embeddings` | - - - - -```python -from litellm import completion -import os - -## set ENV variables -os.environ["VERTEXAI_PROJECT"] = "hardy-device-38811" -os.environ["VERTEXAI_LOCATION"] = "us-central1" - -response = completion( - model="vertex_ai/openai/", - messages=[{ "content": "Hello, how are you?","role": "user"}] -) -``` - - - - - - -**1. Add to config** - -```yaml -model_list: - - model_name: llama3-1-8b-instruct - litellm_params: - model: vertex_ai/openai/5464397967697903616 - vertex_ai_project: "my-test-project" - vertex_ai_location: "us-east-1" -``` - -**2. Start proxy** - -```bash -litellm --config /path/to/config.yaml - -# RUNNING at http://0.0.0.0:4000 -``` - -**3. Test it!** - -```bash -curl --location 'http://0.0.0.0:4000/chat/completions' \ - --header 'Authorization: Bearer sk-1234' \ - --header 'Content-Type: application/json' \ - --data '{ - "model": "llama3-1-8b-instruct", # 👈 the 'model_name' in config - "messages": [ - { - "role": "user", - "content": "what llm are you" - } - ], - }' -``` - - - - - - - - - - - - -```python -from litellm import completion -import os - -## set ENV variables -os.environ["VERTEXAI_PROJECT"] = "hardy-device-38811" -os.environ["VERTEXAI_LOCATION"] = "us-central1" - -response = completion( - model="vertex_ai/", - messages=[{ "content": "Hello, how are you?","role": "user"}] -) -``` - - - - diff --git a/docs/my-website/docs/providers/vertex_self_deployed.md b/docs/my-website/docs/providers/vertex_self_deployed.md new file mode 100644 index 00000000000..b7a71cdbd0e --- /dev/null +++ b/docs/my-website/docs/providers/vertex_self_deployed.md @@ -0,0 +1,229 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Vertex AI - Self Deployed Models + +Deploy and use your own models on Vertex AI through Model Garden or custom endpoints. + +## Model Garden + +:::tip + +All OpenAI compatible models from Vertex Model Garden are supported. + +::: + +### Using Model Garden + +**Almost all Vertex Model Garden models are OpenAI compatible.** + + + + + +| Property | Details | +|----------|---------| +| Provider Route | `vertex_ai/openai/{MODEL_ID}` | +| Vertex Documentation | [Model Garden LiteLLM Inference](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/open-models/use-cases/model_garden_litellm_inference.ipynb), [Vertex Model Garden](https://cloud.google.com/model-garden?hl=en) | +| Supported Operations | `/chat/completions`, `/embeddings` | + + + + +```python +from litellm import completion +import os + +## set ENV variables +os.environ["VERTEXAI_PROJECT"] = "hardy-device-38811" +os.environ["VERTEXAI_LOCATION"] = "us-central1" + +response = completion( + model="vertex_ai/openai/", + messages=[{ "content": "Hello, how are you?","role": "user"}] +) +``` + + + + + + +**1. Add to config** + +```yaml +model_list: + - model_name: llama3-1-8b-instruct + litellm_params: + model: vertex_ai/openai/5464397967697903616 + vertex_ai_project: "my-test-project" + vertex_ai_location: "us-east-1" +``` + +**2. Start proxy** + +```bash +litellm --config /path/to/config.yaml + +# RUNNING at http://0.0.0.0:4000 +``` + +**3. Test it!** + +```bash +curl --location 'http://0.0.0.0:4000/chat/completions' \ + --header 'Authorization: Bearer sk-1234' \ + --header 'Content-Type: application/json' \ + --data '{ + "model": "llama3-1-8b-instruct", # 👈 the 'model_name' in config + "messages": [ + { + "role": "user", + "content": "what llm are you" + } + ], + }' +``` + + + + + + + + + + + + +```python +from litellm import completion +import os + +## set ENV variables +os.environ["VERTEXAI_PROJECT"] = "hardy-device-38811" +os.environ["VERTEXAI_LOCATION"] = "us-central1" + +response = completion( + model="vertex_ai/", + messages=[{ "content": "Hello, how are you?","role": "user"}] +) +``` + + + + + +## Gemma Models (Custom Endpoints) + +Deploy Gemma models on custom Vertex AI prediction endpoints with OpenAI-compatible format. + +| Property | Details | +|----------|---------| +| Provider Route | `vertex_ai/gemma/{MODEL_NAME}` | +| Vertex Documentation | [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions) | +| Required Parameter | `api_base` - Full prediction endpoint URL | + +**Proxy Usage:** + +**1. Add to config.yaml** + +```yaml +model_list: + - model_name: gemma-model + litellm_params: + model: vertex_ai/gemma/gemma-3-12b-it-1222199011122 + api_base: https://ENDPOINT.us-central1-PROJECT.prediction.vertexai.goog/v1/projects/PROJECT_ID/locations/us-central1/endpoints/ENDPOINT_ID:predict + vertex_project: "my-project-id" + vertex_location: "us-central1" +``` + +**2. Start proxy** + +```bash +litellm --config /path/to/config.yaml +``` + +**3. Test it** + +```bash +curl http://0.0.0.0:4000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "gemma-model", + "messages": [{"role": "user", "content": "What is machine learning?"}], + "max_tokens": 100 + }' +``` + +**SDK Usage:** + +```python +from litellm import completion + +response = completion( + model="vertex_ai/gemma/gemma-3-12b-it-1222199011122", + messages=[{"role": "user", "content": "What is machine learning?"}], + api_base="https://ENDPOINT.us-central1-PROJECT.prediction.vertexai.goog/v1/projects/PROJECT_ID/locations/us-central1/endpoints/ENDPOINT_ID:predict", + vertex_project="my-project-id", + vertex_location="us-central1", +) +``` + +## MedGemma Models (Custom Endpoints) + +Deploy MedGemma models on custom Vertex AI prediction endpoints with OpenAI-compatible format. MedGemma models use the same `vertex_ai/gemma/` route. + +| Property | Details | +|----------|---------| +| Provider Route | `vertex_ai/gemma/{MODEL_NAME}` | +| Vertex Documentation | [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions) | +| Required Parameter | `api_base` - Full prediction endpoint URL | + +**Proxy Usage:** + +**1. Add to config.yaml** + +```yaml +model_list: + - model_name: medgemma-model + litellm_params: + model: vertex_ai/gemma/medgemma-2b-v1 + api_base: https://ENDPOINT.us-central1-PROJECT.prediction.vertexai.goog/v1/projects/PROJECT_ID/locations/us-central1/endpoints/ENDPOINT_ID:predict + vertex_project: "my-project-id" + vertex_location: "us-central1" +``` + +**2. Start proxy** + +```bash +litellm --config /path/to/config.yaml +``` + +**3. Test it** + +```bash +curl http://0.0.0.0:4000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "medgemma-model", + "messages": [{"role": "user", "content": "What are the symptoms of hypertension?"}], + "max_tokens": 100 + }' +``` + +**SDK Usage:** + +```python +from litellm import completion + +response = completion( + model="vertex_ai/gemma/medgemma-2b-v1", + messages=[{"role": "user", "content": "What are the symptoms of hypertension?"}], + api_base="https://ENDPOINT.us-central1-PROJECT.prediction.vertexai.goog/v1/projects/PROJECT_ID/locations/us-central1/endpoints/ENDPOINT_ID:predict", + vertex_project="my-project-id", + vertex_location="us-central1", +) +``` diff --git a/docs/my-website/docs/providers/wandb_inference.md b/docs/my-website/docs/providers/wandb_inference.md new file mode 100644 index 00000000000..c59f08381c6 --- /dev/null +++ b/docs/my-website/docs/providers/wandb_inference.md @@ -0,0 +1,196 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Weights & Biases Inference +https://weave-docs.wandb.ai/quickstart-inference + +:::tip + +Litellm provides support to all models from W&B Inference service. To use a model, set `model=wandb/` as a prefix for litellm requests. The full list of supported models is provided at https://docs.wandb.ai/guides/inference/models/ + +::: + +## API Key + +You can get an API key for W&B Inference at - https://wandb.ai/authorize + +```python +import os +# env variable +os.environ['WANDB_API_KEY'] +``` + +## Sample Usage: Text Generation +```python +from litellm import completion +import os + +os.environ['WANDB_API_KEY'] = "insert-your-wandb-api-key" +response = completion( + model="wandb/Qwen/Qwen3-235B-A22B-Instruct-2507", + messages=[ + { + "role": "user", + "content": "What character was Wall-e in love with?", + } + ], + max_tokens=10, + response_format={ "type": "json_object" }, + seed=123, + temperature=0.6, # either set temperature or `top_p` + top_p=0.01, # to get as deterministic results as possible +) +print(response) +``` + +## Sample Usage - Streaming +```python +from litellm import completion +import os + +os.environ['WANDB_API_KEY'] = "" +response = completion( + model="wandb/Qwen/Qwen3-235B-A22B-Instruct-2507", + messages=[ + { + "role": "user", + "content": "What character was Wall-e in love with?", + } + ], + stream=True, + max_tokens=10, + response_format={ "type": "json_object" }, + seed=123, + temperature=0.6, # either set temperature or `top_p` + top_p=0.01, # to get as deterministic results as possible +) + +for chunk in response: + print(chunk) +``` + +:::tip + +The above examples may not work if the model has been taken offline. Check the full list of available models at https://docs.wandb.ai/guides/inference/models/. + +::: + +## Usage with LiteLLM Proxy Server + +Here's how to call a W&B Inference model with the LiteLLM Proxy Server + +1. Modify the config.yaml + + ```yaml + model_list: + - model_name: my-model + litellm_params: + model: wandb/ # add wandb/ prefix to use W&B Inference as provider + api_key: api-key # api key to send your model + ``` +2. Start the proxy + ```bash + $ litellm --config /path/to/config.yaml + ``` + +3. Send Request to LiteLLM Proxy Server + + + + + + ```python + import openai + client = openai.OpenAI( + api_key="litellm-proxy-key", # pass litellm proxy key, if you're using virtual keys + base_url="http://0.0.0.0:4000" # litellm-proxy-base url + ) + + response = client.chat.completions.create( + model="my-model", + messages = [ + { + "role": "user", + "content": "What character was Wall-e in love with?" + } + ], + ) + + print(response) + ``` + + + + + ```shell + curl --location 'http://0.0.0.0:4000/chat/completions' \ + --header 'Authorization: litellm-proxy-key' \ + --header 'Content-Type: application/json' \ + --data '{ + "model": "my-model", + "messages": [ + { + "role": "user", + "content": "What character was Wall-e in love with?" + } + ], + }' + ``` + + + + +## Supported Parameters + +The W&B Inference provider supports the following parameters: + +### Chat Completion Parameters + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| frequency_penalty | number | Penalizes new tokens based on their frequency in the text | +| function_call | string/object | Controls how the model calls functions | +| functions | array | List of functions for which the model may generate JSON inputs | +| logit_bias | map | Modifies the likelihood of specified tokens | +| max_tokens | integer | Maximum number of tokens to generate | +| n | integer | Number of completions to generate | +| presence_penalty | number | Penalizes tokens based on if they appear in the text so far | +| response_format | object | Format of the response, e.g., `{"type": "json"}` | +| seed | integer | Sampling seed for deterministic results | +| stop | string/array | Sequences where the API will stop generating tokens | +| stream | boolean | Whether to stream the response | +| temperature | number | Controls randomness (0-2) | +| top_p | number | Controls nucleus sampling | + + +## Error Handling + +The integration uses the standard LiteLLM error handling. Further, here's a list of commonly encountered errors with the W&B Inference API - + +| Error Code | Message | Cause | Solution | +| ---------- | ------- | ----- | -------- | +| 401 | Authentication failed | Your authentication credentials are incorrect or your W&B project entity and/or name are incorrect. | Ensure you're using the correct API key and that your W&B project name and entity are correct. | +| 403 | Country, region, or territory not supported | Accessing the API from an unsupported location. | Please see [Geographic restrictions](https://docs.wandb.ai/guides/inference/usage-limits/#geographic-restrictions) | +| 429 | Concurrency limit reached for requests | Too many concurrent requests. | Reduce the number of concurrent requests or increase your limits. For more information, see [Usage information and limits](https://docs.wandb.ai/guides/inference/usage-limits/). | +| 429 | You exceeded your current quota, please check your plan and billing details | Out of credits or reached monthly spending cap. | Get more credits or increase your limits. For more information, see [Usage information and limits](https://docs.wandb.ai/guides/inference/usage-limits/). | +| 429 | W&B Inference isn't available for personal accounts. | Switch to a non-personal account. | Follow [the instructions below](#error-429-personal-entities-unsupported) for a work around. | +| 500 | The server had an error while processing your request | Internal server error. | Retry after a brief wait and contact support if it persists. | +| 503 | The engine is currently overloaded, please try again later | Server is experiencing high traffic. | Retry your request after a short delay. | + + +### Error 429: Personal entities unsupported + +The user is on a personal account, which doesn't have access to W&B Inference. If one isn't available, create a Team to create a non-personal account. + +Once done, add the `openai-project` header to your request as shown below: + +```python +response = completion( + model="...", + extra_headers={"openai-project": "team_name/project_name"}, + ... +``` + +For more information, see [Personal entities unsupported](https://docs.wandb.ai/guides/inference/usage-limits/#personal-entities-unsupported). + +You can find more ways of using custom headers with LiteLLM here - https://docs.litellm.ai/docs/proxy/request_headers. diff --git a/docs/my-website/docs/proxy/admin_ui_sso.md b/docs/my-website/docs/proxy/admin_ui_sso.md index 32bf97410cb..bd18dd9c690 100644 --- a/docs/my-website/docs/proxy/admin_ui_sso.md +++ b/docs/my-website/docs/proxy/admin_ui_sso.md @@ -81,6 +81,23 @@ MICROSOFT_TENANT="5a39737 http://localhost:4000/sso/callback ``` +**Using App Roles for User Permissions** + +You can assign user roles directly from Entra ID using App Roles. LiteLLM will automatically read the app roles from the JWT token and assign the corresponding role to the user. + +Supported roles: +- `proxy_admin` - Admin over the platform +- `proxy_admin_viewer` - Can login, view all keys, view all spend (read-only) +- `internal_user` - Normal user. Can login, view spend and depending on team-member permissions - view/create/delete their own keys. + + +To set up app roles: +1. Navigate to your App Registration on https://portal.azure.com/ +2. Go to "App roles" and create a new app role +3. Use one of the supported role names above (e.g., `proxy_admin`) +4. Assign users to these roles in your Enterprise Application +5. When users sign in via SSO, LiteLLM will automatically assign them the corresponding role + diff --git a/docs/my-website/docs/proxy/caching.md b/docs/my-website/docs/proxy/caching.md index 617609cf08a..9cfd796d90f 100644 --- a/docs/my-website/docs/proxy/caching.md +++ b/docs/my-website/docs/proxy/caching.md @@ -278,6 +278,8 @@ Set either `REDIS_URL` or the `REDIS_HOST` in your os environment, to enable cac REDIS_HOST = "" # REDIS_HOST='redis-18841.c274.us-east-1-3.ec2.cloud.redislabs.com' REDIS_PORT = "" # REDIS_PORT='18841' REDIS_PASSWORD = "" # REDIS_PASSWORD='liteLlmIsAmazing' + REDIS_USERNAME = "" # REDIS_USERNAME='my-redis-username' [OPTIONAL] if your redis server requires a username + REDIS_SSL = "True" # REDIS_SSL='True' to enable SSL by default is False ``` **Additional kwargs** diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index ad3afd59a02..4e440857261 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -224,6 +224,7 @@ router_settings: | service_account_settings | List[Dict[str, Any]] | Set `service_account_settings` if you want to create settings that only apply to service account keys (Doc on service accounts)[./service_accounts.md] | | image_generation_model | str | The default model to use for image generation - ignores model set in request | | store_model_in_db | boolean | If true, enables storing model + credential information in the DB. | +| supported_db_objects | List[str] | Fine-grained control over which object types to load from the database when `store_model_in_db` is True. Available types: `"models"`, `"mcp"`, `"guardrails"`, `"vector_stores"`, `"pass_through_endpoints"`, `"prompts"`, `"model_cost_map"`. If not set, all object types are loaded (default behavior). Example: `supported_db_objects: ["mcp"]` to only load MCP servers from DB. | | store_prompts_in_spend_logs | boolean | If true, allows prompts and responses to be stored in the spend logs table. | | max_request_size_mb | int | The maximum size for requests in MB. Requests above this size will be rejected. | | max_response_size_mb | int | The maximum size for responses in MB. LLM Responses above this size will not be sent. | @@ -352,7 +353,10 @@ router_settings: | AGENTOPS_SERVICE_NAME | Service Name for AgentOps logging integration | AISPEND_ACCOUNT_ID | Account ID for AI Spend | AISPEND_API_KEY | API Key for AI Spend +| AIOHTTP_CONNECTOR_LIMIT | Connection limit for aiohttp connector. When set to 0, no limit is applied. **Default is 0** +| AIOHTTP_KEEPALIVE_TIMEOUT | Keep-alive timeout for aiohttp connections in seconds. **Default is 120** | AIOHTTP_TRUST_ENV | Flag to enable aiohttp trust environment. When this is set to True, aiohttp will respect HTTP(S)_PROXY env vars. **Default is False** +| AIOHTTP_TTL_DNS_CACHE | DNS cache time-to-live for aiohttp in seconds. **Default is 300** | ALLOWED_EMAIL_DOMAINS | List of email domains allowed for access | ARIZE_API_KEY | API key for Arize platform integration | ARIZE_SPACE_KEY | Space key for Arize platform @@ -505,6 +509,8 @@ router_settings: | EMAIL_SIGNATURE | Custom HTML footer/signature for all emails. Can include HTML tags for formatting and links. | EMAIL_SUBJECT_INVITATION | Custom subject template for invitation emails. | EMAIL_SUBJECT_KEY_CREATED | Custom subject template for key creation emails. +| ENKRYPTAI_API_BASE | Base URL for EnkryptAI Guardrails API. **Default is https://api.enkryptai.com** +| ENKRYPTAI_API_KEY | API key for EnkryptAI Guardrails service | EXPERIMENTAL_MULTI_INSTANCE_RATE_LIMITING | Flag to enable new multi-instance rate limiting. **Default is False** | FIREWORKS_AI_4_B | Size parameter for Fireworks AI 4B model. Default is 4 | FIREWORKS_AI_16_B | Size parameter for Fireworks AI 16B model. Default is 16 @@ -628,6 +634,7 @@ router_settings: | LITELLM_MODE | Operating mode for LiteLLM (e.g., production, development) | LITELLM_RATE_LIMIT_WINDOW_SIZE | Rate limit window size for LiteLLM. Default is 60 | LITELLM_SALT_KEY | Salt key for encryption in LiteLLM +| LITELLM_SSL_CIPHERS | SSL/TLS cipher configuration for faster handshakes. Controls cipher suite preferences for OpenSSL connections. | LITELLM_SECRET_AWS_KMS_LITELLM_LICENSE | AWS KMS encrypted license for LiteLLM | LITELLM_TOKEN | Access token for LiteLLM integration | LITELLM_PRINT_STANDARD_LOGGING_PAYLOAD | If true, prints the standard logging payload to the console - useful for debugging @@ -773,6 +780,8 @@ router_settings: | USE_AWS_KMS | Flag to enable AWS Key Management Service for encryption | USE_PRISMA_MIGRATE | Flag to use prisma migrate instead of prisma db push. Recommended for production environments. | WEBHOOK_URL | URL for receiving webhooks from external services -| SPEND_LOG_RUN_LOOPS | Constant for setting how many runs of 1000 batch deletes should spend_log_cleanup task run | -| SPEND_LOG_CLEANUP_BATCH_SIZE | Number of logs deleted per batch during cleanup. Default is 1000 | -| COROUTINE_CHECKER_MAX_SIZE_IN_MEMORY | Maximum size for CoroutineChecker in-memory cache. Default is 1000 | \ No newline at end of file +| SPEND_LOG_RUN_LOOPS | Constant for setting how many runs of 1000 batch deletes should spend_log_cleanup task run +| SPEND_LOG_CLEANUP_BATCH_SIZE | Number of logs deleted per batch during cleanup. Default is 1000 +| COROUTINE_CHECKER_MAX_SIZE_IN_MEMORY | Maximum size for CoroutineChecker in-memory cache. Default is 1000 +| DEFAULT_SHARED_HEALTH_CHECK_TTL | Time-to-live in seconds for cached health check results in shared health check mode. Default is 300 (5 minutes) +| DEFAULT_SHARED_HEALTH_CHECK_LOCK_TTL | Time-to-live in seconds for health check lock in shared health check mode. Default is 60 (1 minute) \ No newline at end of file diff --git a/docs/my-website/docs/proxy/cost_tracking.md b/docs/my-website/docs/proxy/cost_tracking.md index 35db752cbb6..85147e12c66 100644 --- a/docs/my-website/docs/proxy/cost_tracking.md +++ b/docs/my-website/docs/proxy/cost_tracking.md @@ -8,6 +8,10 @@ Track spend for keys, users, and teams across 100+ LLMs. LiteLLM automatically tracks spend for all known models. See our [model cost map](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json) +:::tip Keep Pricing Data Updated +[Sync model pricing data from GitHub](../sync_models_github.md) to ensure accurate cost tracking. +::: + ### How to Track Spend with LiteLLM **Step 1** diff --git a/docs/my-website/docs/proxy/custom_prompt_management.md b/docs/my-website/docs/proxy/custom_prompt_management.md index 72a73332768..98e5228af36 100644 --- a/docs/my-website/docs/proxy/custom_prompt_management.md +++ b/docs/my-website/docs/proxy/custom_prompt_management.md @@ -127,7 +127,9 @@ client = OpenAI( response = client.chat.completions.create( model="gemini-1.5-pro", messages=[{"role": "user", "content": "hi"}], - prompt_id="1234" + extra_body={ + "prompt_id": "1234" + } ) print(response.choices[0].message.content) diff --git a/docs/my-website/docs/proxy/deploy.md b/docs/my-website/docs/proxy/deploy.md index 854d781f546..7d2389383d1 100644 --- a/docs/my-website/docs/proxy/deploy.md +++ b/docs/my-website/docs/proxy/deploy.md @@ -715,6 +715,25 @@ docker run ghcr.io/berriai/litellm:main-stable ``` +### Restart Workers After N Requests + +Use this to mitigate memory growth by recycling workers after a fixed number of requests. When set, each worker restarts after completing the specified number of requests. Defaults to disabled when unset. + +Usage Examples: + +```shell showLineNumbers title="docker run (CLI flag)" +docker run ghcr.io/berriai/litellm:main-stable \ + --max_requests_before_restart 10000 +``` + +Or set via environment variable: + +```shell showLineNumbers title="Environment Variable" +export MAX_REQUESTS_BEFORE_RESTART=10000 +docker run ghcr.io/berriai/litellm:main-stable +``` + + ### 5. config.yaml file on s3, GCS Bucket Object/url Use this if you cannot mount a config file on your deployment service (example - AWS Fargate, Railway etc) @@ -769,6 +788,30 @@ docker run --name litellm-proxy \ ## Platform-specific Guide + + +### Terraform-based ECS Deployment + +LiteLLM maintains a dedicated Terraform tutorial for deploying the proxy on ECS. Follow the step-by-step guide in the [litellm-ecs-deployment repository](https://github.com/BerriAI/litellm-ecs-deployment) to provision the required ECS services, task definitions, and supporting AWS resources. + +1. Clone the tutorial repository to review the Terraform modules and variables. + ```bash + git clone https://github.com/BerriAI/litellm-ecs-deployment.git + cd litellm-ecs-deployment + ``` + +2. Initialize and validate the Terraform project before applying it to your chosen workspace/account. + ```bash + terraform init + terraform plan + terraform apply + ``` + +3. Once `terraform apply` completes, do `./build.sh` to push the repository on ECR and update the ECS cluster. Use that endpoint (port `4000` by default) for API requests to your LiteLLM proxy. + + + + ### Kubernetes (AWS EKS) diff --git a/docs/my-website/docs/proxy/dynamic_rate_limit.md b/docs/my-website/docs/proxy/dynamic_rate_limit.md index b3aed6a359e..06d49dfaf0f 100644 --- a/docs/my-website/docs/proxy/dynamic_rate_limit.md +++ b/docs/my-website/docs/proxy/dynamic_rate_limit.md @@ -141,6 +141,7 @@ litellm_settings: "dev": 0.1 # 10% reserved for development (1 RPM) priority_reservation_settings: default_priority: 0 # Weight (0%) assigned to keys without explicit priority metadata + saturation_threshold: 0.50 # A model is saturated if it has hit 50% of its RPM limit general_settings: master_key: sk-1234 # OR set `LITELLM_MASTER_KEY=".."` in your .env @@ -156,6 +157,8 @@ general_settings: `priority_reservation_settings`: Object (Optional) - **default_priority (float)**: Weight/percentage (0.0 to 1.0) assigned to API keys that have no priority metadata set (defaults to 0.5) +- **saturation_threshold (float)**: Saturation level (0.0 to 1.0) at which strict priority enforcement begins for a model. Saturation is calculated as `max(current_rpm/max_rpm, current_tpm/max_tpm)`. Below this threshold, generous mode allows priority borrowing from unused capacity. Above this threshold, strict mode enforces normalized priority limits. + - Example: When model usage is low, keys can use more than their allocated share. When model usage is high, keys are strictly limited to their allocated share. **Start Proxy** diff --git a/docs/my-website/docs/proxy/guardrails/enkryptai.md b/docs/my-website/docs/proxy/guardrails/enkryptai.md new file mode 100644 index 00000000000..52e66edca40 --- /dev/null +++ b/docs/my-website/docs/proxy/guardrails/enkryptai.md @@ -0,0 +1,276 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# EnkryptAI Guardrails + +LiteLLM supports EnkryptAI guardrails for content moderation and safety checks on LLM inputs and outputs. + +## Quick Start + +### 1. Define Guardrails on your LiteLLM config.yaml + +Define your guardrails under the `guardrails` section: + +```yaml +model_list: + - model_name: gpt-3.5-turbo + litellm_params: + model: openai/gpt-3.5-turbo + api_key: os.environ/OPENAI_API_KEY + +guardrails: + - guardrail_name: "enkryptai-guard" + litellm_params: + guardrail: enkryptai + mode: "pre_call" + api_key: os.environ/ENKRYPTAI_API_KEY + detectors: + toxicity: + enabled: true + nsfw: + enabled: true + pii: + enabled: true + entities: ["email", "phone", "secrets"] + injection_attack: + enabled: true +``` + +#### Supported values for `mode` + +- `pre_call` - Run **before** LLM call, on **input** +- `post_call` - Run **after** LLM call, on **output** +- `during_call` - Run **during** LLM call, on **input**. Same as `pre_call` but runs in parallel as LLM call + +#### Available Detectors + +EnkryptAI supports multiple content detection types: + +- **toxicity** - Detect toxic language +- **nsfw** - Detect NSFW (Not Safe For Work) content +- **pii** - Detect personally identifiable information + - Configure entities: `["pii", "email", "phone", "secrets", "ip_address", "url"]` +- **injection_attack** - Detect prompt injection attempts +- **keyword_detector** - Detect custom keywords/phrases +- **policy_violation** - Detect policy violations +- **bias** - Detect biased content +- **sponge_attack** - Detect sponge attacks + +### 2. Set Environment Variables + +```bash +export ENKRYPTAI_API_KEY="your-api-key" +``` + +### 3. Start LiteLLM Gateway + +```shell +litellm --config config.yaml --detailed_debug +``` + +### 4. Test Request + +**[Langchain, OpenAI SDK Usage Examples](../proxy/user_keys#request-format)** + + + + +```shell +curl -i http://localhost:4000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "gpt-3.5-turbo", + "messages": [ + {"role": "user", "content": "Hello, how can you help me today?"} + ], + "guardrails": ["enkryptai-guard"] + }' +``` + +**Response: HTTP 200 Success** + +Content passes all detector checks and is allowed through. + + + + + +Expect this to fail if content violates detector policies: + +```shell +curl -i http://localhost:4000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "gpt-3.5-turbo", + "messages": [ + {"role": "user", "content": "My email is test@example.com and my SSN is 123-45-6789"} + ], + "guardrails": ["enkryptai-guard"] + }' +``` + +**Expected Response on Failure: HTTP 400 Error** + +```json +{ + "error": { + "message": { + "error": "Content blocked by EnkryptAI guardrail", + "detected": true, + "violations": ["pii"], + "response": { + "summary": { + "pii": 1 + }, + "details": { + "pii": { + "detected": ["email", "ssn"] + } + } + } + }, + "type": "None", + "param": "None", + "code": "400" + } +} +``` + + + + +## Video Walkthrough + + + +## Advanced Configuration + +### Using Custom Policies + +You can specify a custom EnkryptAI policy: + +```yaml +guardrails: + - guardrail_name: "enkryptai-custom" + litellm_params: + guardrail: enkryptai + mode: "pre_call" + api_key: os.environ/ENKRYPTAI_API_KEY + policy_name: "my-custom-policy" # Sent via x-enkrypt-policy header + detectors: + toxicity: + enabled: true +``` + +### Using Deployments + +Specify an EnkryptAI deployment: + +```yaml +guardrails: + - guardrail_name: "enkryptai-deployment" + litellm_params: + guardrail: enkryptai + mode: "pre_call" + api_key: os.environ/ENKRYPTAI_API_KEY + deployment_name: "production" # Sent via X-Enkrypt-Deployment header + detectors: + toxicity: + enabled: true +``` + +### Monitor Mode (Logging Without Blocking) + +Set `block_on_violation: false` to log violations without blocking requests: + +```yaml +guardrails: + - guardrail_name: "enkryptai-monitor" + litellm_params: + guardrail: enkryptai + mode: "pre_call" + api_key: os.environ/ENKRYPTAI_API_KEY + block_on_violation: false # Log violations but don't block + detectors: + toxicity: + enabled: true + nsfw: + enabled: true +``` + +In monitor mode, all violations are logged but requests are never blocked. + +### Input and Output Guardrails + +Configure separate guardrails for input and output: + +```yaml +guardrails: + # Input guardrail + - guardrail_name: "enkryptai-input" + litellm_params: + guardrail: enkryptai + mode: "pre_call" + api_key: os.environ/ENKRYPTAI_API_KEY + detectors: + pii: + enabled: true + entities: ["email", "phone", "ssn"] + injection_attack: + enabled: true + + # Output guardrail + - guardrail_name: "enkryptai-output" + litellm_params: + guardrail: enkryptai + mode: "post_call" + api_key: os.environ/ENKRYPTAI_API_KEY + detectors: + toxicity: + enabled: true + nsfw: + enabled: true +``` + +## Configuration Options + +| Parameter | Type | Description | Default | +|-----------|------|-------------|---------| +| `api_key` | string | EnkryptAI API key | `ENKRYPTAI_API_KEY` env var | +| `api_base` | string | EnkryptAI API base URL | `https://api.enkryptai.com` | +| `policy_name` | string | Custom policy name (sent via `x-enkrypt-policy` header) | None | +| `deployment_name` | string | Deployment name (sent via `X-Enkrypt-Deployment` header) | None | +| `detectors` | object | Detector configuration | `{}` | +| `block_on_violation` | boolean | Block requests on violations | `true` | +| `mode` | string | When to run: `pre_call`, `post_call`, or `during_call` | Required | + +## Observability + +EnkryptAI guardrail logs include: + +- **guardrail_status**: `success`, `guardrail_intervened`, or `guardrail_failed_to_respond` +- **guardrail_provider**: `enkryptai` +- **guardrail_json_response**: Full API response with detection details +- **duration**: Time taken for guardrail check +- **start_time** and **end_time**: Timestamps + +These logs are available through your configured LiteLLM logging callbacks. + +## Error Handling + +The guardrail handles errors gracefully: + +- **API Failures**: Logs error and raises exception +- **Rate Limits (429)**: Logs error and raises exception +- **Invalid Configuration**: Raises `ValueError` on initialization + +Set `block_on_violation: false` to continue processing even when violations are detected (monitor mode). + +## Support + +For more information about EnkryptAI: +- Documentation: [https://docs.enkryptai.com](https://docs.enkryptai.com) +- Website: [https://enkryptai.com](https://enkryptai.com) + diff --git a/docs/my-website/docs/proxy/health.md b/docs/my-website/docs/proxy/health.md index 7e627846b1d..c96753648b8 100644 --- a/docs/my-website/docs/proxy/health.md +++ b/docs/my-website/docs/proxy/health.md @@ -9,13 +9,32 @@ Use this to health check all LLMs defined in your config.yaml | `/health/readiness` | **Load balancer health checks** | Ready to accept traffic - includes DB connection status | | `/health` | **Model health monitoring** | Comprehensive LLM model health - makes actual API calls | | `/health/services` | **Service debugging** | Check specific integrations (datadog, langfuse, etc.) | +| `/health/shared-status` | **Multi-pod coordination** | Monitor shared health check state across pods | ## Summary The proxy exposes: * a /health endpoint which returns the health of the LLM APIs * a /health/readiness endpoint for returning if the proxy is ready to accept requests -* a /health/liveliness endpoint for returning if the proxy is alive +* a /health/liveliness endpoint for returning if the proxy is alive +* a /health/shared-status endpoint for monitoring shared health check coordination across pods + +## Shared Health Check State + +When running multiple LiteLLM proxy pods, you can enable shared health check state to coordinate health checks across pods and avoid duplicate API calls. This is especially beneficial for expensive models like Gemini 2.5-pro. + +**Key Benefits:** +- Reduces duplicate health checks across pods +- Saves costs on expensive model API calls +- Reduces monitoring noise and logging +- Improves resource efficiency + +**Requirements:** +- Redis for shared state coordination +- Background health checks enabled +- Multiple proxy pods + +For detailed configuration and usage, see [Shared Health Check State](./shared_health_check.md). ## `/health` #### Request diff --git a/docs/my-website/docs/proxy/model_management.md b/docs/my-website/docs/proxy/model_management.md index a8cc66ae765..6a87dda2f42 100644 --- a/docs/my-website/docs/proxy/model_management.md +++ b/docs/my-website/docs/proxy/model_management.md @@ -19,6 +19,10 @@ model_list: Retrieve detailed information about each model listed in the `/model/info` endpoint, including descriptions from the `config.yaml` file, and additional model info (e.g. max tokens, cost per input token, etc.) pulled from the model_info you set and the [litellm model cost map](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json). Sensitive details like API keys are excluded for security purposes. +:::tip Sync Model Data +Keep your model pricing data up to date by [syncing models from GitHub](../sync_models_github.md). +::: + Optional: If you observe gradual memory growth under sustained load, consider recycling workers after a fixed number of requests to mitigate leaks. Set this via CLI or environment variable: + +```shell +# CLI +CMD ["--port", "4000", "--config", "./proxy_server_config.yaml", "--max_requests_before_restart", "10000"] + +# or ENV (for deployment manifests / containers) +export MAX_REQUESTS_BEFORE_RESTART=10000 +``` + ## 4. Use Redis 'port','host', 'password'. NOT 'redis_url' diff --git a/docs/my-website/docs/proxy/prometheus.md b/docs/my-website/docs/proxy/prometheus.md index 8bbf737540d..f3c2f2e37d6 100644 --- a/docs/my-website/docs/proxy/prometheus.md +++ b/docs/my-website/docs/proxy/prometheus.md @@ -221,6 +221,8 @@ litellm_settings: 2. Make a request with the custom metadata labels + + ```bash curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \ -H 'Content-Type: application/json' \ @@ -244,6 +246,34 @@ curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \ } }' ``` + + + +```bash +curl -L -X POST 'http://0.0.0.0:4000/key/generate' \ +-H 'Authorization: Bearer sk-1234' \ +-H 'Content-Type: application/json' \ +-d '{ + "metadata": { + "foo": "hello world" + } +}' +``` + + + +```bash +curl -L -X POST 'http://0.0.0.0:4000/team/new' \ +-H 'Authorization: Bearer sk-1234' \ +-H 'Content-Type: application/json' \ +-d '{ + "metadata": { + "foo": "hello world" + } +}' +``` + + 3. Check your `/metrics` endpoint for the custom metrics diff --git a/docs/my-website/docs/proxy/security_encryption_faq.md b/docs/my-website/docs/proxy/security_encryption_faq.md new file mode 100644 index 00000000000..690f67d79a3 --- /dev/null +++ b/docs/my-website/docs/proxy/security_encryption_faq.md @@ -0,0 +1,354 @@ +# LiteLLM Self-Hosted Security & Encryption FAQ + +## Data in Transit Encryption + +### Does the product encrypt data in transit? + +**Yes**, LiteLLM encrypts data in transit using TLS/SSL. + +### Available in both OSS and Enterprise? + +**Yes**, TLS encryption is available in both Open Source and Enterprise versions. + +### In transit between the calling client and the product? + +**Yes**, HTTPS/TLS is supported through SSL certificate configuration. + +**Configuration:** +```bash +# CLI +litellm --ssl_keyfile_path /path/to/key.pem --ssl_certfile_path /path/to/cert.pem + +# Environment Variables +export SSL_KEYFILE_PATH="/path/to/key.pem" +export SSL_CERTFILE_PATH="/path/to/cert.pem" +``` + +**Documentation Reference:** `docs/my-website/docs/guides/security_settings.md` + +### In transit between the product and the LLM providers? + +**Yes**, all connections to LLM providers use TLS encryption by default. + +**Implementation Details:** +- Uses Python's `ssl.create_default_context()` +- Leverages HTTPX and aiohttp libraries with SSL/TLS enabled +- Uses certifi CA bundle by default for SSL verification + +**Code Reference:** `litellm/llms/custom_httpx/http_handler.py` (lines 43-105) + +### Are TCP sessions to the LLM providers shared? + +**Yes**, TCP connections are pooled and reused. + +**Details:** +- Connection pooling is enabled by default +- Default: 1000 max concurrent connections with keepalive +- Sessions are maintained across requests to the same provider +- Reduces overhead of TLS handshakes + +**Code Reference:** `litellm/llms/custom_httpx/http_handler.py` (lines 704-712) + +### Or does the product negotiate a new TLS session with the same LLM provider for every sequential call? + +**No**, TLS sessions are reused through connection pooling. New TLS handshakes are not performed for every request. + +### How is it encrypted? + +**TLS 1.2 and TLS 1.3** + +Uses Python's default SSL context which supports both TLS 1.2 and TLS 1.3. The specific version negotiated depends on: +- Python version +- System SSL library (typically OpenSSL) +- Server capabilities + +**Implementation:** `ssl.create_default_context()` in Python + +### How are these added to the product's configuration? + +#### x.509 Certificate + +**Method 1: CLI Arguments** +```bash +litellm --ssl_certfile_path /path/to/certificate.pem +``` + +**Method 2: Environment Variable** +```bash +export SSL_CERTFILE_PATH="/path/to/certificate.pem" +``` + +#### Private Key + +**Method 1: CLI Arguments** +```bash +litellm --ssl_keyfile_path /path/to/private_key.pem +``` + +**Method 2: Environment Variable** +```bash +export SSL_KEYFILE_PATH="/path/to/private_key.pem" +``` + +#### Certificate Bundle/Chain + +**For client-to-proxy connections:** +Use standard SSL certificate setup with intermediate certificates bundled in the certfile. + +**For proxy-to-LLM provider connections:** + +**Method 1: Config YAML** +```yaml +litellm_settings: + ssl_verify: "/path/to/ca_bundle.pem" +``` + +**Method 2: Environment Variable** +```bash +export SSL_CERT_FILE="/path/to/ca_bundle.pem" +``` + +**Method 3: Client Certificate Authentication** +```yaml +litellm_settings: + ssl_certificate: "/path/to/client_certificate.pem" +``` + +or + +```bash +export SSL_CERTIFICATE="/path/to/client_certificate.pem" +``` + +### Documentation Coverage + +**Primary Documentation:** +- `docs/my-website/docs/guides/security_settings.md` - SSL/TLS configuration guide + +**Additional References:** +- `litellm/proxy/proxy_cli.py` (lines 455-467) - CLI options +- `docs/my-website/docs/completion/http_handler_config.md` - Custom HTTP handler configuration + +--- + +## Data at Rest Encryption + +### Does the product encrypt data at rest? + +**Partially**. Only specific sensitive data is encrypted at rest. + +### What data is stored in encrypted form? + +#### Encrypted Data: +1. **LLM API Keys** - Model credentials in `LiteLLM_ProxyModelTable.litellm_params` +2. **Provider Credentials** - Stored in `LiteLLM_CredentialsTable.credential_values` +3. **Configuration Secrets** - Sensitive config values in `LiteLLM_Config` table +4. **Virtual Keys** - When using secret managers (optional feature) + +#### NOT Encrypted: +1. **Spend Logs** - Request/response data in `LiteLLM_SpendLogs` +2. **Audit Logs** - Change history in `LiteLLM_AuditLog` +3. **User/Team/Organization Data** - Metadata and configuration +4. **Cached Prompts and Completions** - Cache data is stored in plaintext + +### Cached prompts and completions? + +**No**, cached prompts and completions are **NOT encrypted**. + +Cache backends (Redis, S3, local disk) store data as plaintext JSON. + +**Code References:** +- `litellm/caching/redis_cache.py` +- `litellm/caching/s3_cache.py` +- `litellm/caching/caching.py` + +### Configuration data? + +**Partially encrypted**. + +#### What IS Encrypted: +- LLM API keys and credentials in model configurations +- Sensitive values in `LiteLLM_Config` table +- Credential values in `LiteLLM_CredentialsTable` + +#### What is NOT Encrypted: +- Model names and aliases +- Rate limits and budget settings +- User/team/organization metadata +- Non-sensitive configuration parameters + +**Code Reference:** `litellm/proxy/management_endpoints/model_management_endpoints.py` (lines 275-308) + +### Log data? + +**No**, log data is **NOT encrypted**. + +Log data stored in database tables is in plaintext: +- `LiteLLM_SpendLogs` - Contains request/response data, tokens, spend +- `LiteLLM_ErrorLogs` - Error information +- `LiteLLM_AuditLog` - Audit trail of changes + +**Note:** You can disable logging to avoid storing sensitive data: + +```yaml +general_settings: + disable_spend_logs: True # Disable writing spend logs to DB + disable_error_logs: True # Disable writing error logs to DB +``` + +**Documentation:** `docs/my-website/docs/proxy/db_info.md` (lines 52-60) + +### Where is it stored? + +#### In the DB? + +**Yes**, encrypted data is stored in PostgreSQL database. + +**Key Tables with Encrypted Data:** +- `LiteLLM_ProxyModelTable` - Model configurations with encrypted API keys +- `LiteLLM_CredentialsTable` - Credential values +- `LiteLLM_Config` - Configuration secrets + +**Schema Reference:** `schema.prisma` + +#### In the filesystem? + +**No**, encrypted data is not stored in the filesystem by default. + +**Note:** If using disk cache (`disk_cache_dir`), cached data is stored unencrypted. + +#### Somewhere else? + +**Optional:** When using secret managers (AWS Secrets Manager, Azure Key Vault, HashiCorp Vault), encrypted data can be stored externally. + +**Configuration:** +```yaml +general_settings: + key_management_system: "aws_secret_manager" # or "azure_key_vault", "hashicorp_vault" +``` + +**Documentation:** `docs/my-website/docs/secret.md` + +### How is it encrypted? + +**Algorithm:** NaCl SecretBox (XSalsa20-Poly1305 AEAD) + +**NOT AES-256** - LiteLLM uses NaCl (Networking and Cryptography Library) which provides: +- XSalsa20 stream cipher +- Poly1305 MAC for authentication +- Equivalent security to AES-256 + +**Key Derivation:** +1. Takes `LITELLM_SALT_KEY` (or `LITELLM_MASTER_KEY` if salt key not set) +2. Hashes with SHA-256 to derive 256-bit encryption key +3. Uses NaCl SecretBox for authenticated encryption + +**Code Reference:** `litellm/proxy/common_utils/encrypt_decrypt_utils.py` (lines 69-112) + +**Implementation:** +```python +import hashlib +import nacl.secret + +# Derive 256-bit key from salt +hash_object = hashlib.sha256(signing_key.encode()) +hash_bytes = hash_object.digest() + +# Create SecretBox and encrypt +box = nacl.secret.SecretBox(hash_bytes) +encrypted = box.encrypt(value_bytes) +``` + +### Setting the Encryption Key + +**Required Environment Variable:** +```bash +export LITELLM_SALT_KEY="your-strong-random-key-here" +``` + +**Important Notes:** +- ⚠️ **Must be set before adding any models** +- ⚠️ **Never change this key** - encrypted data becomes unrecoverable +- ⚠️ Use a strong random key (recommended: https://1password.com/password-generator/) +- If not set, falls back to `LITELLM_MASTER_KEY` + +**Documentation:** `docs/my-website/docs/proxy/prod.md` (section 8, lines 184-196) + +### Documentation Coverage + +**Primary Documentation:** +- `docs/my-website/docs/proxy/prod.md` (section 8) - LITELLM_SALT_KEY setup +- `docs/my-website/docs/secret.md` - Secret management systems +- `docs/my-website/docs/proxy/db_info.md` - Database information + +**Additional References:** +- `security.md` - General security measures +- `docs/my-website/docs/data_security.md` - Data privacy overview +- `schema.prisma` - Database schema with encrypted fields + +--- + +## Summary of Security Features + +### ✅ Provided Out of the Box + +1. **TLS/SSL encryption** for client-to-proxy connections +2. **TLS encryption** for proxy-to-LLM provider connections (with connection pooling) +3. **Encrypted storage** of LLM API keys and credentials +4. **Support for TLS 1.2 and TLS 1.3** +5. **Connection pooling** to reduce TLS handshake overhead + +### ⚠️ Important Limitations + +1. **Cached data is NOT encrypted** (Redis, S3, disk cache) +2. **Log data is NOT encrypted** (spend logs, audit logs) +3. **Request/response payloads in logs are NOT encrypted** +4. **Uses NaCl SecretBox, NOT AES-256** (equivalent security) +5. **TLS version not explicitly configured** - uses Python/system defaults + +### 🔧 Configuration Requirements + +**For Production Deployments:** + +1. **Set LITELLM_SALT_KEY** before adding any models +2. **Configure SSL certificates** for HTTPS client connections +3. **Consider disabling logs** if they contain sensitive data +4. **Use secret managers** for enhanced security (optional) +5. **Configure CA bundles** if using custom certificates + +--- + +## Quick Start Security Checklist + +```bash +# 1. Generate a strong salt key +export LITELLM_SALT_KEY="$(openssl rand -base64 32)" + +# 2. Set up SSL certificates (for HTTPS) +export SSL_KEYFILE_PATH="/path/to/private_key.pem" +export SSL_CERTFILE_PATH="/path/to/certificate.pem" + +# 3. Configure database +export DATABASE_URL="postgresql://user:password@host:port/dbname" + +# 4. (Optional) Disable logs if they contain sensitive data +# Add to config.yaml: +# general_settings: +# disable_spend_logs: True +# disable_error_logs: True + +# 5. Start LiteLLM Proxy +litellm --config config.yaml +``` + +--- + +## Additional Resources + +- **LiteLLM Documentation:** https://docs.litellm.ai/ +- **Security Settings Guide:** https://docs.litellm.ai/docs/guides/security_settings +- **Production Deployment:** https://docs.litellm.ai/docs/proxy/prod +- **Secret Management:** https://docs.litellm.ai/docs/secret + +For security inquiries: support@berri.ai + diff --git a/docs/my-website/docs/proxy/shared_health_check.md b/docs/my-website/docs/proxy/shared_health_check.md new file mode 100644 index 00000000000..d4b70116309 --- /dev/null +++ b/docs/my-website/docs/proxy/shared_health_check.md @@ -0,0 +1,310 @@ +# Shared Health Check State Across Pods + +This feature enables coordination of health checks across multiple LiteLLM proxy pods to avoid duplicate health checks and reduce costs. + +## Overview + +When running multiple LiteLLM proxy pods (e.g., in Kubernetes), each pod typically runs its own independent health checks on every model. This can result in: + +- **Duplicate health checks** across pods +- **Increased costs** for expensive models (e.g., Gemini 2.5-pro) +- **Redundant monitoring/logging noise** +- **Inefficient resource usage** + +The shared health check state feature solves this by: + +- **Coordinating health checks** across pods using Redis +- **Caching results** with configurable TTL +- **Using distributed locks** to ensure only one pod runs health checks at a time +- **Allowing other pods** to read cached results instead of running redundant checks + +## How It Works + +### 1. Lock Acquisition +When a pod needs to run health checks: +- It attempts to acquire a Redis lock +- If successful, it runs the health checks +- If failed, it waits briefly and checks for cached results + +### 2. Result Caching +After running health checks: +- Results are cached in Redis with a configurable TTL +- Other pods can read these cached results +- Cache includes timestamp and pod ID for tracking + +### 3. Fallback Behavior +If Redis is unavailable or cache is expired: +- Pods fall back to running health checks locally +- System continues to function normally + +## Configuration + +### Enable Shared Health Check + +Add to your `proxy_config.yaml`: + +```yaml +general_settings: + # Enable background health checks (required) + background_health_checks: true + + # Enable shared health check state across pods + use_shared_health_check: true + + # Health check interval (seconds) + health_check_interval: 300 # 5 minutes + +# Redis configuration (required for shared health check) +litellm_settings: + cache: true + cache_params: + type: redis + host: your-redis-host + port: 6379 + password: your-redis-password +``` + +### Environment Variables + +You can also configure using environment variables: + +```bash +# Enable shared health check +export USE_SHARED_HEALTH_CHECK=true + +# Health check TTL (seconds) +export DEFAULT_SHARED_HEALTH_CHECK_TTL=300 + +# Lock TTL (seconds) +export DEFAULT_SHARED_HEALTH_CHECK_LOCK_TTL=60 +``` + +## Requirements + +- **Redis**: Required for shared state coordination +- **Background Health Checks**: Must be enabled (`background_health_checks: true`) +- **Multiple Pods**: Most beneficial with 2+ proxy instances + +## API Endpoints + +### Check Shared Health Check Status + +```bash +GET /health/shared-status +``` + +Returns information about the shared health check coordination: + +```json +{ + "shared_health_check_enabled": true, + "status": { + "pod_id": "pod_1703123456789", + "redis_available": true, + "lock_ttl": 60, + "cache_ttl": 300, + "lock_owner": "pod_1703123456788", + "lock_in_progress": true, + "cache_available": true, + "cache_age_seconds": 45.2, + "last_checked_by": "pod_1703123456788" + } +} +``` + +## Monitoring + +### Health Check Status + +Monitor the shared health check status to ensure proper coordination: + +```bash +curl -H "Authorization: Bearer your-api-key" \ + http://your-proxy-host/health/shared-status +``` + +### Logs + +Look for these log messages: + +``` +INFO: Initialized shared health check manager +INFO: Pod pod_123 acquired health check lock +INFO: Pod pod_123 released health check lock +INFO: Cached health check results for 5 healthy and 0 unhealthy endpoints +DEBUG: Using cached health check results +``` + +## Troubleshooting + +### Common Issues + +#### 1. Shared Health Check Not Working + +**Symptoms**: Each pod still runs independent health checks + +**Solutions**: +- Verify Redis is configured and accessible +- Check that `use_shared_health_check: true` is set +- Ensure `background_health_checks: true` is enabled +- Check Redis connectivity in logs + +#### 2. Redis Connection Issues + +**Symptoms**: Health checks fall back to local execution + +**Solutions**: +- Verify Redis host, port, and credentials +- Check network connectivity between pods and Redis +- Monitor Redis server logs for errors + +#### 3. Lock Not Released + +**Symptoms**: One pod holds the lock indefinitely + +**Solutions**: +- Lock has automatic TTL (default 60 seconds) +- Check pod logs for lock release messages +- Verify Redis TTL settings + +### Debug Mode + +Enable debug logging to see detailed coordination: + +```yaml +general_settings: + set_verbose: true +``` + +## Performance Impact + +### Benefits + +- **Reduced API calls**: Only one pod runs health checks per interval +- **Lower costs**: Especially significant for expensive models +- **Better resource utilization**: Less redundant work across pods +- **Cleaner monitoring**: Reduced noise in logs and metrics + +### Overhead + +- **Redis operations**: Minimal overhead for lock/cache operations +- **Network latency**: Small delay for Redis communication +- **Memory usage**: Negligible additional memory usage + +## Best Practices + +### 1. Redis Configuration + +- Use Redis with persistence enabled +- Configure appropriate memory limits +- Set up Redis monitoring and alerts + +### 2. TTL Settings + +- Set `health_check_interval` to your desired check frequency +- Use default TTL values unless you have specific requirements +- Consider model-specific timeouts for expensive models + +### 3. Monitoring + +- Monitor shared health check status endpoint +- Set up alerts for Redis connectivity issues +- Track health check costs and frequency + +### 4. Scaling + +- Feature works with any number of pods +- More pods = better coordination benefits +- Consider Redis cluster for high availability + +## Example Configuration + +### Complete Example + +```yaml +# proxy_config.yaml +model_list: + - model_name: gpt-4 + litellm_params: + model: gpt-4 + api_key: os.environ/OPENAI_API_KEY + model_info: + health_check_timeout: 30 # 30 second timeout for health checks + +general_settings: + # Enable background health checks + background_health_checks: true + + # Enable shared health check coordination + use_shared_health_check: true + + # Health check interval (5 minutes) + health_check_interval: 300 + + # Health check details + health_check_details: true + +litellm_settings: + # Redis configuration + cache: true + cache_params: + type: redis + host: redis-cluster.example.com + port: 6379 + password: os.environ/REDIS_PASSWORD + ssl: true +``` + +### Kubernetes Example + +```yaml +# deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: litellm-proxy +spec: + replicas: 3 # Multiple pods for coordination + template: + spec: + containers: + - name: litellm-proxy + image: ghcr.io/berriai/litellm:latest + env: + - name: USE_SHARED_HEALTH_CHECK + value: "true" + - name: REDIS_HOST + value: "redis-service" + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: redis-secret + key: password +``` + +## Migration + +### From Independent Health Checks + +1. **Enable Redis**: Ensure Redis is configured and accessible +2. **Enable Background Health Checks**: Set `background_health_checks: true` +3. **Enable Shared Health Check**: Set `use_shared_health_check: true` +4. **Deploy**: Update your proxy configuration +5. **Monitor**: Check `/health/shared-status` endpoint + +### Rollback + +To disable shared health check: + +```yaml +general_settings: + use_shared_health_check: false + # background_health_checks can remain true for independent checks +``` + +## Related Features + +- [Background Health Checks](./health.md#background-health-checks) +- [Redis Caching](./caching.md) +- [High Availability Setup](./db_deadlocks.md) +- [Health Check Endpoints](./health.md#health-endpoints) diff --git a/docs/my-website/docs/proxy/sync_models_github.md b/docs/my-website/docs/proxy/sync_models_github.md new file mode 100644 index 00000000000..d2f410e5496 --- /dev/null +++ b/docs/my-website/docs/proxy/sync_models_github.md @@ -0,0 +1,61 @@ +# Syncing Models to GitHub model_context_window + +Sync model pricing data from GitHub's `model_prices_and_context_window.json` file outside of the LiteLLM UI. + +> **📹 Video Tutorial**: [Watch how to sync models via the Admin UI](https://www.loom.com/share/ba41acc1882d41b284bbddbb0e9c27ce?sid=bdae351e-2026-4e39-932b-fcb185ff612c) + +## Quick Start + +**Manual sync:** +```bash +curl -X POST "https://your-proxy-url/reload/model_cost_map" \ + -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \ + -H "Content-Type: application/json" +``` + +**Automatic sync every 6 hours:** +```bash +curl -X POST "https://your-proxy-url/schedule/model_cost_map_reload?hours=6" \ + -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \ + -H "Content-Type: application/json" +``` + +## API Endpoints + +| Endpoint | Method | Description | +|----------|--------|-------------| +| `/reload/model_cost_map` | POST | Manual sync | +| `/schedule/model_cost_map_reload?hours={hours}` | POST | Schedule periodic sync | +| `/schedule/model_cost_map_reload` | DELETE | Cancel scheduled sync | +| `/schedule/model_cost_map_reload/status` | GET | Check sync status | + +**Authentication:** Requires admin role or master key + +## Python Example + +```python +import requests + +def sync_models(proxy_url, admin_token): + response = requests.post( + f"{proxy_url}/reload/model_cost_map", + headers={"Authorization": f"Bearer {admin_token}"} + ) + return response.json() + +# Usage +result = sync_models("https://your-proxy-url", "your-admin-token") +print(result['message']) +``` + +## Configuration + +**Custom model cost map URL:** +```bash +export LITELLM_MODEL_COST_MAP_URL="https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json" +``` + +**Use local model cost map:** +```bash +export LITELLM_LOCAL_MODEL_COST_MAP=True +``` \ No newline at end of file diff --git a/docs/my-website/docs/proxy/tag_budgets.md b/docs/my-website/docs/proxy/tag_budgets.md new file mode 100644 index 00000000000..01b82ff8d26 --- /dev/null +++ b/docs/my-website/docs/proxy/tag_budgets.md @@ -0,0 +1,277 @@ +import Image from '@theme/IdealImage'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Setting Tag Budgets + +Track spend and set budgets for your API requests using tags. Tags allow you to categorize and monitor costs across different cost centers, projects, and departments. + +## Pre-Requisites + +- You must set up a Postgres database (e.g. Supabase, Neon, etc.) + +## What are Tags? + +Tags are labels you can attach to your LLM requests to track and limit spending by category. + +**Common Use Cases:** +- **Cost Center Tracking**: Allocate LLM costs to specific departments or business units (e.g., "engineering", "marketing", "customer-support") +- **Project-based Budgeting**: Set budgets for different projects or initiatives (e.g., "project-alpha", "chatbot-v2") +- **Customer Attribution**: Track spend per customer or client (e.g., "customer-acme", "customer-techcorp") +- **Feature Monitoring**: Monitor costs for specific features (e.g., "feature-chat", "feature-summarization") + +Tags are added to each request in the `metadata` field to track and enforce budget limits. + +## Setting Tag Budgets + +### 1. Create a tag with budget + +Create a tag to represent a cost center, project, or any budget category. Set `max_budget` ($ value allowed) and `budget_duration` (how frequently the budget resets). + +**Example:** Create a tag for your Engineering department with a monthly $500 budget + +#### API + +Create a new tag and set `max_budget` and `budget_duration` + +```shell +curl -X POST 'http://0.0.0.0:4000/tag/new' \ + -H 'Authorization: Bearer sk-1234' \ + -H 'Content-Type: application/json' \ + -d '{ + "name": "engineering", + "description": "Engineering department cost center", + "max_budget": 500.0, + "budget_duration": "30d" + }' +``` + +**Request Body Parameters:** + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `name` | string | Yes | Unique name for the tag (e.g., cost center name) | +| `description` | string | No | Description of what this tag tracks | +| `models` | list[string] | No | Restrict tag to specific models | +| `max_budget` | float | No | Maximum budget in USD | +| `budget_duration` | string | No | How often budget resets (e.g., "30d", "1d") | +| `soft_budget` | float | No | Soft budget limit for warnings | + +**Response:** + +```json +{ + "name": "engineering", + "description": "Engineering department cost center", + "max_budget": 500.0, + "budget_duration": "30d", + "budget_reset_at": "2025-11-10T00:00:00Z", + "created_at": "2025-10-11T00:00:00Z" +} +``` + +#### LiteLLM Admin UI + +Navigate to the **Tag Management** page and click **Create New Tag**. Fill in the tag details and set your budget: + + + +
+ + +**Possible values for `budget_duration`:** + +| `budget_duration` | When Budget will reset | +| --- | --- | +| `budget_duration="1s"` | every 1 second | +| `budget_duration="1m"` | every 1 minute | +| `budget_duration="1h"` | every 1 hour | +| `budget_duration="1d"` | every 1 day | +| `budget_duration="7d"` | every 1 week | +| `budget_duration="30d"` | every 1 month | + +### 2. Use the tag in your requests + +Add tags to your API requests in the `metadata` field: + +:::info Tags Budgets on API Keys + +Currently, tag budget enforcement is only supported per request. If you'd like to set tags on API keys so all requests automatically inherit the tags budgets, please [create a feature request on GitHub](https://github.com/BerriAI/litellm/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml&title=%5BFeat%5D%3A). + +::: + + + + + +```python +import openai + +client = openai.OpenAI( + api_key="sk-1234", # Your LiteLLM proxy key + base_url="http://0.0.0.0:4000" +) + +response = client.chat.completions.create( + model="gpt-4", + messages=[{"role": "user", "content": "Hello"}], + extra_body={ + "metadata": { + "tags": ["engineering"] + } + } +) +``` + + + + + +```shell +curl -X POST 'http://0.0.0.0:4000/chat/completions' \ + -H 'Authorization: Bearer sk-1234' \ + -H 'Content-Type: application/json' \ + -d '{ + "model": "gpt-4", + "messages": [{"role": "user", "content": "Hello"}], + "metadata": { + "tags": ["engineering"] + } + }' +``` + + + + + +### 3. Test It + +Make requests until the budget is exceeded: + +```shell +curl -X POST 'http://0.0.0.0:4000/chat/completions' \ + -H 'Authorization: Bearer sk-1234' \ + -H 'Content-Type: application/json' \ + -d '{ + "model": "gpt-4", + "messages": [{"role": "user", "content": "Hello"}], + "metadata": { + "tags": ["engineering"] + } + }' +``` + +**When budget is exceeded, you'll see:** + +```json +{ + "error": { + "message": "Budget has been exceeded! Tag=engineering Current cost: 505.50, Max budget: 500.0", + "type": "budget_exceeded", + "param": null, + "code": "400" + } +} +``` + +## Managing Tags + +### View Tag Information + +Get information about specific tags: + +```shell +curl -X POST 'http://0.0.0.0:4000/tag/info' \ + -H 'Authorization: Bearer sk-1234' \ + -H 'Content-Type: application/json' \ + -d '{ + "names": ["engineering", "marketing"] + }' +``` + +**Response:** + +```json +{ + "engineering": { + "name": "engineering", + "description": "Engineering department cost center", + "spend": 245.50, + "max_budget": 500.0, + "budget_duration": "30d", + "budget_reset_at": "2025-11-10T00:00:00Z", + "created_at": "2025-10-11T00:00:00Z", + "updated_at": "2025-10-11T12:30:00Z" + }, + "marketing": { + "name": "marketing", + "description": "Marketing department cost center", + "spend": 89.20, + "max_budget": 300.0, + "budget_duration": "30d", + "budget_reset_at": "2025-11-10T00:00:00Z", + "created_at": "2025-10-11T00:00:00Z", + "updated_at": "2025-10-11T12:30:00Z" + } +} +``` + +### Update Tag Budget + +Update an existing tag's budget: + +```shell +curl -X POST 'http://0.0.0.0:4000/tag/update' \ + -H 'Authorization: Bearer sk-1234' \ + -H 'Content-Type: application/json' \ + -d '{ + "name": "engineering", + "max_budget": 750.0, + "budget_duration": "30d" + }' +``` + +### Delete Tag + +```shell +curl -X POST 'http://0.0.0.0:4000/tag/delete' \ + -H 'Authorization: Bearer sk-1234' \ + -H 'Content-Type: application/json' \ + -d '{ + "name": "engineering" + }' +``` + +## Multiple Tags per Request + +You can apply multiple tags to a single request to track costs across different dimensions simultaneously. For example, track both the cost center and the specific project: + +```python +response = client.chat.completions.create( + model="gpt-4", + messages=[{"role": "user", "content": "Hello"}], + extra_body={ + "metadata": { + "tags": ["engineering", "project-alpha", "customer-acme"] + } + } +) +``` + +```shell +curl -X POST 'http://0.0.0.0:4000/chat/completions' \ + -H 'Authorization: Bearer sk-1234' \ + -H 'Content-Type: application/json' \ + -d '{ + "model": "gpt-4", + "messages": [{"role": "user", "content": "Hello"}], + "metadata": { + "tags": ["engineering", "project-alpha", "customer-acme"] + } + }' +``` + +**Budget Enforcement:** If any tag exceeds its budget, the request will be rejected. diff --git a/docs/my-website/docs/proxy/ui.md b/docs/my-website/docs/proxy/ui.md index a093b226a27..f7419d20740 100644 --- a/docs/my-website/docs/proxy/ui.md +++ b/docs/my-website/docs/proxy/ui.md @@ -54,6 +54,20 @@ Allow others to create/delete their own keys. [**Go Here**](./self_serve.md) +## Model Management + +The Admin UI provides comprehensive model management capabilities: + +- **Add Models**: Add new models through the UI without restarting the proxy +- **Model Hub**: Make models public for developers to discover available models +- **Price Data Sync**: Keep model pricing data up to date by syncing from GitHub + +For detailed information on model management, see [Model Management](./model_management.md). + +:::tip Sync Model Pricing Data +[Sync model pricing data from GitHub](./sync_models_github.md) to keep your model cost information current. +::: + ## Disable Admin UI Set `DISABLE_ADMIN_UI="True"` in your environment to disable the Admin UI. diff --git a/docs/my-website/docs/proxy/virtual_keys.md b/docs/my-website/docs/proxy/virtual_keys.md index 68cbe91b0f6..38ff4ede280 100644 --- a/docs/my-website/docs/proxy/virtual_keys.md +++ b/docs/my-website/docs/proxy/virtual_keys.md @@ -1,5 +1,6 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import Image from '@theme/IdealImage'; # Virtual Keys Track Spend, and control model access via virtual keys for the proxy @@ -66,50 +67,6 @@ curl 'http://0.0.0.0:4000/key/generate' \ --data-raw '{"models": ["gpt-3.5-turbo", "gpt-4"], "metadata": {"user": "ishaan@berri.ai"}}' ``` -## 🔁 Scheduled Key Rotations (NEW in v1.77.5) - -LiteLLM can now rotate **virtual keys automatically** on a schedule you define. - -### How it works -1. When creating a virtual key you set `rotation_schedule` – a [cron expression](https://crontab.guru/). -2. LiteLLM stores the schedule in the DB and runs a background job that regenerates the key at the specified time. -3. Existing key string is invalidated; a **notification webhook** (if configured) is sent with the new key value. - -### Create a key with rotation - -```bash -curl 'http://0.0.0.0:4000/key/generate' \ - -H 'Authorization: Bearer ' \ - -H 'Content-Type: application/json' \ - -d '{ - "models": ["gpt-4o"], - "rotation_schedule": "0 0 * * SUN", # rotate every Sunday at 00:00 UTC - "webhook_url": "https://example.com/key-rotated" - }' -``` - -### Enable globally via env - -Set these env vars when starting the proxy: - -| Variable | Description | Default | -|----------|-------------|---------| -| `LITELLM_KEY_ROTATION_ENABLED` | Enable the rotation worker | `false` | -| `LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS` | How often to scan for keys to rotate | `86400` | - -### Webhook payload - -```json -{ - "event": "virtual_key.rotated", - "old_key_id": "sk-abc...", - "new_key": "sk-def...", - "rotation_time": "2025-10-05T00:00:00Z" -} -``` - -If no `webhook_url` is provided the new key value is returned in the response of the `/key/rotate` REST call instead. - ## Spend Tracking Get spend per: @@ -604,6 +561,94 @@ curl 'http://localhost:4000/key/sk-1234/regenerate' \ [**👉 API REFERENCE DOCS**](https://litellm-api.up.railway.app/#/key%20management/regenerate_key_fn_key__key__regenerate_post) +### Scheduled Key Rotations + +LiteLLM can rotate **virtual keys automatically** based on time intervals you define. + +#### Prerequisites + +1. **Database connection required** - Key rotation requires a connected database to track rotation schedules +2. **Enable the rotation worker** - Set environment variable `LITELLM_KEY_ROTATION_ENABLED=true` +3. **Configure check interval** - Optionally set `LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS` (default: 86400 seconds / 24 hours) + +#### How it works + +1. When creating a virtual key, set `auto_rotate: true` and `rotation_interval` (duration string) +2. LiteLLM calculates the next rotation time as `now + rotation_interval` and stores it in the database +3. A background job periodically checks for keys where the rotation time has passed +4. When a key is due for rotation, LiteLLM automatically regenerates it and invalidates the old key string +5. The new rotation time is calculated and the cycle continues + +#### Create a key with auto rotation + +**API** +```bash +curl 'http://0.0.0.0:4000/key/generate' \ + -H 'Authorization: Bearer ' \ + -H 'Content-Type: application/json' \ + -d '{ + "models": ["gpt-4o"], + "auto_rotate": true, + "rotation_interval": "30d" + }' +``` + +**LiteLLM UI** + +On the LiteLLM UI, Navigate to the Keys page and click on `Generate Key` > `Key Lifecycle` > `Enable Auto Rotation` + + +**Valid rotation_interval formats:** +- `"30s"` - 30 seconds +- `"30m"` - 30 minutes +- `"30h"` - 30 hours +- `"30d"` - 30 days +- `"90d"` - 90 days + +#### Update existing key to enable rotation + +**API** + +```bash +curl 'http://0.0.0.0:4000/key/update' \ + -H 'Authorization: Bearer ' \ + -H 'Content-Type: application/json' \ + -d '{ + "key": "sk-existing-key", + "auto_rotate": true, + "rotation_interval": "90d" + }' +``` + +**LiteLLM UI** + +On the LiteLLM UI, Navigate to the Keys page. Select the key you want to update and click on `Edit Settings` > `Auto-Rotation Settings` + + + +#### Environment variables + +Set these environment variables when starting the proxy: + +| Variable | Description | Default | +|----------|-------------|---------| +| `LITELLM_KEY_ROTATION_ENABLED` | Enable the rotation worker | `false` | +| `LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS` | How often to scan for keys to rotate (in seconds) | `86400` (24 hours) | + +**Example:** +```bash +export LITELLM_KEY_ROTATION_ENABLED=true +export LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS=3600 # Check every hour + +litellm --config config.yaml +``` + ### Temporary Budget Increase Use the `/key/update` endpoint to increase the budget of an existing key. diff --git a/docs/my-website/docs/response_api.md b/docs/my-website/docs/response_api.md index 8bb10bbe36a..80bd2ba6f7b 100644 --- a/docs/my-website/docs/response_api.md +++ b/docs/my-website/docs/response_api.md @@ -14,6 +14,7 @@ Requests to /chat/completions may be bridged here automatically when the provide | Logging | ✅ | Works across all integrations | | End-user Tracking | ✅ | | | Streaming | ✅ | | +| Image Generation Streaming | ✅ | Progressive image generation with partial images (1-3) | | Fallbacks | ✅ | Works between supported models | | Loadbalancing | ✅ | Works between supported models | | Supported operations | Create a response, Get a response, Delete a response | | @@ -56,6 +57,29 @@ for event in response: print(event) ``` +#### Image Generation with Streaming +```python showLineNumbers title="OpenAI Streaming Image Generation" +import litellm +import base64 + +# Streaming image generation with partial images +stream = litellm.responses( + model="gpt-4.1", # Use an actual image generation model + input="Generate a gorgeous image of a river made of white owl feathers", + stream=True, + tools=[{"type": "image_generation", "partial_images": 2}], + +) + +for event in stream: + if event.type == "response.image_generation_call.partial_image": + idx = event.partial_image_index + image_base64 = event.partial_image_b64 + image_bytes = base64.b64decode(image_base64) + with open(f"river{idx}.png", "wb") as f: + f.write(image_bytes) +``` + #### GET a Response ```python showLineNumbers title="Get Response by ID" import litellm @@ -380,6 +404,32 @@ for event in response: print(event) ``` +#### Image Generation with Streaming +```python showLineNumbers title="OpenAI Proxy Streaming Image Generation" +from openai import OpenAI +import base64 + +client = OpenAI(api_key="sk-1234", base_url="http://localhost:4000") + +stream = client.responses.create( + model="gpt-4.1", + input="Draw a gorgeous image of a river made of white owl feathers, snaking its way through a serene winter landscape", + stream=True, + tools=[{"type": "image_generation", "partial_images": 2}], +) + + +for event in stream: + print(f"event: {event}") + if event.type == "response.image_generation_call.partial_image": + idx = event.partial_image_index + image_base64 = event.partial_image_b64 + image_bytes = base64.b64decode(image_base64) + with open(f"river{idx}.png", "wb") as f: + f.write(image_bytes) + +``` + #### GET a Response ```python showLineNumbers title="Get Response by ID with OpenAI SDK" from openai import OpenAI diff --git a/docs/my-website/docs/tutorials/claude_responses_api.md b/docs/my-website/docs/tutorials/claude_responses_api.md index 5000161a520..87d019f11b9 100644 --- a/docs/my-website/docs/tutorials/claude_responses_api.md +++ b/docs/my-website/docs/tutorials/claude_responses_api.md @@ -105,7 +105,7 @@ LITELLM_MASTER_KEY gives claude access to all proxy models, whereas a virtual ke Alternatively, use the Anthropic pass-through endpoint: ```bash -export ANTHROPIC_BASE_URL="http://0.0.0.0:4000/anthropic" +export ANTHROPIC_BASE_URL="http://0.0.0.0:4000" export ANTHROPIC_AUTH_TOKEN="$LITELLM_MASTER_KEY" ``` @@ -209,4 +209,81 @@ claude --model claude-bedrock
- \ No newline at end of file + + + +## Connecting MCP Servers + +You can also connect MCP servers to Claude Code via LiteLLM Proxy. + +:::note + +Limitations: + +- Currently, only HTTP MCP servers are supported +- Does not work in Cursor IDE yet. + +::: + +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 + authorization_url: https://github.com/login/oauth/authorize + token_url: https://github.com/login/oauth/access_token + client_id: os.environ/GITHUB_OAUTH_CLIENT_ID + client_secret: os.environ/GITHUB_OAUTH_CLIENT_SECRET + scopes: ["public_repo", "user:email"] +``` + +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" +``` + +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/msft_sso.md b/docs/my-website/docs/tutorials/msft_sso.md index f7ad6440f2e..2936f27297f 100644 --- a/docs/my-website/docs/tutorials/msft_sso.md +++ b/docs/my-website/docs/tutorials/msft_sso.md @@ -140,6 +140,54 @@ litellm_settings: +## 4. Using Entra ID App Roles for User Permissions + +You can assign user roles directly from Entra ID using App Roles. LiteLLM will automatically read the app roles from the JWT token during SSO sign-in and assign the corresponding role to the user. + +### 4.1 Supported Roles + +LiteLLM supports the following app roles (case-insensitive): + +- `proxy_admin` - Admin over the entire LiteLLM platform +- `proxy_admin_viewer` - Read-only admin access (can view all keys and spend) +- `org_admin` - Admin over a specific organization (can create teams and users within their org) +- `internal_user` - Standard user (can create/view/delete their own keys and view their own spend) + +### 4.2 Create App Roles in Entra ID + +1. Navigate to your App Registration on https://portal.azure.com/ +2. Go to **App roles** > **Create app role** + +3. Configure the app role: + - **Display name**: Proxy Admin (or your preferred display name) + - **Value**: `proxy_admin` (use one of the supported role values above) + - **Description**: Administrator access to LiteLLM proxy + - **Allowed member types**: Users/Groups + + +4. Click **Apply** to save the role + +### 4.3 Assign Users to App Roles + +1. Navigate to **Enterprise Applications** on https://portal.azure.com/ +2. Select your LiteLLM application +3. Go to **Users and groups** > **Add user/group** +4. Select the user and assign them to one of the app roles you created + + +### 4.4 Test the Role Assignment + +1. Sign in to LiteLLM UI via SSO as a user with an assigned app role +2. LiteLLM will automatically extract the app role from the JWT token +3. The user will be assigned the corresponding LiteLLM role in the database +4. The user's permissions will reflect their assigned role + +**How it works:** +- When a user signs in via Microsoft SSO, LiteLLM extracts the `roles` claim from the JWT `id_token` +- If any of the roles match a valid LiteLLM role (case-insensitive), that role is assigned to the user +- If multiple roles are present, LiteLLM uses the first valid role it finds +- This role assignment persists in the LiteLLM database and determines the user's access level + ## Video Walkthrough This walks through setting up sso auto-add for **Microsoft Entra ID** diff --git a/docs/my-website/img/key_r.png b/docs/my-website/img/key_r.png new file mode 100644 index 00000000000..0e31d41fa60 Binary files /dev/null and b/docs/my-website/img/key_r.png differ diff --git a/docs/my-website/img/key_u.png b/docs/my-website/img/key_u.png new file mode 100644 index 00000000000..39f085dc343 Binary files /dev/null and b/docs/my-website/img/key_u.png differ diff --git a/docs/my-website/img/mcp_updates.jpg b/docs/my-website/img/mcp_updates.jpg new file mode 100644 index 00000000000..c53c735116c Binary files /dev/null and b/docs/my-website/img/mcp_updates.jpg differ diff --git a/docs/my-website/img/oauth_2_success.png b/docs/my-website/img/oauth_2_success.png new file mode 100644 index 00000000000..4011b55d35c Binary files /dev/null and b/docs/my-website/img/oauth_2_success.png differ diff --git a/docs/my-website/img/release_notes/1_78_0_perf.png b/docs/my-website/img/release_notes/1_78_0_perf.png new file mode 100644 index 00000000000..ed84c3a420a Binary files /dev/null and b/docs/my-website/img/release_notes/1_78_0_perf.png differ diff --git a/docs/my-website/img/release_notes/perf_77_5.png b/docs/my-website/img/release_notes/perf_77_5.png new file mode 100644 index 00000000000..3aaebaf6164 Binary files /dev/null and b/docs/my-website/img/release_notes/perf_77_5.png differ diff --git a/docs/my-website/img/release_notes/perf_77_7.png b/docs/my-website/img/release_notes/perf_77_7.png new file mode 100644 index 00000000000..bcf6a9afd54 Binary files /dev/null and b/docs/my-website/img/release_notes/perf_77_7.png differ diff --git a/docs/my-website/img/release_notes/schedule_key_rotations.png b/docs/my-website/img/release_notes/schedule_key_rotations.png new file mode 100644 index 00000000000..6ea7d8527d3 Binary files /dev/null and b/docs/my-website/img/release_notes/schedule_key_rotations.png differ diff --git a/docs/my-website/img/release_notes/tool_control.png b/docs/my-website/img/release_notes/tool_control.png new file mode 100644 index 00000000000..3d7fc42e6ad Binary files /dev/null and b/docs/my-website/img/release_notes/tool_control.png differ diff --git a/docs/my-website/img/tag_budget1.png b/docs/my-website/img/tag_budget1.png new file mode 100644 index 00000000000..061e406f490 Binary files /dev/null and b/docs/my-website/img/tag_budget1.png differ diff --git a/docs/my-website/img/tag_budget2.png b/docs/my-website/img/tag_budget2.png new file mode 100644 index 00000000000..f44fd79dd32 Binary files /dev/null and b/docs/my-website/img/tag_budget2.png differ diff --git a/docs/my-website/release_notes/v1.75.5-stable/index.md b/docs/my-website/release_notes/v1.75.5-stable/index.md index 270be64190e..7035d285057 100644 --- a/docs/my-website/release_notes/v1.75.5-stable/index.md +++ b/docs/my-website/release_notes/v1.75.5-stable/index.md @@ -50,6 +50,7 @@ pip install litellm==1.75.5.post2 - **Oracle Cloud Infrastructure** - New LLM provider for calling models on Oracle Cloud Infrastructure. - **Digital Ocean's Gradient AI** - New LLM provider for calling models on Digital Ocean's Gradient AI platform. +--- ### Risk of Upgrade diff --git a/docs/my-website/release_notes/v1.77.5-stable/index.md b/docs/my-website/release_notes/v1.77.5-stable/index.md index ab0f4ac304f..1b06018d8a8 100644 --- a/docs/my-website/release_notes/v1.77.5-stable/index.md +++ b/docs/my-website/release_notes/v1.77.5-stable/index.md @@ -1,5 +1,5 @@ --- -title: "[Preview] v1.77.5-stable - MCP OAuth 2.0 Support" +title: "v1.77.5-stable - MCP OAuth 2.0 Support" slug: "v1-77-5" date: 2025-09-29T10:00:00 authors: @@ -11,6 +11,10 @@ authors: title: CTO, LiteLLM url: https://www.linkedin.com/in/reffajnaahsi/ image_url: https://pbs.twimg.com/profile_images/1613813310264340481/lz54oEiB_400x400.jpg + - name: Alexsander Hamir + title: Backend Performance Engineer + url: https://www.linkedin.com/in/alexsander-baptista/ + image_url: https://media.licdn.com/dms/image/v2/D5603AQGXnziu4kqNCQ/profile-displayphoto-crop_800_800/B56ZkxEcuOKEAI-/0/1757464874550?e=1762387200&v=beta&t=9SNXLsWhx8OnYPAMQ9fqAr02oevDYEAL2vMYg2f9ieg hide_table_of_contents: false --- @@ -28,7 +32,7 @@ import TabItem from '@theme/TabItem'; docker run \ -e STORE_MODEL_IN_DB=True \ -p 4000:4000 \ -ghcr.io/berriai/litellm:v1.77.5.rc.1 +ghcr.io/berriai/litellm:v1.77.5-stable ```
@@ -49,7 +53,41 @@ pip install litellm==1.77.5 - **MCP OAuth 2.0 Support** - Enhanced authentication for Model Context Protocol integrations - **Scheduled Key Rotations** - Automated key rotation capabilities for enhanced security - **New Gemini 2.5 Flash & Flash-lite Models** - Latest September 2025 preview models with improved pricing and features -- **Performance Improvements** - Critical InMemoryCache unbounded growth resolution +- **Performance Improvements** - 54% RPS improvement + +--- + +### Performance Improvements - 54% RPS Improvement + + + +
+ +This release brings a 54% RPS improvement (1,040 → 1,602 RPS, aggregated) per instance. + +The improvement comes from fixing O(n²) inefficiencies in the LiteLLM Router, primarily caused by repeated use of `in` statements inside loops over large arrays. + +Tests were run with a database-only setup (no cache hits). + +#### Test Setup + +All benchmarks were executed using Locust with 1,000 concurrent users and a ramp-up of 500. The environment was configured to stress the routing layer and eliminate caching as a variable. + +**System Specs** + +- **CPU:** 8 vCPUs +- **Memory:** 32 GB RAM + +**Configuration (config.yaml)** + +View the complete configuration: [gist.github.com/AlexsanderHamir/config.yaml](https://gist.github.com/AlexsanderHamir/53f7d554a5d2afcf2c4edb5b6be68ff4) + +**Load Script (no_cache_hits.py)** + +View the complete load testing script: [gist.github.com/AlexsanderHamir/no_cache_hits.py](https://gist.github.com/AlexsanderHamir/42c33d7a4dc7a57f56a78b560dee3a42) + +--- + ## New Models / Updated Models diff --git a/docs/my-website/release_notes/v1.77.7-stable/index.md b/docs/my-website/release_notes/v1.77.7-stable/index.md new file mode 100644 index 00000000000..03456297f23 --- /dev/null +++ b/docs/my-website/release_notes/v1.77.7-stable/index.md @@ -0,0 +1,389 @@ +--- +title: "v1.77.7-stable - 2.9x Lower Median Latency" +slug: "v1-77-7" +date: 2025-10-04T10: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 + - name: Alexsander Hamir + title: Backend Performance Engineer + url: https://www.linkedin.com/in/alexsander-baptista/ + image_url: https://media.licdn.com/dms/image/v2/D5603AQGXnziu4kqNCQ/profile-displayphoto-crop_800_800/B56ZkxEcuOKEAI-/0/1757464874550?e=1762387200&v=beta&t=9SNXLsWhx8OnYPAMQ9fqAr02oevDYEAL2vMYg2f9ieg + - name: Achintya Rajan + title: Fullstack Engineer + url: https://www.linkedin.com/in/achintya-rajan/ + image_url: https://media.licdn.com/dms/image/v2/D5603AQGdkEeyJTdljw/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1716271140869?e=1762387200&v=beta&t=9gOoLPeqR2E5z3KSX61EUj3HVZXmgo87vhVuSHeffjc + - name: Sameer Kankute + title: Backend Engineer (LLM Translation) + url: https://www.linkedin.com/in/sameer-kankute/ + image_url: https://media.licdn.com/dms/image/v2/D4D03AQHB_loQYd5gjg/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1719137160975?e=1762387200&v=beta&t=0jbuX-f4eSnDxBY3olI6meuYr-LMbObhFmFbRcKF5mY + +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 \ +ghcr.io/berriai/litellm:v1.77.7.rc.1 +``` + + + + + +``` showLineNumbers title="pip install litellm" +pip install litellm==1.77.7.rc.1 +``` + + + + +--- + +## Key Highlights + +- **Dynamic Rate Limiter v3** - Automatically maximizes throughput when capacity is available (< 80% saturation) by allowing lower-priority requests to use unused capacity, then switches to fair priority-based allocation under high load (≥ 80%) to prevent blocking +- **Major Performance Improvements** - 2.9x lower median latency at 1,000 concurrent users. +- **Claude Sonnet 4.5** - Support for Anthropic's new Claude Sonnet 4.5 model family with 200K+ context and tiered pricing +- **MCP Gateway Enhancements** - Fine-grained tool control, server permissions, and forwardable headers +- **AMD Lemonade & Nvidia NIM** - New provider support for AMD Lemonade and Nvidia NIM Rerank +- **GitLab Prompt Management** - GitLab-based prompt management integration + +### Performance - 2.9x Lower Median Latency + + + +
+ +This update removes LiteLLM router inefficiencies, reducing complexity from O(M×N) to O(1). Previously, it built a new array and ran repeated checks like data["model"] in llm_router.get_model_ids(). Now, a direct ID-to-deployment map eliminates redundant allocations and scans. + +As a result, performance improved across all latency percentiles: + +- **Median latency:** 320 ms → **110 ms** (−65.6%) +- **p95 latency:** 850 ms → **440 ms** (−48.2%) +- **p99 latency:** 1,400 ms → **810 ms** (−42.1%) +- **Average latency:** 864 ms → **310 ms** (−64%) + + +#### Test Setup + +**Locust** + +- **Concurrent users:** 1,000 +- **Ramp-up:** 500 + +**System Specs** + +- **CPU:** 4 vCPUs +- **Memory:** 8 GB RAM +- **LiteLLM Workers:** 4 +- **Instances**: 4 + +**Configuration (config.yaml)** + +View the complete configuration: [gist.github.com/AlexsanderHamir/config.yaml](https://gist.github.com/AlexsanderHamir/53f7d554a5d2afcf2c4edb5b6be68ff4) + +**Load Script (no_cache_hits.py)** + +View the complete load testing script: [gist.github.com/AlexsanderHamir/no_cache_hits.py](https://gist.github.com/AlexsanderHamir/42c33d7a4dc7a57f56a78b560dee3a42) + +### MCP OAuth 2.0 Support + + + +
+ +This release adds support for OAuth 2.0 Client Credentials for MCP servers. This is great for **Internal Dev Tools** use-cases, as it enables your users to call MCP servers, with their own credentials. E.g. Allowing your developers to call the Github MCP, with their own credentials. + +[Set it up today on Claude Code](../../docs/tutorials/claude_responses_api#connecting-mcp-servers) + +### Scheduled Key Rotations + + + +
+ +This release brings support for scheduling virtual key rotations on LiteLLM AI Gateway. + +From this release you can enforce Virtual Keys to rotate on a schedule of your choice e.g every 15 days/30 days/60 days etc. + +This is great for Proxy Admins who need to enforce security policies for production workloads. + +[Get Started](../../docs/proxy/virtual_keys#scheduled-key-rotations) + + +## New Models / Updated Models + +#### New Model Support + +| Provider | Model | Context Window | Input ($/1M tokens) | Output ($/1M tokens) | Features | +| -------- | ----- | -------------- | ------------------- | -------------------- | -------- | +| Anthropic | `claude-sonnet-4-5` | 200K | $3.00 | $15.00 | Chat, reasoning, vision, function calling, prompt caching | +| Anthropic | `claude-sonnet-4-5-20250929` | 200K | $3.00 | $15.00 | Chat, reasoning, vision, function calling, prompt caching | +| Bedrock | `eu.anthropic.claude-sonnet-4-5-20250929-v1:0` | 200K | $3.00 | $15.00 | Chat, reasoning, vision, function calling, prompt caching | +| Azure AI | `azure_ai/grok-4` | 131K | $5.50 | $27.50 | Chat, reasoning, function calling, web search | +| Azure AI | `azure_ai/grok-4-fast-reasoning` | 131K | $0.43 | $1.73 | Chat, reasoning, function calling, web search | +| Azure AI | `azure_ai/grok-4-fast-non-reasoning` | 131K | $0.43 | $1.73 | Chat, function calling, web search | +| Azure AI | `azure_ai/grok-code-fast-1` | 131K | $3.50 | $17.50 | Chat, function calling, web search | +| Groq | `groq/moonshotai/kimi-k2-instruct-0905` | Context varies | Pricing varies | Pricing varies | Chat, function calling | +| Ollama | Ollama Cloud models | Varies | Free | Free | Self-hosted models via Ollama Cloud | + +#### Features + +- **[Anthropic](../../docs/providers/anthropic)** + - Add new claude-sonnet-4-5 model family with tiered pricing above 200K tokens - [PR #15041](https://github.com/BerriAI/litellm/pull/15041) + - Add anthropic/claude-sonnet-4-5 to model price json with prompt caching support - [PR #15049](https://github.com/BerriAI/litellm/pull/15049) + - Add 200K prices for Sonnet 4.5 - [PR #15140](https://github.com/BerriAI/litellm/pull/15140) + - Add cost tracking for /v1/messages in streaming response - [PR #15102](https://github.com/BerriAI/litellm/pull/15102) + - Add /v1/messages/count_tokens to Anthropic routes for non-admin user access - [PR #15034](https://github.com/BerriAI/litellm/pull/15034) +- **[Gemini](../../docs/providers/gemini)** + - Ignore type param for gemini tools - [PR #15022](https://github.com/BerriAI/litellm/pull/15022) +- **[Vertex AI](../../docs/providers/vertex)** + - Add LiteLLM Overhead metric for VertexAI - [PR #15040](https://github.com/BerriAI/litellm/pull/15040) + - Support googlemap grounding in vertex ai - [PR #15179](https://github.com/BerriAI/litellm/pull/15179) +- **[Azure](../../docs/providers/azure)** + - Add azure_ai grok-4 model family - [PR #15137](https://github.com/BerriAI/litellm/pull/15137) + - Use the `extra_query` parameter for GET requests in Azure Batch - [PR #14997](https://github.com/BerriAI/litellm/pull/14997) + - Use extra_query for download results (Batch API) - [PR #15025](https://github.com/BerriAI/litellm/pull/15025) + - Add support for Azure AD token-based authorization - [PR #14813](https://github.com/BerriAI/litellm/pull/14813) +- **[Ollama](../../docs/providers/ollama)** + - Add ollama cloud models - [PR #15008](https://github.com/BerriAI/litellm/pull/15008) +- **[Groq](../../docs/providers/groq)** + - Add groq/moonshotai/kimi-k2-instruct-0905 - [PR #15079](https://github.com/BerriAI/litellm/pull/15079) +- **[OpenAI](../../docs/providers/openai)** + - Add support for GPT 5 codex models - [PR #14841](https://github.com/BerriAI/litellm/pull/14841) +- **[DeepInfra](../../docs/providers/deepinfra)** + - Update DeepInfra model data refresh with latest pricing - [PR #14939](https://github.com/BerriAI/litellm/pull/14939) +- **[Bedrock](../../docs/providers/bedrock)** + - Add JP Cross-Region Inference - [PR #15188](https://github.com/BerriAI/litellm/pull/15188) + - Add "eu.anthropic.claude-sonnet-4-5-20250929-v1:0" - [PR #15181](https://github.com/BerriAI/litellm/pull/15181) + - Add twelvelabs bedrock Async Invoke Support - [PR #14871](https://github.com/BerriAI/litellm/pull/14871) +- **[Nvidia NIM](../../docs/providers/nvidia_nim)** + - Add Nvidia NIM Rerank Support - [PR #15152](https://github.com/BerriAI/litellm/pull/15152) + +### Bug Fixes + +- **[VLLM](../../docs/providers/vllm)** + - Fix response_format bug in hosted vllm audio_transcription - [PR #15010](https://github.com/BerriAI/litellm/pull/15010) + - Fix passthrough of atranscription into kwargs going to upstream provider - [PR #15005](https://github.com/BerriAI/litellm/pull/15005) +- **[OCI](../../docs/providers/oci)** + - Fix OCI Generative AI Integration when using Proxy - [PR #15072](https://github.com/BerriAI/litellm/pull/15072) +- **General** + - Fix: Authorization header to use correct "Bearer" capitalization - [PR #14764](https://github.com/BerriAI/litellm/pull/14764) + - Bug fix: gpt-5-chat-latest has incorrect max_input_tokens value - [PR #15116](https://github.com/BerriAI/litellm/pull/15116) + - Update request handling for original exceptions - [PR #15013](https://github.com/BerriAI/litellm/pull/15013) + +#### New Provider Support + +- **[AMD Lemonade](../../docs/providers/lemonade)** + - Add AMD Lemonade provider support - [PR #14840](https://github.com/BerriAI/litellm/pull/14840) + +--- + +## LLM API Endpoints + +#### Features + +- **[Responses API](../../docs/response_api)** + - Return Cost for Responses API Streaming requests - [PR #15053](https://github.com/BerriAI/litellm/pull/15053) + +- **[/generateContent](../../docs/providers/gemini)** + - Add full support for native Gemini API translation - [PR #15029](https://github.com/BerriAI/litellm/pull/15029) + +- **Passthrough Gemini Routes** + - Add Gemini generateContent passthrough cost tracking - [PR #15014](https://github.com/BerriAI/litellm/pull/15014) + - Add streamGenerateContent cost tracking in passthrough - [PR #15199](https://github.com/BerriAI/litellm/pull/15199) + +- **Passthrough Vertex AI Routes** + - Add cost tracking for Vertex AI Passthrough `/predict` endpoint - [PR #15019](https://github.com/BerriAI/litellm/pull/15019) + - Add cost tracking for Vertex AI Live API WebSocket Passthrough - [PR #14956](https://github.com/BerriAI/litellm/pull/14956) + +- **General** + - Preserve Whitespace Characters in Model Response Streams - [PR #15160](https://github.com/BerriAI/litellm/pull/15160) + - Add provider name to payload specification - [PR #15130](https://github.com/BerriAI/litellm/pull/15130) + - Ensure query params are forwarded from origin url to downstream request - [PR #15087](https://github.com/BerriAI/litellm/pull/15087) + +--- + +## Management Endpoints / UI + +#### Features + +- **Virtual Keys** + - Ensure LLM_API_KEYs can access pass through routes - [PR #15115](https://github.com/BerriAI/litellm/pull/15115) + - Support 'guaranteed_throughput' when setting limits on keys belonging to a team - [PR #15120](https://github.com/BerriAI/litellm/pull/15120) + +- **Models + Endpoints** + - Ensure OCI secret fields not shared on /models and /v1/models endpoints - [PR #15085](https://github.com/BerriAI/litellm/pull/15085) + - Add snowflake on UI - [PR #15083](https://github.com/BerriAI/litellm/pull/15083) + - Make UI theme settings publicly accessible for custom branding - [PR #15074](https://github.com/BerriAI/litellm/pull/15074) + +- **Admin Settings** + - Ensure OTEL settings are saved in DB after set on UI - [PR #15118](https://github.com/BerriAI/litellm/pull/15118) + - Top api key tags - [PR #15151](https://github.com/BerriAI/litellm/pull/15151), [PR #15156](https://github.com/BerriAI/litellm/pull/15156) + +- **MCP** + - show health status of MCP servers - [PR #15185](https://github.com/BerriAI/litellm/pull/15185) + - allow setting extra headers on the UI - [PR #15185](https://github.com/BerriAI/litellm/pull/15185) + - allow editing allowed tools on the UI - [PR #15185](https://github.com/BerriAI/litellm/pull/15185) + +### Bug Fixes + +- **Virtual Keys** + - (security) prevent user key from updating other user keys - [PR #15201](https://github.com/BerriAI/litellm/pull/15201) + - (security) don't return all keys with blank key alias on /v2/key/info - [PR #15201](https://github.com/BerriAI/litellm/pull/15201) + - Fix Session Token Cookie Infinite Logout Loop - [PR #15146](https://github.com/BerriAI/litellm/pull/15146) + +- **Models + Endpoints** + - Make UI theme settings publicly accessible for custom branding - [PR #15074](https://github.com/BerriAI/litellm/pull/15074) + +- **Teams** + - fix failed copy to clipboard for http ui - [PR #15195](https://github.com/BerriAI/litellm/pull/15195) + +- **Logs** + - fix logs page render logs on filter lookup - [PR #15195](https://github.com/BerriAI/litellm/pull/15195) + - fix lookup list of end users (migrate to more efficient /customers/list lookup) - [PR #15195](https://github.com/BerriAI/litellm/pull/15195) + +- **Test key** + - update selected model on key change - [PR #15197](https://github.com/BerriAI/litellm/pull/15197) + +- **Dashboard** + - Fix LiteLLM model name fallback in dashboard overview - [PR #14998](https://github.com/BerriAI/litellm/pull/14998) + + +--- + +## Logging / Guardrail / Prompt Management Integrations + +#### Features + +- **[OpenTelemetry](../../docs/observability/otel)** + - Use generation_name for span naming in logging method - [PR #14799](https://github.com/BerriAI/litellm/pull/14799) +- **[Langfuse](../../docs/proxy/logging#langfuse)** + - Handle non-serializable objects in Langfuse logging - [PR #15148](https://github.com/BerriAI/litellm/pull/15148) + - Set usage_details.total in langfuse integration - [PR #15015](https://github.com/BerriAI/litellm/pull/15015) +- **[Prometheus](../../docs/proxy/prometheus)** + - support custom metadata labels on key/team - [PR #15094](https://github.com/BerriAI/litellm/pull/15094) + + +#### Guardrails + +- **[Javelin](../../docs/proxy/guardrails)** + - Add Javelin standalone guardrails integration for LiteLLM Proxy - [PR #14983](https://github.com/BerriAI/litellm/pull/14983) + - Add logging for important status fields in guardrails - [PR #15090](https://github.com/BerriAI/litellm/pull/15090) + - Don't run post_call guardrail if no text returned from Bedrock - [PR #15106](https://github.com/BerriAI/litellm/pull/15106) + +#### Prompt Management + +- **[GitLab](../../docs/proxy/prompt_management)** + - GitLab based Prompt manager - [PR #14988](https://github.com/BerriAI/litellm/pull/14988) + +--- + +## Spend Tracking, Budgets and Rate Limiting + +- **Cost Tracking** + - Proxy: end user cost tracking in the responses API - [PR #15124](https://github.com/BerriAI/litellm/pull/15124) +- **Parallel Request Limiter v3** + - Use well known redis cluster hashing algorithm - [PR #15052](https://github.com/BerriAI/litellm/pull/15052) + - Fixes to dynamic rate limiter v3 - add saturation detection - [PR #15119](https://github.com/BerriAI/litellm/pull/15119) + - Dynamic Rate Limiter v3 - fixes for detecting saturation + fixes for post saturation behavior - [PR #15192](https://github.com/BerriAI/litellm/pull/15192) +- **Teams** + - Add model specific tpm/rpm limits to teams on LiteLLM - [PR #15044](https://github.com/BerriAI/litellm/pull/15044) + +--- + +## MCP Gateway + +- **Server Configuration** + - Specify forwardable headers, specify allowed/disallowed tools for MCP servers - [PR #15002](https://github.com/BerriAI/litellm/pull/15002) + - Enforce server permissions on call tools - [PR #15044](https://github.com/BerriAI/litellm/pull/15044) + - MCP Gateway Fine-grained Tools Addition - [PR #15153](https://github.com/BerriAI/litellm/pull/15153) +- **Bug Fixes** + - Remove servername prefix mcp tools tests - [PR #14986](https://github.com/BerriAI/litellm/pull/14986) + - Resolve regression with duplicate Mcp-Protocol-Version header - [PR #15050](https://github.com/BerriAI/litellm/pull/15050) + - Fix test_mcp_server.py - [PR #15183](https://github.com/BerriAI/litellm/pull/15183) + +--- + +## Performance / Loadbalancing / Reliability improvements + +- **Router Optimizations** + - **+62.5% P99 Latency Improvement** - Remove router inefficiencies (from O(M*N) to O(1)) - [PR #15046](https://github.com/BerriAI/litellm/pull/15046) + - Remove hasattr checks in Router - [PR #15082](https://github.com/BerriAI/litellm/pull/15082) + - Remove Double Lookups - [PR #15084](https://github.com/BerriAI/litellm/pull/15084) + - Optimize _filter_cooldown_deployments from O(n×m + k×n) to O(n) - [PR #15091](https://github.com/BerriAI/litellm/pull/15091) + - Optimize unhealthy deployment filtering in retry path (O(n*m) → O(n+m)) - [PR #15110](https://github.com/BerriAI/litellm/pull/15110) +- **Cache Optimizations** + - Reduce complexity of InMemoryCache.evict_cache from O(n*log(n)) to O(log(n)) - [PR #15000](https://github.com/BerriAI/litellm/pull/15000) + - Avoiding expensive operations when cache isn't available - [PR #15182](https://github.com/BerriAI/litellm/pull/15182) +- **Worker Management** + - Add proxy CLI option to recycle workers after N requests - [PR #15007](https://github.com/BerriAI/litellm/pull/15007) +- **Metrics & Monitoring** + - LiteLLM Overhead metric tracking - Add support for tracking litellm overhead on cache hits - [PR #15045](https://github.com/BerriAI/litellm/pull/15045) + +--- + +## Documentation Updates + +- **Provider Documentation** + - Update litellm docs from latest release - [PR #15004](https://github.com/BerriAI/litellm/pull/15004) + - Add missing api_key parameter - [PR #15058](https://github.com/BerriAI/litellm/pull/15058) +- **General Documentation** + - Use docker compose instead of docker-compose - [PR #15024](https://github.com/BerriAI/litellm/pull/15024) + - Add railtracks to projects that are using litellm - [PR #15144](https://github.com/BerriAI/litellm/pull/15144) + - Perf: Last week improvement - [PR #15193](https://github.com/BerriAI/litellm/pull/15193) + - Sync models GitHub documentation with Loom video and cross-reference - [PR #15191](https://github.com/BerriAI/litellm/pull/15191) + +--- + +## Security Fixes + +- **JWT Token Security** - Don't log JWT SSO token on .info() log - [PR #15145](https://github.com/BerriAI/litellm/pull/15145) + +--- + +## New Contributors + +* @herve-ves made their first contribution in [PR #14998](https://github.com/BerriAI/litellm/pull/14998) +* @wenxi-onyx made their first contribution in [PR #15008](https://github.com/BerriAI/litellm/pull/15008) +* @jpetrucciani made their first contribution in [PR #15005](https://github.com/BerriAI/litellm/pull/15005) +* @abhijitjavelin made their first contribution in [PR #14983](https://github.com/BerriAI/litellm/pull/14983) +* @ZeroClover made their first contribution in [PR #15039](https://github.com/BerriAI/litellm/pull/15039) +* @cedarm made their first contribution in [PR #15043](https://github.com/BerriAI/litellm/pull/15043) +* @Isydmr made their first contribution in [PR #15025](https://github.com/BerriAI/litellm/pull/15025) +* @serializer made their first contribution in [PR #15013](https://github.com/BerriAI/litellm/pull/15013) +* @eddierichter-amd made their first contribution in [PR #14840](https://github.com/BerriAI/litellm/pull/14840) +* @malags made their first contribution in [PR #15000](https://github.com/BerriAI/litellm/pull/15000) +* @henryhwang made their first contribution in [PR #15029](https://github.com/BerriAI/litellm/pull/15029) +* @plafleur made their first contribution in [PR #15111](https://github.com/BerriAI/litellm/pull/15111) +* @tyler-liner made their first contribution in [PR #14799](https://github.com/BerriAI/litellm/pull/14799) +* @Amir-R25 made their first contribution in [PR #15144](https://github.com/BerriAI/litellm/pull/15144) +* @georg-wolflein made their first contribution in [PR #15124](https://github.com/BerriAI/litellm/pull/15124) +* @niharm made their first contribution in [PR #15140](https://github.com/BerriAI/litellm/pull/15140) +* @anthony-liner made their first contribution in [PR #15015](https://github.com/BerriAI/litellm/pull/15015) +* @rishiganesh2002 made their first contribution in [PR #15153](https://github.com/BerriAI/litellm/pull/15153) +* @danielaskdd made their first contribution in [PR #15160](https://github.com/BerriAI/litellm/pull/15160) +* @JVenberg made their first contribution in [PR #15146](https://github.com/BerriAI/litellm/pull/15146) +* @speglich made their first contribution in [PR #15072](https://github.com/BerriAI/litellm/pull/15072) +* @daily-kim made their first contribution in [PR #14764](https://github.com/BerriAI/litellm/pull/14764) + +--- + +## **[Full Changelog](https://github.com/BerriAI/litellm/compare/v1.77.5.rc.4...v1.77.7.rc.1)** diff --git a/docs/my-website/release_notes/v1.78.0-stable/index.md b/docs/my-website/release_notes/v1.78.0-stable/index.md new file mode 100644 index 00000000000..63d5eaca0b0 --- /dev/null +++ b/docs/my-website/release_notes/v1.78.0-stable/index.md @@ -0,0 +1,394 @@ +--- +title: "[Preview] v1.78.0-stable - MCP Gateway: Control Tool Access by Team, Key" +slug: "v1-78-0" +date: 2025-10-11T10: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 + - name: Alexsander Hamir + title: Backend Performance Engineer + url: https://www.linkedin.com/in/alexsander-baptista/ + image_url: https://media.licdn.com/dms/image/v2/D5603AQGXnziu4kqNCQ/profile-displayphoto-crop_800_800/B56ZkxEcuOKEAI-/0/1757464874550?e=1762387200&v=beta&t=9SNXLsWhx8OnYPAMQ9fqAr02oevDYEAL2vMYg2f9ieg + - name: Achintya Rajan + title: Fullstack Engineer + url: https://www.linkedin.com/in/achintya-rajan/ + image_url: https://media.licdn.com/dms/image/v2/D5603AQGdkEeyJTdljw/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1716271140869?e=1762387200&v=beta&t=9gOoLPeqR2E5z3KSX61EUj3HVZXmgo87vhVuSHeffjc + - name: Sameer Kankute + title: Backend Engineer (LLM Translation) + url: https://www.linkedin.com/in/sameer-kankute/ + image_url: https://media.licdn.com/dms/image/v2/D4D03AQHB_loQYd5gjg/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1719137160975?e=1762387200&v=beta&t=0jbuX-f4eSnDxBY3olI6meuYr-LMbObhFmFbRcKF5mY + +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 \ +ghcr.io/berriai/litellm:v1.78.0.rc.2 +``` + + + + + +``` showLineNumbers title="pip install litellm" +pip install litellm==1.78.0.rc.2 +``` + + + + +--- + +## Key Highlights + +- **MCP Gateway - Control Tool Access by Team, Key** - Control MCP tool access by team/key. +- **Performance Improvements** - 70% Lower p99 Latency +- **GPT-5 Pro & GPT-Image-1-Mini** - Day 0 support for OpenAI's GPT-5 Pro (400K context) and gpt-image-1-mini image generation +- **EnkryptAI Guardrails** - New guardrail integration for content moderation +- **Tag-Based Budgets** - Support for setting budgets based on request tags + +--- + +### MCP Gateway - Control Tool Access by Team, Key + + + +
+ +Proxy admins can now control MCP tool access by team or key. This makes it easy to grant different teams selective access to tools from the same MCP server. + +For example, you can now give your Engineering team access to `list_repositories`, `create_issue`, and `search_code` tools, while Sales only gets `search_code` and `close_issue` tools. + +This makes it easier for Proxy Admins to govern MCP Tool Access. + +[Get Started](../../docs/mcp_control#set-allowed-tools-for-a-key-team-or-organization) + +--- + +## Performance - 70% Lower p99 Latency + + + +
+ +This release cuts p99 latency by 70% on LiteLLM AI Gateway, making it even better for low-latency use cases. + +These gains come from two key enhancements: + +**Reliable Sessions** + +Added support for shared sessions with aiohttp. The shared_session parameter is now consistently used across all calls, enabling connection pooling. + +**Faster Routing** + +A new `model_name_to_deployment_indices` hash map replaces O(n) list scans in `_get_all_deployments()` with O(1) hash lookups, boosting routing performance and scalability. + +As a result, performance improved across all latency percentiles: + +- **Median latency:** 110 ms → **100 ms** (−9.1%) +- **p95 latency:** 440 ms → **150 ms** (−65.9%) +- **p99 latency:** 810 ms → **240 ms** (−70.4%) +- **Average latency:** 310 ms → **111.73 ms** (−64.0%) + +### **Test Setup** + +**Locust** + +- **Concurrent users:** 1,000 +- **Ramp-up:** 500 + +**System Specs** + +- **Database was used** +- **CPU:** 4 vCPUs +- **Memory:** 8 GB RAM +- **LiteLLM Workers:** 4 +- **Instances**: 4 + +**Configuration (config.yaml)** + +View the complete configuration: [gist.github.com/AlexsanderHamir/config.yaml](https://gist.github.com/AlexsanderHamir/53f7d554a5d2afcf2c4edb5b6be68ff4) + +**Load Script (no_cache_hits.py)** + +View the complete load testing script: [gist.github.com/AlexsanderHamir/no_cache_hits.py](https://gist.github.com/AlexsanderHamir/42c33d7a4dc7a57f56a78b560dee3a42) + +--- + +## New Models / Updated Models + +#### New Model Support + +| Provider | Model | Context Window | Input ($/1M tokens) | Output ($/1M tokens) | Features | +| -------- | ----- | -------------- | ------------------- | -------------------- | -------- | +| OpenAI | `gpt-5-pro` | 400K | $15.00 | $120.00 | Responses API, reasoning, vision, function calling, prompt caching, web search | +| OpenAI | `gpt-5-pro-2025-10-06` | 400K | $15.00 | $120.00 | Responses API, reasoning, vision, function calling, prompt caching, web search | +| OpenAI | `gpt-image-1-mini` | - | $2.00/img | - | Image generation and editing | +| OpenAI | `gpt-realtime-mini` | 128K | $0.60 | $2.40 | Realtime audio, function calling | +| Azure AI | `azure_ai/Phi-4-mini-reasoning` | 131K | $0.08 | $0.32 | Function calling | +| Azure AI | `azure_ai/Phi-4-reasoning` | 32K | $0.125 | $0.50 | Function calling, reasoning | +| Azure AI | `azure_ai/MAI-DS-R1` | 128K | $1.35 | $5.40 | Reasoning, function calling | +| Bedrock | `au.anthropic.claude-sonnet-4-5-20250929-v1:0` | 200K | $3.30 | $16.50 | Chat, reasoning, vision, function calling, prompt caching | +| Bedrock | `global.anthropic.claude-sonnet-4-5-20250929-v1:0` | 200K | $3.00 | $15.00 | Chat, reasoning, vision, function calling, prompt caching | +| Bedrock | `global.anthropic.claude-sonnet-4-20250514-v1:0` | 1M | $3.00 | $15.00 | Chat, reasoning, vision, function calling, prompt caching | +| Bedrock | `cohere.embed-v4:0` | 128K | $0.12 | - | Embeddings, image input support | +| OCI | `oci/cohere.command-latest` | 128K | $1.56 | $1.56 | Function calling | +| OCI | `oci/cohere.command-a-03-2025` | 256K | $1.56 | $1.56 | Function calling | +| OCI | `oci/cohere.command-plus-latest` | 128K | $1.56 | $1.56 | Function calling | +| Together AI | `together_ai/moonshotai/Kimi-K2-Instruct-0905` | 262K | $1.00 | $3.00 | Function calling | +| Together AI | `together_ai/Qwen/Qwen3-Next-80B-A3B-Instruct` | 262K | $0.15 | $1.50 | Function calling | +| Together AI | `together_ai/Qwen/Qwen3-Next-80B-A3B-Thinking` | 262K | $0.15 | $1.50 | Function calling | +| Vertex AI | MedGemma models | Varies | Varies | Varies | Medical-focused Gemma models on custom endpoints | +| Watson X | 27 new foundation models | Varies | Varies | Varies | Granite, Llama, Mistral families | + +#### Features + +- **[OpenAI](../../docs/providers/openai)** + - Add GPT-5 Pro model configuration and documentation - [PR #15258](https://github.com/BerriAI/litellm/pull/15258) + - Add stop parameter to non-supported params for GPT-5 - [PR #15244](https://github.com/BerriAI/litellm/pull/15244) + - Day 0 Support, Add gpt-image-1-mini - [PR #15259](https://github.com/BerriAI/litellm/pull/15259) + - Add gpt-realtime-mini support - [PR #15283](https://github.com/BerriAI/litellm/pull/15283) + - Add gpt-5-pro-2025-10-06 to model costs - [PR #15344](https://github.com/BerriAI/litellm/pull/15344) + - Minimal fix: gpt5 models should not go on cooldown when called with temperature!=1 - [PR #15330](https://github.com/BerriAI/litellm/pull/15330) + +- **[Snowflake Cortex](../../docs/providers/snowflake)** + - Add function calling support for Snowflake Cortex REST API - [PR #15221](https://github.com/BerriAI/litellm/pull/15221) + +- **[Gemini](../../docs/providers/gemini)** + - Fix header forwarding for Gemini/Vertex AI providers in proxy mode - [PR #15231](https://github.com/BerriAI/litellm/pull/15231) + +- **[Azure](../../docs/providers/azure)** + - Removed stop param from unsupported azure models - [PR #15229](https://github.com/BerriAI/litellm/pull/15229) + - Fix(azure/responses): remove invalid status param from azure call - [PR #15253](https://github.com/BerriAI/litellm/pull/15253) + - Add new Azure AI models with pricing details - [PR #15387](https://github.com/BerriAI/litellm/pull/15387) + - AzureAD Default credentials - select credential type based on environment - [PR #14470](https://github.com/BerriAI/litellm/pull/14470) + +- **[Bedrock](../../docs/providers/bedrock)** + - Add Global Cross-Region Inference - [PR #15210](https://github.com/BerriAI/litellm/pull/15210) + - Add Cohere Embed v4 support for AWS Bedrock - [PR #15298](https://github.com/BerriAI/litellm/pull/15298) + - Fix(bedrock): include cacheWriteInputTokens in prompt_tokens calculation - [PR #15292](https://github.com/BerriAI/litellm/pull/15292) + - Add Bedrock AU Cross-Region Inference for Claude Sonnet 4.5 - [PR #15402](https://github.com/BerriAI/litellm/pull/15402) + - Converse → /v1/messages streaming doesn't handle parallel tool calls with Claude models - [PR #15315](https://github.com/BerriAI/litellm/pull/15315) + +- **[Vertex AI](../../docs/providers/vertex)** + - Implement Context Caching for Vertex AI provider - [PR #15226](https://github.com/BerriAI/litellm/pull/15226) + - Support for Vertex AI Gemma Models on Custom Endpoints - [PR #15397](https://github.com/BerriAI/litellm/pull/15397) + - VertexAI - gemma model family support (custom endpoints) - [PR #15419](https://github.com/BerriAI/litellm/pull/15419) + - VertexAI Gemma model family streaming support + Added MedGemma - [PR #15427](https://github.com/BerriAI/litellm/pull/15427) + +- **[OCI](../../docs/providers/oci)** + - Add OCI Cohere support with tool calling and streaming capabilities - [PR #15365](https://github.com/BerriAI/litellm/pull/15365) + +- **[Watson X](../../docs/providers/watsonx)** + - Add Watson X foundation model definitions to model_prices_and_context_window.json - [PR #15219](https://github.com/BerriAI/litellm/pull/15219) + - Watsonx - Apply correct prompt templates for openai/gpt-oss model family - [PR #15341](https://github.com/BerriAI/litellm/pull/15341) + +- **[OpenRouter](../../docs/providers/openrouter)** + - Fix - (openrouter): move cache_control to content blocks for claude/gemini - [PR #15345](https://github.com/BerriAI/litellm/pull/15345) + - Fix - OpenRouter cache_control to only apply to last content block - [PR #15395](https://github.com/BerriAI/litellm/pull/15395) + +- **[Together AI](../../docs/providers/togetherai)** + - Add new together models - [PR #15383](https://github.com/BerriAI/litellm/pull/15383) + +### Bug Fixes + +- **General** + - Bug fix: gpt-5-chat-latest has incorrect max_input_tokens value - [PR #15116](https://github.com/BerriAI/litellm/pull/15116) + - Fix reasoning response ID - [PR #15265](https://github.com/BerriAI/litellm/pull/15265) + - Fix issue with parsing assistant messages - [PR #15320](https://github.com/BerriAI/litellm/pull/15320) + - Fix litellm_param based costing - [PR #15336](https://github.com/BerriAI/litellm/pull/15336) + - Fix lint errors - [PR #15406](https://github.com/BerriAI/litellm/pull/15406) + +--- + +## LLM API Endpoints + +#### Features + +- **[Responses API](../../docs/response_api)** + - Added streaming support for response api streaming image generation - [PR #15269](https://github.com/BerriAI/litellm/pull/15269) + - Add native Responses API support for litellm_proxy provider - [PR #15347](https://github.com/BerriAI/litellm/pull/15347) + - Temporarily relax ResponsesAPIResponse parsing to support custom backends (e.g., vLLM) - [PR #15362](https://github.com/BerriAI/litellm/pull/15362) + +- **[Files API](../../docs/files_api)** + - Feat(files): add @client decorator to file operations - [PR #15339](https://github.com/BerriAI/litellm/pull/15339) + +- **[/generateContent](../../docs/providers/gemini)** + - Fix gemini cli by actually streaming the response - [PR #15264](https://github.com/BerriAI/litellm/pull/15264) + +- **[Azure Passthrough](../../docs/pass_through/azure)** + - Azure - passthrough support with router models - [PR #15240](https://github.com/BerriAI/litellm/pull/15240) + +#### Bugs + +- **General** + - Fix x-litellm-cache-key header not being returned on cache hit - [PR #15348](https://github.com/BerriAI/litellm/pull/15348) + +--- + +## Management Endpoints / UI + +#### Features + +- **Proxy CLI Auth** + - Proxy CLI - dont store existing key in the URL, store it in the state param - [PR #15290](https://github.com/BerriAI/litellm/pull/15290) + +- **Models + Endpoints** + - Make PATCH `/model/{model_id}/update` handle `team_id` consistently with POST `/model/new` - [PR #15297](https://github.com/BerriAI/litellm/pull/15297) + - Feature: adds Infinity as a provider in the UI - [PR #15285](https://github.com/BerriAI/litellm/pull/15285) + - Fix: model + endpoints page crash when config file contains router_settings.model_group_alias - [PR #15308](https://github.com/BerriAI/litellm/pull/15308) + - Models & Endpoints Initial Refactor - [PR #15435](https://github.com/BerriAI/litellm/pull/15435) + - Litellm UI API Reference page updates - [PR #15438](https://github.com/BerriAI/litellm/pull/15438) + +- **Teams** + - Teams page: new column "Your Role" on the teams table - [PR #15384](https://github.com/BerriAI/litellm/pull/15384) + - LiteLLM Dashboard Teams UI refactor - [PR #15418](https://github.com/BerriAI/litellm/pull/15418) + +- **UI Infrastructure** + - Added prettier to autoformat frontend - [PR #15215](https://github.com/BerriAI/litellm/pull/15215) + - Adds turbopack to the npm run dev command in UI to build faster during development - [PR #15250](https://github.com/BerriAI/litellm/pull/15250) + - (perf) fix: Replaces bloated key list calls with lean key aliases endpoint - [PR #15252](https://github.com/BerriAI/litellm/pull/15252) + - Potentially fixes a UI spasm issue with an expired cookie - [PR #15309](https://github.com/BerriAI/litellm/pull/15309) + - LiteLLM UI Refactor Infrastructure - [PR #15236](https://github.com/BerriAI/litellm/pull/15236) + - Enforces removal of unused imports from UI - [PR #15416](https://github.com/BerriAI/litellm/pull/15416) + - Fix: usage page >> Model Activity >> spend per day graph: y-axis clipping on large spend values - [PR #15389](https://github.com/BerriAI/litellm/pull/15389) + - Updates guardrail provider logos - [PR #15421](https://github.com/BerriAI/litellm/pull/15421) + +- **Admin Settings** + - Fix: Router settings do not update despite success message - [PR #15249](https://github.com/BerriAI/litellm/pull/15249) + - Fix: Prevents DB from accidentally overriding config file values if they are empty in DB - [PR #15340](https://github.com/BerriAI/litellm/pull/15340) + +- **SSO** + - SSO - support EntraID app roles - [PR #15351](https://github.com/BerriAI/litellm/pull/15351) + +--- + +## Logging / Guardrail / Prompt Management Integrations + +#### Features + +- **[PostHog](../../docs/observability/posthog)** + - Feat: posthog per request api key - [PR #15379](https://github.com/BerriAI/litellm/pull/15379) + +#### Guardrails + +- **[EnkryptAI](../../docs/proxy/guardrails)** + - Add EnkryptAI Guardrails on LiteLLM - [PR #15390](https://github.com/BerriAI/litellm/pull/15390) + +--- + +## Spend Tracking, Budgets and Rate Limiting + +- **Tag Management** + - Tag Management - Add support for setting tag based budgets - [PR #15433](https://github.com/BerriAI/litellm/pull/15433) + +- **Dynamic Rate Limiter v3** + - QA/Fixes - Dynamic Rate Limiter v3 - final QA - [PR #15311](https://github.com/BerriAI/litellm/pull/15311) + - Fix dynamic Rate limiter v3 - inserting litellm_model_saturation - [PR #15394](https://github.com/BerriAI/litellm/pull/15394) + +- **Shared Health Check** + - Implement Shared Health Check State Across Pods - [PR #15380](https://github.com/BerriAI/litellm/pull/15380) + +--- + +## MCP Gateway + +- **Tool Control** + - MCP Gateway - UI - Select allowed tools for Key, Teams - [PR #15241](https://github.com/BerriAI/litellm/pull/15241) + - MCP Gateway - Backend - Allow storing allowed tools by team/key - [PR #15243](https://github.com/BerriAI/litellm/pull/15243) + - MCP Gateway - Fine-grained Database Object Storage Control - [PR #15255](https://github.com/BerriAI/litellm/pull/15255) + - MCP Gateway - Litellm mcp fixes team control - [PR #15304](https://github.com/BerriAI/litellm/pull/15304) + - MCP Gateway - QA/Fixes - Ensure Team/Key level enforcement works for MCPs - [PR #15305](https://github.com/BerriAI/litellm/pull/15305) + - Feature: Include server_name in /v1/mcp/server/health endpoint response - [PR #15431](https://github.com/BerriAI/litellm/pull/15431) + +- **OpenAPI Integration** + - MCP - support converting OpenAPI specs to MCP servers - [PR #15343](https://github.com/BerriAI/litellm/pull/15343) + - MCP - specify allowed params per tool - [PR #15346](https://github.com/BerriAI/litellm/pull/15346) + +- **Configuration** + - MCP - support setting CA_BUNDLE_PATH - [PR #15253](https://github.com/BerriAI/litellm/pull/15253) + - Fix: Ensure MCP client stays open during tool call - [PR #15391](https://github.com/BerriAI/litellm/pull/15391) + - Remove hardcoded "public" schema in migration.sql - [PR #15363](https://github.com/BerriAI/litellm/pull/15363) + +--- + +## Performance / Loadbalancing / Reliability improvements + +- **Router Optimizations** + - Fix - Router: add model_name index for O(1) deployment lookups - [PR #15113](https://github.com/BerriAI/litellm/pull/15113) + - Refactor Utils: extract inner function from client - [PR #15234](https://github.com/BerriAI/litellm/pull/15234) + - Fix Networking: remove limitations - [PR #15302](https://github.com/BerriAI/litellm/pull/15302) + +- **Session Management** + - Fix - Sessions not being shared - [PR #15388](https://github.com/BerriAI/litellm/pull/15388) + - Fix: remove panic from hot path - [PR #15396](https://github.com/BerriAI/litellm/pull/15396) + - Fix - shared session parsing and usage issue - [PR #15440](https://github.com/BerriAI/litellm/pull/15440) + - Fix: handle closed aiohttp sessions - [PR #15442](https://github.com/BerriAI/litellm/pull/15442) + - Fix: prevent session leaks when recreating aiohttp sessions - [PR #15443](https://github.com/BerriAI/litellm/pull/15443) + +- **SSL/TLS Performance** + - Perf: optimize SSL/TLS handshake performance with prioritized cipher - [PR #15398](https://github.com/BerriAI/litellm/pull/15398) + +- **Dependencies** + - Upgrades tenacity version to 8.5.0 - [PR #15303](https://github.com/BerriAI/litellm/pull/15303) + +- **Data Masking** + - Fix - SensitiveDataMasker converts lists to string - [PR #15420](https://github.com/BerriAI/litellm/pull/15420) + +--- + + +## General AI Gateway Improvements + +#### Security + +- **General** + - Fix: redact AWS credentials when redact_user_api_key_info enabled - [PR #15321](https://github.com/BerriAI/litellm/pull/15321) + +--- + +## Documentation Updates + +- **Provider Documentation** + - Update doc: perf update - [PR #15211](https://github.com/BerriAI/litellm/pull/15211) + - Add W&B Inference documentation - [PR #15278](https://github.com/BerriAI/litellm/pull/15278) + +- **Deployment** + - Deletion of docker-compose buggy comment that cause `config.yaml` based startup fail - [PR #15425](https://github.com/BerriAI/litellm/pull/15425) + +--- + +## New Contributors + +* @Gal-bloch made their first contribution in [PR #15219](https://github.com/BerriAI/litellm/pull/15219) +* @lcfyi made their first contribution in [PR #15315](https://github.com/BerriAI/litellm/pull/15315) +* @ashengstd made their first contribution in [PR #15362](https://github.com/BerriAI/litellm/pull/15362) +* @vkolehmainen made their first contribution in [PR #15363](https://github.com/BerriAI/litellm/pull/15363) +* @jlan-nl made their first contribution in [PR #15330](https://github.com/BerriAI/litellm/pull/15330) +* @BCook98 made their first contribution in [PR #15402](https://github.com/BerriAI/litellm/pull/15402) +* @PabloGmz96 made their first contribution in [PR #15425](https://github.com/BerriAI/litellm/pull/15425) + +--- + +## **[Full Changelog](https://github.com/BerriAI/litellm/compare/v1.77.7.rc.1...v1.78.0.rc.1)** + diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index 56baf1a702c..71f730c4542 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -36,6 +36,7 @@ const sidebars = { "proxy/guardrails/aporia_api", "proxy/guardrails/azure_content_guardrail", "proxy/guardrails/bedrock", + "proxy/guardrails/enkryptai", "proxy/guardrails/lasso_security", "proxy/guardrails/guardrails_ai", "proxy/guardrails/lakera_ai", @@ -93,10 +94,10 @@ const sidebars = { { type: "category", - label: "LiteLLM Proxy Server", + label: "LiteLLM AI Gateway", link: { type: "generated-index", - title: "LiteLLM Proxy Server (LLM Gateway)", + title: "LiteLLM AI Gateway (LLM Proxy)", description: `OpenAI Proxy Server (LLM Gateway) to call 100+ LLMs in a unified interface & track spend, set budgets per virtual key/user`, slug: "/simple_proxy", }, @@ -188,12 +189,13 @@ const sidebars = { type: "category", label: "Budgets + Rate Limits", items: [ + "proxy/users", + "proxy/team_budgets", + "proxy/tag_budgets", "proxy/customers", "proxy/dynamic_rate_limit", "proxy/rate_limit_tiers", - "proxy/team_budgets", "proxy/temporary_budget_increase", - "proxy/users" ], }, "proxy/caching", @@ -333,8 +335,19 @@ const sidebars = { "image_variations", ] }, - "mcp", + { + type: "category", + label: "/mcp - Model Context Protocol", + items: [ + "mcp", + "mcp_usage", + "mcp_control", + "mcp_cost", + "mcp_guardrail", + ] + }, "moderation", + "ocr", { type: "category", label: "Pass-through Endpoints (Anthropic SDK, etc.)", @@ -412,6 +425,7 @@ const sidebars = { items: [ "providers/vertex", "providers/vertex_partner", + "providers/vertex_self_deployed", "providers/vertex_image", "providers/vertex_batch", ] @@ -458,7 +472,14 @@ const sidebars = { "providers/deepgram", "providers/watsonx", "providers/predibase", - "providers/nvidia_nim", + { + type: "category", + label: "Nvidia NIM", + items: [ + "providers/nvidia_nim", + "providers/nvidia_nim_rerank", + ] + }, { type: "doc", id: "providers/nscale", label: "Nscale (EU Sovereign)" }, "providers/xai", "providers/moonshot", @@ -515,22 +536,18 @@ const sidebars = { "providers/oci", "providers/datarobot", "providers/ovhcloud", + "providers/wandb_inference", + "providers/cometapi", ], }, { type: "category", label: "Guides", items: [ - { - type: "category", - label: "Tools", - items: [ - "completion/computer_use", - "completion/web_search", - "completion/web_fetch", - "completion/function_call", - ] - }, + "completion/computer_use", + "completion/web_search", + "completion/web_fetch", + "completion/function_call", "completion/audio", "completion/document_understanding", "completion/drop_params", @@ -667,6 +684,7 @@ const sidebars = { items: [ "data_security", "data_retention", + "proxy/security_encryption_faq", "migration_policy", { type: "category", diff --git a/docs/my-website/src/pages/completion/supported.md b/docs/my-website/src/pages/completion/supported.md index 097af2bb4cb..e146e6efc97 100644 --- a/docs/my-website/src/pages/completion/supported.md +++ b/docs/my-website/src/pages/completion/supported.md @@ -8,6 +8,7 @@ | gpt-3.5-turbo-16k | `completion('gpt-3.5-turbo-16k', messages)` | `os.environ['OPENAI_API_KEY']` | | gpt-3.5-turbo-16k-0613 | `completion('gpt-3.5-turbo-16k-0613', messages)` | `os.environ['OPENAI_API_KEY']` | | gpt-4 | `completion('gpt-4', messages)` | `os.environ['OPENAI_API_KEY']` | +| gpt-5-pro | `completion('gpt-5-pro', messages)` | `os.environ['OPENAI_API_KEY']` | ## Azure OpenAI Chat Completion Models For Azure calls add the `azure/` prefix to `model`. If your azure deployment name is `gpt-v-2` set `model` = `azure/gpt-v-2` diff --git a/enterprise/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py b/enterprise/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py index d4964b9667e..8db0fcf752c 100644 --- a/enterprise/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py +++ b/enterprise/litellm_enterprise/enterprise_callbacks/pagerduty/pagerduty.py @@ -119,6 +119,7 @@ class PagerDutyAlerting(SlackAlerting): user_api_key_end_user_id=_meta.get("user_api_key_end_user_id"), user_api_key_user_email=_meta.get("user_api_key_user_email"), user_api_key_request_route=_meta.get("user_api_key_request_route"), + user_api_key_auth_metadata=_meta.get("user_api_key_auth_metadata"), ) ) @@ -196,7 +197,11 @@ class PagerDutyAlerting(SlackAlerting): user_api_key_alias=user_api_key_dict.key_alias, user_api_key_spend=user_api_key_dict.spend, user_api_key_max_budget=user_api_key_dict.max_budget, - user_api_key_budget_reset_at=user_api_key_dict.budget_reset_at.isoformat() if user_api_key_dict.budget_reset_at else None, + user_api_key_budget_reset_at=( + user_api_key_dict.budget_reset_at.isoformat() + if user_api_key_dict.budget_reset_at + else None + ), user_api_key_org_id=user_api_key_dict.org_id, user_api_key_team_id=user_api_key_dict.team_id, user_api_key_user_id=user_api_key_dict.user_id, @@ -204,6 +209,7 @@ class PagerDutyAlerting(SlackAlerting): user_api_key_end_user_id=user_api_key_dict.end_user_id, user_api_key_user_email=user_api_key_dict.user_email, user_api_key_request_route=user_api_key_dict.request_route, + user_api_key_auth_metadata=user_api_key_dict.metadata, ) ) diff --git a/enterprise/litellm_enterprise/integrations/prometheus.py b/enterprise/litellm_enterprise/integrations/prometheus.py index d3b0aefb86f..3b37e14b896 100644 --- a/enterprise/litellm_enterprise/integrations/prometheus.py +++ b/enterprise/litellm_enterprise/integrations/prometheus.py @@ -21,6 +21,7 @@ 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.types.integrations.prometheus import * +from litellm.types.integrations.prometheus import _sanitize_prometheus_label_name from litellm.types.utils import StandardLoggingPayload from litellm.utils import get_end_user_id_for_cost_tracking @@ -794,9 +795,16 @@ class PrometheusLogger(CustomLogger): output_tokens = standard_logging_payload["completion_tokens"] tokens_used = standard_logging_payload["total_tokens"] response_cost = standard_logging_payload["response_cost"] - _requester_metadata = standard_logging_payload["metadata"].get( + _requester_metadata: Optional[dict] = standard_logging_payload["metadata"].get( "requester_metadata" ) + user_api_key_auth_metadata: Optional[dict] = standard_logging_payload[ + "metadata" + ].get("user_api_key_auth_metadata") + combined_metadata: Dict[str, Any] = { + **(_requester_metadata if _requester_metadata else {}), + **(user_api_key_auth_metadata if user_api_key_auth_metadata else {}), + } if standard_logging_payload is not None and isinstance( standard_logging_payload, dict ): @@ -828,8 +836,7 @@ class PrometheusLogger(CustomLogger): exception_status=None, exception_class=None, custom_metadata_labels=get_custom_labels_from_metadata( - metadata=standard_logging_payload["metadata"].get("requester_metadata") - or {} + metadata=combined_metadata ), route=standard_logging_payload["metadata"].get( "user_api_key_request_route" @@ -1649,9 +1656,22 @@ class PrometheusLogger(CustomLogger): api_base: Optional[str], api_provider: str, ): - self.litellm_deployment_state.labels( - litellm_model_name, model_id, api_base, api_provider - ).set(state) + """ + Set the deployment state. + """ + ### get labels + _labels = prometheus_label_factory( + supported_enum_labels=self.get_labels_for_metric( + metric_name="litellm_deployment_state" + ), + enum_values=UserAPIKeyLabelValues( + litellm_model_name=litellm_model_name, + model_id=model_id, + api_base=api_base, + api_provider=api_provider, + ), + ) + self.litellm_deployment_state.labels(**_labels).set(state) def set_deployment_healthy( self, @@ -2228,8 +2248,10 @@ def prometheus_label_factory( if enum_values.custom_metadata_labels is not None: for key, value in enum_values.custom_metadata_labels.items(): - if key in supported_enum_labels: - filtered_labels[key] = value + # check sanitized key + sanitized_key = _sanitize_prometheus_label_name(key) + if sanitized_key in supported_enum_labels: + filtered_labels[sanitized_key] = value # Add custom tags if configured if enum_values.tags is not None: diff --git a/enterprise/litellm_enterprise/proxy/guardrails/endpoints.py b/enterprise/litellm_enterprise/proxy/guardrails/endpoints.py index cdf86dcea67..8b42b2549cd 100644 --- a/enterprise/litellm_enterprise/proxy/guardrails/endpoints.py +++ b/enterprise/litellm_enterprise/proxy/guardrails/endpoints.py @@ -36,6 +36,8 @@ async def apply_guardrail( if active_guardrail is None: raise Exception(f"Guardrail {request.guardrail_name} not found") - return await active_guardrail.apply_guardrail( + response_text = await active_guardrail.apply_guardrail( text=request.text, language=request.language, entities=request.entities ) + + return ApplyGuardrailResponse(response_text=response_text) diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.23-py3-none-any.whl b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.23-py3-none-any.whl new file mode 100644 index 00000000000..4220fad36c4 Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.23-py3-none-any.whl differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.23.tar.gz b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.23.tar.gz new file mode 100644 index 00000000000..ceccaacda43 Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.23.tar.gz differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.25-py3-none-any.whl b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.25-py3-none-any.whl new file mode 100644 index 00000000000..8e0f50c2121 Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.25-py3-none-any.whl differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.25.tar.gz b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.25.tar.gz new file mode 100644 index 00000000000..2565f68a2b8 Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.25.tar.gz differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.26-py3-none-any.whl b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.26-py3-none-any.whl new file mode 100644 index 00000000000..47b31557f88 Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.26-py3-none-any.whl differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.26.tar.gz b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.26.tar.gz new file mode 100644 index 00000000000..62fd4733428 Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.2.26.tar.gz differ diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql index 5686876b37c..472e2ea1e0c 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql @@ -5,4 +5,4 @@ */ -- AlterTable -ALTER TABLE "public"."LiteLLM_MCPServerTable" DROP COLUMN "spec_version"; +ALTER TABLE "LiteLLM_MCPServerTable" DROP COLUMN "spec_version"; diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql new file mode 100644 index 00000000000..bdac1e42bc2 --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "allowed_tools" TEXT[] DEFAULT ARRAY[]::TEXT[]; + diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql new file mode 100644 index 00000000000..1cfcf062eb1 --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE "LiteLLM_MCPServerTable" ADD COLUMN "extra_headers" TEXT[] DEFAULT ARRAY[]::TEXT[]; + diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql new file mode 100644 index 00000000000..51f3be87582 --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN "mcp_tool_permissions" JSONB; + diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql new file mode 100644 index 00000000000..541c70c7e48 --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql @@ -0,0 +1,18 @@ +-- CreateTable +CREATE TABLE "LiteLLM_TagTable" ( + "tag_name" TEXT NOT NULL, + "description" TEXT, + "models" TEXT[], + "model_info" JSONB, + "spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0, + "budget_id" TEXT, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "LiteLLM_TagTable_pkey" PRIMARY KEY ("tag_name") +); + +-- AddForeignKey +ALTER TABLE "LiteLLM_TagTable" ADD CONSTRAINT "LiteLLM_TagTable_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "LiteLLM_BudgetTable"("budget_id") ON DELETE SET NULL ON UPDATE CASCADE; + diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma index 766625145f6..a13af1afc5f 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma +++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma @@ -25,6 +25,7 @@ model LiteLLM_BudgetTable { organization LiteLLM_OrganizationTable[] // multiple orgs can have the same budget keys LiteLLM_VerificationToken[] // multiple keys can have the same budget end_users LiteLLM_EndUserTable[] // multiple end-users can have the same budget + tags LiteLLM_TagTable[] // multiple tags can have the same budget team_membership LiteLLM_TeamMembership[] // budgets of Users within a Team organization_membership LiteLLM_OrganizationMembership[] // budgets of Users within a Organization } @@ -156,6 +157,7 @@ model LiteLLM_ObjectPermissionTable { object_permission_id String @id @default(uuid()) mcp_servers String[] @default([]) mcp_access_groups String[] @default([]) + mcp_tool_permissions Json? // Tool-level permissions for MCP servers. Format: {"server_id": ["tool_name_1", "tool_name_2"]} vector_stores String[] @default([]) teams LiteLLM_TeamTable[] verification_tokens LiteLLM_VerificationToken[] @@ -178,6 +180,8 @@ model LiteLLM_MCPServerTable { updated_by String? mcp_info Json? @default("{}") mcp_access_groups String[] + allowed_tools String[] @default([]) + extra_headers String[] @default([]) // Health check status status String? @default("unknown") last_health_check DateTime? @@ -242,6 +246,20 @@ model LiteLLM_EndUserTable { blocked Boolean @default(false) } +// Track tags with budgets and spend +model LiteLLM_TagTable { + tag_name String @id + description String? + models String[] + model_info Json? // maps model_id to model_name + spend Float @default(0.0) + budget_id String? + litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id]) + created_at DateTime @default(now()) @map("created_at") + created_by String? + updated_at DateTime @default(now()) @updatedAt @map("updated_at") +} + // store proxy config.yaml model LiteLLM_Config { param_name String @id diff --git a/litellm-proxy-extras/litellm_proxy_extras/utils.py b/litellm-proxy-extras/litellm_proxy_extras/utils.py index ece2b496bf6..73065b050b7 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/utils.py +++ b/litellm-proxy-extras/litellm_proxy_extras/utils.py @@ -131,7 +131,9 @@ class ProxyExtrasDBManager: ) @staticmethod - def _resolve_all_migrations(migrations_dir: str, schema_path: str): + def _resolve_all_migrations( + migrations_dir: str, schema_path: str, mark_all_applied: bool = True + ): """ 1. Compare the current database state to schema.prisma and generate a migration for the diff. 2. Run prisma migrate deploy to apply any pending migrations. @@ -210,6 +212,8 @@ class ProxyExtrasDBManager: logger.warning("Migration diff application timed out.") # 3. Mark all migrations as applied + if not mark_all_applied: + return migration_names = ProxyExtrasDBManager._get_migration_names(migrations_dir) logger.info(f"Resolving {len(migration_names)} migrations") for migration_name in migration_names: @@ -263,6 +267,13 @@ class ProxyExtrasDBManager: logger.info(f"prisma migrate deploy stdout: {result.stdout}") logger.info("prisma migrate deploy completed") + + # Run sanity check to ensure DB matches schema + logger.info("Running post-migration sanity check...") + ProxyExtrasDBManager._resolve_all_migrations( + migrations_dir, schema_path, mark_all_applied=False + ) + logger.info("✅ Post-migration sanity check completed") return True except subprocess.CalledProcessError as e: logger.info(f"prisma db error: {e.stderr}, e: {e.stdout}") diff --git a/litellm-proxy-extras/pyproject.toml b/litellm-proxy-extras/pyproject.toml index 94e7f59bfa1..8af7c212f52 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.2.22" +version = "0.2.27" 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.2.22" +version = "0.2.27" version_files = [ "pyproject.toml:version", "../requirements.txt:litellm-proxy-extras==", diff --git a/litellm/__init__.py b/litellm/__init__.py index d961f42efde..162f07c56ec 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -290,7 +290,7 @@ banned_keywords_list: Optional[Union[str, List]] = None llm_guard_mode: Literal["all", "key-specific", "request-specific"] = "all" guardrail_name_config_map: Dict[str, GuardrailItem] = {} include_cost_in_streaming_usage: bool = False -### PROMPTS ### +### PROMPTS #### from litellm.types.prompts.init_prompts import PromptSpec prompt_name_config_map: Dict[str, PromptSpec] = {} @@ -367,7 +367,7 @@ disable_add_prefix_to_prompt: bool = ( disable_copilot_system_to_assistant: bool = False # If false (default), converts all 'system' role messages to 'assistant' for GitHub Copilot compatibility. Set to true to disable this behavior. public_model_groups: Optional[List[str]] = None public_model_groups_links: Dict[str, str] = {} -#### REQUEST PRIORITIZATION ###### +#### REQUEST PRIORITIZATION ####### priority_reservation: Optional[Dict[str, float]] = None priority_reservation_settings: "PriorityReservationSettings" = ( PriorityReservationSettings() @@ -497,6 +497,7 @@ azure_text_models: Set = set() anyscale_models: Set = set() cerebras_models: Set = set() galadriel_models: Set = set() +nvidia_nim_models: Set = set() sambanova_models: Set = set() sambanova_embedding_models: Set = set() novita_models: Set = set() @@ -691,6 +692,8 @@ def add_known_models(): cerebras_models.add(key) elif value.get("litellm_provider") == "galadriel": galadriel_models.add(key) + elif value.get("litellm_provider") == "nvidia_nim": + nvidia_nim_models.add(key) elif value.get("litellm_provider") == "sambanova": sambanova_models.add(key) elif value.get("litellm_provider") == "sambanova-embedding-models": @@ -818,6 +821,7 @@ model_list = list( | anyscale_models | cerebras_models | galadriel_models + | nvidia_nim_models | sambanova_models | azure_text_models | novita_models @@ -901,6 +905,7 @@ models_by_provider: dict = { "anyscale": anyscale_models, "cerebras": cerebras_models, "galadriel": galadriel_models, + "nvidia_nim": nvidia_nim_models, "sambanova": sambanova_models | sambanova_embedding_models, "novita": novita_models, "nebius": nebius_models | nebius_embedding_models, @@ -1061,6 +1066,7 @@ from .llms.azure_ai.rerank.transformation import AzureAIRerankConfig from .llms.infinity.rerank.transformation import InfinityRerankConfig from .llms.jina_ai.rerank.transformation import JinaAIRerankConfig from .llms.deepinfra.rerank.transformation import DeepinfraRerankConfig +from .llms.nvidia_nim.rerank.transformation import NvidiaNimRerankConfig from .llms.clarifai.chat.transformation import ClarifaiConfig from .llms.ai21.chat.transformation import AI21ChatConfig, AI21ChatConfig as AI21Config from .llms.meta_llama.chat.transformation import LlamaAPIConfig @@ -1161,6 +1167,7 @@ from .llms.bedrock.embed.amazon_titan_v2_transformation import ( ) from .llms.cohere.chat.transformation import CohereChatConfig from .llms.bedrock.embed.cohere_transformation import BedrockCohereEmbeddingConfig +from .llms.bedrock.embed.twelvelabs_marengo_transformation import TwelveLabsMarengoEmbeddingConfig from .llms.openai.openai import OpenAIConfig, MistralEmbeddingConfig from .llms.openai.image_variations.transformation import OpenAIImageVariationConfig from .llms.deepinfra.chat.transformation import DeepInfraConfig @@ -1183,6 +1190,9 @@ from .llms.azure.responses.transformation import AzureOpenAIResponsesAPIConfig from .llms.azure.responses.o_series_transformation import ( AzureOpenAIOSeriesResponsesAPIConfig, ) +from .llms.litellm_proxy.responses.transformation import ( + LiteLLMProxyResponsesAPIConfig, +) from .llms.openai.chat.o_series_transformation import ( OpenAIOSeriesConfig as OpenAIO1Config, # maintain backwards compatibility OpenAIOSeriesConfig, @@ -1277,6 +1287,7 @@ from .llms.hyperbolic.chat.transformation import HyperbolicChatConfig from .llms.vercel_ai_gateway.chat.transformation import VercelAIGatewayConfig from .llms.ovhcloud.chat.transformation import OVHCloudChatConfig from .llms.ovhcloud.embedding.transformation import OVHCloudEmbeddingConfig +from .llms.cometapi.embed.transformation import CometAPIEmbeddingConfig from .llms.lemonade.chat.transformation import LemonadeChatConfig from .main import * # type: ignore from .integrations import * @@ -1314,6 +1325,7 @@ from .batch_completion.main import * # type: ignore from .rerank_api.main import * from .llms.anthropic.experimental_pass_through.messages.handler import * from .responses.main import * +from .ocr.main import * from .realtime_api.main import _arealtime from .fine_tuning.main import * from .files.main import * diff --git a/litellm/_redis.py b/litellm/_redis.py index bcb305985fc..e6ac323ff5a 100644 --- a/litellm/_redis.py +++ b/litellm/_redis.py @@ -177,14 +177,21 @@ def get_redis_url_from_environment(): raise ValueError( "Either 'REDIS_URL' or both 'REDIS_HOST' and 'REDIS_PORT' must be specified for Redis." ) - - if "REDIS_PASSWORD" in os.environ: - redis_password = f":{os.environ['REDIS_PASSWORD']}@" + + if "REDIS_SSL" in os.environ and os.environ["REDIS_SSL"].lower() == "true": + redis_protocol = "rediss" else: - redis_password = "" - + redis_protocol = "redis" + + # Build authentication part of URL + auth_part = "" + if "REDIS_USERNAME" in os.environ and "REDIS_PASSWORD" in os.environ: + auth_part = f"{os.environ['REDIS_USERNAME']}:{os.environ['REDIS_PASSWORD']}@" + elif "REDIS_PASSWORD" in os.environ: + auth_part = f"{os.environ['REDIS_PASSWORD']}@" + return ( - f"redis://{redis_password}{os.environ['REDIS_HOST']}:{os.environ['REDIS_PORT']}" + f"{redis_protocol}://{auth_part}{os.environ['REDIS_HOST']}:{os.environ['REDIS_PORT']}" ) diff --git a/litellm/batches/main.py b/litellm/batches/main.py index 37b9aff4efb..48521e5fba0 100644 --- a/litellm/batches/main.py +++ b/litellm/batches/main.py @@ -59,18 +59,22 @@ def _resolve_timeout( ) -> float: """ Resolve timeout value from various sources and handle httpx.Timeout objects. - + Args: optional_params: GenericLiteLLMParams object containing timeout kwargs: Additional kwargs that may contain request_timeout custom_llm_provider: Provider name for httpx timeout support check default_timeout: Default timeout value to use - + Returns: Resolved timeout as float """ - timeout = optional_params.timeout or kwargs.get("request_timeout", default_timeout) or default_timeout - + timeout = ( + optional_params.timeout + or kwargs.get("request_timeout", default_timeout) + or default_timeout + ) + # Handle httpx.Timeout objects if isinstance(timeout, httpx.Timeout): if supports_httpx_timeout(custom_llm_provider) is False: @@ -81,11 +85,11 @@ def _resolve_timeout( # For providers that support httpx.Timeout, we still need to return a float # This case might need to be handled differently based on the actual use case return float(timeout.read or default_timeout) - + # Handle None case if timeout is None: return float(default_timeout) - + # Handle numeric values (int, float, string representations) return float(timeout) @@ -163,15 +167,19 @@ def create_batch( try: if model is not None: model, _, _, _ = get_llm_provider( - model=model, - custom_llm_provider=None, - ) + model=model, + custom_llm_provider=None, + ) except Exception as e: - verbose_logger.exception(f"litellm.batches.main.py::create_batch() - Error inferring custom_llm_provider - {str(e)}") - + verbose_logger.exception( + f"litellm.batches.main.py::create_batch() - Error inferring custom_llm_provider - {str(e)}" + ) + _is_async = kwargs.pop("acreate_batch", False) is True litellm_params = dict(GenericLiteLLMParams(**kwargs)) - litellm_logging_obj: LiteLLMLoggingObj = cast(LiteLLMLoggingObj, kwargs.get("litellm_logging_obj", None)) + litellm_logging_obj: LiteLLMLoggingObj = cast( + LiteLLMLoggingObj, kwargs.get("litellm_logging_obj", None) + ) ### TIMEOUT LOGIC ### timeout = _resolve_timeout(optional_params, kwargs, custom_llm_provider) litellm_logging_obj.update_environment_variables( @@ -189,7 +197,6 @@ def create_batch( }, custom_llm_provider=custom_llm_provider, ) - _create_batch_request = CreateBatchRequest( completion_window=completion_window, @@ -378,6 +385,7 @@ async def aretrieve_batch( except Exception as e: raise e + def _handle_retrieve_batch_providers_without_provider_config( batch_id: str, optional_params: GenericLiteLLMParams, @@ -497,6 +505,7 @@ def _handle_retrieve_batch_providers_without_provider_config( ) return response + @client def retrieve_batch( batch_id: str, @@ -513,7 +522,9 @@ def retrieve_batch( """ try: optional_params = GenericLiteLLMParams(**kwargs) - litellm_logging_obj: Optional[LiteLLMLoggingObj] = kwargs.get("litellm_logging_obj", None) + litellm_logging_obj: Optional[LiteLLMLoggingObj] = kwargs.get( + "litellm_logging_obj", None + ) ### TIMEOUT LOGIC ### timeout = optional_params.timeout or kwargs.get("request_timeout", 600) or 600 litellm_params = get_litellm_params( @@ -549,7 +560,26 @@ def retrieve_batch( _is_async = kwargs.pop("aretrieve_batch", False) is True client = kwargs.get("client", None) - + + # Check if this is an async invoke ARN (different from regular batch ARN) + # Async invoke ARNs have format: arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:async-invoke/[a-z0-9]{12} + if ( + batch_id.startswith("arn:aws") + and ":bedrock:" in batch_id + and ":async-invoke/" in batch_id + ): + # Handle async invoke status check + # Remove aws_region_name from kwargs to avoid duplicate parameter + async_kwargs = kwargs.copy() + async_kwargs.pop("aws_region_name", None) + + return _handle_async_invoke_status( + batch_id=batch_id, + aws_region_name=kwargs.get("aws_region_name", "us-east-1"), + logging_obj=litellm_logging_obj, + **async_kwargs, + ) + # Try to use provider config first (for providers like bedrock) model: Optional[str] = kwargs.get("model", None) if model is not None: @@ -559,7 +589,7 @@ def retrieve_batch( ) else: provider_config = None - + if provider_config is not None: response = base_llm_http_handler.retrieve_batch( batch_id=batch_id, @@ -568,7 +598,8 @@ def retrieve_batch( headers=extra_headers or {}, api_base=optional_params.api_base, api_key=optional_params.api_key, - logging_obj=litellm_logging_obj or LiteLLMLoggingObj( + logging_obj=litellm_logging_obj + or LiteLLMLoggingObj( model=model or "bedrock/unknown", messages=[], stream=False, @@ -586,7 +617,6 @@ def retrieve_batch( model=model, ) return response - ######################################################### # Handle providers without provider config @@ -600,7 +630,7 @@ def retrieve_batch( _is_async=_is_async, timeout=timeout, ) - + except Exception as e: raise e @@ -933,3 +963,79 @@ def cancel_batch( return response except Exception as e: raise e + + +def _handle_async_invoke_status( + batch_id: str, aws_region_name: str, logging_obj=None, **kwargs +) -> "LiteLLMBatch": + """ + Handle async invoke status check for AWS Bedrock. + + Args: + batch_id: The async invoke ARN + aws_region_name: AWS region name + **kwargs: Additional parameters + + Returns: + dict: Status information including status, output_file_id (S3 URL), etc. + """ + import asyncio + + from litellm.llms.bedrock.embed.embedding import BedrockEmbedding + + async def _async_get_status(): + # Create embedding handler instance + embedding_handler = BedrockEmbedding() + + # Get the status of the async invoke job + status_response = await embedding_handler._get_async_invoke_status( + invocation_arn=batch_id, + aws_region_name=aws_region_name, + logging_obj=logging_obj, + **kwargs, + ) + + # Transform response to a LiteLLMBatch object + from litellm.types.utils import LiteLLMBatch + + result = LiteLLMBatch( + id=status_response["invocationArn"], + object="batch", + status=status_response["status"], + created_at=status_response["submitTime"], + in_progress_at=status_response["lastModifiedTime"], + completed_at=status_response.get("endTime"), + failed_at=status_response.get("endTime") + if status_response["status"] == "failed" + else None, + request_counts={ + "total": 1, + "completed": 1 if status_response["status"] == "completed" else 0, + "failed": 1 if status_response["status"] == "failed" else 0, + }, + metadata={ + "output_file_id": status_response["outputDataConfig"][ + "s3OutputDataConfig" + ]["s3Uri"], + "failure_message": status_response.get("failureMessage"), + "model_arn": status_response["modelArn"], + }, + ) + + return result + + # Since this function is called from within an async context via run_in_executor, + # we need to create a new event loop in a thread to avoid conflicts + import concurrent.futures + + def run_in_thread(): + new_loop = asyncio.new_event_loop() + asyncio.set_event_loop(new_loop) + try: + return new_loop.run_until_complete(_async_get_status()) + finally: + new_loop.close() + + with concurrent.futures.ThreadPoolExecutor() as executor: + future = executor.submit(run_in_thread) + return future.result() diff --git a/litellm/caching/caching_handler.py b/litellm/caching/caching_handler.py index b151ebd6513..6bbc3231224 100644 --- a/litellm/caching/caching_handler.py +++ b/litellm/caching/caching_handler.py @@ -17,6 +17,7 @@ In each method it will call the appropriate method from caching.py import asyncio import datetime import inspect +import time from typing import ( TYPE_CHECKING, Any, @@ -57,10 +58,14 @@ from litellm.types.utils import ( if TYPE_CHECKING: from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj - from litellm.utils import CustomStreamWrapper else: LiteLLMLoggingObj = Any - CustomStreamWrapper = Any + + +from litellm.litellm_core_utils.core_helpers import ( + _get_parent_otel_span_from_kwargs, +) +from litellm.litellm_core_utils.streaming_handler import CustomStreamWrapper class CachingHandlerResponse(BaseModel): @@ -112,7 +117,7 @@ class LLMCachingHandler: call_type: str, kwargs: Dict[str, Any], args: Optional[Tuple[Any, ...]] = None, - ) -> CachingHandlerResponse: + ) -> Optional[CachingHandlerResponse]: """ Internal method to get from the cache. Handles different call types (embeddings, chat/completions, text_completion, transcription) @@ -133,32 +138,27 @@ class LLMCachingHandler: Raises: None """ - from litellm.litellm_core_utils.core_helpers import ( - _get_parent_otel_span_from_kwargs, - ) - from litellm.utils import CustomStreamWrapper - - kwargs = kwargs.copy() - args = args or () - ######################################################### - # Init cache timing metrics - ######################################################### - cache_check_start_time = datetime.datetime.now() - cache_check_end_time = None - ######################################################### - - - parent_otel_span = _get_parent_otel_span_from_kwargs(kwargs) - kwargs["parent_otel_span"] = parent_otel_span - final_embedding_cached_response: Optional[EmbeddingResponse] = None - embedding_all_elements_cache_hit: bool = False - cached_result: Optional[Any] = None + # Check if caching should be performed BEFORE doing expensive operations if ( (kwargs.get("caching", None) is None and litellm.cache is not None) or kwargs.get("caching", False) is True ) and ( kwargs.get("cache", {}).get("no-cache", False) is not True ): # allow users to control returning cached responses from the completion function + args = args or () + final_embedding_cached_response: Optional[EmbeddingResponse] = None + embedding_all_elements_cache_hit: bool = False + cached_result: Optional[Any] = None + kwargs = kwargs.copy() + ######################################################### + # Init cache timing metrics + ######################################################### + cache_check_start_time = time.perf_counter() + cache_check_end_time: Optional[float] = None + ######################################################### + parent_otel_span = _get_parent_otel_span_from_kwargs(kwargs) + kwargs["parent_otel_span"] = parent_otel_span + if litellm.cache is not None and self._is_call_type_supported_by_cache( original_function=original_function ): @@ -168,7 +168,7 @@ class LLMCachingHandler: kwargs=kwargs, args=args, ) - cache_check_end_time = datetime.datetime.now() + cache_check_end_time = time.perf_counter() if cached_result is not None and not isinstance(cached_result, list): verbose_logger.debug("Cache Hit!") @@ -180,7 +180,7 @@ class LLMCachingHandler: api_base=kwargs.get("api_base", None), api_key=kwargs.get("api_key", None), ) - cache_duration_ms = (cache_check_end_time - cache_check_start_time).total_seconds() * 1000 + cache_duration_ms = (cache_check_end_time - cache_check_start_time) * 1000 self._update_litellm_logging_obj_environment( logging_obj=logging_obj, model=model, @@ -212,9 +212,7 @@ class LLMCachingHandler: end_time=end_time, cache_hit=cache_hit, ) - cache_key = litellm.cache._get_preset_cache_key_from_kwargs( - **kwargs - ) + cache_key = litellm.cache.get_cache_key(**kwargs) if ( isinstance(cached_result, BaseModel) or isinstance(cached_result, CustomStreamWrapper) @@ -245,11 +243,14 @@ class LLMCachingHandler: final_embedding_cached_response=final_embedding_cached_response, embedding_all_elements_cache_hit=embedding_all_elements_cache_hit, ) - verbose_logger.debug(f"CACHE RESULT: {cached_result}") - return CachingHandlerResponse( - cached_result=cached_result, - final_embedding_cached_response=final_embedding_cached_response, - ) + + verbose_logger.debug(f"CACHE RESULT: {cached_result}") + return CachingHandlerResponse( + cached_result=cached_result, + final_embedding_cached_response=final_embedding_cached_response, + ) + # Caching disabled - return None to indicate no caching attempted + return None def _sync_get_cache( self, @@ -263,18 +264,22 @@ class LLMCachingHandler: ) -> CachingHandlerResponse: from litellm.utils import CustomStreamWrapper - args = args or () - new_kwargs = kwargs.copy() - new_kwargs.update( - convert_args_to_kwargs( - self.original_function, - args, - ) - ) + cached_result: Optional[Any] = None + + # Check if caching should be performed BEFORE doing expensive kwargs copy if litellm.cache is not None and self._is_call_type_supported_by_cache( original_function=original_function ): + args = args or () + # Now that we confirmed caching will happen, prepare kwargs + new_kwargs = kwargs.copy() + new_kwargs.update( + convert_args_to_kwargs( + self.original_function, + args, + ) + ) print_verbose("Checking Sync Cache") cached_result = litellm.cache.get_cache(**new_kwargs) if cached_result is not None: @@ -321,9 +326,7 @@ class LLMCachingHandler: end_time=end_time, cache_hit=cache_hit ) - cache_key = litellm.cache._get_preset_cache_key_from_kwargs( - **kwargs - ) + cache_key = litellm.cache.get_cache_key(**kwargs) if ( isinstance(cached_result, BaseModel) or isinstance(cached_result, CustomStreamWrapper) diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py index 5f732fc5219..b060f22d355 100644 --- a/litellm/completion_extras/litellm_responses_transformation/transformation.py +++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py @@ -18,13 +18,15 @@ from typing import ( cast, ) +from openai.types.responses.tool_param import FunctionToolParam + from litellm import ModelResponse from litellm._logging import verbose_logger from litellm.llms.base_llm.base_model_iterator import BaseModelResponseIterator from litellm.llms.base_llm.bridges.completion_transformation import ( CompletionTransformationBridge, ) -from litellm.types.llms.openai import Reasoning +from litellm.types.llms.openai import ChatCompletionToolParamFunctionChunk, Reasoning if TYPE_CHECKING: from openai.types.responses import ResponseInputImageParam @@ -50,6 +52,45 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): def __init__(self): pass + def _handle_raw_dict_response_item( + self, item: Dict[str, Any], index: int + ) -> Tuple[Optional[Any], int]: + """ + Handle raw dict response items from Responses API (e.g., GPT-5 Codex format). + + Args: + item: Raw dict response item with 'type' field + index: Current choice index + + Returns: + Tuple of (Choice object or None, updated index) + """ + from litellm.types.utils import Choices, Message + + item_type = item.get("type") + + # Ignore reasoning items for now + if item_type == "reasoning": + return None, index + + # Handle message items with output_text content + if item_type == "message": + content_list = item.get("content", []) + for content_item in content_list: + if isinstance(content_item, dict): + content_type = content_item.get("type") + if content_type == "output_text": + response_text = content_item.get("text", "") + msg = Message( + role=item.get("role", "assistant"), + content=response_text if response_text else "", + ) + choice = Choices(message=msg, finish_reason="stop", index=index) + return choice, index + 1 + + # Unknown or unsupported type + return None, index + def convert_chat_completion_messages_to_responses_api( self, messages: List["AllMessageValues"] ) -> Tuple[List[Any], Optional[str]]: @@ -201,6 +242,11 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): if value is not None: if key == "instructions" and instructions: request_data["instructions"] = instructions + elif key == "stream_options" and isinstance(value, dict): + request_data["stream_options"] = value.get("include_obfuscation") + elif key == "user": # string can't be longer than 64 characters + if isinstance(value, str) and len(value) <= 64: + request_data["user"] = value else: request_data[key] = value @@ -221,7 +267,6 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): json_mode: Optional[bool] = None, ) -> "ModelResponse": """Transform Responses API response to chat completion response""" - from openai.types.responses import ( ResponseFunctionToolCall, ResponseOutputMessage, @@ -240,19 +285,35 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): choices: List[Choices] = [] index = 0 + + reasoning_content: Optional[str] = None + for item in raw_response.output: + if isinstance(item, ResponseReasoningItem): - pass # ignore for now. + + for summary_item in item.summary: + response_text = getattr(summary_item, "text", "") + reasoning_content = response_text if response_text else "" + elif isinstance(item, ResponseOutputMessage): for content in item.content: response_text = getattr(content, "text", "") msg = Message( - role=item.role, content=response_text if response_text else "" + role=item.role, + content=response_text if response_text else "", + reasoning_content=reasoning_content, ) choices.append( - Choices(message=msg, finish_reason="stop", index=index) + Choices( + message=msg, + finish_reason="stop", + index=index, + ) ) + + reasoning_content = None # flush reasoning content index += 1 elif isinstance(item, ResponseFunctionToolCall): msg = Message( @@ -267,12 +328,21 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): "type": "function", } ], + reasoning_content=reasoning_content, ) choices.append( Choices(message=msg, finish_reason="tool_calls", index=index) ) + reasoning_content = None # flush reasoning content index += 1 + elif isinstance(item, dict): + # Handle raw dict responses (e.g., from GPT-5 Codex) + choice, index = self._handle_raw_dict_response_item( + item=item, index=index + ) + if choice is not None: + choices.append(choice) else: pass # don't fail request if item in list is not supported @@ -447,9 +517,25 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): self, tools: List[Dict[str, Any]] ) -> List["ALL_RESPONSES_API_TOOL_PARAMS"]: """Convert chat completion tools to responses API tools format""" - responses_tools = [] + responses_tools: List["ALL_RESPONSES_API_TOOL_PARAMS"] = [] for tool in tools: - responses_tools.append(tool) + # convert function tool from chat completion to responses API format + if tool.get("type") == "function": + function_tool = cast( + ChatCompletionToolParamFunctionChunk, tool.get("function") + ) + responses_tools.append( + FunctionToolParam( + name=function_tool["name"], + parameters=function_tool.get("parameters"), + strict=function_tool.get("strict"), + type="function", + description=function_tool.get("description"), + ) + ) + else: + responses_tools.append(tool) # type: ignore + return cast(List["ALL_RESPONSES_API_TOOL_PARAMS"], responses_tools) def _map_reasoning_effort(self, reasoning_effort: str) -> Optional[Reasoning]: diff --git a/litellm/constants.py b/litellm/constants.py index 3ff9a4b6fb0..d1858bdfd84 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -87,6 +87,35 @@ MAX_TOKEN_TRIMMING_ATTEMPTS = int( ########## Networking constants ############################################################## _DEFAULT_TTL_FOR_HTTPX_CLIENTS = 3600 # 1 hour, re-use the same httpx client for 1 hour +# Aiohttp connection pooling constants +AIOHTTP_CONNECTOR_LIMIT = int(os.getenv("AIOHTTP_CONNECTOR_LIMIT", 0)) +AIOHTTP_KEEPALIVE_TIMEOUT = int(os.getenv("AIOHTTP_KEEPALIVE_TIMEOUT", 120)) +AIOHTTP_TTL_DNS_CACHE = int(os.getenv("AIOHTTP_TTL_DNS_CACHE", 300)) + +# SSL/TLS cipher configuration for faster handshakes +# Strategy: Strongly prefer fast modern ciphers, but allow fallback to commonly supported ones +# This balances performance with broad compatibility +DEFAULT_SSL_CIPHERS = os.getenv( + "LITELLM_SSL_CIPHERS", + # Priority 1: TLS 1.3 ciphers (fastest, ~50ms handshake) + "TLS_AES_256_GCM_SHA384:" # Fastest observed in testing + "TLS_AES_128_GCM_SHA256:" # Slightly faster than 256-bit + "TLS_CHACHA20_POLY1305_SHA256:" # Fast on ARM/mobile + # Priority 2: TLS 1.2 ECDHE+GCM (fast, ~100ms handshake, widely supported) + "ECDHE-RSA-AES256-GCM-SHA384:" + "ECDHE-RSA-AES128-GCM-SHA256:" + "ECDHE-ECDSA-AES256-GCM-SHA384:" + "ECDHE-ECDSA-AES128-GCM-SHA256:" + # Priority 3: Additional modern ciphers (good balance) + "ECDHE-RSA-CHACHA20-POLY1305:" + "ECDHE-ECDSA-CHACHA20-POLY1305:" + # Priority 4: Widely compatible fallbacks (slower but universally supported) + "ECDHE-RSA-AES256-SHA384:" # Common fallback + "ECDHE-RSA-AES128-SHA256:" # Very widely supported + "AES256-GCM-SHA384:" # Non-PFS fallback (compatibility) + "AES128-GCM-SHA256", # Last resort (maximum compatibility) +) + ########### v2 Architecture constants for managing writing updates to the database ########### REDIS_UPDATE_BUFFER_KEY = "litellm_spend_update_buffer" REDIS_DAILY_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_spend_update_buffer" @@ -496,6 +525,7 @@ openai_compatible_providers: List = [ "vercel_ai_gateway", "aiml", "wandb", + "cometapi", ] openai_text_completion_compatible_providers: List = ( [ # providers that support `/v1/completions` @@ -820,6 +850,7 @@ BEDROCK_CONVERSE_MODELS = [ "deepseek.v3-v1:0", "openai.gpt-oss-20b-1:0", "openai.gpt-oss-120b-1:0", + "anthropic.claude-haiku-4-5-20251001-v1:0", "anthropic.claude-sonnet-4-5-20250929-v1:0", "anthropic.claude-opus-4-1-20250805-v1:0", "anthropic.claude-opus-4-20250514-v1:0", @@ -871,6 +902,7 @@ bedrock_embedding_models: set = set( "amazon.titan-embed-text-v1", "cohere.embed-english-v3", "cohere.embed-multilingual-v3", + "cohere.embed-v4:0", "twelvelabs.marengo-embed-2-7-v1:0", ] ) @@ -1027,6 +1059,12 @@ PROXY_BATCH_WRITE_AT = int(os.getenv("PROXY_BATCH_WRITE_AT", 10)) # in seconds DEFAULT_HEALTH_CHECK_INTERVAL = int( os.getenv("DEFAULT_HEALTH_CHECK_INTERVAL", 300) ) # 5 minutes +DEFAULT_SHARED_HEALTH_CHECK_TTL = int( + os.getenv("DEFAULT_SHARED_HEALTH_CHECK_TTL", 300) +) # 5 minutes - TTL for cached health check results +DEFAULT_SHARED_HEALTH_CHECK_LOCK_TTL = int( + os.getenv("DEFAULT_SHARED_HEALTH_CHECK_LOCK_TTL", 60) +) # 1 minute - TTL for health check lock PROMETHEUS_FALLBACK_STATS_SEND_TIME_HOURS = int( os.getenv("PROMETHEUS_FALLBACK_STATS_SEND_TIME_HOURS", 9) ) diff --git a/litellm/experimental_mcp_client/client.py b/litellm/experimental_mcp_client/client.py index 225349b4e8a..6aa671a5011 100644 --- a/litellm/experimental_mcp_client/client.py +++ b/litellm/experimental_mcp_client/client.py @@ -5,8 +5,9 @@ LiteLLM Proxy uses this MCP Client to connnect to other MCP servers. import asyncio import base64 from datetime import timedelta -from typing import Dict, List, Optional, Union +from typing import Callable, Dict, List, Optional, Union +import httpx from mcp import ClientSession, StdioServerParameters from mcp.client.sse import sse_client from mcp.client.stdio import stdio_client @@ -17,6 +18,8 @@ from mcp.types import TextContent from mcp.types import Tool as MCPTool from litellm._logging import verbose_logger +from litellm.llms.custom_httpx.http_handler import get_ssl_configuration +from litellm.types.llms.custom_http import VerifyTypes from litellm.types.mcp import ( MCPAuth, MCPAuthType, @@ -48,6 +51,7 @@ class MCPClient: timeout: float = 60.0, stdio_config: Optional[MCPStdioConfig] = None, extra_headers: Optional[Dict[str, str]] = None, + ssl_verify: Optional[VerifyTypes] = None, ): self.server_url: str = server_url self.transport_type: MCPTransport = transport_type @@ -62,6 +66,7 @@ class MCPClient: self._task: Optional[asyncio.Task] = None self.stdio_config: Optional[MCPStdioConfig] = stdio_config self.extra_headers: Optional[Dict[str, str]] = extra_headers + self.ssl_verify: Optional[VerifyTypes] = ssl_verify # handle the basic auth value if provided if auth_value: self.update_auth_value(auth_value) @@ -81,8 +86,15 @@ class MCPClient: async def connect(self): """Initialize the transport and session.""" if self._session: + verbose_logger.debug( + f"MCP client already connected to {self.server_url or 'stdio'}" + ) return # Already connected + verbose_logger.info( + f"MCP client connecting to {self.server_url or 'stdio'} via {self.transport_type}" + ) + try: if self.transport_type == MCPTransport.stdio: # For stdio transport, use stdio_client with command-line parameters @@ -102,12 +114,17 @@ class MCPClient: ) self._session = await self._session_ctx.__aenter__() await self._session.initialize() + verbose_logger.info( + f"MCP client successfully connected via stdio: {self.stdio_config.get('command', '')}" + ) elif self.transport_type == MCPTransport.sse: headers = self._get_auth_headers() + httpx_client_factory = self._create_httpx_client_factory() self._transport_ctx = sse_client( url=self.server_url, timeout=self.timeout, headers=headers, + httpx_client_factory=httpx_client_factory, ) self._transport = await self._transport_ctx.__aenter__() self._session_ctx = ClientSession( @@ -115,15 +132,20 @@ class MCPClient: ) self._session = await self._session_ctx.__aenter__() await self._session.initialize() + verbose_logger.info( + f"MCP client successfully connected via SSE to {self.server_url}" + ) else: # http headers = self._get_auth_headers() + httpx_client_factory = self._create_httpx_client_factory() verbose_logger.debug( - "litellm headers for streamablehttp_client: ", headers + "litellm headers for streamablehttp_client: %s", headers ) self._transport_ctx = streamablehttp_client( url=self.server_url, timeout=timedelta(seconds=self.timeout), headers=headers, + httpx_client_factory=httpx_client_factory, ) self._transport = await self._transport_ctx.__aenter__() self._session_ctx = ClientSession( @@ -131,6 +153,9 @@ class MCPClient: ) self._session = await self._session_ctx.__aenter__() await self._session.initialize() + verbose_logger.info( + f"MCP client successfully connected via HTTP to {self.server_url}" + ) except ValueError as e: # Re-raise ValueError exceptions (like missing stdio_config) verbose_logger.warning(f"MCP client connection failed: {str(e)}") @@ -150,7 +175,12 @@ class MCPClient: async def disconnect(self): """Clean up session and connections.""" + verbose_logger.info( + f"MCP client disconnecting from {self.server_url or 'stdio'}" + ) + if self._task and not self._task.done(): + verbose_logger.debug("MCP client cancelling background task") self._task.cancel() try: await self._task @@ -159,16 +189,24 @@ class MCPClient: if self._session: try: + verbose_logger.debug("MCP client closing session") await self._session_ctx.__aexit__(None, None, None) # type: ignore - except Exception: + except Exception as e: + verbose_logger.debug( + f"Error closing MCP session: {type(e).__name__}: {str(e)}" + ) pass self._session = None self._session_ctx = None if self._transport_ctx: try: + verbose_logger.debug("MCP client closing transport") await self._transport_ctx.__aexit__(None, None, None) - except Exception: + except Exception as e: + verbose_logger.debug( + f"Error closing MCP transport: {type(e).__name__}: {str(e)}" + ) pass self._transport_ctx = None self._transport = None @@ -215,27 +253,92 @@ class MCPClient: return headers + def _create_httpx_client_factory(self) -> Callable[..., httpx.AsyncClient]: + """ + Create a custom httpx client factory that uses LiteLLM's SSL configuration. + + This factory follows the same CA bundle path logic as http_handler.py: + 1. Check ssl_verify parameter (can be SSLContext, bool, or path to CA bundle) + 2. Check SSL_VERIFY environment variable + 3. Check SSL_CERT_FILE environment variable + 4. Fall back to certifi CA bundle + """ + + def factory( + *, + headers: Optional[Dict[str, str]] = None, + timeout: Optional[httpx.Timeout] = None, + auth: Optional[httpx.Auth] = None, + ) -> httpx.AsyncClient: + """Create an httpx.AsyncClient with LiteLLM's SSL configuration.""" + # Get unified SSL configuration using the same logic as http_handler.py + ssl_config = get_ssl_configuration(self.ssl_verify) + + verbose_logger.debug( + f"MCP client using SSL configuration: {type(ssl_config).__name__}" + ) + + return httpx.AsyncClient( + headers=headers, + timeout=timeout, + auth=auth, + verify=ssl_config, + follow_redirects=True, + ) + + return factory + async def list_tools(self) -> List[MCPTool]: """List available tools from the server.""" + verbose_logger.debug( + f"MCP client listing tools from {self.server_url or 'stdio'}" + ) + if not self._session: + verbose_logger.debug("MCP client session not found, attempting to connect") try: await self.connect() except Exception as e: - verbose_logger.warning(f"MCP client connection failed: {str(e)}") + verbose_logger.error( + f"MCP client connection failed during list_tools: {type(e).__name__}: {str(e)}" + ) return [] if self._session is None: - verbose_logger.warning("MCP client session is not initialized") + verbose_logger.error( + "MCP client session is not initialized after connection attempt" + ) return [] try: result = await self._session.list_tools() + tool_count = len(result.tools) + tool_names = [tool.name for tool in result.tools] + verbose_logger.info( + f"MCP client listed {tool_count} tools from {self.server_url or 'stdio'}: {tool_names}" + ) return result.tools except asyncio.CancelledError: + verbose_logger.warning("MCP client list_tools was cancelled") await self.disconnect() raise except Exception as e: - verbose_logger.warning(f"MCP client list_tools failed: {str(e)}") + error_type = type(e).__name__ + verbose_logger.error( + f"MCP client list_tools failed - " + f"Error Type: {error_type}, " + f"Error: {str(e)}, " + f"Server: {self.server_url or 'stdio'}, " + f"Transport: {self.transport_type}" + ) + + # Check if it's a stream/connection error + if "BrokenResourceError" in error_type or "Broken" in error_type: + verbose_logger.error( + "MCP client detected broken connection/stream during list_tools - " + "the MCP server may have crashed, disconnected, or timed out" + ) + await self.disconnect() # Return empty list instead of raising to allow graceful degradation return [] @@ -246,17 +349,28 @@ class MCPClient: """ Call an MCP Tool. """ + verbose_logger.info( + f"MCP client calling tool '{call_tool_request_params.name}' with arguments: {call_tool_request_params.arguments}" + ) + if not self._session: + verbose_logger.warning( + "MCP client session not found, attempting to connect" + ) try: await self.connect() except Exception as e: - verbose_logger.warning(f"MCP client connection failed: {str(e)}") + verbose_logger.error( + f"MCP client connection failed before tool call: {type(e).__name__}: {str(e)}" + ) return MCPCallToolResult( content=[TextContent(type="text", text=f"{str(e)}")], isError=True ) if self._session is None: - verbose_logger.warning("MCP client session is not initialized") + verbose_logger.error( + "MCP client session is not initialized after connection attempt" + ) return MCPCallToolResult( content=[ TextContent( @@ -266,22 +380,59 @@ class MCPClient: isError=True, ) + # Check session and transport state before calling tool + verbose_logger.debug( + f"MCP client state before tool call - " + f"session: {'active' if self._session else 'none'}, " + f"transport: {'active' if self._transport else 'none'}, " + f"session_ctx: {'active' if self._session_ctx else 'none'}, " + f"transport_ctx: {'active' if self._transport_ctx else 'none'}" + ) + try: + verbose_logger.debug("MCP client sending tool call to session") tool_result = await self._session.call_tool( name=call_tool_request_params.name, arguments=call_tool_request_params.arguments, ) + verbose_logger.info( + f"MCP client tool call '{call_tool_request_params.name}' completed successfully" + ) return tool_result except asyncio.CancelledError: + verbose_logger.warning("MCP client tool call was cancelled") await self.disconnect() raise except Exception as e: - verbose_logger.warning(f"MCP client call_tool failed: {str(e)}") + import traceback + + error_trace = traceback.format_exc() + verbose_logger.debug(f"MCP client tool call traceback:\n{error_trace}") + + # Log detailed error information + error_type = type(e).__name__ + verbose_logger.error( + f"MCP client call_tool failed - " + f"Error Type: {error_type}, " + f"Error: {str(e)}, " + f"Tool: {call_tool_request_params.name}, " + f"Server: {self.server_url or 'stdio'}, " + f"Transport: {self.transport_type}" + ) + + # Check if it's a stream/connection error + if "BrokenResourceError" in error_type or "Broken" in error_type: + verbose_logger.error( + "MCP client detected broken connection/stream - " + "the MCP server may have crashed, disconnected, or timed out. " + "Session and transport will be disconnected." + ) + await self.disconnect() # Return a default error result instead of raising return MCPCallToolResult( content=[ - TextContent(type="text", text=f"{str(e)}") + TextContent(type="text", text=f"{error_type}: {str(e)}") ], # Empty content for error case isError=True, ) diff --git a/litellm/files/main.py b/litellm/files/main.py index 18be2c702bf..7bc2c136726 100644 --- a/litellm/files/main.py +++ b/litellm/files/main.py @@ -18,6 +18,7 @@ from litellm import get_secret_str from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj from litellm.llms.azure.files.handler import AzureOpenAIFilesAPI +from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler from litellm.llms.custom_httpx.llm_http_handler import BaseLLMHTTPHandler from litellm.llms.openai.openai import FileDeleted, FileObject, OpenAIFilesAPI from litellm.llms.vertex_ai.files.handler import VertexAIFilesHandler @@ -268,6 +269,7 @@ def create_file( raise e +@client async def afile_retrieve( file_id: str, custom_llm_provider: Literal["openai", "azure"] = "openai", @@ -308,6 +310,7 @@ async def afile_retrieve( raise e +@client def file_retrieve( file_id: str, custom_llm_provider: Literal["openai", "azure"] = "openai", @@ -422,6 +425,7 @@ def file_retrieve( # Delete file +@client async def afile_delete( file_id: str, custom_llm_provider: Literal["openai", "azure"] = "openai", @@ -462,6 +466,7 @@ async def afile_delete( raise e +@client def file_delete( file_id: str, custom_llm_provider: Literal["openai", "azure"] = "openai", @@ -577,6 +582,7 @@ def file_delete( # List files +@client async def afile_list( custom_llm_provider: Literal["openai", "azure"] = "openai", purpose: Optional[str] = None, @@ -617,6 +623,7 @@ async def afile_list( raise e +@client def file_list( custom_llm_provider: Literal["openai", "azure"] = "openai", purpose: Optional[str] = None, @@ -729,6 +736,7 @@ def file_list( raise e +@client async def afile_content( file_id: str, custom_llm_provider: Literal["openai", "azure", "vertex_ai"] = "openai", @@ -771,6 +779,7 @@ async def afile_content( raise e +@client def file_content( file_id: str, model: Optional[str] = None, diff --git a/litellm/google_genai/main.py b/litellm/google_genai/main.py index a746cc2077e..8a9cb809404 100644 --- a/litellm/google_genai/main.py +++ b/litellm/google_genai/main.py @@ -405,6 +405,7 @@ async def agenerate_content_stream( config=setup_result.generate_content_config_dict, litellm_params=setup_result.litellm_params, tools=tools, + stream=True, **kwargs, ) ) @@ -485,6 +486,7 @@ def generate_content_stream( config=setup_result.generate_content_config_dict, _is_async=_is_async, litellm_params=setup_result.litellm_params, + stream=True, **kwargs, ) diff --git a/litellm/integrations/opentelemetry.py b/litellm/integrations/opentelemetry.py index a091633d7e2..e825f89f56e 100644 --- a/litellm/integrations/opentelemetry.py +++ b/litellm/integrations/opentelemetry.py @@ -576,7 +576,7 @@ class OpenTelemetry(CustomLogger): return litellm_params = kwargs.get("litellm_params", {}) - metadata = litellm_params.get("metadata", {}) + metadata = litellm_params.get("metadata") or {} generation_name = metadata.get("generation_name") raw_span_name = generation_name if generation_name else RAW_REQUEST_SPAN_NAME @@ -1178,7 +1178,7 @@ class OpenTelemetry(CustomLogger): def _get_span_name(self, kwargs): litellm_params = kwargs.get("litellm_params", {}) - metadata = litellm_params.get("metadata", {}) + metadata = litellm_params.get("metadata") or {} generation_name = metadata.get("generation_name") if generation_name: diff --git a/litellm/integrations/posthog.py b/litellm/integrations/posthog.py index 5298e538a72..c609d30ccff 100644 --- a/litellm/integrations/posthog.py +++ b/litellm/integrations/posthog.py @@ -11,11 +11,10 @@ For batching specific details see CustomBatchLogger class import asyncio import os -from litellm._uuid import uuid -from typing import Any, Dict, Optional - +from typing import Any, Dict, Optional, Tuple from litellm._logging import verbose_logger +from litellm._uuid import uuid from litellm.integrations.custom_batch_logger import CustomBatchLogger from litellm.llms.custom_httpx.http_handler import ( _get_httpx_client, @@ -26,7 +25,7 @@ from litellm.types.integrations.posthog import ( POSTHOG_MAX_BATCH_SIZE, PostHogEventPayload, ) -from litellm.types.utils import StandardLoggingPayload +from litellm.types.utils import StandardCallbackDynamicParams, StandardLoggingPayload class PostHogLogger(CustomBatchLogger): @@ -72,17 +71,21 @@ class PostHogLogger(CustomBatchLogger): verbose_logger.debug( "PostHog: Sync logging - Enters logging function for model %s", kwargs ) - + + api_key, api_url = self._get_credentials_for_request(kwargs) + if api_key is None or api_url is None: + raise Exception("PostHog credentials not found in kwargs") event_payload = self.create_posthog_event_payload(kwargs) headers = { "Content-Type": "application/json", } - payload = self._create_posthog_payload([event_payload]) + payload = self._create_posthog_payload([event_payload], api_key) + capture_url = f"{api_url.rstrip('/')}/batch/" response = self.sync_client.post( - url=self.capture_url, + url=capture_url, json=payload, headers=headers, ) @@ -92,9 +95,9 @@ class PostHogLogger(CustomBatchLogger): raise Exception( f"Response from PostHog API status_code: {response.status_code}, text: {response.text}" ) - + verbose_logger.debug("PostHog: Sync event successfully sent") - + except Exception as e: verbose_logger.exception(f"PostHog Sync Layer Error - {str(e)}") @@ -122,9 +125,15 @@ class PostHogLogger(CustomBatchLogger): async def _log_async_event(self, kwargs, response_obj=None, start_time=0.0, end_time=0.0): # Note: response_obj, start_time, end_time not used - all data comes from kwargs + api_key, api_url = self._get_credentials_for_request(kwargs) event_payload = self.create_posthog_event_payload(kwargs) - self.log_queue.append(event_payload) + # Store event with its credentials for batch sending + self.log_queue.append({ + "event": event_payload, + "api_key": api_key, + "api_url": api_url + }) verbose_logger.debug( f"PostHog, event added to queue. Will flush in {self.flush_interval} seconds..." ) @@ -257,16 +266,42 @@ class PostHogLogger(CustomBatchLogger): metadata = self._extract_metadata(kwargs) user_id = self._safe_get(metadata, "user_id") if user_id: - return str(user_id) + return str(user_id) end_user = self._safe_get(standard_logging_object, "end_user") if end_user: return str(end_user) trace_id = self._safe_get(standard_logging_object, "trace_id") if trace_id: - return str(trace_id) - + return str(trace_id) + return self._safe_uuid() + def _get_credentials_for_request(self, kwargs: Dict[str, Any]) -> Tuple[Optional[str], Optional[str]]: + """ + Get PostHog credentials for this request. + + Checks for per-request credentials in standard_callback_dynamic_params, + falls back to instance defaults from environment variables. + + Args: + kwargs: Request kwargs containing standard_callback_dynamic_params + + Returns: + tuple[str, str]: (api_key, api_url) + """ + standard_callback_dynamic_params: Optional[StandardCallbackDynamicParams] = ( + kwargs.get("standard_callback_dynamic_params", None) + ) + + if standard_callback_dynamic_params is not None: + api_key = standard_callback_dynamic_params.get("posthog_api_key") or self.POSTHOG_API_KEY + api_url = standard_callback_dynamic_params.get("posthog_api_url") or self.posthog_host + else: + api_key = self.POSTHOG_API_KEY + api_url = self.posthog_host + + return api_key, api_url + async def async_send_batch(self): """ Sends the in memory logs queue to PostHog API @@ -282,23 +317,34 @@ class PostHogLogger(CustomBatchLogger): f"PostHog: Sending batch of {len(self.log_queue)} events" ) - headers = { - "Content-Type": "application/json", - } + # Group events by credentials for batch sending + batches_by_credentials: Dict[tuple[str, str], list] = {} + for item in self.log_queue: + key = (item["api_key"], item["api_url"]) + if key not in batches_by_credentials: + batches_by_credentials[key] = [] + batches_by_credentials[key].append(item["event"]) - payload = self._create_posthog_payload(list(self.log_queue)) + # Send each batch to its respective PostHog instance + for (api_key, api_url), events in batches_by_credentials.items(): + headers = { + "Content-Type": "application/json", + } - response = await self.async_client.post( - url=self.capture_url, - json=payload, - headers=headers, - ) - response.raise_for_status() + payload = self._create_posthog_payload(events, api_key) + capture_url = f"{api_url.rstrip('/')}/batch/" - if response.status_code != 200: - raise Exception( - f"Response from PostHog API status_code: {response.status_code}, text: {response.text}" + response = await self.async_client.post( + url=capture_url, + json=payload, + headers=headers, ) + response.raise_for_status() + + if response.status_code != 200: + raise Exception( + f"Response from PostHog API status_code: {response.status_code}, text: {response.text}" + ) verbose_logger.debug( f"PostHog: Batch of {len(self.log_queue)} events successfully sent" @@ -324,8 +370,8 @@ class PostHogLogger(CustomBatchLogger): def _safe_uuid(self) -> str: return str(uuid.uuid4()) - def _create_posthog_payload(self, events: list) -> Dict[str, Any]: - return {"api_key": self.POSTHOG_API_KEY, "batch": events} + def _create_posthog_payload(self, events: list, api_key: str) -> Dict[str, Any]: + return {"api_key": api_key, "batch": events} def _safe_get(self, obj: Any, key: str, default: Any = None) -> Any: if obj is None or not hasattr(obj, 'get'): diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index b5ab5aeefe3..eafcab88557 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -81,12 +81,12 @@ from litellm.types.llms.openai import ( ) from litellm.types.mcp import MCPPostCallResponseObject from litellm.types.rerank import RerankResponse -from litellm.types.router import CustomPricingLiteLLMParams from litellm.types.utils import ( CachingDetails, CallTypes, CostBreakdown, CostResponseTypes, + CustomPricingLiteLLMParams, DynamicPromptManagementParamLiteral, EmbeddingResponse, GuardrailStatus, @@ -4040,6 +4040,7 @@ class StandardLoggingPayloadSetup: usage_object=usage_object, requester_custom_headers=None, cold_storage_object_key=None, + user_api_key_auth_metadata=None, ) if isinstance(metadata, dict): # Filter the metadata dictionary to include only the specified keys @@ -4755,6 +4756,7 @@ def get_standard_logging_metadata( requester_custom_headers=None, user_api_key_request_route=None, cold_storage_object_key=None, + user_api_key_auth_metadata=None, ) if isinstance(metadata, dict): # Update the clean_metadata with values from input metadata that match StandardLoggingMetadata fields diff --git a/litellm/litellm_core_utils/llm_cost_calc/utils.py b/litellm/litellm_core_utils/llm_cost_calc/utils.py index 626a3f3625f..2fd0b44962e 100644 --- a/litellm/litellm_core_utils/llm_cost_calc/utils.py +++ b/litellm/litellm_core_utils/llm_cost_calc/utils.py @@ -693,6 +693,15 @@ class CostCalculatorUtils: model=model, image_response=completion_response, ) + elif custom_llm_provider == litellm.LlmProviders.COMETAPI.value: + from litellm.llms.cometapi.image_generation.cost_calculator import ( + cost_calculator as cometapi_image_cost_calculator, + ) + + return cometapi_image_cost_calculator( + model=model, + image_response=completion_response, + ) elif custom_llm_provider == litellm.LlmProviders.GEMINI.value: from litellm.llms.gemini.image_generation.cost_calculator import ( cost_calculator as gemini_image_cost_calculator, diff --git a/litellm/litellm_core_utils/model_response_utils.py b/litellm/litellm_core_utils/model_response_utils.py index 5f6fced9d44..974d12aef6f 100644 --- a/litellm/litellm_core_utils/model_response_utils.py +++ b/litellm/litellm_core_utils/model_response_utils.py @@ -84,7 +84,9 @@ def _has_meaningful_content(value: Any) -> bool: return False if isinstance(value, str): - return len(value.strip()) > 0 + # Don't strip whitespace - preserve all content including newlines, spaces, etc. + # Even pure whitespace characters like '\n' or ' ' are meaningful content + return len(value) > 0 if isinstance(value, (list, dict)): return len(value) > 0 diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index c1d8a1cd41b..d2cad0abd93 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -2,7 +2,6 @@ import copy import json import mimetypes import re -from litellm._uuid import uuid import xml.etree.ElementTree as ET from enum import Enum from typing import Any, List, Optional, Tuple, cast, overload @@ -13,6 +12,7 @@ import litellm import litellm.types import litellm.types.llms from litellm import verbose_logger +from litellm._uuid import uuid from litellm.llms.custom_httpx.http_handler import HTTPHandler, get_async_httpx_client from litellm.types.files import get_file_extension_from_mime_type from litellm.types.llms.anthropic import * @@ -232,7 +232,6 @@ def ollama_pt( ## MERGE CONSECUTIVE ASSISTANT CONTENT ## while msg_i < len(messages) and messages[msg_i]["role"] == "assistant": assistant_content_str += convert_content_list_to_str(messages[msg_i]) - msg_i += 1 tool_calls = messages[msg_i].get("tool_calls") ollama_tool_calls = [] @@ -258,7 +257,7 @@ def ollama_pt( f"Tool Calls: {json.dumps(ollama_tool_calls, indent=2)}" ) - msg_i += 1 + msg_i += 1 if assistant_content_str: prompt += f"### Assistant:\n{assistant_content_str}\n\n" @@ -365,62 +364,20 @@ def phind_codellama_pt(messages): return prompt -def hf_chat_template( # noqa: PLR0915 - model: str, messages: list, chat_template: Optional[Any] = None -): - # Define Jinja2 environment - env = ImmutableSandboxedEnvironment() - - def raise_exception(message): - raise Exception(f"Error message - {message}") - - # Create a template object from the template text - env.globals["raise_exception"] = raise_exception - - ## get the tokenizer config from huggingface - bos_token = "" - eos_token = "" - if chat_template is None: - - def _get_tokenizer_config(hf_model_name): - try: - url = f"https://huggingface.co/{hf_model_name}/raw/main/tokenizer_config.json" - # Make a GET request to fetch the JSON data - client = HTTPHandler(concurrent_limit=1) - - response = client.get(url) - except Exception as e: - raise e - if response.status_code == 200: - # Parse the JSON data - tokenizer_config = json.loads(response.content) - return {"status": "success", "tokenizer": tokenizer_config} - else: - return {"status": "failure"} - - if model in litellm.known_tokenizer_config: - tokenizer_config = litellm.known_tokenizer_config[model] - else: - tokenizer_config = _get_tokenizer_config(model) - litellm.known_tokenizer_config.update({model: tokenizer_config}) - - if ( - tokenizer_config["status"] == "failure" - or "chat_template" not in tokenizer_config["tokenizer"] - ): - raise Exception("No chat template found") - ## read the bos token, eos token and chat template from the json - tokenizer_config = tokenizer_config["tokenizer"] # type: ignore - - bos_token = tokenizer_config["bos_token"] # type: ignore - if bos_token is not None and not isinstance(bos_token, str): - if isinstance(bos_token, dict): - bos_token = bos_token.get("content", None) - eos_token = tokenizer_config["eos_token"] # type: ignore - if eos_token is not None and not isinstance(eos_token, str): - if isinstance(eos_token, dict): - eos_token = eos_token.get("content", None) - chat_template = tokenizer_config["chat_template"] # type: ignore +def _render_chat_template(env, chat_template: str, bos_token: str, eos_token: str, messages: list) -> str: + """ + Shared template rendering logic for both sync and async hf_chat_template + + Args: + env: Jinja2 environment + chat_template: Chat template string + bos_token: Beginning of sequence token + eos_token: End of sequence token + messages: Messages to render + + Returns: + Rendered template string + """ try: template = env.from_string(chat_template) # type: ignore except Exception as e: @@ -435,7 +392,6 @@ def hf_chat_template( # noqa: PLR0915 bos_token="", ) return True - # This will be raised if Jinja attempts to render the system message and it can't except Exception: return False @@ -469,7 +425,7 @@ def hf_chat_template( # noqa: PLR0915 ) except Exception as e: if "Conversation roles must alternate user/assistant" in str(e): - # reformat messages to ensure user/assistant are alternating, if there's either 2 consecutive 'user' messages or 2 consecutive 'assistant' message, add a blank 'user' or 'assistant' message to ensure compatibility + # reformat messages to ensure user/assistant are alternating new_messages = [] for i in range(len(reformatted_messages) - 1): new_messages.append(reformatted_messages[i]) @@ -495,6 +451,188 @@ def hf_chat_template( # noqa: PLR0915 ) # don't use verbose_logger.exception, if exception is raised +async def _afetch_and_extract_template( + model: str, chat_template: Optional[Any], get_config_fn, get_template_fn +) -> Tuple[str, str, str]: + """ + Async version: Fetch template and tokens from HuggingFace. + + Returns: (chat_template, bos_token, eos_token) + """ + from litellm.litellm_core_utils.prompt_templates.huggingface_template_handler import ( + _extract_token_value, + ) + + bos_token = "" + eos_token = "" + + if chat_template is None: + # Fetch or retrieve cached tokenizer config + if model in litellm.known_tokenizer_config: + tokenizer_config = litellm.known_tokenizer_config[model] + else: + tokenizer_config = await get_config_fn(hf_model_name=model) + litellm.known_tokenizer_config.update({model: tokenizer_config}) + + # Try to get chat template from tokenizer_config.json first + if ( + tokenizer_config.get("status") == "success" + and "tokenizer" in tokenizer_config + and isinstance(tokenizer_config["tokenizer"], dict) + and "chat_template" in tokenizer_config["tokenizer"] + ): + tokenizer_data: dict = tokenizer_config["tokenizer"] # type: ignore + bos_token = _extract_token_value( + token_value=tokenizer_data.get("bos_token") + ) + eos_token = _extract_token_value( + token_value=tokenizer_data.get("eos_token") + ) + chat_template = tokenizer_data["chat_template"] + else: + # Fallback: Try to fetch chat template from separate .jinja file + template_result = await get_template_fn(hf_model_name=model) + if template_result.get("status") == "success": + chat_template = template_result["chat_template"] + # Still try to get tokens from tokenizer_config if available + if ( + tokenizer_config.get("status") == "success" + and "tokenizer" in tokenizer_config + and isinstance(tokenizer_config["tokenizer"], dict) + ): + tokenizer_data: dict = tokenizer_config["tokenizer"] # type: ignore + bos_token = _extract_token_value( + token_value=tokenizer_data.get("bos_token") + ) + eos_token = _extract_token_value( + token_value=tokenizer_data.get("eos_token") + ) + else: + raise Exception("No chat template found") + + return chat_template, bos_token, eos_token # type: ignore + + +def _fetch_and_extract_template( + model: str, chat_template: Optional[Any], get_config_fn, get_template_fn +) -> Tuple[str, str, str]: + """ + Sync version: Fetch template and tokens from HuggingFace. + + Returns: (chat_template, bos_token, eos_token) + """ + from litellm.litellm_core_utils.prompt_templates.huggingface_template_handler import ( + _extract_token_value, + ) + + bos_token = "" + eos_token = "" + + if chat_template is None: + # Fetch or retrieve cached tokenizer config + if model in litellm.known_tokenizer_config: + tokenizer_config = litellm.known_tokenizer_config[model] + else: + tokenizer_config = get_config_fn(hf_model_name=model) + litellm.known_tokenizer_config.update({model: tokenizer_config}) + + # Try to get chat template from tokenizer_config.json first + if ( + tokenizer_config.get("status") == "success" + and "tokenizer" in tokenizer_config + and isinstance(tokenizer_config["tokenizer"], dict) + and "chat_template" in tokenizer_config["tokenizer"] + ): + tokenizer_data: dict = tokenizer_config["tokenizer"] # type: ignore + bos_token = _extract_token_value( + token_value=tokenizer_data.get("bos_token") + ) + eos_token = _extract_token_value( + token_value=tokenizer_data.get("eos_token") + ) + chat_template = tokenizer_data["chat_template"] + else: + # Fallback: Try to fetch chat template from separate .jinja file + template_result = get_template_fn(hf_model_name=model) + if template_result.get("status") == "success": + chat_template = template_result["chat_template"] + # Still try to get tokens from tokenizer_config if available + if ( + tokenizer_config.get("status") == "success" + and "tokenizer" in tokenizer_config + and isinstance(tokenizer_config["tokenizer"], dict) + ): + tokenizer_data: dict = tokenizer_config["tokenizer"] # type: ignore + bos_token = _extract_token_value( + token_value=tokenizer_data.get("bos_token") + ) + eos_token = _extract_token_value( + token_value=tokenizer_data.get("eos_token") + ) + else: + raise Exception("No chat template found") + + return chat_template, bos_token, eos_token # type: ignore + + +async def ahf_chat_template( + model: str, messages: list, chat_template: Optional[Any] = None +): + """HuggingFace chat template (async version)""" + from litellm.litellm_core_utils.prompt_templates.huggingface_template_handler import ( + _aget_chat_template_file, + _aget_tokenizer_config, + strftime_now, + ) + + env = ImmutableSandboxedEnvironment() + env.globals["raise_exception"] = lambda msg: Exception(f"Error message - {msg}") + env.globals["strftime_now"] = strftime_now + + template, bos_token, eos_token = await _afetch_and_extract_template( + model=model, + chat_template=chat_template, + get_config_fn=_aget_tokenizer_config, + get_template_fn=_aget_chat_template_file, + ) + return _render_chat_template( + env=env, + chat_template=template, + bos_token=bos_token, + eos_token=eos_token, + messages=messages, + ) + + +def hf_chat_template( + model: str, messages: list, chat_template: Optional[Any] = None +): + """HuggingFace chat template (sync version)""" + from litellm.litellm_core_utils.prompt_templates.huggingface_template_handler import ( + _get_chat_template_file, + _get_tokenizer_config, + strftime_now, + ) + + env = ImmutableSandboxedEnvironment() + env.globals["raise_exception"] = lambda msg: Exception(f"Error message - {msg}") + env.globals["strftime_now"] = strftime_now + + template, bos_token, eos_token = _fetch_and_extract_template( + model=model, + chat_template=chat_template, + get_config_fn=_get_tokenizer_config, + get_template_fn=_get_chat_template_file, + ) + return _render_chat_template( + env=env, + chat_template=template, + bos_token=bos_token, + eos_token=eos_token, + messages=messages, + ) + + def deepseek_r1_pt(messages): return hf_chat_template( model="deepseek-r1/deepseek-r1-7b-instruct", messages=messages @@ -4032,33 +4170,9 @@ def prompt_factory( elif custom_llm_provider == "azure_text": return azure_text_pt(messages=messages) elif custom_llm_provider == "watsonx": - if "granite" in model and "chat" in model: - # granite-13b-chat-v1 and granite-13b-chat-v2 use a specific prompt template - return ibm_granite_pt(messages=messages) - elif "ibm-mistral" in model and "instruct" in model: - # models like ibm-mistral/mixtral-8x7b-instruct-v01-q use the mistral instruct prompt template - return mistral_instruct_pt(messages=messages) - elif "meta-llama/llama-3" in model and "instruct" in model: - # https://llama.meta.com/docs/model-cards-and-prompt-formats/meta-llama-3/ - return custom_prompt( - role_dict={ - "system": { - "pre_message": "<|start_header_id|>system<|end_header_id|>\n", - "post_message": "<|eot_id|>", - }, - "user": { - "pre_message": "<|start_header_id|>user<|end_header_id|>\n", - "post_message": "<|eot_id|>", - }, - "assistant": { - "pre_message": "<|start_header_id|>assistant<|end_header_id|>\n", - "post_message": "<|eot_id|>", - }, - }, - messages=messages, - initial_prompt_value="<|begin_of_text|>", - final_prompt_value="<|start_header_id|>assistant<|end_header_id|>\n", - ) + from litellm.llms.watsonx.chat.transformation import IBMWatsonXChatConfig + return IBMWatsonXChatConfig.apply_prompt_template(model=model, messages=messages) + try: if "meta-llama/llama-2" in model and "chat" in model: return llama_2_chat_pt(messages=messages) diff --git a/litellm/litellm_core_utils/prompt_templates/huggingface_template_handler.py b/litellm/litellm_core_utils/prompt_templates/huggingface_template_handler.py new file mode 100644 index 00000000000..9305d5bbfc1 --- /dev/null +++ b/litellm/litellm_core_utils/prompt_templates/huggingface_template_handler.py @@ -0,0 +1,139 @@ +import json +from datetime import datetime +from typing import Any, Dict, Union + +from litellm.llms.custom_httpx.http_handler import ( + _get_httpx_client, + get_async_httpx_client, +) +from litellm.types.llms.custom_http import httpxSpecialProvider + + +def strftime_now(fmt: str) -> str: + """ + Custom function for templates that need current date/time formatting (e.g., gpt-oss) + + Args: + fmt: Format string for datetime.now().strftime() + + Returns: + Formatted string + """ + return datetime.now().strftime(fmt) + + +def _get_tokenizer_config(hf_model_name: str) -> Dict[str, Any]: + """ + Fetch tokenizer_config.json from HuggingFace (sync) + + Args: + hf_model_name: HuggingFace model name (e.g., 'openai/gpt-oss-120b') + + Returns: + Dict with 'status' and optionally 'tokenizer' keys + """ + try: + url = f"https://huggingface.co/{hf_model_name}/raw/main/tokenizer_config.json" + client = _get_httpx_client() + response = client.get(url=url) + except Exception as e: + raise e + if response.status_code == 200: + tokenizer_config = json.loads(response.content) + return {"status": "success", "tokenizer": tokenizer_config} + else: + return {"status": "failure"} + + +async def _aget_tokenizer_config(hf_model_name: str) -> Dict[str, Any]: + """ + Fetch tokenizer_config.json from HuggingFace (async) + + Args: + hf_model_name: HuggingFace model name (e.g., 'openai/gpt-oss-120b') + + Returns: + Dict with 'status' and optionally 'tokenizer' keys + """ + try: + url = f"https://huggingface.co/{hf_model_name}/raw/main/tokenizer_config.json" + client = get_async_httpx_client( + llm_provider=httpxSpecialProvider.PromptFactory, + ) + response = await client.get(url=url) + except Exception as e: + raise e + if response.status_code == 200: + tokenizer_config = json.loads(response.content) + return {"status": "success", "tokenizer": tokenizer_config} + else: + return {"status": "failure"} + + +def _get_chat_template_file(hf_model_name: str) -> Dict[str, Any]: + """ + Fetch chat template from separate .jinja file (sync) + + Args: + hf_model_name: HuggingFace model name (e.g., 'openai/gpt-oss-120b') + + Returns: + Dict with 'status' and optionally 'chat_template' keys + """ + template_filenames = ["chat_template.jinja", "chat_template.jinja2"] + client = _get_httpx_client() + + for filename in template_filenames: + try: + url = f"https://huggingface.co/{hf_model_name}/raw/main/{filename}" + response = client.get(url=url) + if response.status_code == 200: + return {"status": "success", "chat_template": response.content.decode("utf-8")} + except Exception: + continue + + return {"status": "failure"} + + +async def _aget_chat_template_file(hf_model_name: str) -> Dict[str, Any]: + """ + Fetch chat template from separate .jinja file (async) + + Args: + hf_model_name: HuggingFace model name (e.g., 'openai/gpt-oss-120b') + + Returns: + Dict with 'status' and optionally 'chat_template' keys + """ + template_filenames = ["chat_template.jinja", "chat_template.jinja2"] + client = get_async_httpx_client( + llm_provider=httpxSpecialProvider.PromptFactory, + ) + + for filename in template_filenames: + try: + url = f"https://huggingface.co/{hf_model_name}/raw/main/{filename}" + response = await client.get(url=url) + if response.status_code == 200: + return {"status": "success", "chat_template": response.content.decode("utf-8")} + except Exception: + continue + + return {"status": "failure"} + + +def _extract_token_value(token_value: Union[None, str, Dict[str, Any]]) -> str: + """ + Extract token string from various formats (string, dict, etc.) + + Args: + token_value: Token value in various formats (None, str, or dict with 'content' key) + + Returns: + Extracted token string + """ + if token_value is None or isinstance(token_value, str): + return token_value or "" + if isinstance(token_value, dict): + return token_value.get("content", "") + return "" \ No newline at end of file diff --git a/litellm/litellm_core_utils/sensitive_data_masker.py b/litellm/litellm_core_utils/sensitive_data_masker.py index 05f1a37ca12..ea0bed30416 100644 --- a/litellm/litellm_core_utils/sensitive_data_masker.py +++ b/litellm/litellm_core_utils/sensitive_data_masker.py @@ -75,7 +75,7 @@ class SensitiveDataMasker: masked_data[k] = self._mask_value(str_value) else: masked_data[k] = ( - v if isinstance(v, (int, float, bool, str)) else str(v) + v if isinstance(v, (int, float, bool, str, list)) else str(v) ) except Exception: masked_data[k] = "" @@ -89,12 +89,14 @@ masker = SensitiveDataMasker() data = { "api_key": "sk-1234567890abcdef", "redis_password": "very_secret_pass", - "port": 6379 + "port": 6379, + "tags": ["East US 2", "production", "test"] } masked = masker.mask_dict(data) # Result: { # "api_key": "sk-1****cdef", # "redis_password": "very****pass", -# "port": 6379 +# "port": 6379, +# "tags": ["East US 2", "production", "test"] # } """ diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index c7f0a6da61e..691b46af8da 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -878,7 +878,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): prompt_tokens_details = PromptTokensDetailsWrapper( cached_tokens=cache_read_input_tokens, - cache_creation_tokens=cache_read_input_tokens, + cache_creation_tokens=cache_creation_input_tokens, cache_creation_token_details=cache_creation_token_details, ) completion_token_details = ( diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py b/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py index 5e0dfa9238a..88a63fc6f5d 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py @@ -133,7 +133,6 @@ class LiteLLMMessagesToCompletionTransformationHandler: **kwargs, ) -> Union[AnthropicMessagesResponse, AsyncIterator]: """Handle non-Anthropic models asynchronously using the adapter""" - completion_kwargs = ( LiteLLMMessagesToCompletionTransformationHandler._prepare_completion_kwargs( max_tokens=max_tokens, 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 306bcd9bb2c..47263dc1748 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py @@ -270,7 +270,6 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): processed_chunk.get("delta", {}).get("stop_reason") is not None ): - self.holding_stop_reason_chunk = processed_chunk else: self.chunk_queue.append(processed_chunk) @@ -380,4 +379,11 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): self.current_content_block_start = content_block_start return True + # For parallel tool calls, we'll necessarily have a new content block + # if we get a function name since it signals a new tool call + if block_type == "tool_use" and content_block_start.get("name"): + self.current_content_block_type = block_type + self.current_content_block_start = content_block_start + return True + return False diff --git a/litellm/llms/azure/azure.py b/litellm/llms/azure/azure.py index 3645c16bf8f..7c5b693b453 100644 --- a/litellm/llms/azure/azure.py +++ b/litellm/llms/azure/azure.py @@ -1117,6 +1117,14 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM): status_code=422, message="max retries must be an int" ) + if api_key is None and azure_ad_token_provider is not None: + azure_ad_token = azure_ad_token_provider() + if azure_ad_token: + headers.pop( + "api-key", None + ) + headers["Authorization"] = f"Bearer {azure_ad_token}" + # init AzureOpenAI Client azure_client_params: Dict[str, Any] = self.initialize_azure_sdk_client( litellm_params=litellm_params or {}, diff --git a/litellm/llms/azure/common_utils.py b/litellm/llms/azure/common_utils.py index 04448681b63..dfe662cc165 100644 --- a/litellm/llms/azure/common_utils.py +++ b/litellm/llms/azure/common_utils.py @@ -365,6 +365,11 @@ def get_azure_ad_token( azure_ad_token_provider = get_azure_ad_token_provider(azure_scope=scope) except ValueError: verbose_logger.debug("Azure AD Token Provider could not be used.") + except Exception as e: + verbose_logger.error( + f"Error calling Azure AD token provider: {str(e)}. Follow docs - https://docs.litellm.ai/docs/providers/azure/#azure-ad-token-refresh---defaultazurecredential" + ) + raise e ######################################################### # If litellm.enable_azure_ad_token_refresh is True and no other token provider is available, @@ -561,7 +566,9 @@ class BaseAzureLLM(BaseOpenAILLM): "Using Azure AD token provider based on Service Principal with Secret workflow for Azure Auth" ) try: - azure_ad_token_provider = get_azure_ad_token_provider(azure_scope=scope) + azure_ad_token_provider = get_azure_ad_token_provider( + azure_scope=scope, + ) except ValueError: verbose_logger.debug("Azure AD Token Provider could not be used.") if api_version is None: @@ -665,7 +672,7 @@ class BaseAzureLLM(BaseOpenAILLM): ) -> dict: litellm_params = litellm_params or GenericLiteLLMParams() - # If api-key is already in headers, preserve it + # Check if api-key is already in headers; if so, use it if "api-key" in headers: return headers @@ -693,7 +700,7 @@ class BaseAzureLLM(BaseOpenAILLM): def _get_base_azure_url( api_base: Optional[str], litellm_params: Optional[Union[GenericLiteLLMParams, Dict[str, Any]]], - route: Literal["/openai/responses", "/openai/vector_stores"], + route: Union[Literal["/openai/responses", "/openai/vector_stores"], str], default_api_version: Optional[Union[str, Literal["latest", "preview"]]] = None, ) -> str: """ diff --git a/litellm/llms/azure/passthrough/transformation.py b/litellm/llms/azure/passthrough/transformation.py new file mode 100644 index 00000000000..4e9de4b314f --- /dev/null +++ b/litellm/llms/azure/passthrough/transformation.py @@ -0,0 +1,85 @@ +from typing import TYPE_CHECKING, List, Optional, Tuple + +import httpx + +from litellm.llms.azure.common_utils import BaseAzureLLM +from litellm.llms.base_llm.passthrough.transformation import BasePassthroughConfig +from litellm.secret_managers.main import get_secret_str +from litellm.types.llms.openai import AllMessageValues +from litellm.types.router import GenericLiteLLMParams + +if TYPE_CHECKING: + from httpx import URL + + +class AzurePassthroughConfig(BasePassthroughConfig): + def is_streaming_request(self, endpoint: str, request_data: dict) -> bool: + return "stream" in request_data + + def get_complete_url( + self, + api_base: Optional[str], + api_key: Optional[str], + model: str, + endpoint: str, + request_query_params: Optional[dict], + litellm_params: dict, + ) -> Tuple["URL", str]: + base_target_url = self.get_api_base(api_base) + + if base_target_url is None: + raise Exception("Azure api base not found") + + litellm_metadata = litellm_params.get("litellm_metadata") or {} + model_group = litellm_metadata.get("model_group") + if model_group and model_group in endpoint: + endpoint = endpoint.replace(model_group, model) + + complete_url = BaseAzureLLM._get_base_azure_url( + api_base=base_target_url, + litellm_params=litellm_params, + route=endpoint, + default_api_version=litellm_params.get("api_version"), + ) + return ( + httpx.URL(complete_url), + base_target_url, + ) + + 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: + return BaseAzureLLM._base_validate_azure_environment( + headers=headers, + litellm_params=GenericLiteLLMParams( + **{**litellm_params, "api_key": api_key} + ), + ) + + @staticmethod + def get_api_base( + api_base: Optional[str] = None, + ) -> Optional[str]: + return api_base or get_secret_str("AZURE_API_BASE") + + @staticmethod + def get_api_key( + api_key: Optional[str] = None, + ) -> Optional[str]: + return api_key or get_secret_str("AZURE_API_KEY") + + @staticmethod + def get_base_model(model: str) -> Optional[str]: + return model + + def get_models( + self, api_key: Optional[str] = None, api_base: Optional[str] = None + ) -> List[str]: + return super().get_models(api_key, api_base) diff --git a/litellm/llms/azure/responses/transformation.py b/litellm/llms/azure/responses/transformation.py index 0050bd163d1..1516ed089ee 100644 --- a/litellm/llms/azure/responses/transformation.py +++ b/litellm/llms/azure/responses/transformation.py @@ -1,6 +1,7 @@ -from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Tuple +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple, Union import httpx +from openai.types.responses import ResponseReasoningItem from litellm._logging import verbose_logger from litellm.llms.azure.common_utils import BaseAzureLLM @@ -38,6 +39,74 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig): model = model.replace("o_series/", "") return model + def _handle_reasoning_item(self, item: Dict[str, Any]) -> Dict[str, Any]: + """ + Handle reasoning items to filter out the status field. + Issue: https://github.com/BerriAI/litellm/issues/13484 + + Azure OpenAI API does not accept 'status' field in reasoning input items. + """ + if item.get("type") == "reasoning": + try: + # Ensure required fields are present for ResponseReasoningItem + item_data = dict(item) + if "id" not in item_data: + item_data["id"] = f"rs_{hash(str(item_data))}" + if "summary" not in item_data: + item_data["summary"] = ( + item_data.get("reasoning_content", "")[:100] + "..." + if len(item_data.get("reasoning_content", "")) > 100 + else item_data.get("reasoning_content", "") + ) + + # Create ResponseReasoningItem object from the item data + reasoning_item = ResponseReasoningItem(**item_data) + + # Convert back to dict with exclude_none=True to exclude None fields + dict_reasoning_item = reasoning_item.model_dump(exclude_none=True) + dict_reasoning_item.pop("status", None) + + return dict_reasoning_item + except Exception as e: + verbose_logger.debug( + f"Failed to create ResponseReasoningItem, falling back to manual filtering: {e}" + ) + # Fallback: manually filter out known None fields + filtered_item = { + k: v + for k, v in item.items() + if v is not None + or k not in {"status", "content", "encrypted_content"} + } + return filtered_item + return item + + def _validate_input_param( + self, input: Union[str, ResponseInputParam] + ) -> Union[str, ResponseInputParam]: + """ + Override parent method to also filter out 'status' field from message items. + Azure OpenAI API does not accept 'status' field in input messages. + """ + from typing import cast + + # First call parent's validation + validated_input = super()._validate_input_param(input) + + # Then filter out status from message items + if isinstance(validated_input, list): + filtered_input: List[Any] = [] + for item in validated_input: + if isinstance(item, dict) and item.get("type") == "message": + # Filter out status field from message items + filtered_item = {k: v for k, v in item.items() if k != "status"} + filtered_input.append(filtered_item) + else: + filtered_input.append(item) + return cast(ResponseInputParam, filtered_input) + + return validated_input + def transform_responses_api_request( self, model: str, @@ -48,12 +117,13 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig): ) -> Dict: """No transform applied since inputs are in OpenAI spec already""" stripped_model_name = self.get_stripped_model_name(model) - return dict( - ResponsesAPIRequestParams( - model=stripped_model_name, - input=input, - **response_api_optional_request_params, - ) + + return super().transform_responses_api_request( + model=stripped_model_name, + input=input, + response_api_optional_request_params=response_api_optional_request_params, + litellm_params=litellm_params, + headers=headers, ) def get_complete_url( @@ -217,15 +287,15 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig): at the correct location (before any query parameters). """ from urllib.parse import urlparse, urlunparse - + # Parse the URL to separate its components parsed_url = urlparse(api_base) - + # Insert the response_id and /cancel at the end of the path component # Remove trailing slash if present to avoid double slashes path = parsed_url.path.rstrip("/") new_path = f"{path}/{response_id}/cancel" - + # Reconstruct the URL with all original components but with the modified path cancel_url = urlunparse( ( diff --git a/litellm/llms/azure_ai/chat/transformation.py b/litellm/llms/azure_ai/chat/transformation.py index 7eb7b767d04..04d2b3a2769 100644 --- a/litellm/llms/azure_ai/chat/transformation.py +++ b/litellm/llms/azure_ai/chat/transformation.py @@ -14,6 +14,7 @@ from litellm.litellm_core_utils.prompt_templates.common_utils import ( from litellm.llms.base_llm.chat.transformation import LiteLLMLoggingObj from litellm.llms.openai.common_utils import drop_params_from_unprocessable_entity_error from litellm.llms.openai.openai import OpenAIConfig +from litellm.llms.xai.chat.transformation import XAIChatConfig from litellm.secret_managers.main import get_secret_str from litellm.types.llms.openai import AllMessageValues from litellm.types.utils import ModelResponse, ProviderField @@ -35,9 +36,24 @@ class AzureAIStudioConfig(OpenAIConfig): for param in supported_params: if param != "tool_choice": filtered_supported_params.append(param) - return filtered_supported_params + supported_params = filtered_supported_params + + # Filter out unsupported parameters for specific models + if not self._supports_stop_reason(model): + supported_params = [param for param in supported_params if param != "stop"] + return supported_params + def _supports_stop_reason(self, model: str) -> bool: + """ + Check if the model supports stop tokens. + """ + if "grok" in model: + # Reuse Xai method for Grok model + xai_config = XAIChatConfig() + return xai_config._supports_stop_reason(model) + return True + def validate_environment( self, headers: dict, @@ -53,9 +69,7 @@ class AzureAIStudioConfig(OpenAIConfig): else: headers["Authorization"] = f"Bearer {api_key}" - headers["Content-Type"] = ( - "application/json" # tell Azure AI Studio to expect JSON - ) + headers["Content-Type"] = "application/json" # tell Azure AI Studio to expect JSON return headers @@ -65,10 +79,7 @@ class AzureAIStudioConfig(OpenAIConfig): """ parsed_url = urlparse(api_base) host = parsed_url.hostname - if host and ( - host.endswith(".services.ai.azure.com") - or host.endswith(".openai.azure.com") - ): + if host and (host.endswith(".services.ai.azure.com") or host.endswith(".openai.azure.com")): return True return False @@ -115,13 +126,9 @@ class AzureAIStudioConfig(OpenAIConfig): # Add the path to the base URL if "services.ai.azure.com" in api_base: - new_url = _add_path_to_api_base( - api_base=api_base, ending_path="/models/chat/completions" - ) + new_url = _add_path_to_api_base(api_base=api_base, ending_path="/models/chat/completions") else: - new_url = _add_path_to_api_base( - api_base=api_base, ending_path="/chat/completions" - ) + new_url = _add_path_to_api_base(api_base=api_base, ending_path="/chat/completions") # Use the new query_params dictionary final_url = httpx.URL(new_url).copy_with(params=query_params) @@ -191,11 +198,7 @@ class AzureAIStudioConfig(OpenAIConfig): dynamic_api_key = api_key or get_secret_str("AZURE_AI_API_KEY") if self._is_azure_openai_model(model=model, api_base=api_base): - verbose_logger.debug( - "Model={} is Azure OpenAI model. Setting custom_llm_provider='azure'.".format( - model - ) - ) + verbose_logger.debug("Model={} is Azure OpenAI model. Setting custom_llm_provider='azure'.".format(model)) custom_llm_provider = "azure" return api_base, dynamic_api_key, custom_llm_provider @@ -211,9 +214,7 @@ class AzureAIStudioConfig(OpenAIConfig): if extra_body and isinstance(extra_body, dict): optional_params.update(extra_body) optional_params.pop("max_retries", None) - return super().transform_request( - model, messages, optional_params, litellm_params, headers - ) + return super().transform_request(model, messages, optional_params, litellm_params, headers) def transform_response( self, @@ -252,47 +253,30 @@ class AzureAIStudioConfig(OpenAIConfig): if should_drop_params and "Extra inputs are not permitted" in error_text: return True - elif ( - "unknown field: parameter index is not a valid field" in error_text - ): # remove index from tool calls + elif "unknown field: parameter index is not a valid field" in error_text: # remove index from tool calls return True elif ( - AzureFoundryErrorStrings.SET_EXTRA_PARAMETERS_TO_PASS_THROUGH.value - in error_text + AzureFoundryErrorStrings.SET_EXTRA_PARAMETERS_TO_PASS_THROUGH.value in error_text ): # remove extra-parameters from tool calls return True - return super().should_retry_llm_api_inside_llm_translation_on_http_error( - e=e, litellm_params=litellm_params - ) + return super().should_retry_llm_api_inside_llm_translation_on_http_error(e=e, litellm_params=litellm_params) @property def max_retry_on_unprocessable_entity_error(self) -> int: return 2 - def transform_request_on_unprocessable_entity_error( - self, e: httpx.HTTPStatusError, request_data: dict - ) -> dict: + def transform_request_on_unprocessable_entity_error(self, e: httpx.HTTPStatusError, request_data: dict) -> dict: _messages = cast(Optional[List[AllMessageValues]], request_data.get("messages")) - if ( - "unknown field: parameter index is not a valid field" in e.response.text - and _messages is not None - ): + if "unknown field: parameter index is not a valid field" in e.response.text and _messages is not None: litellm.remove_index_from_tool_calls( messages=_messages, ) - elif ( - AzureFoundryErrorStrings.SET_EXTRA_PARAMETERS_TO_PASS_THROUGH.value - in e.response.text - ): - request_data = self._drop_extra_params_from_request_data( - request_data, e.response.text - ) + elif AzureFoundryErrorStrings.SET_EXTRA_PARAMETERS_TO_PASS_THROUGH.value in e.response.text: + request_data = self._drop_extra_params_from_request_data(request_data, e.response.text) data = drop_params_from_unprocessable_entity_error(e=e, data=request_data) return data - def _drop_extra_params_from_request_data( - self, request_data: dict, error_text: str - ) -> dict: + def _drop_extra_params_from_request_data(self, request_data: dict, error_text: str) -> dict: params_to_drop = self._extract_params_to_drop_from_error_text(error_text) if params_to_drop: for param in params_to_drop: @@ -300,9 +284,7 @@ class AzureAIStudioConfig(OpenAIConfig): request_data.pop(param, None) return request_data - def _extract_params_to_drop_from_error_text( - self, error_text: str - ) -> Optional[List[str]]: + def _extract_params_to_drop_from_error_text(self, error_text: str) -> Optional[List[str]]: """ Error text looks like this" "Extra parameters ['stream_options', 'extra-parameters'] are not allowed when extra-parameters is not set or set to be 'error'. diff --git a/litellm/llms/azure_ai/embed/handler.py b/litellm/llms/azure_ai/embed/handler.py index da39c5f3b89..13b8cc4cf29 100644 --- a/litellm/llms/azure_ai/embed/handler.py +++ b/litellm/llms/azure_ai/embed/handler.py @@ -210,6 +210,7 @@ class AzureAIEmbedding(OpenAIChatCompletion): client=None, aembedding=None, max_retries: Optional[int] = None, + shared_session=None, ) -> EmbeddingResponse: """ - Separate image url from text @@ -275,6 +276,7 @@ class AzureAIEmbedding(OpenAIChatCompletion): else None ), aembedding=aembedding, + shared_session=shared_session, ) text_embedding_responses = response.data diff --git a/litellm/llms/azure_ai/ocr/__init__.py b/litellm/llms/azure_ai/ocr/__init__.py new file mode 100644 index 00000000000..86f7e53d60b --- /dev/null +++ b/litellm/llms/azure_ai/ocr/__init__.py @@ -0,0 +1,5 @@ +"""Azure AI OCR module.""" +from .transformation import AzureAIOCRConfig + +__all__ = ["AzureAIOCRConfig"] + diff --git a/litellm/llms/azure_ai/ocr/transformation.py b/litellm/llms/azure_ai/ocr/transformation.py new file mode 100644 index 00000000000..eade2dd765f --- /dev/null +++ b/litellm/llms/azure_ai/ocr/transformation.py @@ -0,0 +1,268 @@ +""" +Azure AI OCR transformation implementation. +""" +from typing import Dict, Optional + +from litellm._logging import verbose_logger +from litellm.litellm_core_utils.prompt_templates.image_handling import ( + async_convert_url_to_base64, + convert_url_to_base64, +) +from litellm.llms.base_llm.ocr.transformation import DocumentType, OCRRequestData +from litellm.llms.mistral.ocr.transformation import MistralOCRConfig +from litellm.secret_managers.main import get_secret_str + + +class AzureAIOCRConfig(MistralOCRConfig): + """ + Azure AI OCR transformation configuration. + + Azure AI uses Mistral's OCR API but with a different endpoint format. + Inherits transformation logic from MistralOCRConfig since they use the same format. + + Reference: Azure AI Foundry OCR documentation + + Important: Azure AI only supports base64 data URIs (data:image/..., data:application/pdf;base64,...). + Regular URLs are not supported. + """ + + def __init__(self) -> None: + super().__init__() + + def validate_environment( + self, + headers: Dict, + model: str, + api_key: Optional[str] = None, + api_base: Optional[str] = None, + **kwargs, + ) -> Dict: + """ + Validate environment and return headers for Azure AI OCR. + + Azure AI uses Bearer token authentication with AZURE_AI_API_KEY. + """ + # Get API key from environment if not provided + if api_key is None: + api_key = get_secret_str("AZURE_AI_API_KEY") + + if api_key is None: + raise ValueError( + "Missing Azure AI API Key - A call is being made to Azure AI but no key is set either in the environment variables or via params" + ) + + # Validate API base is provided + if api_base is None: + api_base = get_secret_str("AZURE_AI_API_BASE") + + if api_base is None: + raise ValueError( + "Missing Azure AI API Base - Set AZURE_AI_API_BASE environment variable or pass api_base parameter" + ) + + headers = { + "Authorization": f"Bearer {api_key}", + "Content-Type": "application/json", + **headers, + } + + return headers + + def get_complete_url( + self, + api_base: Optional[str], + model: str, + optional_params: dict, + **kwargs, + ) -> str: + """ + Get complete URL for Azure AI OCR endpoint. + + Azure AI endpoint format: https:///providers/mistral/azure/ocr + + Args: + api_base: Azure AI API base URL + model: Model name (not used in URL construction) + optional_params: Optional parameters + + Returns: Complete URL for Azure AI OCR endpoint + """ + if api_base is None: + raise ValueError( + "Missing Azure AI API Base - Set AZURE_AI_API_BASE environment variable or pass api_base parameter" + ) + + # Ensure no trailing slash + api_base = api_base.rstrip("/") + + # Azure AI OCR endpoint format + return f"{api_base}/providers/mistral/azure/ocr" + + def _convert_url_to_data_uri_sync(self, url: str) -> str: + """ + Synchronously convert a URL to a base64 data URI. + + Azure AI OCR doesn't have internet access, so we need to fetch URLs + and convert them to base64 data URIs. + + Args: + url: The URL to convert + + Returns: + Base64 data URI string + """ + verbose_logger.debug(f"Azure AI OCR: Converting URL to base64 data URI (sync): {url}") + + # Fetch and convert to base64 data URI + # convert_url_to_base64 already returns a full data URI like "data:image/jpeg;base64,..." + data_uri = convert_url_to_base64(url=url) + + verbose_logger.debug(f"Azure AI OCR: Converted URL to data URI (length: {len(data_uri)})") + + return data_uri + + async def _convert_url_to_data_uri_async(self, url: str) -> str: + """ + Asynchronously convert a URL to a base64 data URI. + + Azure AI OCR doesn't have internet access, so we need to fetch URLs + and convert them to base64 data URIs. + + Args: + url: The URL to convert + + Returns: + Base64 data URI string + """ + verbose_logger.debug(f"Azure AI OCR: Converting URL to base64 data URI (async): {url}") + + # Fetch and convert to base64 data URI asynchronously + # async_convert_url_to_base64 already returns a full data URI like "data:image/jpeg;base64,..." + data_uri = await async_convert_url_to_base64(url=url) + + verbose_logger.debug(f"Azure AI OCR: Converted URL to data URI (length: {len(data_uri)})") + + return data_uri + + def transform_ocr_request( + self, + model: str, + document: DocumentType, + optional_params: dict, + headers: dict, + **kwargs, + ) -> OCRRequestData: + """ + Transform OCR request for Azure AI, converting URLs to base64 data URIs (sync). + + Azure AI OCR doesn't have internet access, so we automatically fetch + any URLs and convert them to base64 data URIs synchronously. + + Args: + model: Model name + document: Document dict from user + optional_params: Already mapped optional parameters + headers: Request headers + **kwargs: Additional arguments + + Returns: + OCRRequestData with JSON data + """ + verbose_logger.debug(f"Azure AI OCR transform_ocr_request (sync) - model: {model}") + + if not isinstance(document, dict): + raise ValueError(f"Expected document dict, got {type(document)}") + + # Check if we need to convert URL to base64 + doc_type = document.get("type") + transformed_document = document.copy() + + if doc_type == "document_url": + document_url = document.get("document_url", "") + # If it's not already a data URI, convert it + if document_url and not document_url.startswith("data:"): + verbose_logger.debug( + "Azure AI OCR: Converting document URL to base64 data URI (sync)" + ) + data_uri = self._convert_url_to_data_uri_sync(url=document_url) + transformed_document["document_url"] = data_uri + elif doc_type == "image_url": + image_url = document.get("image_url", "") + # If it's not already a data URI, convert it + if image_url and not image_url.startswith("data:"): + verbose_logger.debug( + "Azure AI OCR: Converting image URL to base64 data URI (sync)" + ) + data_uri = self._convert_url_to_data_uri_sync(url=image_url) + transformed_document["image_url"] = data_uri + + # Call parent's transform to build the request + return super().transform_ocr_request( + model=model, + document=transformed_document, + optional_params=optional_params, + headers=headers, + **kwargs, + ) + + async def async_transform_ocr_request( + self, + model: str, + document: DocumentType, + optional_params: dict, + headers: dict, + **kwargs, + ) -> OCRRequestData: + """ + Transform OCR request for Azure AI, converting URLs to base64 data URIs (async). + + Azure AI OCR doesn't have internet access, so we automatically fetch + any URLs and convert them to base64 data URIs asynchronously. + + Args: + model: Model name + document: Document dict from user + optional_params: Already mapped optional parameters + headers: Request headers + **kwargs: Additional arguments + + Returns: + OCRRequestData with JSON data + """ + verbose_logger.debug(f"Azure AI OCR async_transform_ocr_request - model: {model}") + + if not isinstance(document, dict): + raise ValueError(f"Expected document dict, got {type(document)}") + + # Check if we need to convert URL to base64 + doc_type = document.get("type") + transformed_document = document.copy() + + if doc_type == "document_url": + document_url = document.get("document_url", "") + # If it's not already a data URI, convert it + if document_url and not document_url.startswith("data:"): + verbose_logger.debug( + "Azure AI OCR: Converting document URL to base64 data URI (async)" + ) + data_uri = await self._convert_url_to_data_uri_async(url=document_url) + transformed_document["document_url"] = data_uri + elif doc_type == "image_url": + image_url = document.get("image_url", "") + # If it's not already a data URI, convert it + if image_url and not image_url.startswith("data:"): + verbose_logger.debug( + "Azure AI OCR: Converting image URL to base64 data URI (async)" + ) + data_uri = await self._convert_url_to_data_uri_async(url=image_url) + transformed_document["image_url"] = data_uri + + # Call parent's transform to build the request + return super().transform_ocr_request( + model=model, + document=transformed_document, + optional_params=optional_params, + headers=headers, + **kwargs, + ) + diff --git a/litellm/llms/base_llm/ocr/__init__.py b/litellm/llms/base_llm/ocr/__init__.py new file mode 100644 index 00000000000..5965af5f2b7 --- /dev/null +++ b/litellm/llms/base_llm/ocr/__init__.py @@ -0,0 +1,22 @@ +"""Base OCR transformation module.""" +from .transformation import ( + BaseOCRConfig, + DocumentType, + OCRPage, + OCRPageDimensions, + OCRPageImage, + OCRRequestData, + OCRResponse, + OCRUsageInfo, +) + +__all__ = [ + "BaseOCRConfig", + "DocumentType", + "OCRResponse", + "OCRPage", + "OCRPageDimensions", + "OCRPageImage", + "OCRUsageInfo", + "OCRRequestData", +] diff --git a/litellm/llms/base_llm/ocr/transformation.py b/litellm/llms/base_llm/ocr/transformation.py new file mode 100644 index 00000000000..41d7d31e6bc --- /dev/null +++ b/litellm/llms/base_llm/ocr/transformation.py @@ -0,0 +1,207 @@ +""" +Base OCR transformation configuration. +""" +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union + +import httpx +from pydantic import BaseModel + +from litellm.llms.base_llm.chat.transformation import BaseLLMException + +if TYPE_CHECKING: + from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj +else: + LiteLLMLoggingObj = Any + + +# DocumentType for OCR - Mistral format document dict +DocumentType = Dict[str, str] + + +class OCRPageDimensions(BaseModel): + """Page dimensions from OCR response.""" + dpi: Optional[int] = None + height: Optional[int] = None + width: Optional[int] = None + + +class OCRPageImage(BaseModel): + """Image extracted from OCR page.""" + image_base64: Optional[str] = None + bbox: Optional[Dict[str, Any]] = None + + model_config = {"extra": "allow"} + + +class OCRPage(BaseModel): + """Single page from OCR response.""" + index: int + markdown: str + images: Optional[List[OCRPageImage]] = None + dimensions: Optional[OCRPageDimensions] = None + + model_config = {"extra": "allow"} + + +class OCRUsageInfo(BaseModel): + """Usage information from OCR response.""" + pages_processed: Optional[int] = None + doc_size_bytes: Optional[int] = None + + model_config = {"extra": "allow"} + + +class OCRResponse(BaseModel): + """ + Standard OCR response format. + Standardized to Mistral OCR format - other providers should transform to this format. + """ + pages: List[OCRPage] + model: str + document_annotation: Optional[Any] = None + usage_info: Optional[OCRUsageInfo] = None + object: str = "ocr" + + model_config = {"extra": "allow"} + + +class OCRRequestData(BaseModel): + """OCR request data structure.""" + data: Optional[Union[Dict, bytes]] = None + files: Optional[Dict[str, Any]] = None + + +class BaseOCRConfig: + """ + Base configuration for OCR transformations. + Handles provider-agnostic OCR operations. + """ + + def __init__(self) -> None: + pass + + def get_supported_ocr_params(self, model: str) -> list: + """ + Get supported OCR parameters for this provider. + Override this method in provider-specific implementations. + """ + return [] + + def map_ocr_params( + self, + non_default_params: dict, + optional_params: dict, + model: str, + ) -> dict: + """Map OCR parameters to provider-specific parameters.""" + return optional_params + + def validate_environment( + self, + headers: Dict, + model: str, + api_key: Optional[str] = None, + api_base: Optional[str] = None, + **kwargs, + ) -> Dict: + """ + Validate environment and return headers. + Override in provider-specific implementations. + """ + return headers + + def get_complete_url( + self, + api_base: Optional[str], + model: str, + optional_params: dict, + **kwargs, + ) -> str: + """ + Get complete URL for OCR endpoint. + Override in provider-specific implementations. + """ + raise NotImplementedError("get_complete_url must be implemented by provider") + + def transform_ocr_request( + self, + model: str, + document: DocumentType, + optional_params: dict, + headers: dict, + **kwargs, + ) -> OCRRequestData: + """ + Transform OCR request to provider-specific format. + Override in provider-specific implementations. + + Args: + model: Model name + document: Document to process (Mistral format dict, or file path, bytes, etc.) + optional_params: Optional parameters for the request + headers: Request headers + + Returns: + OCRRequestData with data and files fields + """ + raise NotImplementedError("transform_ocr_request must be implemented by provider") + + async def async_transform_ocr_request( + self, + model: str, + document: DocumentType, + optional_params: dict, + headers: dict, + **kwargs, + ) -> OCRRequestData: + """ + Async transform OCR request to provider-specific format. + Optional method - providers can override if they need async transformations + (e.g., Azure AI for URL-to-base64 conversion). + + Default implementation falls back to sync transform_ocr_request. + + Args: + model: Model name + document: Document to process (Mistral format dict, or file path, bytes, etc.) + optional_params: Optional parameters for the request + headers: Request headers + + Returns: + OCRRequestData with data and files fields + """ + # Default implementation: call sync version + return self.transform_ocr_request( + model=model, + document=document, + optional_params=optional_params, + headers=headers, + **kwargs, + ) + + def transform_ocr_response( + self, + model: str, + raw_response: httpx.Response, + logging_obj: LiteLLMLoggingObj, + **kwargs, + ) -> OCRResponse: + """ + Transform provider-specific OCR response to standard format. + Override in provider-specific implementations. + """ + raise NotImplementedError("transform_ocr_response must be implemented by provider") + + def get_error_class( + self, + error_message: str, + status_code: int, + headers: dict, + ) -> Exception: + """Get appropriate error class for the provider.""" + return BaseLLMException( + status_code=status_code, + message=error_message, + headers=headers, + ) + diff --git a/litellm/llms/base_llm/rerank/transformation.py b/litellm/llms/base_llm/rerank/transformation.py index 8701fe57bfd..6e9c03dee89 100644 --- a/litellm/llms/base_llm/rerank/transformation.py +++ b/litellm/llms/base_llm/rerank/transformation.py @@ -3,7 +3,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import httpx -from litellm.types.rerank import OptionalRerankParams, RerankBilledUnits, RerankResponse +from litellm.types.rerank import RerankBilledUnits, RerankResponse from litellm.types.utils import ModelInfo from ..chat.transformation import BaseLLMException @@ -30,7 +30,7 @@ class BaseRerankConfig(ABC): def transform_rerank_request( self, model: str, - optional_rerank_params: OptionalRerankParams, + optional_rerank_params: Dict, headers: dict, ) -> dict: return {} @@ -78,7 +78,7 @@ class BaseRerankConfig(ABC): return_documents: Optional[bool] = True, max_chunks_per_doc: Optional[int] = None, max_tokens_per_doc: Optional[int] = None, - ) -> OptionalRerankParams: + ) -> Dict: pass def get_error_class( diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py index a61cfa39e47..d099c9813d6 100644 --- a/litellm/llms/bedrock/chat/converse_transformation.py +++ b/litellm/llms/bedrock/chat/converse_transformation.py @@ -1092,10 +1092,8 @@ class AmazonConverseConfig(BaseConfig): cache_read_input_tokens = usage["cacheReadInputTokens"] input_tokens += cache_read_input_tokens if "cacheWriteInputTokens" in usage: - """ - Do not increment prompt_tokens with cacheWriteInputTokens - """ cache_creation_input_tokens = usage["cacheWriteInputTokens"] + input_tokens += cache_creation_input_tokens prompt_tokens_details = PromptTokensDetailsWrapper( cached_tokens=cache_read_input_tokens diff --git a/litellm/llms/bedrock/common_utils.py b/litellm/llms/bedrock/common_utils.py index 2b111cde600..1a599fda59f 100644 --- a/litellm/llms/bedrock/common_utils.py +++ b/litellm/llms/bedrock/common_utils.py @@ -440,27 +440,30 @@ class BedrockModelInfo(BaseLLMModelInfo): """ Abbreviations of regions AWS Bedrock supports for cross region inference """ - return ["us", "eu", "apac"] + return ["global", "us", "eu", "apac", "jp", "au"] @staticmethod def get_bedrock_route( model: str, - ) -> Literal["converse", "invoke", "converse_like", "agent"]: + ) -> Literal["converse", "invoke", "converse_like", "agent", "async_invoke"]: """ Get the bedrock route for the given model. """ - route_mappings: Dict[str, Literal["invoke", "converse_like", "converse", "agent"]] = { + route_mappings: Dict[ + str, Literal["invoke", "converse_like", "converse", "agent", "async_invoke"] + ] = { "invoke/": "invoke", - "converse_like/": "converse_like", + "converse_like/": "converse_like", "converse/": "converse", - "agent/": "agent" + "agent/": "agent", + "async_invoke/": "async_invoke", } - + # Check explicit routes first for prefix, route_type in route_mappings.items(): if prefix in model: return route_type - + base_model = BedrockModelInfo.get_base_model(model) alt_model = BedrockModelInfo.get_non_litellm_routing_model_name(model=model) if ( @@ -469,38 +472,46 @@ class BedrockModelInfo(BaseLLMModelInfo): ): return "converse" return "invoke" - + @staticmethod def _explicit_converse_route(model: str) -> bool: """ Check if the model is an explicit converse route. """ return "converse/" in model - + @staticmethod def _explicit_invoke_route(model: str) -> bool: """ Check if the model is an explicit invoke route. """ return "invoke/" in model - + @staticmethod def _explicit_agent_route(model: str) -> bool: """ Check if the model is an explicit agent route. """ return "agent/" in model - + @staticmethod def _explicit_converse_like_route(model: str) -> bool: """ Check if the model is an explicit converse like route. """ return "converse_like/" in model - @staticmethod - def get_bedrock_provider_config_for_messages_api(model: str) -> Optional[BaseAnthropicMessagesConfig]: + def _explicit_async_invoke_route(model: str) -> bool: + """ + Check if the model is an explicit async invoke route. + """ + return "async_invoke/" in model + + @staticmethod + def get_bedrock_provider_config_for_messages_api( + model: str, + ) -> Optional[BaseAnthropicMessagesConfig]: """ Get the bedrock provider config for the given model. @@ -513,19 +524,20 @@ class BedrockModelInfo(BaseLLMModelInfo): # Converse routes should go through litellm.completion() if BedrockModelInfo._explicit_converse_route(model): return None - + ######################################################### # This goes through litellm.AmazonAnthropicClaude3MessagesConfig() # Since bedrock Invoke supports Native Anthropic Messages API ######################################################### if "claude" in model: return litellm.AmazonAnthropicClaudeMessagesConfig() - + ######################################################### # These routes will go through litellm.completion() ######################################################### return None + class BedrockEventStreamDecoderBase: """ Base class for event stream decoding for Bedrock @@ -595,20 +607,20 @@ def get_anthropic_beta_from_headers(headers: dict) -> List[str]: """ Extract anthropic-beta header values and convert them to a list. Supports comma-separated values from user headers. - + Used by both converse and invoke transformations for consistent handling of anthropic-beta headers that should be passed to AWS Bedrock. - + Args: headers (dict): Request headers dictionary - + Returns: List[str]: List of anthropic beta feature strings, empty list if no header """ anthropic_beta_header = headers.get("anthropic-beta") if not anthropic_beta_header: return [] - + # Split comma-separated values and strip whitespace return [beta.strip() for beta in anthropic_beta_header.split(",")] @@ -618,19 +630,20 @@ class CommonBatchFilesUtils: Common utilities for Bedrock batch and file operations. Provides shared functionality to reduce code duplication between batches and files. """ - + def __init__(self): # Import here to avoid circular imports from .base_aws_llm import BaseAWSLLM + self._base_aws = BaseAWSLLM() def get_bedrock_model_id_from_litellm_model(self, model: str) -> str: """ Extract the actual Bedrock model ID from LiteLLM model name. - + Args: model: LiteLLM model name (e.g., "bedrock/anthropic.claude-3-sonnet-20240229-v1:0") - + Returns: Bedrock model ID (e.g., "anthropic.claude-3-sonnet-20240229-v1:0") """ @@ -641,41 +654,45 @@ class CommonBatchFilesUtils: def parse_s3_uri(self, s3_uri: str) -> tuple: """ Parse S3 URI into bucket and key components. - + Args: s3_uri: S3 URI (e.g., "s3://bucket/key/path") - + Returns: Tuple of (bucket, key) - + Raises: ValueError: If URI format is invalid """ if not s3_uri.startswith("s3://"): raise ValueError(f"Invalid S3 URI format: {s3_uri}") - + s3_parts = s3_uri[5:].split("/", 1) # Remove "s3://" and split on first "/" if len(s3_parts) != 2: raise ValueError(f"Invalid S3 URI format: {s3_uri}") - + return s3_parts[0], s3_parts[1] # bucket, key - def extract_model_from_s3_file_path(self, s3_uri: str, optional_params: dict) -> str: + def extract_model_from_s3_file_path( + self, s3_uri: str, optional_params: dict + ) -> str: """ Extract model ID from S3 file path. - + The Bedrock file transformation creates S3 objects with the model name embedded: Format: s3://bucket/litellm-bedrock-files-{model}-{uuid}.jsonl """ # Check if model is provided in optional_params first if "model" in optional_params and optional_params["model"]: - return self.get_bedrock_model_id_from_litellm_model(optional_params["model"]) - + return self.get_bedrock_model_id_from_litellm_model( + optional_params["model"] + ) + # Extract model from S3 URI path # Expected format: s3://bucket/litellm-bedrock-files-{model}-{uuid}.jsonl try: bucket, object_key = self.parse_s3_uri(s3_uri) - + # Extract model from object key if it follows our naming pattern if object_key.startswith("litellm-bedrock-files-"): # Remove prefix and suffix to get model part @@ -690,7 +707,7 @@ class CommonBatchFilesUtils: return model_name except Exception: pass - + # Fallback to default model return "anthropic.claude-3-5-sonnet-20240620-v1:0" @@ -704,14 +721,14 @@ class CommonBatchFilesUtils: ) -> tuple: """ Sign AWS request using Signature Version 4. - + Args: service_name: AWS service name ("bedrock" or "s3") data: Request data (string or dict) endpoint_url: Full endpoint URL optional_params: Optional parameters containing AWS credentials method: HTTP method (default: POST) - + Returns: Tuple of (signed_headers, signed_data) """ @@ -736,7 +753,7 @@ class CommonBatchFilesUtils: aws_web_identity_token=optional_params.get("aws_web_identity_token"), aws_sts_endpoint=optional_params.get("aws_sts_endpoint"), ) - + # Prepare the request data method_upper = method.upper() if method_upper == "GET": @@ -746,12 +763,13 @@ class CommonBatchFilesUtils: else: if isinstance(data, dict): import json + request_data = json.dumps(data) else: request_data = data # Prepare headers for non-GET requests headers = {"Content-Type": "application/json"} - + # Create AWS request and sign it sigv4 = SigV4Auth(credentials, service_name, aws_region_name) request = AWSRequest( @@ -759,45 +777,51 @@ class CommonBatchFilesUtils: ) sigv4.add_auth(request) prepped = request.prepare() - - return dict(prepped.headers), request_data.encode('utf-8') if isinstance(request_data, str) else request_data + + return ( + dict(prepped.headers), + request_data.encode("utf-8") + if isinstance(request_data, str) + else request_data, + ) def generate_unique_job_name(self, model: str, prefix: str = "litellm") -> str: """ Generate a unique job name for AWS services. AWS services often have length limits, so this creates a concise name. - + Args: model: Model name to include in the job name prefix: Prefix for the job name - + Returns: Unique job name (≤ 63 characters for Bedrock compatibility) """ from litellm._uuid import uuid + unique_id = str(uuid.uuid4())[:8] # Format: {prefix}-batch-{model}-{uuid} # Example: litellm-batch-claude-266c398e job_name = f"{prefix}-batch-{unique_id}" - + return job_name def get_s3_bucket_and_key_from_config( - self, - litellm_params: dict, + self, + litellm_params: dict, optional_params: dict, bucket_env_var: str = "AWS_S3_BUCKET_NAME", - key_prefix: str = "litellm" + key_prefix: str = "litellm", ) -> tuple: """ Get S3 bucket and generate a unique key from configuration. - + Args: litellm_params: LiteLLM parameters optional_params: Optional parameters bucket_env_var: Environment variable name for bucket key_prefix: Prefix for the S3 key - + Returns: Tuple of (bucket_name, object_key) """ @@ -806,18 +830,20 @@ class CommonBatchFilesUtils: # Get bucket name bucket_name = ( - litellm_params.get("s3_bucket_name") + litellm_params.get("s3_bucket_name") or optional_params.get("s3_bucket_name") or os.getenv(bucket_env_var) ) if not bucket_name: - raise ValueError(f"S3 bucket name is required. Set 's3_bucket_name' parameter or {bucket_env_var} env var") - + raise ValueError( + f"S3 bucket name is required. Set 's3_bucket_name' parameter or {bucket_env_var} env var" + ) + # Generate unique object key timestamp = int(time.time()) unique_id = str(uuid.uuid4())[:8] object_key = f"{key_prefix}-{timestamp}-{unique_id}" - + return bucket_name, object_key def get_error_class( @@ -827,7 +853,5 @@ class CommonBatchFilesUtils: Get Bedrock-specific error class. """ return BedrockError( - status_code=status_code, - message=error_message, - headers=headers + status_code=status_code, message=error_message, headers=headers ) diff --git a/litellm/llms/bedrock/embed/embedding.py b/litellm/llms/bedrock/embed/embedding.py index d4dd716a1f4..3edd6d6741b 100644 --- a/litellm/llms/bedrock/embed/embedding.py +++ b/litellm/llms/bedrock/embed/embedding.py @@ -22,9 +22,8 @@ from litellm.secret_managers.main import get_secret from litellm.types.llms.bedrock import ( AmazonEmbeddingRequest, CohereEmbeddingRequest, - TwelveLabsMarengoEmbeddingRequest, ) -from litellm.types.utils import EmbeddingResponse +from litellm.types.utils import EmbeddingResponse, LlmProviders from ..base_aws_llm import BaseAWSLLM from ..common_utils import BedrockError @@ -77,7 +76,7 @@ class BedrockEmbedding(BaseAWSLLM): if aws_region_name is None: aws_region_name = "us-west-2" - credentials: Credentials = self.get_credentials( + credentials: Credentials = self.get_credentials( # type: ignore aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, aws_session_token=aws_session_token, @@ -151,35 +150,80 @@ class BedrockEmbedding(BaseAWSLLM): raise BedrockError(status_code=408, message="Timeout error occurred.") return response.json() - + def _transform_response( - self, response_list: List[dict], model: str, provider: BEDROCK_EMBEDDING_PROVIDERS_LITERAL + self, + response_list: List[dict], + model: str, + provider: BEDROCK_EMBEDDING_PROVIDERS_LITERAL, + is_async_invoke: Optional[bool] = False, ) -> Optional[EmbeddingResponse]: """ Transforms the response from the Bedrock embedding provider to the OpenAI format. """ returned_response: Optional[EmbeddingResponse] = None - if model == "amazon.titan-embed-image-v1": - returned_response = ( - AmazonTitanMultimodalEmbeddingG1Config()._transform_response( + + # Handle async invoke responses (single response with invocationArn) + if ( + is_async_invoke + and len(response_list) == 1 + and "invocationArn" in response_list[0] + ): + if provider == "twelvelabs": + returned_response = ( + TwelveLabsMarengoEmbeddingConfig()._transform_async_invoke_response( + response=response_list[0], model=model + ) + ) + else: + # For other providers, create a generic async response + invocation_arn = response_list[0].get("invocationArn", "") + + from litellm.types.utils import Embedding, Usage + + embedding = Embedding( + embedding=[], + index=0, + object="embedding", # Must be literal "embedding" + ) + usage = Usage(prompt_tokens=0, total_tokens=0) + + # Create hidden params with job ID + from litellm.types.llms.base import HiddenParams + + hidden_params = HiddenParams() + setattr(hidden_params, "_invocation_arn", invocation_arn) + + returned_response = EmbeddingResponse( + data=[embedding], + model=model, + usage=usage, + hidden_params=hidden_params, + ) + else: + # Handle regular invoke responses + if model == "amazon.titan-embed-image-v1": + returned_response = ( + AmazonTitanMultimodalEmbeddingG1Config()._transform_response( + response_list=response_list, model=model + ) + ) + elif model == "amazon.titan-embed-text-v1": + returned_response = AmazonTitanG1Config()._transform_response( response_list=response_list, model=model ) - ) - elif model == "amazon.titan-embed-text-v1": - returned_response = AmazonTitanG1Config()._transform_response( - response_list=response_list, model=model - ) - elif model == "amazon.titan-embed-text-v2:0": - returned_response = AmazonTitanV2Config()._transform_response( - response_list=response_list, model=model - ) - elif provider == "twelvelabs": - returned_response = TwelveLabsMarengoEmbeddingConfig()._transform_response( - response_list=response_list, model=model - ) - - - ########################################################## + elif model == "amazon.titan-embed-text-v2:0": + returned_response = AmazonTitanV2Config()._transform_response( + response_list=response_list, model=model + ) + elif provider == "twelvelabs": + returned_response = ( + TwelveLabsMarengoEmbeddingConfig()._transform_response( + response_list=response_list, model=model + ) + ) + + ########################################################## # Validate returned response ########################################################## if returned_response is None: @@ -203,6 +247,7 @@ class BedrockEmbedding(BaseAWSLLM): logging_obj: Any, provider: BEDROCK_EMBEDDING_PROVIDERS_LITERAL, api_key: Optional[str] = None, + is_async_invoke: Optional[bool] = False, ): responses: List[dict] = [] for data in batch_data: @@ -210,7 +255,7 @@ class BedrockEmbedding(BaseAWSLLM): if extra_headers is not None: headers = {"Content-Type": "application/json", **extra_headers} - prepped = self.get_request_headers( + prepped = self.get_request_headers( # type: ignore # type: ignore credentials=credentials, aws_region_name=aws_region_name, extra_headers=extra_headers, @@ -249,7 +294,10 @@ class BedrockEmbedding(BaseAWSLLM): responses.append(response) return self._transform_response( - response_list=responses, model=model, provider=provider + response_list=responses, + model=model, + provider=provider, + is_async_invoke=is_async_invoke, ) async def _async_single_func_embeddings( @@ -265,6 +313,7 @@ class BedrockEmbedding(BaseAWSLLM): logging_obj: Any, provider: BEDROCK_EMBEDDING_PROVIDERS_LITERAL, api_key: Optional[str] = None, + is_async_invoke: Optional[bool] = False, ): responses: List[dict] = [] for data in batch_data: @@ -272,7 +321,7 @@ class BedrockEmbedding(BaseAWSLLM): if extra_headers is not None: headers = {"Content-Type": "application/json", **extra_headers} - prepped = self.get_request_headers( + prepped = self.get_request_headers( # type: ignore # type: ignore credentials=credentials, aws_region_name=aws_region_name, extra_headers=extra_headers, @@ -311,7 +360,10 @@ class BedrockEmbedding(BaseAWSLLM): responses.append(response) ## TRANSFORM RESPONSE ## return self._transform_response( - response_list=responses, model=model, provider=provider + response_list=responses, + model=model, + provider=provider, + is_async_invoke=is_async_invoke, ) def embeddings( @@ -343,7 +395,10 @@ class BedrockEmbedding(BaseAWSLLM): model=model, model_id=unencoded_model_id, ) - + # Check async invoke needs to be used + has_async_invoke = "async_invoke/" in model + if has_async_invoke: + model = model.replace("async_invoke/", "", 1) provider = self.get_bedrock_embedding_provider(model) if provider is None: raise Exception( @@ -402,10 +457,14 @@ class BedrockEmbedding(BaseAWSLLM): elif provider == "twelvelabs": batch_data = [] for i in input: - twelvelabs_request: ( - TwelveLabsMarengoEmbeddingRequest - ) = TwelveLabsMarengoEmbeddingConfig()._transform_request( - input=i, inference_params=inference_params + twelvelabs_request = ( + TwelveLabsMarengoEmbeddingConfig()._transform_request( + input=i, + inference_params=inference_params, + async_invoke_route=has_async_invoke, + model_id=modelId, + output_s3_uri=inference_params.get("output_s3_uri"), + ) ) batch_data.append(twelvelabs_request) @@ -417,7 +476,10 @@ class BedrockEmbedding(BaseAWSLLM): ), aws_region_name=aws_region_name, ) - endpoint_url = f"{endpoint_url}/model/{modelId}/invoke" + if has_async_invoke: + endpoint_url = f"{endpoint_url}/async-invoke" + else: + endpoint_url = f"{endpoint_url}/model/{modelId}/invoke" if batch_data is not None: if aembedding: @@ -437,6 +499,7 @@ class BedrockEmbedding(BaseAWSLLM): logging_obj=logging_obj, api_key=api_key, provider=provider, + is_async_invoke=has_async_invoke, ) returned_response = self._single_func_embeddings( client=( @@ -454,6 +517,7 @@ class BedrockEmbedding(BaseAWSLLM): logging_obj=logging_obj, api_key=api_key, provider=provider, + is_async_invoke=has_async_invoke, ) if returned_response is None: raise Exception("Unable to map Bedrock request to provider") @@ -465,7 +529,7 @@ class BedrockEmbedding(BaseAWSLLM): if extra_headers is not None: headers = {"Content-Type": "application/json", **extra_headers} - prepped = self.get_request_headers( + prepped = self.get_request_headers( # type: ignore credentials=credentials, aws_region_name=aws_region_name, extra_headers=extra_headers, @@ -491,3 +555,94 @@ class BedrockEmbedding(BaseAWSLLM): client=client, headers=prepped.headers, # type: ignore ) + + async def _get_async_invoke_status( + self, invocation_arn: str, aws_region_name: str, logging_obj=None, **kwargs + ) -> dict: + """ + Get the status of an async invoke job using the GetAsyncInvoke operation. + + Args: + invocation_arn: The invocation ARN from the async invoke response + aws_region_name: AWS region name + **kwargs: Additional parameters (credentials, etc.) + + Returns: + dict: Status response from AWS Bedrock + """ + + # Get AWS credentials using the same method as other Bedrock methods + credentials, _ = self._load_credentials(kwargs) + + # Get the runtime endpoint + endpoint_url, _ = self.get_runtime_endpoint( + api_base=None, + aws_bedrock_runtime_endpoint=kwargs.get("aws_bedrock_runtime_endpoint"), + aws_region_name=aws_region_name, + ) + + # Construct the status check URL + status_url = f"{endpoint_url}/async-invoke/{invocation_arn}" + + # Prepare headers + headers = {"Content-Type": "application/json"} + + # Get AWS signed headers + prepped = self.get_request_headers( # type: ignore + credentials=credentials, + aws_region_name=aws_region_name, + extra_headers=None, + endpoint_url=status_url, + data="", # GET request, no body + headers=headers, + api_key=None, + ) + + # LOGGING + if logging_obj is not None: + # Create custom curl command for GET request + masked_headers = logging_obj._get_masked_headers(prepped.headers) + formatted_headers = " ".join( + [f"-H '{k}: {v}'" for k, v in masked_headers.items()] + ) + custom_curl = "\n\nGET Request Sent from LiteLLM:\n" + custom_curl += "curl -X GET \\\n" + custom_curl += f"{prepped.url} \\\n" + custom_curl += f"{formatted_headers}\n" + + logging_obj.pre_call( + input=invocation_arn, + api_key="", + additional_args={ + "complete_input_dict": {"invocation_arn": invocation_arn}, + "api_base": prepped.url, + "headers": prepped.headers, + "request_str": custom_curl, # Override with custom GET curl command + }, + ) + + # Make the GET request + client = get_async_httpx_client(llm_provider=LlmProviders.BEDROCK) + response = await client.get( + url=prepped.url, + headers=prepped.headers, + ) + + # LOGGING + if logging_obj is not None: + logging_obj.post_call( + input=invocation_arn, + api_key="", + original_response=response, + additional_args={ + "complete_input_dict": {"invocation_arn": invocation_arn} + }, + ) + + # Parse response + if response.status_code == 200: + return response.json() + else: + raise Exception( + f"Failed to get async invoke status: {response.status_code} - {response.text}" + ) diff --git a/litellm/llms/bedrock/embed/twelvelabs_marengo_transformation.py b/litellm/llms/bedrock/embed/twelvelabs_marengo_transformation.py index fdad8a65043..c85c388eebc 100644 --- a/litellm/llms/bedrock/embed/twelvelabs_marengo_transformation.py +++ b/litellm/llms/bedrock/embed/twelvelabs_marengo_transformation.py @@ -1,33 +1,47 @@ """ -Transformation logic from OpenAI /v1/embeddings format to Bedrock TwelveLabs Marengo /invoke format. +Transformation logic from OpenAI /v1/embeddings format to Bedrock TwelveLabs Marengo /invoke and /async-invoke format. Why separate file? Make it easy to see how transformation works Docs - https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-marengo.html """ -from typing import List +from typing import List, Optional, Union, cast from litellm.types.llms.bedrock import ( + TWELVELABS_EMBEDDING_INPUT_TYPES, + TwelveLabsAsyncInvokeRequest, TwelveLabsMarengoEmbeddingRequest, + TwelveLabsOutputDataConfig, + TwelveLabsS3Location, + TwelveLabsS3OutputDataConfig, ) from litellm.types.utils import Embedding, EmbeddingResponse, Usage -from litellm.utils import get_base64_str, is_base64_encoded class TwelveLabsMarengoEmbeddingConfig: """ Reference - https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-marengo.html - Supports text and image inputs for Phase 1. - Video and audio support will be added in Phase 2. + Supports text, image, video, and audio inputs. + - InvokeModel: text and image inputs + - StartAsyncInvoke: video, audio, image, and text inputs """ def __init__(self) -> None: pass def get_supported_openai_params(self) -> List[str]: - return ["encoding_format", "textTruncate", "embeddingOption"] + return [ + "encoding_format", + "textTruncate", + "embeddingOption", + "startSec", + "lengthSec", + "useFixedLengthSec", + "minClipSec", + "input_type", + ] def map_openai_params( self, non_default_params: dict, optional_params: dict @@ -41,45 +55,142 @@ class TwelveLabsMarengoEmbeddingConfig: optional_params["textTruncate"] = v elif k == "embeddingOption": optional_params["embeddingOption"] = v + elif k == "input_type": + # Map input_type to inputType for Bedrock + optional_params["inputType"] = v + elif k in ["startSec", "lengthSec", "useFixedLengthSec", "minClipSec"]: + optional_params[k] = v return optional_params + def _extract_bucket_owner_from_params(self, inference_params: dict) -> str: + """ + Extract bucket owner from inference parameters. + """ + return inference_params.get("bucketOwner", "") + + def _is_s3_url(self, input: str) -> bool: + """Check if input is an S3 URL.""" + return input.startswith("s3://") + def _transform_request( - self, input: str, inference_params: dict - ) -> TwelveLabsMarengoEmbeddingRequest: + self, + input: str, + inference_params: dict, + async_invoke_route: bool = False, + model_id: Optional[str] = None, + output_s3_uri: Optional[str] = None, + ) -> Union[TwelveLabsMarengoEmbeddingRequest, TwelveLabsAsyncInvokeRequest]: """ - Transform OpenAI-style input to TwelveLabs Marengo format. - Phase 1: Supports text and image inputs only. - """ - # Check if input is base64 encoded image - is_encoded = is_base64_encoded(input) + Transform OpenAI-style input to TwelveLabs Marengo format/async-invoke format. - if is_encoded: - # Image input - b64_str = get_base64_str(input) - transformed_request = TwelveLabsMarengoEmbeddingRequest( - inputType="image", mediaSource={"base64String": b64_str} - ) - else: - # Text input - transformed_request = TwelveLabsMarengoEmbeddingRequest( - inputType="text", inputText=input + Supports: + - Text inputs (for both invoke and async-invoke) + - Image inputs (for both invoke and async-invoke) + - Video inputs (async-invoke only) + - Audio inputs (async-invoke only) + - S3 URLs for all media types (async-invoke only) + """ + # Get input_type or default to "text" + input_type = cast( + TWELVELABS_EMBEDDING_INPUT_TYPES, + inference_params.get("inputType") or inference_params.get("input_type") or "text" + ) + + # Validate that async-invoke is used for video/audio + if input_type in ["video", "audio"] and not async_invoke_route: + raise ValueError( + f"Input type '{input_type}' requires async_invoke route. " + f"Use model format: 'bedrock/async_invoke/model_id'" ) + transformed_request: TwelveLabsMarengoEmbeddingRequest = { + "inputType": input_type + } + + if input_type == "text": + transformed_request["inputText"] = input # Set default textTruncate if not specified if "textTruncate" not in inference_params: transformed_request["textTruncate"] = "end" + elif input_type in ["image", "video", "audio"]: + if self._is_s3_url(input): + # S3 URL input + s3_location: TwelveLabsS3Location = {"uri": input} + bucket_owner = self._extract_bucket_owner_from_params(inference_params) + if bucket_owner: + s3_location["bucketOwner"] = bucket_owner + + transformed_request["mediaSource"] = {"s3Location": s3_location} + else: + # Base64 encoded input + if input.startswith("data:"): + # Extract base64 data from data URL + b64_str = input.split(",", 1)[1] if "," in input else input + else: + # Direct base64 string + from litellm.utils import get_base64_str + b64_str = get_base64_str(input) + + transformed_request["mediaSource"] = {"base64String": b64_str} + # Apply any additional inference parameters for k, v in inference_params.items(): if k not in [ "inputType", + "input_type", # Exclude both camelCase and snake_case "inputText", "mediaSource", + "bucketOwner", # Don't include bucketOwner in the request ]: # Don't override core fields transformed_request[k] = v # type: ignore + # If async invoke route, wrap in the async invoke format + if async_invoke_route and model_id: + return self._wrap_async_invoke_request( + model_input=transformed_request, + model_id=model_id, + output_s3_uri=output_s3_uri, + ) + return transformed_request + def _wrap_async_invoke_request( + self, + model_input: TwelveLabsMarengoEmbeddingRequest, + model_id: str, + output_s3_uri: Optional[str] = None, + ) -> TwelveLabsAsyncInvokeRequest: + """ + Wrap the transformed request in the correct AWS Bedrock async invoke format. + + Args: + model_input: The transformed TwelveLabs Marengo embedding request + model_id: The model identifier (without async_invoke prefix) + output_s3_uri: Optional S3 URI for output data config + + Returns: + TwelveLabsAsyncInvokeRequest: The wrapped async invoke request + """ + import urllib.parse + + # Clean the model ID + unquoted_model_id = urllib.parse.unquote(model_id) + if unquoted_model_id.startswith("async_invoke/"): + unquoted_model_id = unquoted_model_id.replace("async_invoke/", "") + + # Validate that the S3 URI is not empty + if not output_s3_uri or output_s3_uri.strip() == "": + raise ValueError("output_s3_uri cannot be empty for async invoke requests") + + return TwelveLabsAsyncInvokeRequest( + modelId=unquoted_model_id, + modelInput=model_input, + outputDataConfig=TwelveLabsOutputDataConfig( + s3OutputDataConfig=TwelveLabsS3OutputDataConfig(s3Uri=output_s3_uri) + ), + ) + def _transform_response( self, response_list: List[dict], model: str ) -> EmbeddingResponse: @@ -138,3 +249,53 @@ class TwelveLabsMarengoEmbeddingConfig: usage = Usage(prompt_tokens=total_tokens, total_tokens=total_tokens) return EmbeddingResponse(data=embeddings, model=model, usage=usage) + + def _transform_async_invoke_response( + self, response: dict, model: str + ) -> EmbeddingResponse: + """ + Transform async invoke response (invocation ARN) to OpenAI format. + + AWS async invoke returns: + { + "invocationArn": "arn:aws:bedrock:us-east-1:123456789012:async-invoke/abc123" + } + + We transform this to a job-like embedding response: + { + "object": "list", + "data": [ + { + "object": "embedding_job_id:1234567890", + "embedding": [], + "index": 0 + } + ], + "model": "model", + "usage": {} + } + """ + invocation_arn = response.get("invocationArn", "") + + # Create a placeholder embedding object for the job + embedding = Embedding( + embedding=[], # Empty embedding for async jobs + index=0, + object="embedding", + ) + + # Create usage object (empty for async jobs) + usage = Usage(prompt_tokens=0, total_tokens=0) + + # Create hidden params with job ID + from litellm.types.llms.base import HiddenParams + + hidden_params = HiddenParams() + setattr(hidden_params, "_invocation_arn", invocation_arn) + + return EmbeddingResponse( + data=[embedding], + model=model, + usage=usage, + hidden_params=hidden_params, + ) diff --git a/litellm/llms/cohere/common_utils.py b/litellm/llms/cohere/common_utils.py index 6dbe52d575e..d194d9556b6 100644 --- a/litellm/llms/cohere/common_utils.py +++ b/litellm/llms/cohere/common_utils.py @@ -31,7 +31,7 @@ def validate_environment( "Request-Source": "unspecified:litellm", "accept": "application/json", "content-type": "application/json", - "Authorization": "bearer $CO_API_KEY" + "Authorization": "Bearer $CO_API_KEY" } """ headers.update( @@ -42,7 +42,7 @@ def validate_environment( } ) if api_key: - headers["Authorization"] = f"bearer {api_key}" + headers["Authorization"] = f"Bearer {api_key}" return headers diff --git a/litellm/llms/cohere/rerank/transformation.py b/litellm/llms/cohere/rerank/transformation.py index 5371b9a4b61..f9c979712da 100644 --- a/litellm/llms/cohere/rerank/transformation.py +++ b/litellm/llms/cohere/rerank/transformation.py @@ -1,8 +1,8 @@ from typing import Any, Dict, List, Optional, Union import httpx -import litellm +import litellm from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj from litellm.llms.base_llm.chat.transformation import BaseLLMException from litellm.llms.base_llm.rerank.transformation import BaseRerankConfig @@ -52,20 +52,20 @@ class CohereRerankConfig(BaseRerankConfig): return_documents: Optional[bool] = True, max_chunks_per_doc: Optional[int] = None, max_tokens_per_doc: Optional[int] = None, - ) -> OptionalRerankParams: + ) -> Dict: """ Map Cohere rerank params No mapping required - returns all supported params """ - return OptionalRerankParams( + return dict(OptionalRerankParams( query=query, documents=documents, top_n=top_n, rank_fields=rank_fields, return_documents=return_documents, max_chunks_per_doc=max_chunks_per_doc, - ) + )) def validate_environment( self, @@ -86,7 +86,7 @@ class CohereRerankConfig(BaseRerankConfig): ) default_headers = { - "Authorization": f"bearer {api_key}", + "Authorization": f"Bearer {api_key}", "accept": "application/json", "content-type": "application/json", } @@ -101,7 +101,7 @@ class CohereRerankConfig(BaseRerankConfig): def transform_rerank_request( self, model: str, - optional_rerank_params: OptionalRerankParams, + optional_rerank_params: Dict, headers: dict, ) -> dict: if "query" not in optional_rerank_params: diff --git a/litellm/llms/cohere/rerank_v2/transformation.py b/litellm/llms/cohere/rerank_v2/transformation.py index 74e760460d0..eb551a8a949 100644 --- a/litellm/llms/cohere/rerank_v2/transformation.py +++ b/litellm/llms/cohere/rerank_v2/transformation.py @@ -44,25 +44,25 @@ class CohereRerankV2Config(CohereRerankConfig): return_documents: Optional[bool] = True, max_chunks_per_doc: Optional[int] = None, max_tokens_per_doc: Optional[int] = None, - ) -> OptionalRerankParams: + ) -> Dict: """ Map Cohere rerank params No mapping required - returns all supported params """ - return OptionalRerankParams( + return dict(OptionalRerankParams( query=query, documents=documents, top_n=top_n, rank_fields=rank_fields, return_documents=return_documents, max_tokens_per_doc=max_tokens_per_doc, - ) + )) def transform_rerank_request( self, model: str, - optional_rerank_params: OptionalRerankParams, + optional_rerank_params: Dict, headers: dict, ) -> dict: if "query" not in optional_rerank_params: diff --git a/litellm/llms/cometapi/embed/__init__.py b/litellm/llms/cometapi/embed/__init__.py new file mode 100644 index 00000000000..a36647f46c6 --- /dev/null +++ b/litellm/llms/cometapi/embed/__init__.py @@ -0,0 +1,3 @@ +from .transformation import CometAPIEmbeddingConfig + +__all__ = ["CometAPIEmbeddingConfig"] diff --git a/litellm/llms/cometapi/embed/transformation.py b/litellm/llms/cometapi/embed/transformation.py new file mode 100644 index 00000000000..5cfd1253149 --- /dev/null +++ b/litellm/llms/cometapi/embed/transformation.py @@ -0,0 +1,157 @@ +""" +CometAPI Embedding API support - OpenAI compatible +""" + +from typing import List, Optional, Union + +import httpx + +from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj +from litellm.llms.base_llm.chat.transformation import BaseLLMException +from litellm.llms.base_llm.embedding.transformation import BaseEmbeddingConfig +from litellm.secret_managers.main import get_secret_str +from litellm.types.llms.openai import AllEmbeddingInputValues, AllMessageValues +from litellm.types.utils import EmbeddingResponse, Usage + +from ..common_utils import CometAPIException + + +class CometAPIEmbeddingConfig(BaseEmbeddingConfig): + """ + Configuration class for CometAPI Embedding API. + + Since CometAPI is OpenAI-compatible, this class provides OpenAI-standard + embedding functionality with CometAPI-specific authentication and endpoints. + """ + + def __init__(self) -> None: + pass + + 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 the CometAPI embedding endpoint. + """ + api_base = ( + "https://api.cometapi.com/v1" if api_base is None else api_base.rstrip("/") + ) + complete_url = f"{api_base}/embeddings" + return complete_url + + 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: + """ + Validate and set up authentication headers for CometAPI. + """ + if api_key is None: + api_key = get_secret_str("COMETAPI_KEY") + + default_headers = { + "Authorization": f"Bearer {api_key}", + "accept": "application/json", + "Content-Type": "application/json", + } + + if "Authorization" in headers: + default_headers["Authorization"] = headers["Authorization"] + + return {**default_headers, **headers} + + def get_supported_openai_params(self, model: str) -> List[str]: + """ + Get the supported OpenAI parameters for embedding requests. + CometAPI supports standard OpenAI embedding parameters. + """ + return [ + "dimensions", + "encoding_format", + "user", + ] + + def map_openai_params( + self, + non_default_params: dict, + optional_params: dict, + model: str, + drop_params: bool, + ) -> dict: + """ + Map OpenAI parameters to CometAPI format. + """ + supported_openai_params = self.get_supported_openai_params(model) + for param, value in non_default_params.items(): + if param in supported_openai_params: + optional_params[param] = value + return optional_params + + def transform_embedding_request( + self, + model: str, + input: AllEmbeddingInputValues, + optional_params: dict, + headers: dict, + ) -> dict: + """ + Transform the embedding request into CometAPI format. + """ + return {"input": input, "model": model, **optional_params} + + def transform_embedding_response( + self, + model: str, + raw_response: httpx.Response, + model_response: EmbeddingResponse, + logging_obj: LiteLLMLoggingObj, + api_key: Optional[str], + request_data: dict, + optional_params: dict, + litellm_params: dict, + ) -> EmbeddingResponse: + """ + Transform CometAPI response into standard EmbeddingResponse format. + """ + try: + raw_response_json = raw_response.json() + except Exception: + raise CometAPIException( + message=raw_response.text, + status_code=raw_response.status_code, + headers=raw_response.headers, + ) + + model_response.model = raw_response_json.get("model") + model_response.data = raw_response_json.get("data") + model_response.object = raw_response_json.get("object") + + usage = Usage( + prompt_tokens=raw_response_json.get("usage", {}).get("prompt_tokens", 0), + total_tokens=raw_response_json.get("usage", {}).get("total_tokens", 0), + ) + + model_response.usage = usage + return model_response + + def get_error_class( + self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers] + ) -> BaseLLMException: + """ + Get the appropriate error class for CometAPI exceptions. + """ + return CometAPIException( + message=error_message, status_code=status_code, headers=headers + ) diff --git a/litellm/llms/cometapi/image_generation/__init__.py b/litellm/llms/cometapi/image_generation/__init__.py new file mode 100644 index 00000000000..8d7630f2b30 --- /dev/null +++ b/litellm/llms/cometapi/image_generation/__init__.py @@ -0,0 +1,13 @@ +from litellm.llms.base_llm.image_generation.transformation import ( + BaseImageGenerationConfig, +) + +from .transformation import CometAPIImageGenerationConfig + +__all__ = [ + "CometAPIImageGenerationConfig", +] + + +def get_cometapi_image_generation_config(model: str) -> BaseImageGenerationConfig: + return CometAPIImageGenerationConfig() diff --git a/litellm/llms/cometapi/image_generation/cost_calculator.py b/litellm/llms/cometapi/image_generation/cost_calculator.py new file mode 100644 index 00000000000..b10c9d09087 --- /dev/null +++ b/litellm/llms/cometapi/image_generation/cost_calculator.py @@ -0,0 +1,25 @@ +from typing import Any + +import litellm +from litellm.types.utils import ImageResponse + + +def cost_calculator( + model: str, + image_response: Any, +) -> float: + """ + CometAPI image generation cost calculator + """ + _model_info = litellm.get_model_info( + model=model, + custom_llm_provider=litellm.LlmProviders.COMETAPI.value, + ) + output_cost_per_image: float = _model_info.get("output_cost_per_image") or 0.0 + num_images: int = 0 + if isinstance(image_response, ImageResponse): + if image_response.data: + num_images = len(image_response.data) + return output_cost_per_image * num_images + else: + raise ValueError(f"image_response must be of type ImageResponse got type={type(image_response)}") diff --git a/litellm/llms/cometapi/image_generation/transformation.py b/litellm/llms/cometapi/image_generation/transformation.py new file mode 100644 index 00000000000..bf1ca9ddde6 --- /dev/null +++ b/litellm/llms/cometapi/image_generation/transformation.py @@ -0,0 +1,170 @@ +from typing import TYPE_CHECKING, Any, List, Optional + +import httpx + +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 ( + AllMessageValues, + OpenAIImageGenerationOptionalParams, +) +from litellm.types.utils import ImageObject, ImageResponse + +if TYPE_CHECKING: + from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj + + LiteLLMLoggingObj = _LiteLLMLoggingObj +else: + LiteLLMLoggingObj = Any + + +class CometAPIImageGenerationConfig(BaseImageGenerationConfig): + DEFAULT_BASE_URL: str = "https://api.cometapi.com" + IMAGE_GENERATION_ENDPOINT: str = "v1/images/generations" + + def get_supported_openai_params( + self, model: str + ) -> List[OpenAIImageGenerationOptionalParams]: + """ + https://api.cometapi.com/v1/images/generations + """ + return [ + "n", + "quality", + "response_format", + "size", + "style", + ] + + def map_openai_params( + self, + non_default_params: dict, + optional_params: dict, + model: str, + drop_params: bool, + ) -> dict: + supported_params = self.get_supported_openai_params(model) + + for k in non_default_params.keys(): + if k not in optional_params.keys(): + if k in supported_params: + # CometAPI uses OpenAI-compatible parameters, so we can pass them directly + optional_params[k] = non_default_params[k] + elif drop_params: + pass + else: + raise ValueError( + f"Parameter {k} is not supported for model {model}. Supported parameters are {supported_params}. Set drop_params=True to drop unsupported parameters." + ) + + return optional_params + + 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 the request + """ + complete_url: str = ( + api_base + or get_secret_str("COMETAPI_BASE_URL") + or get_secret_str("COMETAPI_API_BASE") + or self.DEFAULT_BASE_URL + ) + + complete_url = complete_url.rstrip("/") + complete_url = f"{complete_url}/{self.IMAGE_GENERATION_ENDPOINT}" + return complete_url + + 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: + final_api_key: Optional[str] = ( + api_key or + get_secret_str("COMETAPI_KEY") or + get_secret_str("COMETAPI_API_KEY") + ) + if not final_api_key: + raise ValueError("COMETAPI_KEY or COMETAPI_API_KEY is not set") + + headers["Authorization"] = f"Bearer {final_api_key}" + headers["Content-Type"] = "application/json" + return headers + + def transform_image_generation_request( + self, + model: str, + prompt: str, + optional_params: dict, + litellm_params: dict, + headers: dict, + ) -> dict: + """ + Transform the image generation request to the CometAPI image generation request body + + https://api.cometapi.com/v1/images/generations + """ + # CometAPI uses OpenAI-compatible format + request_body = { + "prompt": prompt, + "model": model, + **optional_params, + } + 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 the image generation response to the litellm image response + + https://api.cometapi.com/v1/images/generations + """ + try: + response_data = raw_response.json() + except Exception as e: + raise self.get_error_class( + error_message=f"Error transforming image generation response: {e}", + status_code=raw_response.status_code, + headers=raw_response.headers, + ) + + if not model_response.data: + model_response.data = [] + + # CometAPI returns OpenAI-compatible format + # Expected format: {"created": timestamp, "data": [{"url": "...", "b64_json": "..."}]} + if "data" in response_data: + for image_data in response_data["data"]: + image_obj = ImageObject( + b64_json=image_data.get("b64_json"), + url=image_data.get("url"), + ) + model_response.data.append(image_obj) + + return model_response diff --git a/litellm/llms/custom_httpx/aiohttp_transport.py b/litellm/llms/custom_httpx/aiohttp_transport.py index ab69ea1f8c3..50bbccd6a4b 100644 --- a/litellm/llms/custom_httpx/aiohttp_transport.py +++ b/litellm/llms/custom_httpx/aiohttp_transport.py @@ -152,6 +152,16 @@ class LiteLLMAiohttpTransport(AiohttpTransport): # If we don't have a client or it's not a ClientSession, create one if not isinstance(self.client, ClientSession): + if hasattr(self, "_client_factory") and callable(self._client_factory): + self.client = self._client_factory() + else: + self.client = ClientSession() + # Don't return yet - check if the newly created session is valid + + # Check if the session itself is closed + if self.client.closed: + verbose_logger.debug("Session is closed, creating new session") + # Create a new session if hasattr(self, "_client_factory") and callable(self._client_factory): self.client = self._client_factory() else: @@ -169,14 +179,17 @@ class LiteLLMAiohttpTransport(AiohttpTransport): or session_loop != current_loop or session_loop.is_closed() ): - # Clean up the old session + # Close old session to prevent leaks + old_session = self.client try: - # Note: not awaiting close() here as it might be from a different loop - # The session will be garbage collected - pass + if not old_session.closed: + try: + asyncio.create_task(old_session.close()) + except RuntimeError: + # Different event loop - can't schedule task, rely on GC + verbose_logger.debug("Old session from different loop, relying on GC") except Exception as e: verbose_logger.debug(f"Error closing old session: {e}") - pass # Create a new session in the current event loop if hasattr(self, "_client_factory") and callable(self._client_factory): @@ -193,13 +206,58 @@ class LiteLLMAiohttpTransport(AiohttpTransport): return self.client + async def _make_aiohttp_request( + self, + client_session: ClientSession, + request: httpx.Request, + timeout: dict, + proxy: Optional[str], + sni_hostname: Optional[str], + ) -> ClientResponse: + """ + Helper function to make an aiohttp request with the given parameters. + + Args: + client_session: The aiohttp ClientSession to use + request: The httpx Request to send + timeout: Timeout settings dict with 'connect', 'read', 'pool' keys + proxy: Optional proxy URL + sni_hostname: Optional SNI hostname for SSL + + Returns: + ClientResponse from aiohttp + """ + from aiohttp import ClientTimeout + from yarl import URL as YarlURL + + try: + data = request.content + except httpx.RequestNotRead: + data = request.stream # type: ignore + request.headers.pop("transfer-encoding", None) # handled by aiohttp + + response = await client_session.request( + method=request.method, + url=YarlURL(str(request.url), encoded=True), + headers=request.headers, + data=data, + allow_redirects=False, + auto_decompress=False, + timeout=ClientTimeout( + sock_connect=timeout.get("connect"), + sock_read=timeout.get("read"), + connect=timeout.get("pool"), + ), + proxy=proxy, + server_hostname=sni_hostname, + ).__aenter__() + + return response + async def handle_async_request( self, request: httpx.Request, ) -> httpx.Response: - from aiohttp import ClientTimeout - from yarl import URL as YarlURL - timeout = request.extensions.get("timeout", {}) sni_hostname = request.extensions.get("sni_hostname") @@ -209,28 +267,38 @@ class LiteLLMAiohttpTransport(AiohttpTransport): # Resolve proxy settings from environment variables proxy = await self._get_proxy_settings(request) - with map_aiohttp_exceptions(): - try: - data = request.content - except httpx.RequestNotRead: - data = request.stream # type: ignore - request.headers.pop("transfer-encoding", None) # handled by aiohttp - - response = await client_session.request( - method=request.method, - url=YarlURL(str(request.url), encoded=True), - headers=request.headers, - data=data, - allow_redirects=False, - auto_decompress=False, - timeout=ClientTimeout( - sock_connect=timeout.get("connect"), - sock_read=timeout.get("read"), - connect=timeout.get("pool"), - ), - proxy=proxy, - server_hostname=sni_hostname, - ).__aenter__() + try: + with map_aiohttp_exceptions(): + response = await self._make_aiohttp_request( + client_session=client_session, + request=request, + timeout=timeout, + proxy=proxy, + sni_hostname=sni_hostname, + ) + except RuntimeError as e: + # Handle the case where session was closed between our check and actual use + if "Session is closed" in str(e): + verbose_logger.debug(f"Session closed during request, retrying with new session: {e}") + # Force creation of a new session + if hasattr(self, "_client_factory") and callable(self._client_factory): + self.client = self._client_factory() + else: + self.client = ClientSession() + client_session = self.client + + # Retry the request with the new session + with map_aiohttp_exceptions(): + response = await self._make_aiohttp_request( + client_session=client_session, + request=request, + timeout=timeout, + proxy=proxy, + sni_hostname=sni_hostname, + ) + else: + # Re-raise if it's a different RuntimeError + raise return httpx.Response( status_code=response.status, diff --git a/litellm/llms/custom_httpx/http_handler.py b/litellm/llms/custom_httpx/http_handler.py index 3a67d5127b7..a3ad2c67272 100644 --- a/litellm/llms/custom_httpx/http_handler.py +++ b/litellm/llms/custom_httpx/http_handler.py @@ -12,7 +12,13 @@ from httpx._types import RequestFiles import litellm from litellm._logging import verbose_logger -from litellm.constants import _DEFAULT_TTL_FOR_HTTPX_CLIENTS +from litellm.constants import ( + _DEFAULT_TTL_FOR_HTTPX_CLIENTS, + AIOHTTP_CONNECTOR_LIMIT, + AIOHTTP_KEEPALIVE_TIMEOUT, + AIOHTTP_TTL_DNS_CACHE, + DEFAULT_SSL_CIPHERS +) from litellm.litellm_core_utils.logging_utils import track_llm_api_timing from litellm.types.llms.custom_http import * @@ -94,10 +100,19 @@ def get_ssl_configuration( if ssl_verify is not False: custom_ssl_context = ssl.create_default_context(cafile=cafile) - # If security level is set, apply it to the SSL context + + # Optimize SSL handshake performance + # Set minimum TLS version to 1.2 for better performance + custom_ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2 + + # Configure cipher suites for optimal performance if ssl_security_level and isinstance(ssl_security_level, str): - # Create a custom SSL context with reduced security level + # User provided custom cipher configuration (e.g., via SSL_SECURITY_LEVEL env var) custom_ssl_context.set_ciphers(ssl_security_level) + else: + # Use optimized cipher list that strongly prefers fast ciphers + # but falls back to widely compatible ones + custom_ssl_context.set_ciphers(DEFAULT_SSL_CIPHERS) # Use our custom SSL context instead of the original ssl_verify value return custom_ssl_context @@ -164,7 +179,7 @@ class AsyncHTTPHandler: self, timeout: Optional[Union[float, httpx.Timeout]] = None, event_hooks: Optional[Mapping[str, List[Callable[..., Any]]]] = None, - concurrent_limit=1000, + concurrent_limit=None, # Kept for backward compatibility, but ignored (no limits) client_alias: Optional[str] = None, # name for client in logs ssl_verify: Optional[VerifyTypes] = None, shared_session: Optional["ClientSession"] = None, @@ -173,7 +188,6 @@ class AsyncHTTPHandler: self.event_hooks = event_hooks self.client = self.create_client( timeout=timeout, - concurrent_limit=concurrent_limit, event_hooks=event_hooks, ssl_verify=ssl_verify, shared_session=shared_session, @@ -183,7 +197,6 @@ class AsyncHTTPHandler: def create_client( self, timeout: Optional[Union[float, httpx.Timeout]], - concurrent_limit: int, event_hooks: Optional[Mapping[str, List[Callable[..., Any]]]], ssl_verify: Optional[VerifyTypes] = None, shared_session: Optional["ClientSession"] = None, @@ -209,10 +222,6 @@ class AsyncHTTPHandler: transport=transport, event_hooks=event_hooks, timeout=timeout, - limits=httpx.Limits( - max_connections=concurrent_limit, - max_keepalive_connections=concurrent_limit, - ), verify=ssl_config, cert=cert, headers=headers, @@ -286,7 +295,7 @@ class AsyncHTTPHandler: except (httpx.RemoteProtocolError, httpx.ConnectError): # Retry the request with a new session if there is a connection error new_client = self.create_client( - timeout=timeout, concurrent_limit=1, event_hooks=self.event_hooks + timeout=timeout, event_hooks=self.event_hooks ) try: return await self.single_connection_post_request( @@ -352,7 +361,7 @@ class AsyncHTTPHandler: except (httpx.RemoteProtocolError, httpx.ConnectError): # Retry the request with a new session if there is a connection error new_client = self.create_client( - timeout=timeout, concurrent_limit=1, event_hooks=self.event_hooks + timeout=timeout, event_hooks=self.event_hooks ) try: return await self.single_connection_post_request( @@ -412,7 +421,7 @@ class AsyncHTTPHandler: except (httpx.RemoteProtocolError, httpx.ConnectError): # Retry the request with a new session if there is a connection error new_client = self.create_client( - timeout=timeout, concurrent_limit=1, event_hooks=self.event_hooks + timeout=timeout, event_hooks=self.event_hooks ) try: return await self.single_connection_post_request( @@ -471,7 +480,7 @@ class AsyncHTTPHandler: except (httpx.RemoteProtocolError, httpx.ConnectError): # Retry the request with a new session if there is a connection error new_client = self.create_client( - timeout=timeout, concurrent_limit=1, event_hooks=self.event_hooks + timeout=timeout, event_hooks=self.event_hooks ) try: return await self.single_connection_post_request( @@ -657,7 +666,13 @@ class AsyncHTTPHandler: ) return LiteLLMAiohttpTransport( client=lambda: ClientSession( - connector=TCPConnector(**connector_kwargs), + connector=TCPConnector( + limit=AIOHTTP_CONNECTOR_LIMIT, + keepalive_timeout=AIOHTTP_KEEPALIVE_TIMEOUT, + ttl_dns_cache=AIOHTTP_TTL_DNS_CACHE, + enable_cleanup_closed=True, + **connector_kwargs + ), trust_env=trust_env, ), ) @@ -680,7 +695,7 @@ class HTTPHandler: def __init__( self, timeout: Optional[Union[float, httpx.Timeout]] = None, - concurrent_limit=1000, + concurrent_limit=None, # Kept for backward compatibility, but ignored (no limits) client: Optional[httpx.Client] = None, ssl_verify: Optional[Union[bool, str]] = None, ): @@ -701,10 +716,6 @@ class HTTPHandler: self.client = httpx.Client( transport=transport, timeout=timeout, - limits=httpx.Limits( - max_connections=concurrent_limit, - max_keepalive_connections=concurrent_limit, - ), verify=ssl_config, cert=cert, headers=headers, diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py index 173bb5a2ccb..d7b7987b670 100644 --- a/litellm/llms/custom_httpx/llm_http_handler.py +++ b/litellm/llms/custom_httpx/llm_http_handler.py @@ -39,6 +39,7 @@ from litellm.llms.base_llm.image_edit.transformation import BaseImageEditConfig from litellm.llms.base_llm.image_generation.transformation import ( BaseImageGenerationConfig, ) +from litellm.llms.base_llm.ocr.transformation import BaseOCRConfig, OCRResponse from litellm.llms.base_llm.realtime.transformation import BaseRealtimeConfig from litellm.llms.base_llm.rerank.transformation import BaseRerankConfig from litellm.llms.base_llm.responses.transformation import BaseResponsesAPIConfig @@ -65,7 +66,7 @@ from litellm.types.llms.openai import ( ResponseInputParam, ResponsesAPIResponse, ) -from litellm.types.rerank import OptionalRerankParams, RerankResponse +from litellm.types.rerank import RerankResponse from litellm.types.responses.main import DeleteResponseResult from litellm.types.router import GenericLiteLLMParams from litellm.types.utils import ( @@ -426,6 +427,7 @@ class BaseLLMHTTPHandler: ), json_mode=json_mode, signed_json_body=signed_json_body, + shared_session=shared_session, ) if stream is True: @@ -893,7 +895,7 @@ class BaseLLMHTTPHandler: custom_llm_provider: str, logging_obj: LiteLLMLoggingObj, provider_config: BaseRerankConfig, - optional_rerank_params: OptionalRerankParams, + optional_rerank_params: Dict, timeout: Optional[Union[float, httpx.Timeout]], model_response: RerankResponse, _is_async: bool = False, @@ -1255,6 +1257,289 @@ class BaseLLMHTTPHandler: api_key=api_key, ) + def _prepare_ocr_request( + self, + model: str, + document: Dict[str, str], + optional_params: dict, + logging_obj: LiteLLMLoggingObj, + api_key: Optional[str], + api_base: Optional[str], + headers: Optional[Dict[str, Any]], + provider_config: BaseOCRConfig, + litellm_params: dict, + ) -> Tuple[Dict[str, Any], str, Dict[str, Any], None]: + """ + Shared logic for preparing OCR requests. + Returns: (headers, complete_url, data, files) + """ + from litellm.llms.base_llm.ocr.transformation import OCRRequestData + + headers = provider_config.validate_environment( + api_key=api_key, + api_base=api_base, + headers=headers or {}, + model=model, + ) + + complete_url = provider_config.get_complete_url( + api_base=api_base, + model=model, + optional_params=optional_params, + ) + + # Transform the request to get data and files + transformed_result = provider_config.transform_ocr_request( + model=model, + document=document, + optional_params=optional_params, + headers=headers, + ) + + # All providers return OCRRequestData + if not isinstance(transformed_result, OCRRequestData): + raise ValueError( + f"Provider {provider_config.__class__.__name__} must return OCRRequestData" + ) + + # Data is always a dict for Mistral OCR format + if not isinstance(transformed_result.data, dict): + raise ValueError(f"Expected dict data for OCR request, got {type(transformed_result.data)}") + + data = transformed_result.data + + ## LOGGING + logging_obj.pre_call( + input="OCR document processing", + api_key=api_key, + additional_args={ + "complete_input_dict": data, + "api_base": complete_url, + "headers": headers, + }, + ) + + return headers, complete_url, data, None + + async def _async_prepare_ocr_request( + self, + model: str, + document: Dict[str, str], + optional_params: dict, + logging_obj: LiteLLMLoggingObj, + api_key: Optional[str], + api_base: Optional[str], + headers: Optional[Dict[str, Any]], + provider_config: BaseOCRConfig, + litellm_params: dict, + ) -> Tuple[Dict[str, Any], str, Dict[str, Any], None]: + """ + Async version of _prepare_ocr_request for providers that need async transforms. + Returns: (headers, complete_url, data, files) + """ + from litellm.llms.base_llm.ocr.transformation import OCRRequestData + + headers = provider_config.validate_environment( + api_key=api_key, + api_base=api_base, + headers=headers or {}, + model=model, + ) + + complete_url = provider_config.get_complete_url( + api_base=api_base, + model=model, + optional_params=optional_params, + ) + + # Use async transform (providers can override this method if they need async operations) + transformed_result = await provider_config.async_transform_ocr_request( + model=model, + document=document, + optional_params=optional_params, + headers=headers, + ) + + # All providers return OCRRequestData + if not isinstance(transformed_result, OCRRequestData): + raise ValueError( + f"Provider {provider_config.__class__.__name__} must return OCRRequestData" + ) + + # Data is always a dict for Mistral OCR format + if not isinstance(transformed_result.data, dict): + raise ValueError(f"Expected dict data for OCR request, got {type(transformed_result.data)}") + + data = transformed_result.data + + ## LOGGING + logging_obj.pre_call( + input="OCR document processing", + api_key=api_key, + additional_args={ + "complete_input_dict": data, + "api_base": complete_url, + "headers": headers, + }, + ) + + return headers, complete_url, data, None + + def _transform_ocr_response( + self, + provider_config: BaseOCRConfig, + model: str, + response: httpx.Response, + logging_obj: LiteLLMLoggingObj, + ) -> OCRResponse: + """Shared logic for transforming OCR responses.""" + return provider_config.transform_ocr_response( + model=model, + raw_response=response, + logging_obj=logging_obj, + ) + + def ocr( + self, + model: str, + document: Dict[str, str], + optional_params: dict, + timeout: Union[float, httpx.Timeout], + logging_obj: LiteLLMLoggingObj, + api_key: Optional[str], + api_base: Optional[str], + custom_llm_provider: str, + client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None, + aocr: bool = False, + headers: Optional[Dict[str, Any]] = None, + provider_config: Optional[BaseOCRConfig] = None, + litellm_params: Optional[dict] = None, + ) -> Union[OCRResponse, Coroutine[Any, Any, OCRResponse]]: + """ + Sync OCR handler. + """ + if provider_config is None: + raise ValueError( + f"No provider config found for model: {model} and provider: {custom_llm_provider}" + ) + + if litellm_params is None: + litellm_params = {} + + if aocr is True: + return self.async_ocr( + model=model, + document=document, + optional_params=optional_params, + timeout=timeout, + logging_obj=logging_obj, + api_key=api_key, + api_base=api_base, + custom_llm_provider=custom_llm_provider, + client=client, + headers=headers, + provider_config=provider_config, + litellm_params=litellm_params, + ) + + # Prepare the request + headers, complete_url, data, files = self._prepare_ocr_request( + model=model, + document=document, + optional_params=optional_params, + logging_obj=logging_obj, + api_key=api_key, + api_base=api_base, + headers=headers, + provider_config=provider_config, + litellm_params=litellm_params, + ) + + if client is None or not isinstance(client, HTTPHandler): + client = _get_httpx_client() + + try: + # Make the POST request with JSON data (Mistral format) + response = client.post( + url=complete_url, + headers=headers, + json=data, + timeout=timeout, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=provider_config) + + return self._transform_ocr_response( + provider_config=provider_config, + model=model, + response=response, + logging_obj=logging_obj, + ) + + async def async_ocr( + self, + model: str, + document: Dict[str, str], + optional_params: dict, + timeout: Union[float, httpx.Timeout], + logging_obj: LiteLLMLoggingObj, + api_key: Optional[str], + api_base: Optional[str], + custom_llm_provider: str, + client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None, + headers: Optional[Dict[str, Any]] = None, + provider_config: Optional[BaseOCRConfig] = None, + litellm_params: Optional[dict] = None, + ) -> OCRResponse: + """ + Async OCR handler. + """ + if provider_config is None: + raise ValueError( + f"No provider config found for model: {model} and provider: {custom_llm_provider}" + ) + + if litellm_params is None: + litellm_params = {} + + # Prepare the request using async prepare method + headers, complete_url, data, files = await self._async_prepare_ocr_request( + model=model, + document=document, + optional_params=optional_params, + logging_obj=logging_obj, + api_key=api_key, + api_base=api_base, + headers=headers, + provider_config=provider_config, + litellm_params=litellm_params, + ) + + if client is None or not isinstance(client, AsyncHTTPHandler): + async_httpx_client = get_async_httpx_client( + llm_provider=litellm.LlmProviders(custom_llm_provider), + ) + else: + async_httpx_client = client + + try: + # Make the async POST request with JSON data (Mistral format) + response = await async_httpx_client.post( + url=complete_url, + headers=headers, + json=data, + timeout=timeout, + ) + except Exception as e: + raise self._handle_error(e=e, provider_config=provider_config) + + return self._transform_ocr_response( + provider_config=provider_config, + model=model, + response=response, + logging_obj=logging_obj, + ) + async def async_anthropic_messages_handler( self, model: str, @@ -1532,6 +1817,7 @@ class BaseLLMHTTPHandler: data=data, fake_stream=fake_stream, ) + response = sync_httpx_client.post( url=api_base, headers=headers, @@ -2993,6 +3279,7 @@ class BaseLLMHTTPHandler: BaseGoogleGenAIGenerateContentConfig, BaseAnthropicMessagesConfig, BaseBatchesConfig, + BaseOCRConfig, "BasePassthroughConfig", ], ): diff --git a/litellm/llms/deepinfra/rerank/transformation.py b/litellm/llms/deepinfra/rerank/transformation.py index 6a3244a3c88..69c7dabebd8 100644 --- a/litellm/llms/deepinfra/rerank/transformation.py +++ b/litellm/llms/deepinfra/rerank/transformation.py @@ -2,11 +2,11 @@ Translate between Cohere's `/rerank` format and Deepinfra's `/rerank` format. """ -from litellm._uuid import uuid from typing import Any, Dict, List, Optional, Union import httpx +from litellm._uuid import uuid from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj from litellm.llms.base_llm.rerank.transformation import ( BaseLLMException, @@ -98,7 +98,7 @@ class DeepinfraRerankConfig(BaseRerankConfig): return_documents: Optional[bool] = True, max_chunks_per_doc: Optional[int] = None, max_tokens_per_doc: Optional[int] = None, - ) -> OptionalRerankParams: + ) -> Dict: # Start with the basic parameters optional_rerank_params = {} if query: @@ -124,7 +124,7 @@ class DeepinfraRerankConfig(BaseRerankConfig): def transform_rerank_request( self, model: str, - optional_rerank_params: OptionalRerankParams, + optional_rerank_params: Dict, headers: dict, ) -> dict: # Convert OptionalRerankParams to dict as expected by parent class diff --git a/litellm/llms/gemini/realtime/transformation.py b/litellm/llms/gemini/realtime/transformation.py index e1dd6f146f3..62329358e47 100644 --- a/litellm/llms/gemini/realtime/transformation.py +++ b/litellm/llms/gemini/realtime/transformation.py @@ -3,10 +3,10 @@ This file contains the transformation logic for the Gemini realtime API. """ import json -from litellm._uuid import uuid from typing import Any, Dict, List, Optional, Union, cast from litellm import verbose_logger +from litellm._uuid import uuid from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj from litellm.llms.base_llm.realtime.transformation import BaseRealtimeConfig from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import ( @@ -186,9 +186,10 @@ class GeminiRealtimeConfig(BaseRealtimeConfig): ) vertex_gemini_config = VertexGeminiConfig() - vertex_gemini_config._map_function(value) optional_params["generationConfig"]["tools"] = ( - vertex_gemini_config._map_function(value) + vertex_gemini_config._map_function( + value=value, optional_params=optional_params + ) ) elif key == "input_audio_transcription" and value is not None: optional_params["inputAudioTranscription"] = {} diff --git a/litellm/llms/hosted_vllm/rerank/transformation.py b/litellm/llms/hosted_vllm/rerank/transformation.py index 4ed604e2c88..2faef2c4c73 100644 --- a/litellm/llms/hosted_vllm/rerank/transformation.py +++ b/litellm/llms/hosted_vllm/rerank/transformation.py @@ -2,27 +2,26 @@ Transformation logic for Hosted VLLM rerank """ -from litellm._uuid import uuid from typing import Any, Dict, List, Optional, Union +import httpx + +from litellm._uuid import uuid +from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj +from litellm.llms.base_llm.chat.transformation import BaseLLMException +from litellm.llms.base_llm.rerank.transformation import BaseRerankConfig +from litellm.secret_managers.main import get_secret_str from litellm.types.rerank import ( + OptionalRerankParams, RerankBilledUnits, + RerankRequest, RerankResponse, RerankResponseDocument, RerankResponseMeta, RerankResponseResult, RerankTokens, - OptionalRerankParams, - RerankRequest, ) -import httpx - -from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj -from litellm.llms.base_llm.chat.transformation import BaseLLMException -from litellm.llms.base_llm.rerank.transformation import BaseRerankConfig -from litellm.secret_managers.main import get_secret_str - class HostedVLLMRerankError(BaseLLMException): def __init__( @@ -72,20 +71,20 @@ class HostedVLLMRerankConfig(BaseRerankConfig): return_documents: Optional[bool] = True, max_chunks_per_doc: Optional[int] = None, max_tokens_per_doc: Optional[int] = None, - ) -> OptionalRerankParams: + ) -> Dict: """ Map parameters for Hosted VLLM rerank """ if max_chunks_per_doc is not None: raise ValueError("Hosted VLLM does not support max_chunks_per_doc") - return OptionalRerankParams( + return dict(OptionalRerankParams( query=query, documents=documents, top_n=top_n, rank_fields=rank_fields, return_documents=return_documents, - ) + )) def validate_environment( self, @@ -112,7 +111,7 @@ class HostedVLLMRerankConfig(BaseRerankConfig): def transform_rerank_request( self, model: str, - optional_rerank_params: OptionalRerankParams, + optional_rerank_params: Dict, headers: dict, ) -> dict: if "query" not in optional_rerank_params: diff --git a/litellm/llms/huggingface/rerank/transformation.py b/litellm/llms/huggingface/rerank/transformation.py index aa0f37bc6ba..1454328cc13 100644 --- a/litellm/llms/huggingface/rerank/transformation.py +++ b/litellm/llms/huggingface/rerank/transformation.py @@ -1,11 +1,11 @@ import os -from litellm._uuid import uuid from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import httpx from typing_extensions import TypedDict import litellm +from litellm._uuid import uuid from litellm.llms.base_llm.chat.transformation import BaseLLMException from litellm.llms.base_llm.rerank.transformation import BaseRerankConfig from litellm.secret_managers.main import get_secret_str @@ -95,7 +95,7 @@ class HuggingFaceRerankConfig(BaseRerankConfig): return_documents: Optional[bool] = True, max_chunks_per_doc: Optional[int] = None, max_tokens_per_doc: Optional[int] = None, - ) -> OptionalRerankParams: + ) -> Dict: optional_rerank_params = {} if non_default_params is not None: for k, v in non_default_params.items(): diff --git a/litellm/llms/infinity/rerank/transformation.py b/litellm/llms/infinity/rerank/transformation.py index 6259d445aec..55aac6033d5 100644 --- a/litellm/llms/infinity/rerank/transformation.py +++ b/litellm/llms/infinity/rerank/transformation.py @@ -49,7 +49,7 @@ class InfinityRerankConfig(CohereRerankConfig): ) default_headers = { - "Authorization": f"bearer {api_key}", + "Authorization": f"Bearer {api_key}", "accept": "application/json", "content-type": "application/json", } diff --git a/litellm/llms/jina_ai/rerank/transformation.py b/litellm/llms/jina_ai/rerank/transformation.py index d8569b01b83..3ba24680fd4 100644 --- a/litellm/llms/jina_ai/rerank/transformation.py +++ b/litellm/llms/jina_ai/rerank/transformation.py @@ -6,11 +6,11 @@ Why separate file? Make it easy to see how transformation works Docs - https://jina.ai/reranker """ -from litellm._uuid import uuid from typing import Any, Dict, List, Optional, Tuple, Union from httpx import URL, Response +from litellm._uuid import uuid from litellm.llms.base_llm.chat.transformation import LiteLLMLoggingObj from litellm.llms.base_llm.rerank.transformation import BaseRerankConfig from litellm.types.rerank import ( @@ -45,15 +45,15 @@ class JinaAIRerankConfig(BaseRerankConfig): return_documents: Optional[bool] = True, max_chunks_per_doc: Optional[int] = None, max_tokens_per_doc: Optional[int] = None, - ) -> OptionalRerankParams: + ) -> Dict: optional_params = {} supported_params = self.get_supported_cohere_rerank_params(model) for k, v in non_default_params.items(): if k in supported_params: optional_params[k] = v - return OptionalRerankParams( + return dict(OptionalRerankParams( **optional_params, - ) + )) def get_complete_url(self, api_base: Optional[str], model: str) -> str: base_path = "/v1/rerank" @@ -67,7 +67,7 @@ class JinaAIRerankConfig(BaseRerankConfig): return cleaned_base def transform_rerank_request( - self, model: str, optional_rerank_params: OptionalRerankParams, headers: Dict + self, model: str, optional_rerank_params: Dict, headers: Dict ) -> Dict: return {"model": model, **optional_rerank_params} @@ -98,9 +98,26 @@ class JinaAIRerankConfig(BaseRerankConfig): if _results is None: raise ValueError(f"No results found in the response={_json_response}") + # Transform Jina AI's response format to match LiteLLM's expected format + # Jina AI returns: {"index": 0, "relevance_score": 0.72, "document": "hello"} + # LiteLLM expects: {"index": 0, "relevance_score": 0.72, "document": {"text": "hello"}} + transformed_results = [] + for result in _results: + transformed_result = { + "index": result["index"], + "relevance_score": result["relevance_score"], + } + # Convert document from string to dict format if it exists + if "document" in result and isinstance(result["document"], str): + transformed_result["document"] = {"text": result["document"]} + elif "document" in result: + # If it's already a dict, keep it as is + transformed_result["document"] = result["document"] + transformed_results.append(transformed_result) + return RerankResponse( id=_json_response.get("id") or str(uuid.uuid4()), - results=_results, # type: ignore + results=transformed_results, # type: ignore meta=rerank_meta, ) # Return response diff --git a/litellm/llms/litellm_proxy/responses/transformation.py b/litellm/llms/litellm_proxy/responses/transformation.py new file mode 100644 index 00000000000..0b81d8be7d8 --- /dev/null +++ b/litellm/llms/litellm_proxy/responses/transformation.py @@ -0,0 +1,48 @@ +""" +Responses API transformation for LiteLLM Proxy provider. + +LiteLLM Proxy supports the OpenAI Responses API natively when the underlying model supports it. +This config enables pass-through behavior to the proxy's /v1/responses endpoint. +""" + +from typing import Optional + +from litellm.llms.openai.responses.transformation import OpenAIResponsesAPIConfig +from litellm.secret_managers.main import get_secret_str +from litellm.types.utils import LlmProviders + + +class LiteLLMProxyResponsesAPIConfig(OpenAIResponsesAPIConfig): + """ + Configuration for LiteLLM Proxy Responses API support. + + Extends OpenAI's config since the proxy follows OpenAI's API spec, + but uses LITELLM_PROXY_API_BASE for the base URL. + """ + + @property + def custom_llm_provider(self) -> LlmProviders: + return LlmProviders.LITELLM_PROXY + + def get_complete_url( + self, + api_base: Optional[str], + litellm_params: dict, + ) -> str: + """ + Get the endpoint for LiteLLM Proxy responses API. + + Uses LITELLM_PROXY_API_BASE environment variable if api_base is not provided. + """ + api_base = api_base or get_secret_str("LITELLM_PROXY_API_BASE") + + if api_base is None: + raise ValueError( + "api_base not set for LiteLLM Proxy responses API. " + "Set via api_base parameter or LITELLM_PROXY_API_BASE environment variable" + ) + + # Remove trailing slashes + api_base = api_base.rstrip("/") + + return f"{api_base}/responses" diff --git a/litellm/llms/mistral/ocr/__init__.py b/litellm/llms/mistral/ocr/__init__.py new file mode 100644 index 00000000000..40cc62696be --- /dev/null +++ b/litellm/llms/mistral/ocr/__init__.py @@ -0,0 +1,2 @@ +"""Mistral OCR transformation module.""" + diff --git a/litellm/llms/mistral/ocr/transformation.py b/litellm/llms/mistral/ocr/transformation.py new file mode 100644 index 00000000000..f17c872f536 --- /dev/null +++ b/litellm/llms/mistral/ocr/transformation.py @@ -0,0 +1,223 @@ +""" +Mistral OCR transformation implementation. +""" +from typing import Any, Dict, Optional + +import httpx + +from litellm._logging import verbose_logger +from litellm.llms.base_llm.ocr.transformation import ( + BaseOCRConfig, + DocumentType, + OCRRequestData, + OCRResponse, +) +from litellm.secret_managers.main import get_secret_str + + +class MistralOCRConfig(BaseOCRConfig): + """ + Mistral OCR transformation configuration. + + Reference: https://docs.mistral.ai/api/#tag/ocr + """ + + def __init__(self) -> None: + super().__init__() + + def get_supported_ocr_params(self, model: str) -> list: + """ + Get supported OCR parameters for Mistral OCR. + + Mistral OCR supports: + - pages: List of page numbers to process + - include_image_base64: Whether to include base64 encoded images + - image_limit: Maximum number of images to return + - image_min_size: Minimum size of images to include + - bbox_annotation_format: Format for bounding box annotations + - document_annotation_format: Format for document annotations + """ + return [ + "pages", + "include_image_base64", + "image_limit", + "image_min_size", + "bbox_annotation_format", + "document_annotation_format", + ] + + def map_ocr_params( + self, + non_default_params: dict, + optional_params: dict, + model: str, + ) -> dict: + """ + Map OCR parameters to Mistral-specific format. + + Mistral accepts these parameters directly, so no transformation needed. + Just filter out unsupported params. + """ + supported_params = self.get_supported_ocr_params(model=model) + + # Only include params that are in the supported list + mapped_params = {} + for param, value in non_default_params.items(): + if param in supported_params: + mapped_params[param] = value + + return mapped_params + + def validate_environment( + self, + headers: Dict, + model: str, + api_key: Optional[str] = None, + api_base: Optional[str] = None, + **kwargs, + ) -> Dict: + """ + Validate environment and return headers for Mistral OCR. + """ + # Get API key from environment if not provided + if api_key is None: + api_key = ( + get_secret_str("MISTRAL_API_KEY") + ) + + if api_key is None: + raise ValueError( + "Missing Mistral API Key - A call is being made to Mistral but no key is set either in the environment variables or via params" + ) + + headers = { + "Authorization": f"Bearer {api_key}", + **headers, + } + + # Don't set Content-Type for multipart/form-data - httpx will handle it + + return headers + + def get_complete_url( + self, + api_base: Optional[str], + model: str, + optional_params: dict, + **kwargs, + ) -> str: + """ + Get complete URL for Mistral OCR endpoint. + + Returns: https://api.mistral.ai/v1/ocr + """ + if api_base is None: + api_base = "https://api.mistral.ai/v1" + + # Ensure no trailing slash + api_base = api_base.rstrip("/") + + # Remove /v1 if it's already in the base to avoid duplication + if api_base.endswith("/v1"): + return f"{api_base}/ocr" + + return f"{api_base}/v1/ocr" + + + def transform_ocr_request( + self, + model: str, + document: DocumentType, + optional_params: dict, + headers: dict, + **kwargs, + ) -> OCRRequestData: + """ + Transform OCR request to Mistral-specific format. + + Mistral OCR API accepts: + { + "model": "mistral-ocr-latest", + "document": { + "type": "document_url", + "document_url": "" + }, + "pages": [0], # optional + "include_image_base64": false, # optional + ... + } + + Args: + model: Model name (e.g., "mistral-ocr-latest") + document: Document dict from user (Mistral format) - already validated in main.py + optional_params: Already mapped optional parameters + headers: Request headers + + Returns: + OCRRequestData with JSON data + """ + verbose_logger.debug(f"Mistral OCR transform_ocr_request - model: {model}") + + # Document parameter is the Mistral-format dict from the user + # Just pass it through as-is to the Mistral API + if not isinstance(document, dict): + raise ValueError(f"Expected document dict, got {type(document)}") + + # Build request data - use document dict directly + data = { + "model": model, + "document": document, # Pass through the Mistral-format document dict + } + + # Add all optional parameters from the already-mapped optional_params + data.update(optional_params) + + # No multipart files - using JSON + return OCRRequestData(data=data, files=None) + + def transform_ocr_response( + self, + model: str, + raw_response: httpx.Response, + logging_obj: Any, + **kwargs, + ) -> OCRResponse: + """ + Return Mistral OCR response in native format. + + Mistral OCR is the standard format for LiteLLM OCR responses. + No transformation needed - return native response. + + Mistral OCR returns: + { + "pages": [ + { + "index": 0, + "markdown": "extracted text content", + "images": [...], + "dimensions": {...} + }, + ... + ], + "model": "mistral-ocr-2505-completion", + "document_annotation": null, + "usage_info": {...} + } + """ + try: + response_json = raw_response.json() + + verbose_logger.debug(f"Mistral OCR response keys: {response_json.keys()}") + + # Return native Mistral format - no transformation + return OCRResponse( + pages=response_json.get("pages", []), + model=response_json.get("model", model), + document_annotation=response_json.get("document_annotation"), + usage_info=response_json.get("usage_info"), + object="ocr", + ) + except Exception as e: + verbose_logger.error(f"Error parsing Mistral OCR response: {e}") + raise e + diff --git a/litellm/llms/nvidia_nim/rerank/transformation.py b/litellm/llms/nvidia_nim/rerank/transformation.py new file mode 100644 index 00000000000..cb9fd4bebaa --- /dev/null +++ b/litellm/llms/nvidia_nim/rerank/transformation.py @@ -0,0 +1,325 @@ +from typing import Any, Dict, List, Literal, Optional, Union + +import httpx +from typing_extensions import Required, TypedDict + +import litellm +from litellm._uuid import uuid +from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj +from litellm.llms.base_llm.chat.transformation import BaseLLMException +from litellm.llms.base_llm.rerank.transformation import BaseRerankConfig +from litellm.secret_managers.main import get_secret_str +from litellm.types.rerank import ( + RerankBilledUnits, + RerankResponse, + RerankResponseMeta, + RerankResponseResult, +) + + +class NvidiaNimQueryObject(TypedDict): + text: Required[str] + + +class NvidiaNimPassageObject(TypedDict): + text: Required[str] + + +class NvidiaNimRerankRequest(TypedDict, total=False): + model: Required[str] + query: Required[NvidiaNimQueryObject] + passages: Required[List[NvidiaNimPassageObject]] + truncate: Literal["NONE", "END"] + top_k: int + + +class NvidiaNimRankingResult(TypedDict): + index: Required[int] + logit: Required[float] + + +class NvidiaNimRerankResponse(TypedDict): + rankings: Required[List[NvidiaNimRankingResult]] + + +class NvidiaNimRerankConfig(BaseRerankConfig): + """ + Reference: https://docs.api.nvidia.com/nim/reference/nvidia-llama-3_2-nv-rerankqa-1b-v2-infer + + Nvidia NIM rerank API uses a different format: + - query is an object with 'text' field + - documents are called 'passages' and have 'text' field + """ + DEFAULT_NIM_RERANK_API_BASE = "https://ai.api.nvidia.com" + + def __init__(self) -> None: + pass + + def get_complete_url(self, api_base: Optional[str], model: str) -> str: + """ + Construct the Nvidia NIM rerank URL. + + Format: {api_base}/v1/retrieval/{model}/reranking + + If the user provides a full URL (e.g., {api_base}/v1/retrieval/{model}/reranking), + it will be used as-is. + """ + if not api_base: + api_base = self.DEFAULT_NIM_RERANK_API_BASE + + api_base = api_base.rstrip("/") + + # Check if user already provided the full URL with /retrieval/ path + if "/retrieval/" in api_base: + return api_base + + # Ensure we don't have duplicate /v1 + if api_base.endswith("/v1"): + api_base = api_base[:-3] + + return f"{api_base}/v1/retrieval/{model}/reranking" + + def get_supported_cohere_rerank_params(self, model: str) -> list: + """ + Nvidia NIM supports these rerank parameters. + """ + return [ + "query", + "documents", + "top_n", + ] + + def map_cohere_rerank_params( + self, + non_default_params: Optional[dict], + model: str, + drop_params: bool, + query: str, + documents: List[Union[str, Dict[str, Any]]], + custom_llm_provider: Optional[str] = None, + top_n: Optional[int] = None, + rank_fields: Optional[List[str]] = None, + return_documents: Optional[bool] = True, + max_chunks_per_doc: Optional[int] = None, + max_tokens_per_doc: Optional[int] = None, + ) -> Dict: + """ + Map Cohere/OpenAI rerank params to Nvidia NIM format. + + Parameter mapping: + - top_n (Cohere) -> top_k (Nvidia) + + Nvidia NIM specific params (passed through as-is from non_default_params): + - truncate: How to truncate input if too long (NONE, END) + """ + optional_nvidia_nim_rerank_params: Dict[str, Any] = { + "query": query, + "documents": documents, + } + + # Map Cohere's top_n to Nvidia's top_k + if top_n is not None: + optional_nvidia_nim_rerank_params["top_k"] = top_n + + # Pass through Nvidia-specific params from non_default_params + if non_default_params: + optional_nvidia_nim_rerank_params.update(non_default_params) + return dict(optional_nvidia_nim_rerank_params) + + def validate_environment( + self, + headers: dict, + model: str, + api_key: Optional[str] = None, + ) -> dict: + """ + Validate that the Nvidia NIM API key is present. + """ + if api_key is None: + api_key = ( + get_secret_str("NVIDIA_NIM_API_KEY") + or litellm.api_key + ) + + if api_key is None: + raise ValueError( + "Nvidia NIM API key is required. Please set 'NVIDIA_NIM_API_KEY' in your environment" + ) + + default_headers = { + "Authorization": f"Bearer {api_key}", + "accept": "application/json", + "content-type": "application/json", + } + + # If 'Authorization' is provided in headers, it overrides the default + if "Authorization" in headers: + default_headers["Authorization"] = headers["Authorization"] + + # Merge other headers, overriding any default ones except Authorization + return {**default_headers, **headers} + + def transform_rerank_request( + self, + model: str, + optional_rerank_params: Dict, + headers: dict, + ) -> dict: + """ + Transform request to Nvidia NIM format. + + Nvidia NIM expects: + - query as {text: "..."} + - documents as passages: [{text: "..."}, ...] + - Optional: truncate (NONE or END), top_k + + Note: optional_rerank_params may contain provider-specific params like 'top_k' and 'truncate' + that aren't in the OptionalRerankParams TypedDict but are passed through at runtime. + The mapping from Cohere's 'top_n' to Nvidia's 'top_k' already happened in map_cohere_rerank_params. + """ + if "query" not in optional_rerank_params: + raise ValueError("query is required for Nvidia NIM rerank") + if "documents" not in optional_rerank_params: + raise ValueError("documents is required for Nvidia NIM rerank") + + query = optional_rerank_params["query"] + documents = optional_rerank_params["documents"] + + # Transform query to object format + query_obj: NvidiaNimQueryObject = {"text": query} + + # Transform documents to passages format + passages: List[NvidiaNimPassageObject] = [] + for doc in documents: + if isinstance(doc, str): + passages.append({"text": doc}) + elif isinstance(doc, dict): + # If document is already a dict, check if it has 'text' field + if "text" in doc: + passages.append({"text": doc["text"]}) + else: + # Otherwise, stringify the dict + import json + passages.append({"text": json.dumps(doc)}) + else: + passages.append({"text": str(doc)}) + + # Note: URL path uses underscores (llama-3_2) but JSON body uses periods (llama-3.2) + # Convert underscores back to periods for the model field in request body + model_for_body = model.replace("_", ".") + + # Build request using TypedDict + request_data: NvidiaNimRerankRequest = { + "model": model_for_body, + "query": query_obj, + "passages": passages, + } + + # Add optional top_k parameter if provided (already mapped from top_n in map_cohere_rerank_params) + if "top_k" in optional_rerank_params and optional_rerank_params.get("top_k") is not None: # type: ignore + request_data["top_k"] = optional_rerank_params.get("top_k") # type: ignore + + # Add Nvidia-specific truncate parameter if provided + # This is passed through from non_default_params, not in base OptionalRerankParams + if "truncate" in optional_rerank_params and optional_rerank_params.get("truncate") is not None: # type: ignore + truncate_value = optional_rerank_params.get("truncate") # type: ignore + if truncate_value in ["NONE", "END"]: + request_data["truncate"] = truncate_value # type: ignore + + return dict(request_data) + + def transform_rerank_response( + self, + model: str, + raw_response: httpx.Response, + model_response: RerankResponse, + logging_obj: LiteLLMLoggingObj, + api_key: Optional[str] = None, + request_data: dict = {}, + optional_params: dict = {}, + litellm_params: dict = {}, + ) -> RerankResponse: + """ + Transform Nvidia NIM rerank response to LiteLLM format. + + Nvidia NIM returns (NvidiaNimRerankResponse): + { + "rankings": [ + { + "index": 0, + "logit": 0.123 + } + ] + } + + LiteLLM expects (RerankResponse): + { + "results": [ + { + "index": 0, + "relevance_score": 0.123, + "document": {"text": "..."} # optional + } + ] + } + """ + try: + raw_response_json = raw_response.json() + except Exception: + raise BaseLLMException( + status_code=raw_response.status_code, + message=raw_response.text, + headers=raw_response.headers, + ) + + # Parse as NvidiaNimRerankResponse + nvidia_response: NvidiaNimRerankResponse = raw_response_json + + # Transform Nvidia NIM response to LiteLLM format + results: List[RerankResponseResult] = [] + rankings = nvidia_response.get("rankings", []) + + # Get original documents from request if we need to include them + original_passages: List[NvidiaNimPassageObject] = request_data.get("passages", []) + + for ranking in rankings: + result_item: RerankResponseResult = { + "index": ranking["index"], + "relevance_score": ranking["logit"], + } + + # Include document if it was in the original request + index: int = ranking["index"] + if index < len(original_passages): + result_item["document"] = {"text": original_passages[index]["text"]} # type: ignore + + results.append(result_item) + + # Construct metadata with billed_units + # Nvidia NIM uses "usage" field with "total_tokens" + usage = raw_response_json.get("usage", {}) + total_tokens = usage.get("total_tokens", 0) + + billed_units: RerankBilledUnits = { + "total_tokens": total_tokens if total_tokens > 0 else len(results) + } + + meta: RerankResponseMeta = { + "billed_units": billed_units + } + + return RerankResponse( + id=raw_response_json.get("id") or str(uuid.uuid4()), + results=results, + meta=meta, + ) + + def get_error_class( + self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers] + ) -> BaseLLMException: + return BaseLLMException( + status_code=status_code, + message=error_message, + headers=headers, + ) + diff --git a/litellm/llms/oci/chat/transformation.py b/litellm/llms/oci/chat/transformation.py index 6755cab22e0..3ab827797c5 100644 --- a/litellm/llms/oci/chat/transformation.py +++ b/litellm/llms/oci/chat/transformation.py @@ -19,6 +19,13 @@ from litellm.llms.custom_httpx.http_handler import ( ) from litellm.llms.oci.common_utils import OCIError from litellm.types.llms.oci import ( + CohereChatRequest, + CohereMessage, + CohereChatResult, + CohereParameterDefinition, + CohereStreamChunk, + CohereTool, + CohereToolCall, OCIChatRequestPayload, OCICompletionPayload, OCICompletionResponse, @@ -37,13 +44,13 @@ from litellm.types.llms.openai import AllMessageValues from litellm.types.utils import ( Delta, LlmProviders, + ModelResponse, ModelResponseStream, StreamingChoices, ) from litellm.utils import ( ChatCompletionMessageToolCall, CustomStreamWrapper, - ModelResponse, Usage, ) @@ -170,13 +177,16 @@ class OCIChatConfig(BaseConfig): "web_search_options": False, } + # Cohere and Gemini use the same parameter mapping as GENERIC + self.openai_to_oci_cohere_param_map = self.openai_to_oci_generic_param_map.copy() + def get_supported_openai_params(self, model: str) -> List[str]: supported_params = [] vendor = get_vendor_from_model(model) if vendor == OCIVendors.COHERE: - raise ValueError( - "Cohere models are not yet supported in the litellm OCI chat completion endpoint. Use the Cohere API directly." - ) + open_ai_to_oci_param_map = self.openai_to_oci_cohere_param_map + open_ai_to_oci_param_map.pop("tool_choice") + open_ai_to_oci_param_map.pop("max_retries") else: open_ai_to_oci_param_map = self.openai_to_oci_generic_param_map for key, value in open_ai_to_oci_param_map.items(): @@ -195,9 +205,7 @@ class OCIChatConfig(BaseConfig): adapted_params = {} vendor = get_vendor_from_model(model) if vendor == OCIVendors.COHERE: - raise ValueError( - "Cohere models are not yet supported in the litellm OCI chat completion endpoint. Use the Cohere API directly." - ) + open_ai_to_oci_param_map = self.openai_to_oci_cohere_param_map else: open_ai_to_oci_param_map = self.openai_to_oci_generic_param_map @@ -207,9 +215,9 @@ class OCIChatConfig(BaseConfig): alias = open_ai_to_oci_param_map.get(key) if alias is False: - if drop_params: + # Workaround for mypy issue + if drop_params or litellm.drop_params: continue - raise Exception(f"param `{key}` is not supported on OCI") if alias is None: @@ -416,21 +424,130 @@ class OCIChatConfig(BaseConfig): def _get_optional_params(self, vendor: OCIVendors, optional_params: dict) -> Dict: selected_params = {} if vendor == OCIVendors.COHERE: - raise ValueError( - "Cohere models are not yet supported in the litellm OCI chat completion endpoint. Use the Cohere API directly." - ) + open_ai_to_oci_param_map = self.openai_to_oci_cohere_param_map + # remove tool_choice from the map + open_ai_to_oci_param_map.pop("tool_choice") + # Add default values for Cohere API + selected_params = { + "maxTokens": 600, + "temperature": 1, + "topK": 0, + "topP": 0.75, + "frequencyPenalty": 0 + } else: open_ai_to_oci_param_map = self.openai_to_oci_generic_param_map - for value in open_ai_to_oci_param_map.values(): - if value in optional_params: - selected_params[value] = optional_params[value] + # Map OpenAI params to OCI params + for openai_key, oci_key in open_ai_to_oci_param_map.items(): + if oci_key and openai_key in optional_params: + selected_params[oci_key] = optional_params[openai_key] # type: ignore[index] + + # Also check for already-mapped OCI params (for backward compatibility) + for oci_value in open_ai_to_oci_param_map.values(): + if oci_value and oci_value in optional_params and oci_value not in selected_params: + selected_params[oci_value] = optional_params[oci_value] # type: ignore[index] + if "tools" in selected_params: - selected_params["tools"] = adapt_tool_definition_to_oci_standard( - selected_params["tools"], vendor - ) + if vendor == OCIVendors.COHERE: + selected_params["tools"] = self.adapt_tool_definitions_to_cohere_standard( # type: ignore[assignment] + selected_params["tools"] # type: ignore[arg-type] + ) + else: + selected_params["tools"] = adapt_tool_definition_to_oci_standard( # type: ignore[assignment] + selected_params["tools"], vendor # type: ignore[arg-type] + ) return selected_params + def adapt_messages_to_cohere_standard(self, messages: List[AllMessageValues]) -> List[CohereMessage]: + """Build chat history for Cohere models.""" + chat_history = [] + for msg in messages[:-1]: # All messages except the last one + role = msg.get("role") + content = msg.get("content") + + if isinstance(content, list): + # Extract text from content array + text_content = "" + for content_item in content: + if isinstance(content_item, dict) and content_item.get("type") == "text": + text_content += content_item.get("text", "") + content = text_content + + # Ensure content is a string + if not isinstance(content, str): + content = str(content) if content is not None else "" + + # Handle tool calls + tool_calls: Optional[List[CohereToolCall]] = None + if role == "assistant" and "tool_calls" in msg and msg.get("tool_calls"): # type: ignore[union-attr,typeddict-item] + tool_calls = [] + for tool_call in msg["tool_calls"]: # type: ignore[union-attr,typeddict-item] + # Parse arguments if they're a JSON string + raw_arguments: Any = tool_call.get("function", {}).get("arguments", {}) + if isinstance(raw_arguments, str): + try: + arguments: Dict[str, Any] = json.loads(raw_arguments) + except json.JSONDecodeError: + arguments = {} + else: + arguments = raw_arguments + + tool_calls.append(CohereToolCall( + name=str(tool_call.get("function", {}).get("name", "")), + parameters=arguments + )) + + if role == "user": + chat_history.append(CohereMessage(role="USER", message=content)) + elif role == "assistant": + chat_history.append(CohereMessage(role="CHATBOT", message=content, toolCalls=tool_calls)) + elif role == "tool": + # Tool messages need special handling + chat_history.append(CohereMessage( + role="TOOL", + message=content, + toolCalls=None # Tool messages don't have tool calls + )) + + return chat_history + + def adapt_tool_definitions_to_cohere_standard(self, tools: List[Dict[str, Any]]) -> List[CohereTool]: + """Adapt tool definitions to Cohere format.""" + cohere_tools = [] + for tool in tools: + function_def = tool.get("function", {}) + parameters = function_def.get("parameters", {}).get("properties", {}) + required = function_def.get("parameters", {}).get("required", []) + + parameter_definitions = {} + for param_name, param_schema in parameters.items(): + parameter_definitions[param_name] = CohereParameterDefinition( + description=param_schema.get("description", ""), + type=param_schema.get("type", "string"), + isRequired=param_name in required + ) + + cohere_tools.append(CohereTool( + name=function_def.get("name", ""), + description=function_def.get("description", ""), + parameterDefinitions=parameter_definitions + )) + + return cohere_tools + + def _extract_text_content(self, content: Any) -> str: + """Extract text content from message content.""" + if isinstance(content, str): + return content + elif isinstance(content, list): + text_content = "" + for content_item in content: + if isinstance(content_item, dict) and content_item.get("type") == "text": + text_content += content_item.get("text", "") + return text_content + return str(content) + def transform_request( self, model: str, @@ -445,17 +562,50 @@ class OCIChatConfig(BaseConfig): vendor = get_vendor_from_model(model) - if vendor == OCIVendors.COHERE: + oci_serving_mode = optional_params.get("oci_serving_mode", "ON_DEMAND") + if oci_serving_mode not in ["ON_DEMAND", "DEDICATED"]: raise Exception( - "Cohere models are not yet supported in the litellm OCI chat completion endpoint. Use the Cohere API directly." + "kwarg `oci_serving_mode` must be either 'ON_DEMAND' or 'DEDICATED'" + ) + + if oci_serving_mode == "DEDICATED": + servingMode = OCIServingMode( + servingType="DEDICATED", + endpointId=model, ) else: + servingMode = OCIServingMode( + servingType="ON_DEMAND", + modelId=model, + ) + + # Build request based on vendor type + if vendor == OCIVendors.COHERE: + # For Cohere, we need to use the specific Cohere format + # Extract the last user message as the main message + user_messages = [msg for msg in messages if msg.get("role") == "user"] + if not user_messages: + raise Exception("No user message found for Cohere model") + + + # Create Cohere-specific chat request + chat_request = CohereChatRequest( + apiFormat="COHERE", + message=self._extract_text_content(user_messages[-1]["content"]), + chatHistory=self.adapt_messages_to_cohere_standard(messages), + **self._get_optional_params(OCIVendors.COHERE, optional_params) + ) + data = OCICompletionPayload( compartmentId=oci_compartment_id, - servingMode=OCIServingMode( - servingType="ON_DEMAND", - modelId=model, - ), + servingMode=servingMode, + chatRequest=chat_request + ) + else: + # Use generic format for other vendors + data = OCICompletionPayload( + compartmentId=oci_compartment_id, + servingMode=servingMode, chatRequest=OCIChatRequestPayload( apiFormat=vendor.value, messages=adapt_messages_to_generic_oci_standard(messages), @@ -465,6 +615,111 @@ class OCIChatConfig(BaseConfig): return data.model_dump(exclude_none=True) + def _handle_cohere_response( + self, + json_response: dict, + model: str, + model_response: ModelResponse + ) -> ModelResponse: + """Handle Cohere-specific response format.""" + cohere_response = CohereChatResult(**json_response) + # Cohere response format (uses camelCase) + model_id = model + + # Set basic response info + model_response.model = model_id + model_response.created = int(datetime.datetime.now().timestamp()) + + # Extract the response text + response_text = cohere_response.chatResponse.text + oci_finish_reason = cohere_response.chatResponse.finishReason + + # Map finish reason + if oci_finish_reason == "COMPLETE": + finish_reason = "stop" + elif oci_finish_reason == "MAX_TOKENS": + finish_reason = "length" + else: + finish_reason = "stop" + + # Handle tool calls + tool_calls: Optional[List[Dict[str, Any]]] = None + if cohere_response.chatResponse.toolCalls: + tool_calls = [] + for tool_call in cohere_response.chatResponse.toolCalls: + tool_calls.append({ + "id": f"call_{len(tool_calls)}", # Generate a simple ID + "type": "function", + "function": { + "name": tool_call.name, + "arguments": json.dumps(tool_call.parameters) + } + }) + + # Create choice + from litellm.types.utils import Choices + choice = Choices( + index=0, + message={ + "role": "assistant", + "content": response_text, + "tool_calls": tool_calls + }, + finish_reason=finish_reason + ) + model_response.choices = [choice] + + # Extract usage info + usage_info = cohere_response.chatResponse.usage + from litellm.types.utils import Usage + model_response.usage = Usage( # type: ignore[attr-defined] + prompt_tokens=usage_info.promptTokens, # type: ignore[union-attr] + completion_tokens=usage_info.completionTokens, # type: ignore[union-attr] + total_tokens=usage_info.totalTokens # type: ignore[union-attr] + ) + + return model_response + + def _handle_generic_response( + self, + json: dict, + model: str, + model_response: ModelResponse, + raw_response: httpx.Response + ) -> ModelResponse: + """Handle generic OCI response format.""" + try: + completion_response = OCICompletionResponse(**json) + except TypeError as e: + raise OCIError( + message=f"Response cannot be casted to OCICompletionResponse: {str(e)}", + status_code=raw_response.status_code, + ) + + iso_str = completion_response.chatResponse.timeCreated + dt = datetime.datetime.fromisoformat(iso_str.replace("Z", "+00:00")) + model_response.created = int(dt.timestamp()) + + model_response.model = completion_response.modelId + + message = model_response.choices[0].message # type: ignore + response_message = completion_response.chatResponse.choices[0].message + if response_message.content and response_message.content[0].type == "TEXT": + message.content = response_message.content[0].text + if response_message.toolCalls: + message.tool_calls = adapt_tools_to_openai_standard( + response_message.toolCalls + ) + + usage = Usage( + prompt_tokens=completion_response.chatResponse.usage.promptTokens, + completion_tokens=completion_response.chatResponse.usage.completionTokens, + total_tokens=completion_response.chatResponse.usage.totalTokens, + ) + model_response.usage = usage # type: ignore + + return model_response + def transform_response( self, model: str, @@ -495,46 +750,13 @@ class OCIChatConfig(BaseConfig): status_code=raw_response.status_code, ) - try: - completion_response = OCICompletionResponse(**json) - except TypeError as e: - raise OCIError( - message=f"Response cannot be casted to OCICompletionResponse: {str(e)}", - status_code=raw_response.status_code, - ) - vendor = get_vendor_from_model(model) + + # Handle response based on vendor type if vendor == OCIVendors.COHERE: - raise ValueError( - "Cohere models are not yet supported in the litellm OCI chat completion endpoint. Use the Cohere API directly." - ) + model_response = self._handle_cohere_response(json, model, model_response) else: - iso_str = completion_response.chatResponse.timeCreated - dt = datetime.datetime.fromisoformat(iso_str.replace("Z", "+00:00")) - model_response.created = int(dt.timestamp()) - - model_response.model = completion_response.modelId - - message = model_response.choices[0].message # type: ignore - if vendor == OCIVendors.COHERE: - raise ValueError( - "Cohere models are not yet supported in the litellm OCI chat completion endpoint. Use the Cohere API directly." - ) - else: - response_message = completion_response.chatResponse.choices[0].message - if response_message.content and response_message.content[0].type == "TEXT": - message.content = response_message.content[0].text - if response_message.toolCalls: - message.tool_calls = adapt_tools_to_openai_standard( - response_message.toolCalls - ) - - usage = Usage( - prompt_tokens=completion_response.chatResponse.usage.promptTokens, - completion_tokens=completion_response.chatResponse.usage.completionTokens, - total_tokens=completion_response.chatResponse.usage.totalTokens, - ) - model_response.usage = usage # type: ignore + model_response = self._handle_generic_response(json, model, model_response, raw_response) model_response._hidden_params["additional_headers"] = raw_response.headers @@ -804,26 +1026,21 @@ def adapt_messages_to_generic_oci_standard( def adapt_tool_definition_to_oci_standard(tools: List[Dict], vendor: OCIVendors): new_tools = [] - if vendor == OCIVendors.COHERE: - raise ValueError( - "Cohere models are not yet supported in the litellm OCI chat completion endpoint. Use the Cohere API directly." + for tool in tools: + if tool["type"] != "function": + raise Exception("OCI only supports function tools") + + tool_function = tool.get("function") + if not isinstance(tool_function, dict): + raise Exception("Prop `function` is not a dictionary") + + new_tool = OCIToolDefinition( + type="FUNCTION", + name=tool_function.get("name"), + description=tool_function.get("description", ""), + parameters=tool_function.get("parameters", {}), ) - else: - for tool in tools: - if tool["type"] != "function": - raise Exception("OCI only supports function tools") - - tool_function = tool.get("function") - if not isinstance(tool_function, dict): - raise Exception("Prop `function` is not a dictionary") - - new_tool = OCIToolDefinition( - type="FUNCTION", - name=tool_function.get("name"), - description=tool_function.get("description", ""), - parameters=tool_function.get("parameters", {}), - ) - new_tools.append(new_tool) + new_tools.append(new_tool) return new_tools @@ -863,6 +1080,58 @@ class OCIStreamWrapper(CustomStreamWrapper): if not chunk.startswith("data:"): raise ValueError(f"Chunk does not start with 'data:': {chunk}") dict_chunk = json.loads(chunk[5:]) # Remove 'data: ' prefix and parse JSON + + # Check if this is a Cohere stream chunk + if "apiFormat" in dict_chunk and dict_chunk.get("apiFormat") == "COHERE": + return self._handle_cohere_stream_chunk(dict_chunk) + else: + return self._handle_generic_stream_chunk(dict_chunk) + + def _handle_cohere_stream_chunk(self, dict_chunk: dict): + """Handle Cohere-specific streaming chunks.""" + try: + typed_chunk = CohereStreamChunk(**dict_chunk) + except TypeError as e: + raise ValueError(f"Chunk cannot be casted to CohereStreamChunk: {str(e)}") + + if typed_chunk.index is None: + typed_chunk.index = 0 + + # Extract text content + text = typed_chunk.text or "" + + # Map finish reason to standard format + finish_reason = typed_chunk.finishReason + if finish_reason == "COMPLETE": + finish_reason = "stop" + elif finish_reason == "MAX_TOKENS": + finish_reason = "length" + elif finish_reason is None: + finish_reason = None + else: + finish_reason = "stop" + + # For Cohere, we don't have tool calls in the streaming format + tool_calls = None + + return ModelResponseStream( + choices=[ + StreamingChoices( + index=typed_chunk.index if typed_chunk.index else 0, + delta=Delta( + content=text, + tool_calls=tool_calls, + provider_specific_fields=None, + thinking_blocks=None, + reasoning_content=None, + ), + finish_reason=finish_reason, + ) + ] + ) + + def _handle_generic_stream_chunk(self, dict_chunk: dict): + """Handle generic OCI streaming chunks.""" try: typed_chunk = OCIStreamChunk(**dict_chunk) except TypeError as e: diff --git a/litellm/llms/ollama/chat/transformation.py b/litellm/llms/ollama/chat/transformation.py index 3b755e79330..b740eb122fd 100644 --- a/litellm/llms/ollama/chat/transformation.py +++ b/litellm/llms/ollama/chat/transformation.py @@ -184,9 +184,12 @@ class OllamaChatConfig(BaseConfig): ): if value.get("json_schema") and value["json_schema"].get("schema"): optional_params["format"] = value["json_schema"]["schema"] - ### FUNCTION CALLING LOGIC ### if param == "reasoning_effort" and value is not None: - optional_params["think"] = True + if model.startswith("gpt-oss"): + optional_params["think"] = value + else: + optional_params["think"] = True + ### FUNCTION CALLING LOGIC ### if param == "tools": ## CHECK IF MODEL SUPPORTS TOOL CALLING ## try: @@ -281,6 +284,7 @@ class OllamaChatConfig(BaseConfig): stream = optional_params.pop("stream", False) format = optional_params.pop("format", None) keep_alive = optional_params.pop("keep_alive", None) + think = optional_params.pop("think", None) function_name = optional_params.pop("function_name", None) litellm_params["function_name"] = function_name tools = optional_params.pop("tools", None) @@ -344,6 +348,8 @@ class OllamaChatConfig(BaseConfig): data["tools"] = tools if keep_alive is not None: data["keep_alive"] = keep_alive + if think is not None: + data["think"] = think return data diff --git a/litellm/llms/ollama/completion/transformation.py b/litellm/llms/ollama/completion/transformation.py index 981a987ec91..b476e5c8a63 100644 --- a/litellm/llms/ollama/completion/transformation.py +++ b/litellm/llms/ollama/completion/transformation.py @@ -180,7 +180,10 @@ class OllamaConfig(BaseConfig): elif param == "stop": optional_params["stop"] = value elif param == "reasoning_effort" and value is not None: - optional_params["think"] = True + if model.startswith("gpt-oss"): + optional_params["think"] = value + else: + optional_params["think"] = True elif param == "response_format" and isinstance(value, dict): if value["type"] == "json_object": optional_params["format"] = "json" @@ -412,6 +415,7 @@ class OllamaConfig(BaseConfig): stream = optional_params.pop("stream", False) format = optional_params.pop("format", None) images = optional_params.pop("images", None) + think = optional_params.pop("think", None) data = { "model": model, "prompt": ollama_prompt, @@ -425,6 +429,8 @@ class OllamaConfig(BaseConfig): data["images"] = [ _convert_image(convert_to_ollama_image(image)) for image in images ] + if think is not None: + data["think"] = think return data diff --git a/litellm/llms/ollama_chat.py b/litellm/llms/ollama_chat.py index 082312d28f2..e186636de99 100644 --- a/litellm/llms/ollama_chat.py +++ b/litellm/llms/ollama_chat.py @@ -59,6 +59,7 @@ def get_ollama_response( # noqa: PLR0915 stream = optional_params.pop("stream", False) format = optional_params.pop("format", None) keep_alive = optional_params.pop("keep_alive", None) + think = optional_params.pop("think", None) function_name = optional_params.pop("function_name", None) tools = optional_params.pop("tools", None) @@ -98,6 +99,8 @@ def get_ollama_response( # noqa: PLR0915 data["tools"] = tools if keep_alive is not None: data["keep_alive"] = keep_alive + if think is not None: + data["think"] = think ## LOGGING logging_obj.pre_call( input=None, diff --git a/litellm/llms/openai/chat/gpt_5_transformation.py b/litellm/llms/openai/chat/gpt_5_transformation.py index fa357c1bd22..183f60debbd 100644 --- a/litellm/llms/openai/chat/gpt_5_transformation.py +++ b/litellm/llms/openai/chat/gpt_5_transformation.py @@ -41,6 +41,7 @@ class OpenAIGPT5Config(OpenAIGPTConfig): "presence_penalty", "frequency_penalty", "top_logprobs", + "stop", ] return [ diff --git a/litellm/llms/openai/chat/gpt_transformation.py b/litellm/llms/openai/chat/gpt_transformation.py index 204916e3a48..3e18617905c 100644 --- a/litellm/llms/openai/chat/gpt_transformation.py +++ b/litellm/llms/openai/chat/gpt_transformation.py @@ -397,13 +397,13 @@ class OpenAIGPTConfig(BaseLLMModelInfo, BaseConfig): ) from litellm.types.llms.openai import ChatCompletionToolParam - for message in messages: - message = cast( + for i, message in enumerate(messages): + messages[i] = cast( AllMessageValues, filter_value_from_dict(message, "cache_control") # type: ignore ) if tools is not None: - for tool in tools: - tool = cast( + for i, tool in enumerate(tools): + tools[i] = cast( ChatCompletionToolParam, filter_value_from_dict(tool, "cache_control"), # type: ignore ) diff --git a/litellm/llms/openai/common_utils.py b/litellm/llms/openai/common_utils.py index 00197a67e95..ce470f04aca 100644 --- a/litellm/llms/openai/common_utils.py +++ b/litellm/llms/openai/common_utils.py @@ -207,7 +207,6 @@ class BaseOpenAILLM: ssl_config = get_ssl_configuration() return httpx.AsyncClient( - limits=httpx.Limits(max_connections=1000, max_keepalive_connections=100), verify=ssl_config, transport=AsyncHTTPHandler._create_async_transport( ssl_context=ssl_config @@ -228,7 +227,6 @@ class BaseOpenAILLM: ssl_config = get_ssl_configuration() return httpx.Client( - limits=httpx.Limits(max_connections=1000, max_keepalive_connections=100), verify=ssl_config, follow_redirects=True, ) diff --git a/litellm/llms/openai/openai.py b/litellm/llms/openai/openai.py index 3347e533242..324205237dc 100644 --- a/litellm/llms/openai/openai.py +++ b/litellm/llms/openai/openai.py @@ -1125,6 +1125,7 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM): api_base: Optional[str] = None, client: Optional[AsyncOpenAI] = None, max_retries=None, + shared_session: Optional["ClientSession"] = None, ): try: openai_aclient: AsyncOpenAI = self._get_openai_client( # type: ignore @@ -1134,6 +1135,7 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM): timeout=timeout, max_retries=max_retries, client=client, + shared_session=shared_session, ) headers, response = await self.make_openai_embedding_request( openai_aclient=openai_aclient, @@ -1197,6 +1199,7 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM): client=None, aembedding=None, max_retries: Optional[int] = None, + shared_session: Optional["ClientSession"] = None, ) -> EmbeddingResponse: super().embedding() try: @@ -1223,6 +1226,7 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM): timeout=timeout, client=client, max_retries=max_retries, + shared_session=shared_session, ) openai_client: OpenAI = self._get_openai_client( # type: ignore diff --git a/litellm/llms/openai/responses/transformation.py b/litellm/llms/openai/responses/transformation.py index 25078267571..1e949e434d3 100644 --- a/litellm/llms/openai/responses/transformation.py +++ b/litellm/llms/openai/responses/transformation.py @@ -1,12 +1,4 @@ -from typing import ( - TYPE_CHECKING, - Any, - Dict, - Optional, - Union, - cast, - get_type_hints, -) +from typing import TYPE_CHECKING, Any, Dict, Optional, Union, cast, get_type_hints import httpx from openai.types.responses import ResponseReasoningItem @@ -127,13 +119,12 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig): 2. Create a ResponseReasoningItem object with the item data 3. Convert it back to dict with exclude_none=True to filter None values """ - verbose_logger.debug(f"Handling reasoning item: {item}") if item.get("type") == "reasoning": try: # Ensure required fields are present for ResponseReasoningItem item_data = dict(item) if "id" not in item_data: - item_data["id"] = f"reasoning_{hash(str(item_data))}" + item_data["id"] = f"rs_{hash(str(item_data))}" if "summary" not in item_data: item_data["summary"] = ( item_data.get("reasoning_content", "")[:100] + "..." @@ -170,6 +161,10 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig): ) -> ResponsesAPIResponse: """No transform applied since outputs are in OpenAI spec already""" try: + logging_obj.post_call( + original_response=raw_response.text, + additional_args={"complete_input_dict": {}}, + ) raw_response_json = raw_response.json() raw_response_json["created_at"] = _safe_convert_created_field( raw_response_json["created_at"] @@ -178,7 +173,13 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig): raise OpenAIError( message=raw_response.text, status_code=raw_response.status_code ) - return ResponsesAPIResponse(**raw_response_json) + try: + return ResponsesAPIResponse(**raw_response_json) + except Exception: + verbose_logger.debug( + f"Error constructing ResponsesAPIResponse: {raw_response_json}, using model_construct" + ) + return ResponsesAPIResponse.model_construct(**raw_response_json) def validate_environment( self, headers: dict, model: str, litellm_params: Optional[GenericLiteLLMParams] @@ -280,6 +281,7 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig): ResponsesAPIStreamEvents.MCP_CALL_ARGUMENTS_DONE: MCPCallArgumentsDoneEvent, ResponsesAPIStreamEvents.MCP_CALL_COMPLETED: MCPCallCompletedEvent, ResponsesAPIStreamEvents.MCP_CALL_FAILED: MCPCallFailedEvent, + ResponsesAPIStreamEvents.IMAGE_GENERATION_PARTIAL_IMAGE: ImageGenerationPartialImageEvent, ResponsesAPIStreamEvents.ERROR: ErrorEvent, } diff --git a/litellm/llms/openrouter/chat/transformation.py b/litellm/llms/openrouter/chat/transformation.py index bf57218c91d..f1eafe4e294 100644 --- a/litellm/llms/openrouter/chat/transformation.py +++ b/litellm/llms/openrouter/chat/transformation.py @@ -6,7 +6,8 @@ Calls done in OpenAI/openai.py as OpenRouter is openai-compatible. Docs: https://openrouter.ai/docs/parameters """ -from typing import Any, AsyncIterator, Iterator, List, Optional, Tuple, Union +from enum import Enum +from typing import Any, AsyncIterator, Iterator, List, Optional, Tuple, Union, cast import httpx @@ -20,6 +21,12 @@ from ...openai.chat.gpt_transformation import OpenAIGPTConfig from ..common_utils import OpenRouterException +class CacheControlSupportedModels(str, Enum): + """Models that support cache_control in content blocks.""" + CLAUDE = "claude" + GEMINI = "gemini" + + class OpenrouterConfig(OpenAIGPTConfig): def map_openai_params( self, @@ -48,19 +55,76 @@ class OpenrouterConfig(OpenAIGPTConfig): ) return mapped_openai_params + def _supports_cache_control_in_content(self, model: str) -> bool: + """ + Check if the model supports cache_control in content blocks. + + Returns: + bool: True if model supports cache_control (Claude or Gemini models) + """ + model_lower = model.lower() + return any( + supported_model.value in model_lower + for supported_model in CacheControlSupportedModels + ) + def remove_cache_control_flag_from_messages_and_tools( self, model: str, messages: List[AllMessageValues], tools: Optional[List["ChatCompletionToolParam"]] = None, ) -> Tuple[List[AllMessageValues], Optional[List["ChatCompletionToolParam"]]]: - if "claude" in model.lower(): # don't remove 'cache_control' flag + if self._supports_cache_control_in_content(model): return messages, tools else: return super().remove_cache_control_flag_from_messages_and_tools( model, messages, tools ) + def _move_cache_control_to_content( + self, messages: List[AllMessageValues] + ) -> List[AllMessageValues]: + """ + Move cache_control from message level to content blocks. + OpenRouter requires cache_control to be inside content blocks, not at message level. + + To avoid exceeding Anthropic's limit of 4 cache breakpoints, cache_control is only + added to the LAST content block in each message. + """ + transformed_messages: List[AllMessageValues] = [] + for message in messages: + message_dict = dict(message) + cache_control = message_dict.pop("cache_control", None) + + if cache_control is not None: + content = message_dict.get("content") + + if isinstance(content, list): + # Content is already a list, add cache_control only to the last block + if len(content) > 0: + content_copy = [] + for i, block in enumerate(content): + block_dict = dict(block) + # Only add cache_control to the last content block + if i == len(content) - 1: + block_dict["cache_control"] = cache_control + content_copy.append(block_dict) + message_dict["content"] = content_copy + else: + # Content is a string, convert to structured format + message_dict["content"] = [ + { + "type": "text", + "text": content, + "cache_control": cache_control, + } + ] + + # Cast back to AllMessageValues after modification + transformed_messages.append(cast(AllMessageValues, message_dict)) + + return transformed_messages + def transform_request( self, model: str, @@ -75,13 +139,78 @@ class OpenrouterConfig(OpenAIGPTConfig): Returns: dict: The transformed request. Sent as the body of the API call. """ + if self._supports_cache_control_in_content(model): + messages = self._move_cache_control_to_content(messages) + extra_body = optional_params.pop("extra_body", {}) response = super().transform_request( model, messages, optional_params, litellm_params, headers ) response.update(extra_body) + + # ALWAYS add usage parameter to get cost data from OpenRouter + # This ensures cost tracking works for all OpenRouter models + if "usage" not in response: + response["usage"] = {"include": True} + return response + def transform_response( + self, + model: str, + raw_response: httpx.Response, + model_response: ModelResponse, + logging_obj: Any, + request_data: dict, + messages: List[AllMessageValues], + optional_params: dict, + litellm_params: dict, + encoding: Any, + api_key: Optional[str] = None, + json_mode: Optional[bool] = None, + ) -> ModelResponse: + """ + Transform the response from OpenRouter API. + + Extracts cost information from response headers if available. + + Returns: + ModelResponse: The transformed response with cost information. + """ + # Call parent transform_response to get the standard ModelResponse + model_response = super().transform_response( + model=model, + raw_response=raw_response, + model_response=model_response, + logging_obj=logging_obj, + request_data=request_data, + messages=messages, + optional_params=optional_params, + litellm_params=litellm_params, + encoding=encoding, + api_key=api_key, + json_mode=json_mode, + ) + + # Extract cost from OpenRouter response body + # OpenRouter returns cost information in the usage object when usage.include=true + try: + response_json = raw_response.json() + if "usage" in response_json and response_json["usage"]: + response_cost = response_json["usage"].get("cost") + if response_cost is not None: + # Store cost in hidden params for the cost calculator to use + 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(response_cost) + except Exception: + # If we can't extract cost, continue without it - don't fail the response + pass + + return model_response + def get_error_class( self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers] ) -> BaseLLMException: diff --git a/litellm/llms/snowflake/chat/transformation.py b/litellm/llms/snowflake/chat/transformation.py index 2b92911b055..4c0258d9f4b 100644 --- a/litellm/llms/snowflake/chat/transformation.py +++ b/litellm/llms/snowflake/chat/transformation.py @@ -1,14 +1,15 @@ """ -Support for Snowflake REST API +Support for Snowflake REST API """ -from typing import TYPE_CHECKING, Any, List, Optional, Tuple +import json +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import httpx from litellm.secret_managers.main import get_secret_str from litellm.types.llms.openai import AllMessageValues -from litellm.types.utils import ModelResponse +from litellm.types.utils import ChatCompletionMessageToolCall, Function, ModelResponse from ...openai_like.chat.transformation import OpenAIGPTConfig @@ -22,15 +23,25 @@ else: class SnowflakeConfig(OpenAIGPTConfig): """ - source: https://docs.snowflake.com/en/sql-reference/functions/complete-snowflake-cortex + Reference: https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-llm-rest-api + + Snowflake Cortex LLM REST API supports function calling with specific models (e.g., Claude 3.5 Sonnet). + This config handles transformation between OpenAI format and Snowflake's tool_spec format. """ @classmethod def get_config(cls): return super().get_config() - def get_supported_openai_params(self, model: str) -> List: - return ["temperature", "max_tokens", "top_p", "response_format"] + def get_supported_openai_params(self, model: str) -> List[str]: + return [ + "temperature", + "max_tokens", + "top_p", + "response_format", + "tools", + "tool_choice", + ] def map_openai_params( self, @@ -56,6 +67,57 @@ class SnowflakeConfig(OpenAIGPTConfig): optional_params[param] = value return optional_params + def _transform_tool_calls_from_snowflake_to_openai( + self, content_list: List[Dict[str, Any]] + ) -> Tuple[str, Optional[List[ChatCompletionMessageToolCall]]]: + """ + Transform Snowflake tool calls to OpenAI format. + + Args: + content_list: Snowflake's content_list array containing text and tool_use items + + Returns: + Tuple of (text_content, tool_calls) + + Snowflake format in content_list: + { + "type": "tool_use", + "tool_use": { + "tool_use_id": "tooluse_...", + "name": "get_weather", + "input": {"location": "Paris"} + } + } + + OpenAI format (returned tool_calls): + ChatCompletionMessageToolCall( + id="tooluse_...", + type="function", + function=Function(name="get_weather", arguments='{"location": "Paris"}') + ) + """ + text_content = "" + tool_calls: List[ChatCompletionMessageToolCall] = [] + + for idx, content_item in enumerate(content_list): + if content_item.get("type") == "text": + text_content += content_item.get("text", "") + + ## TOOL CALLING + elif content_item.get("type") == "tool_use": + tool_use_data = content_item.get("tool_use", {}) + tool_call = ChatCompletionMessageToolCall( + id=tool_use_data.get("tool_use_id", ""), + type="function", + function=Function( + name=tool_use_data.get("name", ""), + arguments=json.dumps(tool_use_data.get("input", {})), + ), + ) + tool_calls.append(tool_call) + + return text_content, tool_calls if tool_calls else None + def transform_response( self, model: str, @@ -71,6 +133,7 @@ class SnowflakeConfig(OpenAIGPTConfig): json_mode: Optional[bool] = None, ) -> ModelResponse: response_json = raw_response.json() + logging_obj.post_call( input=messages, api_key="", @@ -78,6 +141,26 @@ class SnowflakeConfig(OpenAIGPTConfig): additional_args={"complete_input_dict": request_data}, ) + ## RESPONSE TRANSFORMATION + # Snowflake returns content_list (not content) with tool_use objects + # We need to transform this to OpenAI's format with content + tool_calls + if "choices" in response_json and len(response_json["choices"]) > 0: + choice = response_json["choices"][0] + if "message" in choice and "content_list" in choice["message"]: + content_list = choice["message"]["content_list"] + ( + text_content, + tool_calls, + ) = self._transform_tool_calls_from_snowflake_to_openai(content_list) + + # Update the choice message with OpenAI format + choice["message"]["content"] = text_content + if tool_calls: + choice["message"]["tool_calls"] = tool_calls + + # Remove Snowflake-specific content_list + del choice["message"]["content_list"] + returned_response = ModelResponse(**response_json) returned_response.model = "snowflake/" + (returned_response.model or "") @@ -150,6 +233,95 @@ class SnowflakeConfig(OpenAIGPTConfig): return api_base + def _transform_tools(self, tools: List[Dict[str, Any]]) -> List[Dict[str, Any]]: + """ + Transform OpenAI tool format to Snowflake tool format. + + Args: + tools: List of tools in OpenAI format + + Returns: + List of tools in Snowflake format + + OpenAI format: + { + "type": "function", + "function": { + "name": "get_weather", + "description": "...", + "parameters": {...} + } + } + + Snowflake format: + { + "tool_spec": { + "type": "generic", + "name": "get_weather", + "description": "...", + "input_schema": {...} + } + } + """ + snowflake_tools: List[Dict[str, Any]] = [] + for tool in tools: + if tool.get("type") == "function": + function = tool.get("function", {}) + snowflake_tool: Dict[str, Any] = { + "tool_spec": { + "type": "generic", + "name": function.get("name"), + "input_schema": function.get( + "parameters", + {"type": "object", "properties": {}}, + ), + } + } + # Add description if present + if "description" in function: + snowflake_tool["tool_spec"]["description"] = function[ + "description" + ] + + snowflake_tools.append(snowflake_tool) + + return snowflake_tools + + def _transform_tool_choice( + self, tool_choice: Union[str, Dict[str, Any]] + ) -> Union[str, Dict[str, Any]]: + """ + Transform OpenAI tool_choice format to Snowflake format. + + Args: + tool_choice: Tool choice in OpenAI format (str or dict) + + Returns: + Tool choice in Snowflake format + + OpenAI format: + {"type": "function", "function": {"name": "get_weather"}} + + Snowflake format: + {"type": "tool", "name": ["get_weather"]} + + Note: String values ("auto", "required", "none") pass through unchanged. + """ + if isinstance(tool_choice, str): + # "auto", "required", "none" pass through as-is + return tool_choice + + if isinstance(tool_choice, dict): + if tool_choice.get("type") == "function": + function_name = tool_choice.get("function", {}).get("name") + if function_name: + return { + "type": "tool", + "name": [function_name], # Snowflake expects array + } + + return tool_choice + def transform_request( self, model: str, @@ -160,6 +332,18 @@ class SnowflakeConfig(OpenAIGPTConfig): ) -> dict: stream: bool = optional_params.pop("stream", None) or False extra_body = optional_params.pop("extra_body", {}) + + ## TOOL CALLING + # Transform tools from OpenAI format to Snowflake's tool_spec format + tools = optional_params.pop("tools", None) + if tools: + optional_params["tools"] = self._transform_tools(tools) + + # Transform tool_choice from OpenAI format to Snowflake's tool name array format + tool_choice = optional_params.pop("tool_choice", None) + if tool_choice: + optional_params["tool_choice"] = self._transform_tool_choice(tool_choice) + return { "model": model, "messages": messages, diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index 8588c3efa27..3e650ecd111 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -1,4 +1,5 @@ import re +from enum import Enum from typing import Any, Dict, List, Literal, Optional, Set, Tuple, Union, get_type_hints import httpx @@ -24,6 +25,68 @@ class VertexAIError(BaseLLMException): super().__init__(message=message, status_code=status_code, headers=headers) +class VertexAIModelRoute(str, Enum): + """Enum for Vertex AI model routing""" + PARTNER_MODELS = "partner_models" + GEMINI = "gemini" + GEMMA = "gemma" + MODEL_GARDEN = "model_garden" + NON_GEMINI = "non_gemini" + + +def get_vertex_ai_model_route(model: str, litellm_params: Optional[dict] = None) -> VertexAIModelRoute: + """ + Determine which handler to use for a Vertex AI model based on the model name. + + Args: + model: The model name (e.g., "llama3-405b", "gemini-pro", "gemma/gemma-3-12b-it", "openai/gpt-oss-120b") + litellm_params: Optional litellm parameters dict that may contain base_model for routing + + Returns: + VertexAIModelRoute: The route enum indicating which handler should be used + + Examples: + >>> get_vertex_ai_model_route("llama3-405b") + VertexAIModelRoute.PARTNER_MODELS + + >>> get_vertex_ai_model_route("gemini-pro") + VertexAIModelRoute.GEMINI + + >>> get_vertex_ai_model_route("gemma/gemma-3-12b-it") + VertexAIModelRoute.GEMMA + + >>> get_vertex_ai_model_route("openai/gpt-oss-120b") + VertexAIModelRoute.MODEL_GARDEN + """ + from litellm.llms.vertex_ai.vertex_ai_partner_models.main import ( + VertexAIPartnerModels, + ) + + # Check base_model in litellm_params for gemini override + if litellm_params and litellm_params.get("base_model") is not None: + if "gemini" in litellm_params["base_model"]: + return VertexAIModelRoute.GEMINI + + # Check for partner models (llama, mistral, claude, etc.) + if VertexAIPartnerModels.is_vertex_partner_model(model=model): + return VertexAIModelRoute.PARTNER_MODELS + + # Check for gemma models + if "gemma/" in model: + return VertexAIModelRoute.GEMMA + + # Check for model garden openai models + if "openai" in model: + return VertexAIModelRoute.MODEL_GARDEN + + # Check for gemini models + if "gemini" in model: + return VertexAIModelRoute.GEMINI + + # Default to non-gemini (legacy vertex models like chat-bison, text-bison, etc.) + return VertexAIModelRoute.NON_GEMINI + + def get_supports_system_message( model: str, custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"] ) -> bool: diff --git a/litellm/llms/vertex_ai/context_caching/transformation.py b/litellm/llms/vertex_ai/context_caching/transformation.py index f3ca699546f..bb40b7665c1 100644 --- a/litellm/llms/vertex_ai/context_caching/transformation.py +++ b/litellm/llms/vertex_ai/context_caching/transformation.py @@ -5,7 +5,7 @@ Why separate file? Make it easy to see how transformation works """ import re -from typing import List, Optional, Tuple +from typing import List, Optional, Tuple, Literal from litellm.types.llms.openai import AllMessageValues from litellm.types.llms.vertex_ai import CachedContentRequestBody @@ -155,13 +155,18 @@ def separate_cached_messages( def transform_openai_messages_to_gemini_context_caching( - model: str, messages: List[AllMessageValues], cache_key: str + model: str, + messages: List[AllMessageValues], + custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"], + cache_key: str, + vertex_project: Optional[str], + vertex_location: Optional[str], ) -> CachedContentRequestBody: # Extract TTL from cached messages BEFORE system message transformation ttl = extract_ttl_from_cached_messages(messages) supports_system_message = get_supports_system_message( - model=model, custom_llm_provider="gemini" + model=model, custom_llm_provider=custom_llm_provider ) transformed_system_messages, new_messages = _transform_system_message( @@ -170,9 +175,14 @@ def transform_openai_messages_to_gemini_context_caching( transformed_messages = _gemini_convert_messages_with_history(messages=new_messages) + model_name = "models/{}".format(model) + + if custom_llm_provider == "vertex_ai" or custom_llm_provider == "vertex_ai_beta": + model_name = f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/{model_name}" + data = CachedContentRequestBody( contents=transformed_messages, - model="models/{}".format(model), + model=model_name, displayName=cache_key, ) 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 33a480aa6bb..70b068b5a4d 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 @@ -41,8 +41,11 @@ class ContextCachingEndpoints(VertexBase): def _get_token_and_url_context_caching( self, gemini_api_key: Optional[str], - custom_llm_provider: Literal["gemini"], + custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"], api_base: Optional[str], + vertex_project: Optional[str], + vertex_location: Optional[str], + vertex_auth_header: Optional[str], ) -> Tuple[Optional[str], str]: """ Internal function. Returns the token and url for the call. @@ -58,9 +61,15 @@ class ContextCachingEndpoints(VertexBase): url = "https://generativelanguage.googleapis.com/v1beta/{}?key={}".format( endpoint, gemini_api_key ) - + elif custom_llm_provider == "vertex_ai": + auth_header = vertex_auth_header + endpoint = "cachedContents" + url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/{endpoint}" else: - raise NotImplementedError + auth_header = vertex_auth_header + endpoint = "cachedContents" + url = f"https://{vertex_location}-aiplatform.googleapis.com/v1beta1/projects/{vertex_project}/locations/{vertex_location}/{endpoint}" + return self._check_custom_proxy( api_base=api_base, @@ -80,6 +89,10 @@ class ContextCachingEndpoints(VertexBase): api_key: str, api_base: Optional[str], logging_obj: Logging, + custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"], + vertex_project: Optional[str], + vertex_location: Optional[str], + vertex_auth_header: Optional[str], ) -> Optional[str]: """ Checks if content already cached. @@ -94,8 +107,11 @@ class ContextCachingEndpoints(VertexBase): _, url = self._get_token_and_url_context_caching( gemini_api_key=api_key, - custom_llm_provider="gemini", + custom_llm_provider=custom_llm_provider, api_base=api_base, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=vertex_auth_header ) try: ## LOGGING @@ -145,6 +161,10 @@ class ContextCachingEndpoints(VertexBase): api_key: str, api_base: Optional[str], logging_obj: Logging, + custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"], + vertex_project: Optional[str], + vertex_location: Optional[str], + vertex_auth_header: Optional[str] ) -> Optional[str]: """ Checks if content already cached. @@ -159,8 +179,11 @@ class ContextCachingEndpoints(VertexBase): _, url = self._get_token_and_url_context_caching( gemini_api_key=api_key, - custom_llm_provider="gemini", + custom_llm_provider=custom_llm_provider, api_base=api_base, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=vertex_auth_header ) try: ## LOGGING @@ -212,6 +235,10 @@ class ContextCachingEndpoints(VertexBase): client: Optional[HTTPHandler], timeout: Optional[Union[float, httpx.Timeout]], logging_obj: Logging, + custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"], + vertex_project: Optional[str], + vertex_location: Optional[str], + vertex_auth_header: Optional[str], extra_headers: Optional[dict] = None, cached_content: Optional[str] = None, ) -> Tuple[List[AllMessageValues], dict, Optional[str]]: @@ -240,8 +267,11 @@ class ContextCachingEndpoints(VertexBase): ## AUTHORIZATION ## token, url = self._get_token_and_url_context_caching( gemini_api_key=api_key, - custom_llm_provider="gemini", + custom_llm_provider=custom_llm_provider, api_base=api_base, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=vertex_auth_header ) headers = { @@ -273,6 +303,10 @@ class ContextCachingEndpoints(VertexBase): api_key=api_key, api_base=api_base, logging_obj=logging_obj, + custom_llm_provider=custom_llm_provider, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=vertex_auth_header ) if google_cache_name: return non_cached_messages, optional_params, google_cache_name @@ -280,7 +314,12 @@ class ContextCachingEndpoints(VertexBase): ## TRANSFORM REQUEST cached_content_request_body = ( transform_openai_messages_to_gemini_context_caching( - model=model, messages=cached_messages, cache_key=generated_cache_key + model=model, + messages=cached_messages, + cache_key=generated_cache_key, + custom_llm_provider=custom_llm_provider, + vertex_project=vertex_project, + vertex_location=vertex_location, ) ) @@ -328,6 +367,10 @@ class ContextCachingEndpoints(VertexBase): client: Optional[AsyncHTTPHandler], timeout: Optional[Union[float, httpx.Timeout]], logging_obj: Logging, + custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"], + vertex_project: Optional[str], + vertex_location: Optional[str], + vertex_auth_header: Optional[str], extra_headers: Optional[dict] = None, cached_content: Optional[str] = None, ) -> Tuple[List[AllMessageValues], dict, Optional[str]]: @@ -356,8 +399,11 @@ class ContextCachingEndpoints(VertexBase): ## AUTHORIZATION ## token, url = self._get_token_and_url_context_caching( gemini_api_key=api_key, - custom_llm_provider="gemini", + custom_llm_provider=custom_llm_provider, api_base=api_base, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=vertex_auth_header ) headers = { @@ -386,6 +432,10 @@ class ContextCachingEndpoints(VertexBase): api_key=api_key, api_base=api_base, logging_obj=logging_obj, + custom_llm_provider=custom_llm_provider, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=vertex_auth_header ) if google_cache_name: @@ -394,7 +444,12 @@ class ContextCachingEndpoints(VertexBase): ## TRANSFORM REQUEST cached_content_request_body = ( transform_openai_messages_to_gemini_context_caching( - model=model, messages=cached_messages, cache_key=generated_cache_key + model=model, + messages=cached_messages, + cache_key=generated_cache_key, + custom_llm_provider=custom_llm_provider, + vertex_project=vertex_project, + vertex_location=vertex_location, ) ) diff --git a/litellm/llms/vertex_ai/cost_calculator.py b/litellm/llms/vertex_ai/cost_calculator.py index 119ba2b0366..e98dc75915d 100644 --- a/litellm/llms/vertex_ai/cost_calculator.py +++ b/litellm/llms/vertex_ai/cost_calculator.py @@ -44,6 +44,7 @@ def cost_router( or "mistral" in model or "jamba" in model or "codestral" in model + or "gemma" in model ): return "cost_per_token" elif custom_llm_provider == "vertex_ai" and ( diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.py index ccaf28e5906..3d313456d19 100644 --- a/litellm/llms/vertex_ai/gemini/transformation.py +++ b/litellm/llms/vertex_ai/gemini/transformation.py @@ -514,34 +514,35 @@ def sync_transform_request_body( logging_obj: LiteLLMLoggingObj, custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"], litellm_params: dict, + vertex_project: Optional[str], + vertex_location: Optional[str], + vertex_auth_header: Optional[str], ) -> RequestBody: from ..context_caching.vertex_ai_context_caching import ContextCachingEndpoints context_caching_endpoints = ContextCachingEndpoints() - if gemini_api_key is not None: - ( - messages, - optional_params, - cached_content, - ) = context_caching_endpoints.check_and_create_cache( - messages=messages, - optional_params=optional_params, - api_key=gemini_api_key, - api_base=api_base, - model=model, - client=client, - timeout=timeout, - extra_headers=extra_headers, - cached_content=optional_params.pop("cached_content", None), - logging_obj=logging_obj, - ) - else: # [TODO] implement context caching for gemini as well - cached_content = None - if "cached_content" in optional_params: - cached_content = optional_params.pop("cached_content") - elif "cachedContent" in optional_params: - cached_content = optional_params.pop("cachedContent") + ( + messages, + optional_params, + cached_content, + ) = context_caching_endpoints.check_and_create_cache( + messages=messages, + optional_params=optional_params, + api_key=gemini_api_key or "dummy", + api_base=api_base, + model=model, + client=client, + timeout=timeout, + extra_headers=extra_headers, + cached_content=optional_params.pop("cached_content", None), + logging_obj=logging_obj, + custom_llm_provider=custom_llm_provider, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=vertex_auth_header, + ) + return _transform_request_body( messages=messages, @@ -565,34 +566,34 @@ async def async_transform_request_body( logging_obj: litellm.litellm_core_utils.litellm_logging.Logging, # type: ignore custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"], litellm_params: dict, + vertex_project: Optional[str], + vertex_location: Optional[str], + vertex_auth_header: Optional[str], ) -> RequestBody: from ..context_caching.vertex_ai_context_caching import ContextCachingEndpoints context_caching_endpoints = ContextCachingEndpoints() - if gemini_api_key is not None: - ( - messages, - optional_params, - cached_content, - ) = await context_caching_endpoints.async_check_and_create_cache( - messages=messages, - optional_params=optional_params, - api_key=gemini_api_key, - api_base=api_base, - model=model, - client=client, - timeout=timeout, - extra_headers=extra_headers, - cached_content=optional_params.pop("cached_content", None), - logging_obj=logging_obj, - ) - else: # [TODO] implement context caching for gemini as well - cached_content = None - if "cached_content" in optional_params: - cached_content = optional_params.pop("cached_content") - elif "cachedContent" in optional_params: - cached_content = optional_params.pop("cachedContent") + ( + messages, + optional_params, + cached_content, + ) = await context_caching_endpoints.async_check_and_create_cache( + messages=messages, + optional_params=optional_params, + api_key=gemini_api_key or "dummy", + api_base=api_base, + model=model, + client=client, + timeout=timeout, + extra_headers=extra_headers, + cached_content=optional_params.pop("cached_content", None), + logging_obj=logging_obj, + custom_llm_provider=custom_llm_provider, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=vertex_auth_header, + ) return _transform_request_body( messages=messages, 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 5871c353381..cd7ebaca790 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 @@ -68,6 +68,7 @@ from litellm.types.llms.vertex_ai import ( ToolConfig, Tools, UsageMetadata, + VertexToolName, ) from litellm.types.utils import ( ChatCompletionAudioResponse, @@ -276,42 +277,106 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): """ return Tools(googleSearch={}) - def _map_function(self, value: List[dict]) -> List[Tools]: # noqa: PLR0915 + def _extract_google_maps_retrieval_config( + self, google_maps_config: dict + ) -> Tuple[dict, Optional[dict]]: + """ + Extract location configuration from googleMaps tool for Vertex AI toolConfig. + + Supports two interface styles: + 1. Nested (recommended): {"enableWidget": "...", "retrievalConfig": {"latitude": ..., "longitude": ...}} + 2. Flat (backward compat): {"enableWidget": "...", "latitude": ..., "longitude": ...} + + Args: + google_maps_config: The googleMaps tool configuration from LiteLLM + + Returns: + Tuple of (cleaned_google_maps_config, retrieval_config): + - cleaned_google_maps_config: googleMaps config without location fields + - retrieval_config: Location config for toolConfig.retrievalConfig or None + """ + retrieval_config = None + latitude = google_maps_config.get("latitude") + longitude = google_maps_config.get("longitude") + language_code = google_maps_config.get("languageCode") + + if latitude is not None and longitude is not None: + retrieval_config = { + "latLng": { + "latitude": latitude, + "longitude": longitude, + } + } + if language_code is not None: + retrieval_config["languageCode"] = language_code + + # Remove location fields from tool definition + cleaned_config = { + k: v + for k, v in google_maps_config.items() + if k not in ["latitude", "longitude", "languageCode"] + } + + return cleaned_config, retrieval_config + + def get_tool_value( + self, + tool: dict, + tool_name: str + ) -> Optional[dict]: + """ + Helper function to get tool value handling both camelCase and underscore_case variants + + Args: + tool (dict): The tool dictionary + tool_name (str): The base tool name (e.g. "codeExecution") + + Returns: + Optional[dict]: The tool value if found, None otherwise + """ + # Convert camelCase to underscore_case + underscore_name = "".join( + ["_" + c.lower() if c.isupper() else c for c in tool_name] + ).lstrip("_") + # Try both camelCase and underscore_case variants + + if tool.get(tool_name) is not None: + return tool.get(tool_name) + elif tool.get(underscore_name) is not None: + return tool.get(underscore_name) + else: + return None + + def _map_function( # noqa: PLR0915 + self, value: List[dict], optional_params: dict + ) -> List[Tools]: + """ + Map OpenAI-style tools/functions to Vertex AI format. + + Args: + value: List of tool definitions + optional_params: Request-scoped parameters to store retrieval config + + Returns: + List of mapped tools in Vertex AI format + + Side effects: + May add 'toolConfig' with 'retrievalConfig' to optional_params if + googleMaps tools contain location data + """ gtool_func_declarations = [] googleSearch: Optional[dict] = None googleSearchRetrieval: Optional[dict] = None enterpriseWebSearch: Optional[dict] = None urlContext: Optional[dict] = None code_execution: Optional[dict] = None + googleMaps: Optional[dict] = None + google_maps_retrieval_config: Optional[dict] = None # remove 'additionalProperties' from tools value = _remove_additional_properties(value) # remove 'strict' from tools value = _remove_strict_from_schema(value) - def get_tool_value(tool: dict, tool_name: str) -> Optional[dict]: - """ - Helper function to get tool value handling both camelCase and underscore_case variants - - Args: - tool (dict): The tool dictionary - tool_name (str): The base tool name (e.g. "codeExecution") - - Returns: - Optional[dict]: The tool value if found, None otherwise - """ - # Convert camelCase to underscore_case - underscore_name = "".join( - ["_" + c.lower() if c.isupper() else c for c in tool_name] - ).lstrip("_") - # Try both camelCase and underscore_case variants - - if tool.get(tool_name) is not None: - return tool.get(tool_name) - elif tool.get(underscore_name) is not None: - return tool.get(underscore_name) - else: - return None - for tool in value: openai_function_object: Optional[ ChatCompletionToolParamFunctionChunk @@ -341,17 +406,27 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): tool_name = list(tool.keys())[0] if len(tool.keys()) == 1 else None if tool_name and ( - tool_name == "codeExecution" or tool_name == "code_execution" + tool_name == "codeExecution" or tool_name == VertexToolName.CODE_EXECUTION.value ): # code_execution maintained for backwards compatibility - code_execution = get_tool_value(tool, "codeExecution") - elif tool_name and tool_name == "googleSearch": - googleSearch = get_tool_value(tool, "googleSearch") - elif tool_name and tool_name == "googleSearchRetrieval": - googleSearchRetrieval = get_tool_value(tool, "googleSearchRetrieval") - elif tool_name and tool_name == "enterpriseWebSearch": - enterpriseWebSearch = get_tool_value(tool, "enterpriseWebSearch") - elif tool_name and tool_name == "urlContext": - urlContext = get_tool_value(tool, "urlContext") + code_execution = self.get_tool_value(tool, "codeExecution") + elif tool_name and tool_name == VertexToolName.GOOGLE_SEARCH.value: + googleSearch = self.get_tool_value(tool, VertexToolName.GOOGLE_SEARCH.value) + elif tool_name and tool_name == VertexToolName.GOOGLE_SEARCH_RETRIEVAL.value: + googleSearchRetrieval = self.get_tool_value(tool, VertexToolName.GOOGLE_SEARCH_RETRIEVAL.value) + elif tool_name and tool_name == VertexToolName.ENTERPRISE_WEB_SEARCH.value: + enterpriseWebSearch = self.get_tool_value(tool, VertexToolName.ENTERPRISE_WEB_SEARCH.value) + elif tool_name and (tool_name == VertexToolName.URL_CONTEXT.value or tool_name == "urlContext"): + urlContext = self.get_tool_value(tool, tool_name) + elif tool_name and ( + tool_name == VertexToolName.GOOGLE_MAPS.value or tool_name == "google_maps" + ): + google_maps_value = self.get_tool_value(tool, VertexToolName.GOOGLE_MAPS.value) + + # Extract and transform location configuration for toolConfig + if google_maps_value is not None: + googleMaps, google_maps_retrieval_config = self._extract_google_maps_retrieval_config( + google_maps_config=google_maps_value + ) elif openai_function_object is not None: gtool_func_declaration = FunctionDeclaration( name=openai_function_object["name"], @@ -373,19 +448,29 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): "Invalid tool={}. Use `litellm.set_verbose` or `litellm --detailed_debug` to see raw request." ) - _tools = Tools( - function_declarations=gtool_func_declarations, - ) + # Only include function_declarations if there are actual functions + _tools = Tools() + if gtool_func_declarations: + _tools["function_declarations"] = gtool_func_declarations if googleSearch is not None: - _tools["googleSearch"] = googleSearch + _tools[VertexToolName.GOOGLE_SEARCH.value] = googleSearch if googleSearchRetrieval is not None: - _tools["googleSearchRetrieval"] = googleSearchRetrieval + _tools[VertexToolName.GOOGLE_SEARCH_RETRIEVAL.value] = googleSearchRetrieval if enterpriseWebSearch is not None: - _tools["enterpriseWebSearch"] = enterpriseWebSearch + _tools[VertexToolName.ENTERPRISE_WEB_SEARCH.value] = enterpriseWebSearch if code_execution is not None: - _tools["code_execution"] = code_execution + _tools[VertexToolName.CODE_EXECUTION.value] = code_execution if urlContext is not None: - _tools["url_context"] = urlContext + _tools[VertexToolName.URL_CONTEXT.value] = urlContext + if googleMaps is not None: + _tools[VertexToolName.GOOGLE_MAPS.value] = googleMaps + + # Add retrieval config to toolConfig if googleMaps has location data + if google_maps_retrieval_config is not None: + if "toolConfig" not in optional_params: + optional_params["toolConfig"] = {} + optional_params["toolConfig"]["retrievalConfig"] = google_maps_retrieval_config + return [_tools] def _map_response_schema(self, value: dict) -> dict: @@ -606,8 +691,12 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): and isinstance(value, list) and value ): + # Pass optional_params so _map_function can add toolConfig if needed + mapped_tools = self._map_function( + value=value, optional_params=optional_params + ) optional_params = self._add_tools_to_optional_params( - optional_params, self._map_function(value=value) + optional_params, mapped_tools ) elif param == "tool_choice" and ( isinstance(value, str) or isinstance(value, dict) @@ -1703,7 +1792,6 @@ class VertexLLM(VertexBase): gemini_api_key: Optional[str] = None, extra_headers: Optional[dict] = None, ) -> CustomStreamWrapper: - request_body = await async_transform_request_body(**data) # type: ignore should_use_v1beta1_features = self.is_using_v1beta1_features( optional_params=optional_params @@ -1737,6 +1825,13 @@ class VertexLLM(VertexBase): litellm_params=litellm_params, ) + request_body = await async_transform_request_body( + **data, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=auth_header) # type: ignore + + ## LOGGING logging_obj.pre_call( input=messages, @@ -1824,7 +1919,12 @@ class VertexLLM(VertexBase): litellm_params=litellm_params, ) - request_body = await async_transform_request_body(**data) # type: ignore + request_body = await async_transform_request_body( + **data, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=auth_header) # type: ignore + _async_client_params = {} if timeout: _async_client_params["timeout"] = timeout @@ -1999,7 +2099,11 @@ class VertexLLM(VertexBase): ) ## TRANSFORMATION ## - data = sync_transform_request_body(**transform_request_params) + data = sync_transform_request_body( + **transform_request_params, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_auth_header=auth_header) ## LOGGING logging_obj.pre_call( diff --git a/litellm/llms/vertex_ai/vertex_gemma_models/__init__.py b/litellm/llms/vertex_ai/vertex_gemma_models/__init__.py new file mode 100644 index 00000000000..d06c7a5cd7a --- /dev/null +++ b/litellm/llms/vertex_ai/vertex_gemma_models/__init__.py @@ -0,0 +1,2 @@ +"""Vertex AI Gemma-AI Models Handler""" + diff --git a/litellm/llms/vertex_ai/vertex_gemma_models/main.py b/litellm/llms/vertex_ai/vertex_gemma_models/main.py new file mode 100644 index 00000000000..8203b285ebd --- /dev/null +++ b/litellm/llms/vertex_ai/vertex_gemma_models/main.py @@ -0,0 +1,145 @@ +""" +API Handler for calling Vertex AI Gemma Models + +These models use a custom prediction endpoint format that wraps messages in 'instances' +with @requestFormat: "chatCompletions" and returns responses wrapped in 'predictions'. + +Usage: + +response = litellm.completion( + model="vertex_ai/gemma/gemma-3-12b-it-1222199011122", + messages=[{"role": "user", "content": "What is machine learning?"}], + vertex_project="your-project-id", + vertex_location="us-central1", +) + +Sent to this route when `model` is in the format `vertex_ai/gemma/{MODEL_NAME}` + +The API expects a custom endpoint URL format: +https://{ENDPOINT_NUMBER}.{location}-{REGION_NUMBER}.prediction.vertexai.goog/v1/projects/{PROJECT_ID}/locations/{location}/endpoints/{ENDPOINT_ID}:predict +""" + +from typing import Callable, Optional, Union + +import httpx # type: ignore + +from litellm.utils import ModelResponse + +from ..common_utils import VertexAIError +from ..vertex_llm_base import VertexBase + + +class VertexAIGemmaModels(VertexBase): + def __init__(self) -> None: + pass + + def completion( + self, + model: str, + messages: list, + model_response: ModelResponse, + print_verbose: Callable, + encoding, + logging_obj, + api_base: Optional[str], + optional_params: dict, + custom_prompt_dict: dict, + headers: Optional[dict], + timeout: Union[float, httpx.Timeout], + litellm_params: dict, + vertex_project=None, + vertex_location=None, + vertex_credentials=None, + logger_fn=None, + acompletion: bool = False, + client=None, + ): + """ + Handles calling Vertex AI Gemma Models + + Sent to this route when `model` is in the format `vertex_ai/gemma/{MODEL_NAME}` + """ + try: + import vertexai + + from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import ( + VertexLLM, + ) + from litellm.llms.vertex_ai.vertex_gemma_models.transformation import ( + VertexGemmaConfig, + ) + except Exception as e: + raise VertexAIError( + status_code=400, + message=f"""vertexai import failed please run `pip install -U "google-cloud-aiplatform>=1.38"`. Got error: {e}""", + ) + + if not ( + hasattr(vertexai, "preview") or hasattr(vertexai.preview, "language_models") + ): + raise VertexAIError( + status_code=400, + message="""Upgrade vertex ai. Run `pip install "google-cloud-aiplatform>=1.38"`""", + ) + try: + model = model.replace("gemma/", "") + vertex_httpx_logic = VertexLLM() + + access_token, project_id = vertex_httpx_logic._ensure_access_token( + credentials=vertex_credentials, + project_id=vertex_project, + custom_llm_provider="vertex_ai", + ) + + gemma_transformation = VertexGemmaConfig() + + ## CONSTRUCT API BASE + stream: bool = optional_params.get("stream", False) or False + optional_params["stream"] = stream + + # If api_base is not provided, it should be set as an environment variable + # or passed explicitly because the endpoint URL is unique per deployment + if api_base is None: + raise VertexAIError( + status_code=400, + message="api_base is required for Vertex AI Gemma models. Please provide the full endpoint URL.", + ) + + # Check if we need to append :predict + if not api_base.endswith(":predict"): + _, api_base = self._check_custom_proxy( + api_base=api_base, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="predict", + stream=stream, + auth_header=None, + url=api_base, + ) + # If api_base already ends with :predict, use it as-is + + # Use the custom transformation handler for gemma models + return gemma_transformation.completion( + model=model, + messages=messages, + api_base=api_base, + api_key=access_token, + custom_prompt_dict=custom_prompt_dict, + model_response=model_response, + print_verbose=print_verbose, + logging_obj=logging_obj, + optional_params=optional_params, + acompletion=acompletion, + litellm_params=litellm_params, + logger_fn=logger_fn, + client=client, + timeout=timeout, + encoding=encoding, + custom_llm_provider="vertex_ai", + ) + + except Exception as e: + if hasattr(e, "status_code"): + raise e + raise VertexAIError(status_code=500, message=str(e)) + diff --git a/litellm/llms/vertex_ai/vertex_gemma_models/transformation.py b/litellm/llms/vertex_ai/vertex_gemma_models/transformation.py new file mode 100644 index 00000000000..24b53f0ba4f --- /dev/null +++ b/litellm/llms/vertex_ai/vertex_gemma_models/transformation.py @@ -0,0 +1,354 @@ +""" +Transformation logic for Vertex AI Gemma Models + +Handles the custom request/response format: +- Request: Wraps messages in 'instances' with @requestFormat: "chatCompletions" +- Response: Extracts data from 'predictions' wrapper + +The actual message transformation reuses OpenAIGPTConfig since Gemma uses OpenAI-compatible format. +""" + +from typing import Any, Callable, Dict, List, Optional, Union, cast + +import httpx + +from litellm.llms.base_llm.chat.transformation import BaseLLMException +from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig +from litellm.types.llms.openai import AllMessageValues +from litellm.types.utils import ModelResponse + + +class VertexGemmaConfig(OpenAIGPTConfig): + """ + Configuration and transformation class for Vertex AI Gemma models + + Extends OpenAIGPTConfig to wrap/unwrap the instances/predictions format + used by Vertex AI's Gemma deployment endpoint. + """ + + def __init__(self) -> None: + super().__init__() + + def should_fake_stream( + self, + model: Optional[str], + stream: Optional[bool], + custom_llm_provider: Optional[str] = None, + ) -> bool: + """ + Vertex AI Gemma models do not support streaming. + Return True to enable fake streaming on the client side. + """ + return True + + def _handle_fake_stream_response( + self, + model_response: ModelResponse, + stream: bool, + ) -> Union[ModelResponse, Any]: + """ + Helper method to return fake stream iterator if streaming is requested. + + Args: + model_response: The completed model response + stream: Whether streaming was requested + + Returns: + MockResponseIterator if stream=True, otherwise the model_response + """ + if stream: + from litellm.llms.base_llm.base_model_iterator import MockResponseIterator + return MockResponseIterator(model_response=model_response) + return model_response + + def transform_request( + self, + model: str, + messages: List[AllMessageValues], + optional_params: dict, + litellm_params: dict, + headers: dict, + ) -> dict: + """ + Transform request to Vertex Gemma format. + + Uses parent class to create OpenAI-compatible request, then wraps it + in the Vertex Gemma instances format. + """ + # Get the base OpenAI request from parent class + openai_request = super().transform_request( + model=model, + messages=messages, + optional_params=optional_params, + litellm_params=litellm_params, + headers=headers, + ) + + # Remove params not needed/supported by Vertex Gemma + openai_request.pop("model", None) + openai_request.pop("stream", None) # Streaming not supported, will be faked client-side + openai_request.pop("stream_options", None) # Stream options not supported + + # Wrap in Vertex Gemma format + return { + "instances": [ + { + "@requestFormat": "chatCompletions", + **openai_request, + } + ] + } + + def _unwrap_predictions_response( + self, + response_json: Dict[str, Any], + ) -> Dict[str, Any]: + """ + Unwrap the Vertex Gemma predictions format to OpenAI format. + + Vertex Gemma wraps the OpenAI-compatible response in a 'predictions' field. + This method extracts it so the parent class can process it normally. + """ + if "predictions" not in response_json: + raise BaseLLMException( + status_code=422, + message="Invalid response format: missing 'predictions' field", + ) + + return response_json["predictions"] + + def completion( + self, + model: str, + messages: list, + api_base: str, + api_key: str, + custom_prompt_dict: dict, + model_response: ModelResponse, + print_verbose: Callable, + logging_obj: Any, + optional_params: dict, + acompletion: bool, + litellm_params: dict, + logger_fn: Optional[Callable] = None, + client: Optional[httpx.Client] = None, + timeout: Optional[Union[float, httpx.Timeout]] = None, + encoding=None, + custom_llm_provider: str = "vertex_ai", + ): + """ + Make completion request to Vertex Gemma endpoint. + Supports both sync and async requests with fake streaming. + """ + if acompletion: + return self._async_completion( + model=model, + messages=messages, + api_base=api_base, + api_key=api_key, + model_response=model_response, + print_verbose=print_verbose, + logging_obj=logging_obj, + optional_params=optional_params, + litellm_params=litellm_params, + timeout=timeout, + encoding=encoding, + ) + else: + return self._sync_completion( + model=model, + messages=messages, + api_base=api_base, + api_key=api_key, + model_response=model_response, + print_verbose=print_verbose, + logging_obj=logging_obj, + optional_params=optional_params, + litellm_params=litellm_params, + timeout=timeout, + encoding=encoding, + ) + + def _sync_completion( + self, + model: str, + messages: list, + api_base: str, + api_key: str, + model_response: ModelResponse, + print_verbose: Callable, + logging_obj: Any, + optional_params: dict, + litellm_params: dict, + timeout: Optional[Union[float, httpx.Timeout]], + encoding: Any, + ): + """Synchronous completion request""" + from litellm.llms.custom_httpx.http_handler import HTTPHandler + from litellm.utils import convert_to_model_response_object + + # Check if streaming is requested (will be faked) + stream = optional_params.get("stream", False) + + # Transform the request using parent class methods + request_data = self.transform_request( + model=model, + messages=messages, + optional_params=optional_params.copy(), + litellm_params=litellm_params, + headers={}, + ) + + # Set up headers + headers = { + "Authorization": f"Bearer {api_key}", + "Content-Type": "application/json", + } + + # Log the request + logging_obj.pre_call( + input=messages, + api_key=api_key, + additional_args={ + "complete_input_dict": request_data, + "api_base": api_base, + }, + ) + + # Make the HTTP request + http_handler = HTTPHandler(concurrent_limit=1) + response = http_handler.post( + url=api_base, + headers=headers, + json=request_data, + timeout=timeout, + ) + + if response.status_code != 200: + raise BaseLLMException( + status_code=response.status_code, + message=f"Request failed: {response.text}", + ) + + response_json = response.json() + + # Unwrap predictions to get OpenAI-compatible response + openai_response = self._unwrap_predictions_response(response_json) + + # Use litellm's standard response converter + model_response = cast( + ModelResponse, + convert_to_model_response_object( + response_object=openai_response, + model_response_object=model_response, + _response_headers={}, + ), + ) + + # Ensure model is set correctly + model_response.model = model + + # Log the response + logging_obj.post_call( + input=messages, + api_key=api_key, + original_response=response_json, + additional_args={"complete_input_dict": request_data}, + ) + + # Return fake stream iterator if streaming was requested + return self._handle_fake_stream_response(model_response=model_response, stream=stream) + + async def _async_completion( + self, + model: str, + messages: list, + api_base: str, + api_key: str, + model_response: ModelResponse, + print_verbose: Callable, + logging_obj: Any, + optional_params: dict, + litellm_params: dict, + timeout: Optional[Union[float, httpx.Timeout]], + encoding: Any, + ): + """Asynchronous completion request""" + from litellm.llms.custom_httpx.http_handler import get_async_httpx_client + from litellm.types.utils import LlmProviders + from litellm.utils import convert_to_model_response_object + + # Check if streaming is requested (will be faked) + stream = optional_params.get("stream", False) + + # Transform the request using parent class async methods + request_data = await self.async_transform_request( + model=model, + messages=messages, + optional_params=optional_params.copy(), + litellm_params=litellm_params, + headers={}, + ) + + # Set up headers + headers = { + "Authorization": f"Bearer {api_key}", + "Content-Type": "application/json", + } + + # Log the request + logging_obj.pre_call( + input=messages, + api_key=api_key, + additional_args={ + "complete_input_dict": request_data, + "api_base": api_base, + }, + ) + + # Make the HTTP request + http_handler = get_async_httpx_client( + llm_provider=LlmProviders.VERTEX_AI, + ) + response = await http_handler.post( + url=api_base, + headers=headers, + json=request_data, + timeout=timeout, + ) + + if response.status_code != 200: + raise BaseLLMException( + status_code=response.status_code, + message=f"Request failed: {response.text}", + ) + + response_json = response.json() + + # Unwrap predictions to get OpenAI-compatible response + openai_response = self._unwrap_predictions_response(response_json) + + # Use litellm's standard response converter + model_response = cast( + ModelResponse, + convert_to_model_response_object( + response_object=openai_response, + model_response_object=model_response, + _response_headers={}, + ), + ) + + # Ensure model is set correctly + model_response.model = model + + # Log the response + logging_obj.post_call( + input=messages, + api_key=api_key, + original_response=response_json, + additional_args={"complete_input_dict": request_data}, + ) + + # Return fake stream iterator if streaming was requested + return self._handle_fake_stream_response(model_response=model_response, stream=stream) + diff --git a/litellm/llms/watsonx/chat/transformation.py b/litellm/llms/watsonx/chat/transformation.py index 6b0dd5a39ae..2c096cafced 100644 --- a/litellm/llms/watsonx/chat/transformation.py +++ b/litellm/llms/watsonx/chat/transformation.py @@ -4,10 +4,14 @@ Translation from OpenAI's `/chat/completions` endpoint to IBM WatsonX's `/text/c Docs: https://cloud.ibm.com/apidocs/watsonx-ai#text-chat """ -from typing import List, Optional, Tuple, Union +from typing import Dict, List, Optional, Tuple, Union from litellm.secret_managers.main import get_secret_str -from litellm.types.llms.watsonx import WatsonXAIEndpoint, WatsonXAPIParams +from litellm.types.llms.watsonx import ( + WatsonXAIEndpoint, + WatsonXAPIParams, + WatsonXModelPattern, +) from ....utils import _remove_additional_properties, _remove_strict_from_schema from ...openai.chat.gpt_transformation import OpenAIGPTConfig @@ -120,3 +124,95 @@ class IBMWatsonXChatConfig(IBMWatsonXMixin, OpenAIGPTConfig): 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) -> Optional[str]: + """Core logic for applying prompt templates""" + from litellm.litellm_core_utils.prompt_templates.factory import ( + custom_prompt, + ibm_granite_pt, + mistral_instruct_pt, + ) + + if WatsonXModelPattern.GRANITE_CHAT.value in model: + return ibm_granite_pt(messages=messages) + elif WatsonXModelPattern.IBM_MISTRAL.value in model: + return mistral_instruct_pt(messages=messages) + elif WatsonXModelPattern.GPT_OSS.value in model: + hf_model = model.split("watsonx/")[-1] if "watsonx/" in model else model + try: + return hf_template_fn(model=hf_model, messages=messages) + except Exception: + pass + elif WatsonXModelPattern.LLAMA3_INSTRUCT.value in model: + return custom_prompt( + role_dict={ + "system": {"pre_message": "<|start_header_id|>system<|end_header_id|>\n", "post_message": "<|eot_id|>"}, + "user": {"pre_message": "<|start_header_id|>user<|end_header_id|>\n", "post_message": "<|eot_id|>"}, + "assistant": {"pre_message": "<|start_header_id|>assistant<|end_header_id|>\n", "post_message": "<|eot_id|>"}, + }, + messages=messages, + initial_prompt_value="<|begin_of_text|>", + final_prompt_value="<|start_header_id|>assistant<|end_header_id|>\n", + ) + return None + + @staticmethod + async def aapply_prompt_template(model: str, messages: List[Dict[str, str]]) -> Optional[str]: + """Apply prompt template (async version)""" + import litellm + from litellm.litellm_core_utils.prompt_templates.factory import ( + ahf_chat_template, + custom_prompt, + hf_chat_template, + ibm_granite_pt, + mistral_instruct_pt, + ) + + if WatsonXModelPattern.GRANITE_CHAT.value in model: + return ibm_granite_pt(messages=messages) + elif WatsonXModelPattern.IBM_MISTRAL.value in model: + return mistral_instruct_pt(messages=messages) + elif WatsonXModelPattern.GPT_OSS.value in model: + hf_model = model.split("watsonx/")[-1] if "watsonx/" in model else model + try: + # Use sync if cached, async if not + if hf_model in litellm.known_tokenizer_config: + return hf_chat_template(model=hf_model, messages=messages) + else: + return await ahf_chat_template(model=hf_model, messages=messages) + except Exception: + pass + elif WatsonXModelPattern.LLAMA3_INSTRUCT.value in model: + return custom_prompt( + role_dict={ + "system": { + "pre_message": "<|start_header_id|>system<|end_header_id|>\n", + "post_message": "<|eot_id|>", + }, + "user": { + "pre_message": "<|start_header_id|>user<|end_header_id|>\n", + "post_message": "<|eot_id|>", + }, + "assistant": { + "pre_message": "<|start_header_id|>assistant<|end_header_id|>\n", + "post_message": "<|eot_id|>", + }, + }, + messages=messages, + initial_prompt_value="<|begin_of_text|>", + final_prompt_value="<|start_header_id|>assistant<|end_header_id|>\n", + ) + return None + + @staticmethod + def apply_prompt_template(model: str, messages: List[Dict[str, str]]) -> Optional[str]: + """Apply prompt template (sync version)""" + from litellm.litellm_core_utils.prompt_templates.factory import ( + hf_chat_template, + ) + + return IBMWatsonXChatConfig._apply_prompt_template_core( + model=model, messages=messages, hf_template_fn=hf_chat_template + ) + diff --git a/litellm/llms/watsonx/common_utils.py b/litellm/llms/watsonx/common_utils.py index c756be6d458..58b33097cbd 100644 --- a/litellm/llms/watsonx/common_utils.py +++ b/litellm/llms/watsonx/common_utils.py @@ -131,34 +131,102 @@ def _get_api_params( ) -def convert_watsonx_messages_to_prompt( +async def _aconvert_watsonx_messages_core( model: str, messages: List[AllMessageValues], provider: str, custom_prompt_dict: Dict, + apply_template_fn, ) -> str: + """Async core logic for converting watsonx messages to prompt""" + from litellm.types.llms.watsonx import WatsonXModelPattern + # handle anthropic prompts and amazon titan prompts if model in custom_prompt_dict: - # check if the model has a registered custom prompt model_prompt_dict = custom_prompt_dict[model] - prompt = ptf.custom_prompt( + 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", ""), eos_token=model_prompt_dict.get("eos_token", ""), ) - return prompt - elif provider == "ibm-mistralai": - prompt = ptf.mistral_instruct_pt(messages=messages) + elif provider == WatsonXModelPattern.IBM_MISTRALAI.value: + return ptf.mistral_instruct_pt(messages=messages) else: - prompt: str = ptf.prompt_factory( # type: ignore + # Try applying specific template first + result = await apply_template_fn(model=model, messages=messages) + if result: + return result + # Fallback to default + return ptf.prompt_factory( model=model, messages=messages, custom_llm_provider="watsonx" + ) # type: ignore + + +def _convert_watsonx_messages_core( + model: str, + messages: List[AllMessageValues], + provider: str, + custom_prompt_dict: Dict, + apply_template_fn, +) -> str: + """Sync core logic for converting watsonx messages to prompt""" + from litellm.types.llms.watsonx import WatsonXModelPattern + + # handle anthropic prompts and amazon titan prompts + if model in custom_prompt_dict: + 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")), + 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", ""), + eos_token=model_prompt_dict.get("eos_token", ""), ) - return prompt + elif provider == WatsonXModelPattern.IBM_MISTRALAI.value: + return ptf.mistral_instruct_pt(messages=messages) + else: + # Try applying specific template first + result = apply_template_fn(model=model, messages=messages) + if result: + return result + # Fallback to default + return ptf.prompt_factory( + model=model, messages=messages, custom_llm_provider="watsonx" + ) # type: ignore + + +async def aconvert_watsonx_messages_to_prompt( + 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 + + return await _aconvert_watsonx_messages_core( + model=model, + messages=messages, + provider=provider, + custom_prompt_dict=custom_prompt_dict, + apply_template_fn=IBMWatsonXChatConfig.aapply_prompt_template, + ) + + +def convert_watsonx_messages_to_prompt( + 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 + + return _convert_watsonx_messages_core( + model=model, + messages=messages, + provider=provider, + custom_prompt_dict=custom_prompt_dict, + apply_template_fn=IBMWatsonXChatConfig.apply_prompt_template, + ) # Mixin class for shared IBM Watson X functionality diff --git a/litellm/llms/watsonx/completion/transformation.py b/litellm/llms/watsonx/completion/transformation.py index a0b9735a990..3c1229ecd2b 100644 --- a/litellm/llms/watsonx/completion/transformation.py +++ b/litellm/llms/watsonx/completion/transformation.py @@ -228,39 +228,35 @@ class IBMWatsonXAIConfig(IBMWatsonXMixin, BaseConfig): "us-south", ] - def transform_request( - self, - model: str, - messages: List[AllMessageValues], - optional_params: Dict, - litellm_params: Dict, - headers: Dict, - ) -> Dict: - provider = model.split("/")[0] - prompt = convert_watsonx_messages_to_prompt( - model=model, - messages=messages, - provider=provider, - custom_prompt_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, - ) - - # init the payload to the text generation call - payload = { + watsonx_auth_payload = self._prepare_payload(model=model, api_params=watsonx_api_params) + + return { "input": prompt, "moderations": optional_params.pop("moderations", {}), "parameters": optional_params, **watsonx_auth_payload, } - return payload + 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: + """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) def transform_response( self, diff --git a/litellm/main.py b/litellm/main.py index cfb0bef0797..5c50f096460 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -85,6 +85,10 @@ from litellm.litellm_core_utils.prompt_templates.common_utils import ( from litellm.llms.base_llm import BaseConfig, BaseImageGenerationConfig from litellm.llms.bedrock.common_utils import BedrockModelInfo from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler +from litellm.llms.vertex_ai.common_utils import ( + VertexAIModelRoute, + get_vertex_ai_model_route, +) from litellm.realtime_api.main import _realtime_health_check from litellm.secret_managers.main import get_secret_bool, get_secret_str from litellm.types.router import GenericLiteLLMParams @@ -150,7 +154,6 @@ from .llms.bedrock.chat import BedrockConverseLLM, BedrockLLM from .llms.bedrock.embed.embedding import BedrockEmbedding from .llms.bedrock.image.image_handler import BedrockImageGeneration from .llms.bytez.chat.transformation import BytezChatConfig -from .llms.lemonade.chat.transformation import LemonadeChatConfig from .llms.codestral.completion.handler import CodestralTextCompletion from .llms.cohere.embed import handler as cohere_embed from .llms.custom_httpx.aiohttp_handler import BaseLLMAIOHTTPHandler @@ -162,6 +165,7 @@ from .llms.gemini.common_utils import get_api_key_from_env from .llms.groq.chat.handler import GroqChatCompletion from .llms.heroku.chat.transformation import HerokuChatConfig from .llms.huggingface.embedding.handler import HuggingFaceEmbedding +from .llms.lemonade.chat.transformation import LemonadeChatConfig from .llms.nlp_cloud.chat.handler import completion as nlp_cloud_chat_completion from .llms.oci.chat.transformation import OCIChatConfig from .llms.ollama.completion import handler as ollama @@ -192,6 +196,7 @@ from .llms.vertex_ai.multimodal_embeddings.embedding_handler import ( from .llms.vertex_ai.text_to_speech.text_to_speech_handler import VertexTextToSpeechAPI from .llms.vertex_ai.vertex_ai_partner_models.main import VertexAIPartnerModels from .llms.vertex_ai.vertex_embeddings.embedding_handler import VertexEmbedding +from .llms.vertex_ai.vertex_gemma_models.main import VertexAIGemmaModels from .llms.vertex_ai.vertex_model_garden.main import VertexAIModelGardenModels from .llms.vllm.completion import handler as vllm_handler from .llms.watsonx.chat.handler import WatsonXChatHandler @@ -255,6 +260,7 @@ vertex_multimodal_embedding = VertexMultimodalEmbedding() vertex_image_generation = VertexImageGeneration() google_batch_embeddings = GoogleBatchEmbeddings() vertex_partner_models_chat_completion = VertexAIPartnerModels() +vertex_gemma_chat_completion = VertexAIGemmaModels() vertex_model_garden_chat_completion = VertexAIModelGardenModels() vertex_text_to_speech = VertexTextToSpeechAPI() sagemaker_llm = SagemakerLLM() @@ -2872,10 +2878,10 @@ def completion( # type: ignore # noqa: PLR0915 custom_llm_provider=custom_llm_provider, # type: ignore client=client, api_base=api_base, - extra_headers=extra_headers, + extra_headers=headers, ) - elif custom_llm_provider == "vertex_ai": + elif custom_llm_provider == "vertex_ai": vertex_ai_project = ( optional_params.pop("vertex_project", None) or optional_params.pop("vertex_ai_project", None) @@ -2897,7 +2903,9 @@ def completion( # type: ignore # noqa: PLR0915 api_base = api_base or litellm.api_base or get_secret("VERTEXAI_API_BASE") new_params = safe_deep_copy(optional_params or {}) - if vertex_partner_models_chat_completion.is_vertex_partner_model(model): + model_route = get_vertex_ai_model_route(model=model, litellm_params=litellm_params) + + if model_route == VertexAIModelRoute.PARTNER_MODELS: model_response = vertex_partner_models_chat_completion.completion( model=model, messages=messages, @@ -2918,10 +2926,7 @@ def completion( # type: ignore # noqa: PLR0915 timeout=timeout, client=client, ) - elif "gemini" in model or ( - litellm_params.get("base_model") is not None - and "gemini" in litellm_params["base_model"] - ): + elif model_route == VertexAIModelRoute.GEMINI: model_response = vertex_chat_completion.completion( # type: ignore model=model, messages=messages, @@ -2941,9 +2946,31 @@ def completion( # type: ignore # noqa: PLR0915 custom_llm_provider=custom_llm_provider, # type: ignore client=client, api_base=api_base, - extra_headers=extra_headers, + extra_headers=headers, ) - elif "openai" in model: + elif model_route == VertexAIModelRoute.GEMMA: + # Vertex Gemma Models with custom prediction endpoint + model_response = vertex_gemma_chat_completion.completion( + model=model, + messages=messages, + model_response=model_response, + print_verbose=print_verbose, + optional_params=new_params, + litellm_params=litellm_params, # type: ignore + logger_fn=logger_fn, + encoding=encoding, + api_base=api_base, + vertex_location=vertex_ai_location, + vertex_project=vertex_ai_project, + vertex_credentials=vertex_credentials, + logging_obj=logging, + acompletion=acompletion, + headers=headers, + custom_prompt_dict=custom_prompt_dict, + timeout=timeout, + client=client, + ) + elif model_route == VertexAIModelRoute.MODEL_GARDEN: # Vertex Model Garden - OpenAI compatible models model_response = vertex_model_garden_chat_completion.completion( model=model, @@ -2965,7 +2992,7 @@ def completion( # type: ignore # noqa: PLR0915 timeout=timeout, client=client, ) - else: + else: # VertexAIModelRoute.NON_GEMINI model_response = vertex_ai_non_gemini.completion( model=model, messages=messages, @@ -3969,6 +3996,7 @@ def embedding( # noqa: PLR0915 """ azure = kwargs.get("azure", None) client = kwargs.pop("client", None) + shared_session = kwargs.get("shared_session", None) max_retries = kwargs.get("max_retries", None) litellm_logging_obj: LiteLLMLoggingObj = kwargs.get("litellm_logging_obj") # type: ignore mock_response: Optional[List[float]] = kwargs.get("mock_response", None) # type: ignore @@ -4158,6 +4186,7 @@ def embedding( # noqa: PLR0915 client=client, aembedding=aembedding, max_retries=max_retries, + shared_session=shared_session, ) elif custom_llm_provider == "databricks": api_base = api_base or litellm.api_base or get_secret("DATABRICKS_API_BASE") # type: ignore @@ -4725,6 +4754,33 @@ def embedding( # noqa: PLR0915 aembedding=aembedding, litellm_params={}, ) + elif custom_llm_provider == "cometapi": + api_key = ( + api_key + or litellm.cometapi_key + or get_secret_str("COMETAPI_KEY") + or litellm.api_key + ) + api_base = ( + api_base + or litellm.api_base + or get_secret_str("COMETAPI_API_BASE") + or "https://api.cometapi.com/v1" + ) + response = base_llm_http_handler.embedding( + model=model, + input=input, + custom_llm_provider=custom_llm_provider, + api_base=api_base, + api_key=api_key, + logging_obj=logging, + timeout=timeout, + model_response=EmbeddingResponse(), + optional_params=optional_params, + client=client, + aembedding=aembedding, + litellm_params={}, + ) elif custom_llm_provider in litellm._custom_providers: custom_handler: Optional[CustomLLM] = None for item in litellm.custom_provider_map: diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index bae7c11e66c..6129754e887 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -400,6 +400,44 @@ "supports_response_schema": true, "supports_tool_choice": true }, + "anthropic.claude-haiku-4-5-20251001-v1:0": { + "cache_creation_input_token_cost": 1.25e-06, + "cache_read_input_token_cost": 1e-07, + "input_cost_per_token": 1e-06, + "litellm_provider": "bedrock", + "max_input_tokens": 200000, + "max_output_tokens": 8192, + "max_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 5e-06, + "source": "https://aws.amazon.com/about-aws/whats-new/2025/10/claude-4-5-haiku-anthropic-amazon-bedrock", + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true + }, + "anthropic.claude-haiku-4-5@20251001": { + "cache_creation_input_token_cost": 1.25e-06, + "cache_read_input_token_cost": 1e-07, + "input_cost_per_token": 1e-06, + "litellm_provider": "bedrock", + "max_input_tokens": 200000, + "max_output_tokens": 8192, + "max_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 5e-06, + "source": "https://aws.amazon.com/about-aws/whats-new/2025/10/claude-4-5-haiku-anthropic-amazon-bedrock", + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true + }, "anthropic.claude-3-5-sonnet-20240620-v1:0": { "input_cost_per_token": 3e-06, "litellm_provider": "bedrock", @@ -810,6 +848,25 @@ "supports_tool_choice": true, "supports_vision": true }, + "apac.anthropic.claude-haiku-4-5-20251001-v1:0": { + "cache_creation_input_token_cost": 1.25e-06, + "cache_read_input_token_cost": 1e-07, + "input_cost_per_token": 1e-06, + "litellm_provider": "bedrock", + "max_input_tokens": 200000, + "max_output_tokens": 8192, + "max_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 5e-06, + "source": "https://aws.amazon.com/about-aws/whats-new/2025/10/claude-4-5-haiku-anthropic-amazon-bedrock", + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true + }, "apac.anthropic.claude-3-sonnet-20240229-v1:0": { "input_cost_per_token": 3e-06, "litellm_provider": "bedrock", @@ -866,6 +923,36 @@ "mode": "audio_transcription", "output_cost_per_second": 0.0 }, + "au.anthropic.claude-sonnet-4-5-20250929-v1:0": { + "cache_creation_input_token_cost": 4.125e-06, + "cache_read_input_token_cost": 3.3e-07, + "input_cost_per_token": 3.3e-06, + "input_cost_per_token_above_200k_tokens": 6.6e-06, + "output_cost_per_token_above_200k_tokens": 2.475e-05, + "cache_creation_input_token_cost_above_200k_tokens": 8.25e-06, + "cache_read_input_token_cost_above_200k_tokens": 6.6e-07, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 200000, + "mode": "chat", + "output_cost_per_token": 1.65e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "azure/ada": { "input_cost_per_token": 1e-07, "litellm_provider": "azure", @@ -3164,6 +3251,42 @@ "supports_function_calling": true, "supports_vision": true }, + "azure_ai/Phi-4-mini-reasoning": { + "input_cost_per_token": 8e-08, + "litellm_provider": "azure_ai", + "max_input_tokens": 131072, + "max_output_tokens": 4096, + "max_tokens": 4096, + "mode": "chat", + "output_cost_per_token": 3.2e-07, + "source": "https://azure.microsoft.com/en-us/pricing/details/ai-foundry-models/microsoft/", + "supports_function_calling": true + }, + "azure_ai/Phi-4-reasoning": { + "input_cost_per_token": 1.25e-07, + "litellm_provider": "azure_ai", + "max_input_tokens": 32768, + "max_output_tokens": 4096, + "max_tokens": 4096, + "mode": "chat", + "output_cost_per_token": 5e-07, + "source": "https://azure.microsoft.com/en-us/pricing/details/ai-foundry-models/microsoft/", + "supports_function_calling": true, + "supports_tool_choice": true, + "supports_reasoning": true + }, + "azure_ai/MAI-DS-R1": { + "input_cost_per_token": 1.35e-06, + "litellm_provider": "azure_ai", + "max_input_tokens": 128000, + "max_output_tokens": 8192, + "max_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 5.4e-06, + "source": "https://azure.microsoft.com/en-us/pricing/details/ai-foundry-models/microsoft/", + "supports_reasoning": true, + "supports_tool_choice": true + }, "azure_ai/cohere-rerank-v3-english": { "input_cost_per_query": 0.002, "input_cost_per_token": 0.0, @@ -3324,28 +3447,27 @@ "supports_web_search": true }, "azure_ai/grok-4-fast-non-reasoning": { - "input_cost_per_token": 5e-06, + "input_cost_per_token": 0.43e-06, + "output_cost_per_token": 1.73e-06, "litellm_provider": "azure_ai", "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, "mode": "chat", - "output_cost_per_token": 2.5e-03, - "source": "https://azure.microsoft.com/en-us/blog/grok-4-is-now-available-in-azure-ai-foundry-unlock-frontier-intelligence-and-business-ready-capabilities/", "supports_function_calling": true, "supports_response_schema": true, "supports_tool_choice": true, "supports_web_search": true }, "azure_ai/grok-4-fast-reasoning": { - "input_cost_per_token": 5.8e-06, + "input_cost_per_token": 0.43e-06, + "output_cost_per_token": 1.73e-06, "litellm_provider": "azure_ai", "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, "mode": "chat", - "output_cost_per_token": 2.9e-03, - "source": "https://azure.microsoft.com/en-us/blog/grok-4-is-now-available-in-azure-ai-foundry-unlock-frontier-intelligence-and-business-ready-capabilities/", + "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", "supports_function_calling": true, "supports_reasoning": true, "supports_response_schema": true, @@ -4547,6 +4669,48 @@ "supports_web_search": true, "tool_use_system_prompt_tokens": 264 }, + "claude-haiku-4-5-20251001": { + "cache_creation_input_token_cost": 1.25e-06, + "cache_creation_input_token_cost_above_1hr": 2e-06, + "cache_read_input_token_cost": 1e-07, + "input_cost_per_token": 1e-06, + "litellm_provider": "anthropic", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 5e-06, + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_computer_use": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true + }, + "claude-haiku-4-5": { + "cache_creation_input_token_cost": 1.25e-06, + "cache_creation_input_token_cost_above_1hr": 2e-06, + "cache_read_input_token_cost": 1e-07, + "input_cost_per_token": 1e-06, + "litellm_provider": "anthropic", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 5e-06, + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_computer_use": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true + }, "claude-3-5-sonnet-20240620": { "cache_creation_input_token_cost": 3.75e-06, "cache_creation_input_token_cost_above_1hr": 6e-06, @@ -4776,7 +4940,7 @@ "input_cost_per_token_above_200k_tokens": 6e-06, "litellm_provider": "anthropic", "max_input_tokens": 1000000, - "max_output_tokens": 1000000, + "max_output_tokens": 64000, "max_tokens": 1000000, "mode": "chat", "output_cost_per_token": 1.5e-05, @@ -4801,6 +4965,10 @@ "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, "litellm_provider": "anthropic", "max_input_tokens": 200000, "max_output_tokens": 64000, @@ -4827,6 +4995,10 @@ "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, "litellm_provider": "anthropic", "max_input_tokens": 200000, "max_output_tokens": 64000, @@ -5287,6 +5459,16 @@ "output_cost_per_token": 0.0, "supports_embedding_image_input": true }, + "cohere.embed-v4:0": { + "input_cost_per_token": 1.2e-07, + "litellm_provider": "bedrock", + "max_input_tokens": 128000, + "max_tokens": 128000, + "mode": "embedding", + "output_cost_per_token": 0.0, + "output_vector_size": 1536, + "supports_embedding_image_input": true + }, "cohere.rerank-v3-5:0": { "input_cost_per_query": 0.002, "input_cost_per_token": 0.0, @@ -6685,629 +6867,679 @@ ] }, "deepinfra/Gryphe/MythoMax-L2-13b": { - "input_cost_per_token": 7.2e-08, - "litellm_provider": "deepinfra", + "max_tokens": 4096, "max_input_tokens": 4096, "max_output_tokens": 4096, - "max_tokens": 4096, + "input_cost_per_token": 8e-08, + "output_cost_per_token": 9e-08, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 7.2e-08, "supports_tool_choice": true }, "deepinfra/NousResearch/Hermes-3-Llama-3.1-405B": { - "input_cost_per_token": 7e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 1e-06, + "output_cost_per_token": 1e-06, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 8e-07, "supports_tool_choice": true }, "deepinfra/NousResearch/Hermes-3-Llama-3.1-70B": { - "input_cost_per_token": 1e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 3e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 2.8e-07, "supports_tool_choice": false }, "deepinfra/Qwen/QwQ-32B": { - "input_cost_per_token": 1.5e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 1.5e-07, "output_cost_per_token": 4e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/Qwen/Qwen2.5-72B-Instruct": { - "input_cost_per_token": 1.2e-07, - "litellm_provider": "deepinfra", + "max_tokens": 32768, "max_input_tokens": 32768, "max_output_tokens": 32768, - "max_tokens": 32768, - "mode": "chat", + "input_cost_per_token": 1.2e-07, "output_cost_per_token": 3.9e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/Qwen/Qwen2.5-7B-Instruct": { - "input_cost_per_token": 4e-08, - "litellm_provider": "deepinfra", + "max_tokens": 32768, "max_input_tokens": 32768, "max_output_tokens": 32768, - "max_tokens": 32768, - "mode": "chat", + "input_cost_per_token": 4e-08, "output_cost_per_token": 1e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": false }, "deepinfra/Qwen/Qwen2.5-VL-32B-Instruct": { - "input_cost_per_token": 2e-07, - "litellm_provider": "deepinfra", + "max_tokens": 128000, "max_input_tokens": 128000, "max_output_tokens": 128000, - "max_tokens": 128000, - "mode": "chat", + "input_cost_per_token": 2e-07, "output_cost_per_token": 6e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/Qwen/Qwen3-14B": { - "input_cost_per_token": 6e-08, - "litellm_provider": "deepinfra", + "max_tokens": 40960, "max_input_tokens": 40960, "max_output_tokens": 40960, - "max_tokens": 40960, - "mode": "chat", + "input_cost_per_token": 6e-08, "output_cost_per_token": 2.4e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/Qwen/Qwen3-235B-A22B": { - "input_cost_per_token": 1.3e-07, - "litellm_provider": "deepinfra", + "max_tokens": 40960, "max_input_tokens": 40960, "max_output_tokens": 40960, - "max_tokens": 40960, + "input_cost_per_token": 1.8e-07, + "output_cost_per_token": 5.4e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 6e-07, "supports_tool_choice": true }, "deepinfra/Qwen/Qwen3-235B-A22B-Instruct-2507": { - "input_cost_per_token": 1.3e-07, - "litellm_provider": "deepinfra", + "max_tokens": 262144, "max_input_tokens": 262144, "max_output_tokens": 262144, - "max_tokens": 262144, - "mode": "chat", + "input_cost_per_token": 9e-08, "output_cost_per_token": 6e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/Qwen/Qwen3-235B-A22B-Thinking-2507": { - "input_cost_per_token": 1.3e-07, - "litellm_provider": "deepinfra", + "max_tokens": 262144, "max_input_tokens": 262144, "max_output_tokens": 262144, - "max_tokens": 262144, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 2.9e-06, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 6e-07, "supports_tool_choice": true }, "deepinfra/Qwen/Qwen3-30B-A3B": { - "input_cost_per_token": 8e-08, - "litellm_provider": "deepinfra", + "max_tokens": 40960, "max_input_tokens": 40960, "max_output_tokens": 40960, - "max_tokens": 40960, - "mode": "chat", + "input_cost_per_token": 8e-08, "output_cost_per_token": 2.9e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/Qwen/Qwen3-32B": { - "input_cost_per_token": 1e-07, - "litellm_provider": "deepinfra", + "max_tokens": 40960, "max_input_tokens": 40960, "max_output_tokens": 40960, - "max_tokens": 40960, + "input_cost_per_token": 1e-07, + "output_cost_per_token": 2.8e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 3e-07, "supports_tool_choice": true }, "deepinfra/Qwen/Qwen3-Coder-480B-A35B-Instruct": { - "input_cost_per_token": 4e-07, - "litellm_provider": "deepinfra", + "max_tokens": 262144, "max_input_tokens": 262144, "max_output_tokens": 262144, - "max_tokens": 262144, - "mode": "chat", + "input_cost_per_token": 4e-07, "output_cost_per_token": 1.6e-06, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo": { - "cache_read_input_token_cost": 2.4e-07, - "input_cost_per_token": 3e-07, - "litellm_provider": "deepinfra", + "max_tokens": 262144, "max_input_tokens": 262144, "max_output_tokens": 262144, - "max_tokens": 262144, - "mode": "chat", + "input_cost_per_token": 2.9e-07, "output_cost_per_token": 1.2e-06, + "litellm_provider": "deepinfra", + "mode": "chat", + "supports_tool_choice": true + }, + "deepinfra/Qwen/Qwen3-Next-80B-A3B-Instruct": { + "max_tokens": 262144, + "max_input_tokens": 262144, + "max_output_tokens": 262144, + "input_cost_per_token": 1.4e-07, + "output_cost_per_token": 1.4e-06, + "litellm_provider": "deepinfra", + "mode": "chat", + "supports_tool_choice": true + }, + "deepinfra/Qwen/Qwen3-Next-80B-A3B-Thinking": { + "max_tokens": 262144, + "max_input_tokens": 262144, + "max_output_tokens": 262144, + "input_cost_per_token": 1.4e-07, + "output_cost_per_token": 1.4e-06, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/Sao10K/L3-8B-Lunaris-v1-Turbo": { - "input_cost_per_token": 2e-08, - "litellm_provider": "deepinfra", + "max_tokens": 8192, "max_input_tokens": 8192, "max_output_tokens": 8192, - "max_tokens": 8192, - "mode": "chat", + "input_cost_per_token": 4e-08, "output_cost_per_token": 5e-08, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": false }, "deepinfra/Sao10K/L3.1-70B-Euryale-v2.2": { - "input_cost_per_token": 6.5e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 6.5e-07, "output_cost_per_token": 7.5e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": false }, "deepinfra/Sao10K/L3.3-70B-Euryale-v2.3": { - "input_cost_per_token": 6.5e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 6.5e-07, "output_cost_per_token": 7.5e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": false }, "deepinfra/allenai/olmOCR-7B-0725-FP8": { - "input_cost_per_token": 2.7e-07, - "litellm_provider": "deepinfra", + "max_tokens": 16384, "max_input_tokens": 16384, "max_output_tokens": 16384, - "max_tokens": 16384, - "mode": "chat", + "input_cost_per_token": 2.7e-07, "output_cost_per_token": 1.5e-06, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": false }, "deepinfra/anthropic/claude-3-7-sonnet-latest": { - "cache_read_input_token_cost": 3.3e-07, - "input_cost_per_token": 3.3e-06, - "litellm_provider": "deepinfra", + "max_tokens": 200000, "max_input_tokens": 200000, "max_output_tokens": 200000, - "max_tokens": 200000, - "mode": "chat", + "input_cost_per_token": 3.3e-06, "output_cost_per_token": 1.65e-05, + "cache_read_input_token_cost": 3.3e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/anthropic/claude-4-opus": { - "input_cost_per_token": 1.65e-05, - "litellm_provider": "deepinfra", + "max_tokens": 200000, "max_input_tokens": 200000, "max_output_tokens": 200000, - "max_tokens": 200000, - "mode": "chat", + "input_cost_per_token": 1.65e-05, "output_cost_per_token": 8.25e-05, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/anthropic/claude-4-sonnet": { - "input_cost_per_token": 3.3e-06, - "litellm_provider": "deepinfra", + "max_tokens": 200000, "max_input_tokens": 200000, "max_output_tokens": 200000, - "max_tokens": 200000, - "mode": "chat", + "input_cost_per_token": 3.3e-06, "output_cost_per_token": 1.65e-05, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/deepseek-ai/DeepSeek-R1": { - "input_cost_per_token": 7e-07, - "litellm_provider": "deepinfra", + "max_tokens": 163840, "max_input_tokens": 163840, "max_output_tokens": 163840, - "max_tokens": 163840, - "mode": "chat", + "input_cost_per_token": 7e-07, "output_cost_per_token": 2.4e-06, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/deepseek-ai/DeepSeek-R1-0528": { - "cache_read_input_token_cost": 4e-07, - "input_cost_per_token": 5e-07, - "litellm_provider": "deepinfra", + "max_tokens": 163840, "max_input_tokens": 163840, "max_output_tokens": 163840, - "max_tokens": 163840, - "mode": "chat", + "input_cost_per_token": 5e-07, "output_cost_per_token": 2.15e-06, + "cache_read_input_token_cost": 4e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/deepseek-ai/DeepSeek-R1-0528-Turbo": { - "input_cost_per_token": 1e-06, - "litellm_provider": "deepinfra", + "max_tokens": 32768, "max_input_tokens": 32768, "max_output_tokens": 32768, - "max_tokens": 32768, - "mode": "chat", + "input_cost_per_token": 1e-06, "output_cost_per_token": 3e-06, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/deepseek-ai/DeepSeek-R1-Distill-Llama-70B": { - "input_cost_per_token": 1e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 2e-07, + "output_cost_per_token": 6e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 4e-07, "supports_tool_choice": false }, "deepinfra/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B": { - "input_cost_per_token": 7.5e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 2.7e-07, + "output_cost_per_token": 2.7e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 1.5e-07, "supports_tool_choice": true }, "deepinfra/deepseek-ai/DeepSeek-R1-Turbo": { - "input_cost_per_token": 1e-06, - "litellm_provider": "deepinfra", + "max_tokens": 40960, "max_input_tokens": 40960, "max_output_tokens": 40960, - "max_tokens": 40960, - "mode": "chat", + "input_cost_per_token": 1e-06, "output_cost_per_token": 3e-06, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/deepseek-ai/DeepSeek-V3": { - "input_cost_per_token": 3.8e-07, - "litellm_provider": "deepinfra", + "max_tokens": 163840, "max_input_tokens": 163840, "max_output_tokens": 163840, - "max_tokens": 163840, - "mode": "chat", + "input_cost_per_token": 3.8e-07, "output_cost_per_token": 8.9e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/deepseek-ai/DeepSeek-V3-0324": { - "cache_read_input_token_cost": 2.24e-07, - "input_cost_per_token": 2.8e-07, - "litellm_provider": "deepinfra", + "max_tokens": 163840, "max_input_tokens": 163840, "max_output_tokens": 163840, - "max_tokens": 163840, - "mode": "chat", + "input_cost_per_token": 2.5e-07, "output_cost_per_token": 8.8e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/deepseek-ai/DeepSeek-V3.1": { - "cache_read_input_token_cost": 2.16e-07, - "input_cost_per_token": 2.7e-07, - "litellm_provider": "deepinfra", + "max_tokens": 163840, "max_input_tokens": 163840, "max_output_tokens": 163840, - "max_tokens": 163840, - "mode": "chat", + "input_cost_per_token": 2.7e-07, "output_cost_per_token": 1e-06, - "supports_reasoning": true, + "cache_read_input_token_cost": 2.16e-07, + "litellm_provider": "deepinfra", + "mode": "chat", + "supports_tool_choice": true, + "supports_reasoning": true + }, + "deepinfra/deepseek-ai/DeepSeek-V3.1-Terminus": { + "max_tokens": 163840, + "max_input_tokens": 163840, + "max_output_tokens": 163840, + "input_cost_per_token": 2.7e-07, + "output_cost_per_token": 1e-06, + "cache_read_input_token_cost": 2.16e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/google/gemini-2.0-flash-001": { - "input_cost_per_token": 1e-07, - "litellm_provider": "deepinfra", + "max_tokens": 1000000, "max_input_tokens": 1000000, "max_output_tokens": 1000000, - "max_tokens": 1000000, - "mode": "chat", + "input_cost_per_token": 1e-07, "output_cost_per_token": 4e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/google/gemini-2.5-flash": { - "input_cost_per_token": 2.1e-07, - "litellm_provider": "deepinfra", + "max_tokens": 1000000, "max_input_tokens": 1000000, "max_output_tokens": 1000000, - "max_tokens": 1000000, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 2.5e-06, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 1.75e-06, "supports_tool_choice": true }, "deepinfra/google/gemini-2.5-pro": { - "input_cost_per_token": 8.75e-07, - "litellm_provider": "deepinfra", + "max_tokens": 1000000, "max_input_tokens": 1000000, "max_output_tokens": 1000000, - "max_tokens": 1000000, + "input_cost_per_token": 1.25e-06, + "output_cost_per_token": 1e-05, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 7e-06, "supports_tool_choice": true }, "deepinfra/google/gemma-3-12b-it": { - "input_cost_per_token": 5e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 5e-08, "output_cost_per_token": 1e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/google/gemma-3-27b-it": { - "input_cost_per_token": 9e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 9e-08, + "output_cost_per_token": 1.6e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 1.7e-07, "supports_tool_choice": true }, "deepinfra/google/gemma-3-4b-it": { - "input_cost_per_token": 4e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 4e-08, "output_cost_per_token": 8e-08, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/meta-llama/Llama-3.2-11B-Vision-Instruct": { - "input_cost_per_token": 4.9e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 4.9e-08, "output_cost_per_token": 4.9e-08, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": false }, "deepinfra/meta-llama/Llama-3.2-3B-Instruct": { - "input_cost_per_token": 1.2e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 2e-08, + "output_cost_per_token": 2e-08, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 2.4e-08, "supports_tool_choice": true }, "deepinfra/meta-llama/Llama-3.3-70B-Instruct": { - "input_cost_per_token": 2.3e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 2.3e-07, "output_cost_per_token": 4e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/meta-llama/Llama-3.3-70B-Instruct-Turbo": { - "input_cost_per_token": 3.8e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 1.3e-07, + "output_cost_per_token": 3.9e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 1.2e-07, "supports_tool_choice": true }, "deepinfra/meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8": { - "input_cost_per_token": 1.5e-07, - "litellm_provider": "deepinfra", + "max_tokens": 1048576, "max_input_tokens": 1048576, "max_output_tokens": 1048576, - "max_tokens": 1048576, - "mode": "chat", + "input_cost_per_token": 1.5e-07, "output_cost_per_token": 6e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/meta-llama/Llama-4-Scout-17B-16E-Instruct": { - "input_cost_per_token": 8e-08, - "litellm_provider": "deepinfra", + "max_tokens": 327680, "max_input_tokens": 327680, "max_output_tokens": 327680, - "max_tokens": 327680, - "mode": "chat", + "input_cost_per_token": 8e-08, "output_cost_per_token": 3e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/meta-llama/Llama-Guard-3-8B": { - "input_cost_per_token": 5.5e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 5.5e-08, "output_cost_per_token": 5.5e-08, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": false }, "deepinfra/meta-llama/Llama-Guard-4-12B": { - "input_cost_per_token": 1.8e-07, - "litellm_provider": "deepinfra", + "max_tokens": 163840, "max_input_tokens": 163840, "max_output_tokens": 163840, - "max_tokens": 163840, - "mode": "chat", + "input_cost_per_token": 1.8e-07, "output_cost_per_token": 1.8e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": false }, "deepinfra/meta-llama/Meta-Llama-3-8B-Instruct": { - "input_cost_per_token": 3e-08, - "litellm_provider": "deepinfra", + "max_tokens": 8192, "max_input_tokens": 8192, "max_output_tokens": 8192, - "max_tokens": 8192, - "mode": "chat", + "input_cost_per_token": 3e-08, "output_cost_per_token": 6e-08, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/meta-llama/Meta-Llama-3.1-70B-Instruct": { - "input_cost_per_token": 2.3e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 4e-07, "output_cost_per_token": 4e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo": { - "input_cost_per_token": 1e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 1e-07, "output_cost_per_token": 2.8e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/meta-llama/Meta-Llama-3.1-8B-Instruct": { - "input_cost_per_token": 3e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 3e-08, "output_cost_per_token": 5e-08, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo": { - "input_cost_per_token": 1.5e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 2e-08, + "output_cost_per_token": 3e-08, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 2e-08, "supports_tool_choice": true }, "deepinfra/microsoft/WizardLM-2-8x22B": { - "input_cost_per_token": 4.8e-07, - "litellm_provider": "deepinfra", + "max_tokens": 65536, "max_input_tokens": 65536, "max_output_tokens": 65536, - "max_tokens": 65536, - "mode": "chat", + "input_cost_per_token": 4.8e-07, "output_cost_per_token": 4.8e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": false }, "deepinfra/microsoft/phi-4": { - "input_cost_per_token": 7e-08, - "litellm_provider": "deepinfra", + "max_tokens": 16384, "max_input_tokens": 16384, "max_output_tokens": 16384, - "max_tokens": 16384, - "mode": "chat", + "input_cost_per_token": 7e-08, "output_cost_per_token": 1.4e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/mistralai/Mistral-Nemo-Instruct-2407": { - "input_cost_per_token": 2e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 2e-08, "output_cost_per_token": 4e-08, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/mistralai/Mistral-Small-24B-Instruct-2501": { - "input_cost_per_token": 5e-08, - "litellm_provider": "deepinfra", + "max_tokens": 32768, "max_input_tokens": 32768, "max_output_tokens": 32768, - "max_tokens": 32768, - "mode": "chat", + "input_cost_per_token": 5e-08, "output_cost_per_token": 8e-08, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/mistralai/Mistral-Small-3.2-24B-Instruct-2506": { - "input_cost_per_token": 5e-08, - "litellm_provider": "deepinfra", + "max_tokens": 128000, "max_input_tokens": 128000, "max_output_tokens": 128000, - "max_tokens": 128000, + "input_cost_per_token": 7.5e-08, + "output_cost_per_token": 2e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 1e-07, "supports_tool_choice": true }, "deepinfra/mistralai/Mixtral-8x7B-Instruct-v0.1": { - "input_cost_per_token": 8e-08, - "litellm_provider": "deepinfra", + "max_tokens": 32768, "max_input_tokens": 32768, "max_output_tokens": 32768, - "max_tokens": 32768, + "input_cost_per_token": 4e-07, + "output_cost_per_token": 4e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 2.4e-07, "supports_tool_choice": true }, "deepinfra/moonshotai/Kimi-K2-Instruct": { - "input_cost_per_token": 5e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 5e-07, "output_cost_per_token": 2e-06, + "litellm_provider": "deepinfra", + "mode": "chat", + "supports_tool_choice": true + }, + "deepinfra/moonshotai/Kimi-K2-Instruct-0905": { + "max_tokens": 262144, + "max_input_tokens": 262144, + "max_output_tokens": 262144, + "input_cost_per_token": 5e-07, + "output_cost_per_token": 2e-06, + "cache_read_input_token_cost": 4e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/nvidia/Llama-3.1-Nemotron-70B-Instruct": { - "input_cost_per_token": 1.2e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 6e-07, + "output_cost_per_token": 6e-07, + "litellm_provider": "deepinfra", + "mode": "chat", + "supports_tool_choice": true + }, + "deepinfra/nvidia/Llama-3.3-Nemotron-Super-49B-v1.5": { + "max_tokens": 131072, + "max_input_tokens": 131072, + "max_output_tokens": 131072, + "input_cost_per_token": 1e-07, + "output_cost_per_token": 4e-07, + "litellm_provider": "deepinfra", + "mode": "chat", + "supports_tool_choice": true + }, + "deepinfra/nvidia/NVIDIA-Nemotron-Nano-9B-v2": { + "max_tokens": 131072, + "max_input_tokens": 131072, + "max_output_tokens": 131072, + "input_cost_per_token": 4e-08, + "output_cost_per_token": 1.6e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 3e-07, "supports_tool_choice": true }, "deepinfra/openai/gpt-oss-120b": { - "input_cost_per_token": 9e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", + "input_cost_per_token": 5e-08, "output_cost_per_token": 4.5e-07, + "litellm_provider": "deepinfra", + "mode": "chat", "supports_tool_choice": true }, "deepinfra/openai/gpt-oss-20b": { - "input_cost_per_token": 4e-08, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, + "input_cost_per_token": 4e-08, + "output_cost_per_token": 1.5e-07, + "litellm_provider": "deepinfra", "mode": "chat", - "output_cost_per_token": 1.6e-07, "supports_tool_choice": true }, "deepinfra/zai-org/GLM-4.5": { - "input_cost_per_token": 5.5e-07, - "litellm_provider": "deepinfra", + "max_tokens": 131072, "max_input_tokens": 131072, "max_output_tokens": 131072, - "max_tokens": 131072, - "mode": "chat", - "output_cost_per_token": 2e-06, - "supports_tool_choice": true - }, - "deepinfra/zai-org/GLM-4.5-Air": { - "input_cost_per_token": 2e-07, + "input_cost_per_token": 4e-07, + "output_cost_per_token": 1.6e-06, "litellm_provider": "deepinfra", - "max_input_tokens": 131072, - "max_output_tokens": 131072, - "max_tokens": 131072, "mode": "chat", - "output_cost_per_token": 1.1e-06, "supports_tool_choice": true }, "deepseek/deepseek-chat": { @@ -7608,6 +7840,25 @@ "supports_response_schema": true, "supports_tool_choice": true }, + "eu.anthropic.claude-haiku-4-5-20251001-v1:0": { + "cache_creation_input_token_cost": 1.25e-06, + "cache_read_input_token_cost": 1e-07, + "input_cost_per_token": 1e-06, + "litellm_provider": "bedrock", + "max_input_tokens": 200000, + "max_output_tokens": 8192, + "max_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 5e-06, + "source": "https://aws.amazon.com/about-aws/whats-new/2025/10/claude-4-5-haiku-anthropic-amazon-bedrock", + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true + }, "eu.anthropic.claude-3-5-sonnet-20240620-v1:0": { "input_cost_per_token": 3e-06, "litellm_provider": "bedrock", @@ -7780,6 +8031,36 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 159 }, + "eu.anthropic.claude-sonnet-4-5-20250929-v1:0": { + "cache_creation_input_token_cost": 4.125e-06, + "cache_read_input_token_cost": 3.3e-07, + "input_cost_per_token": 3.3e-06, + "input_cost_per_token_above_200k_tokens": 6.6e-06, + "output_cost_per_token_above_200k_tokens": 2.475e-05, + "cache_creation_input_token_cost_above_200k_tokens": 8.25e-06, + "cache_read_input_token_cost_above_200k_tokens": 6.6e-07, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 200000, + "mode": "chat", + "output_cost_per_token": 1.65e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "eu.meta.llama3-2-1b-instruct-v1:0": { "input_cost_per_token": 1.3e-07, "litellm_provider": "bedrock", @@ -11733,6 +12014,66 @@ "video" ] }, + "global.anthropic.claude-sonnet-4-5-20250929-v1:0": { + "cache_creation_input_token_cost": 3.75e-06, + "cache_read_input_token_cost": 3e-07, + "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 200000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, + "global.anthropic.claude-sonnet-4-20250514-v1:0": { + "cache_creation_input_token_cost": 3.75e-06, + "cache_read_input_token_cost": 3e-07, + "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 1000000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 159 + }, "gpt-3.5-turbo": { "input_cost_per_token": 0.5e-06, "litellm_provider": "openai", @@ -12785,16 +13126,18 @@ "supports_tool_choice": true, "supports_vision": true }, - "gpt-5-codex": { - "cache_read_input_token_cost": 1.25e-07, - "input_cost_per_token": 1.25e-06, + "gpt-5-pro": { + "input_cost_per_token": 1.5e-05, + "input_cost_per_token_batches": 7.5e-06, "litellm_provider": "openai", "max_input_tokens": 400000, - "max_output_tokens": 128000, - "max_tokens": 128000, - "mode": "chat", - "output_cost_per_token": 1e-05, + "max_output_tokens": 272000, + "max_tokens": 272000, + "mode": "responses", + "output_cost_per_token": 1.2e-04, + "output_cost_per_token_batches": 6e-05, "supported_endpoints": [ + "/v1/batch", "/v1/responses" ], "supported_modalities": [ @@ -12805,13 +13148,49 @@ "text" ], "supports_function_calling": true, - "supports_native_streaming": true, + "supports_native_streaming": false, "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_tool_choice": true, + "supports_vision": true, + "supports_web_search": true + }, + "gpt-5-pro-2025-10-06": { + "input_cost_per_token": 1.5e-05, + "input_cost_per_token_batches": 7.5e-06, + "litellm_provider": "openai", + "max_input_tokens": 400000, + "max_output_tokens": 272000, + "max_tokens": 272000, + "mode": "responses", + "output_cost_per_token": 1.2e-04, + "output_cost_per_token_batches": 6e-05, + "supported_endpoints": [ + "/v1/batch", + "/v1/responses" + ], + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_function_calling": true, + "supports_native_streaming": false, + "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, + "supports_web_search": true }, "gpt-5-2025-08-07": { "cache_read_input_token_cost": 1.25e-07, @@ -13102,6 +13481,19 @@ "/v1/images/generations" ] }, + "gpt-image-1-mini": { + "cache_read_input_image_token_cost": 2.5e-07, + "cache_read_input_token_cost": 2e-07, + "input_cost_per_image_token": 2.5e-06, + "input_cost_per_token": 2e-06, + "litellm_provider": "openai", + "mode": "chat", + "output_cost_per_image_token": 8e-06, + "supported_endpoints": [ + "/v1/images/generations", + "/v1/images/edits" + ] + }, "gpt-realtime": { "cache_creation_input_audio_token_cost": 4e-07, "cache_read_input_token_cost": 4e-07, @@ -13134,6 +13526,37 @@ "supports_system_messages": true, "supports_tool_choice": true }, + "gpt-realtime-mini": { + "cache_creation_input_audio_token_cost": 3e-07, + "cache_read_input_audio_token_cost": 3e-07, + "input_cost_per_audio_token": 1e-05, + "input_cost_per_token": 6e-07, + "litellm_provider": "openai", + "max_input_tokens": 128000, + "max_output_tokens": 4096, + "max_tokens": 4096, + "mode": "chat", + "output_cost_per_audio_token": 2e-05, + "output_cost_per_token": 2.4e-06, + "supported_endpoints": [ + "/v1/realtime" + ], + "supported_modalities": [ + "text", + "image", + "audio" + ], + "supported_output_modalities": [ + "text", + "audio" + ], + "supports_audio_input": true, + "supports_audio_output": true, + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_system_messages": true, + "supports_tool_choice": true + }, "gpt-realtime-2025-08-28": { "cache_creation_input_audio_token_cost": 4e-07, "cache_read_input_token_cost": 4e-07, @@ -14131,6 +14554,55 @@ "mode": "rerank", "output_cost_per_token": 1.8e-08 }, + "jp.anthropic.claude-sonnet-4-5-20250929-v1:0": { + "cache_creation_input_token_cost": 4.125e-06, + "cache_read_input_token_cost": 3.3e-07, + "input_cost_per_token": 3.3e-06, + "input_cost_per_token_above_200k_tokens": 6.6e-06, + "output_cost_per_token_above_200k_tokens": 2.475e-05, + "cache_creation_input_token_cost_above_200k_tokens": 8.25e-06, + "cache_read_input_token_cost_above_200k_tokens": 6.6e-07, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 200000, + "mode": "chat", + "output_cost_per_token": 1.65e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, + "jp.anthropic.claude-haiku-4-5-20251001-v1:0": { + "cache_creation_input_token_cost": 1.25e-06, + "cache_read_input_token_cost": 1e-07, + "input_cost_per_token": 1e-06, + "litellm_provider": "bedrock", + "max_input_tokens": 200000, + "max_output_tokens": 8192, + "max_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 5e-06, + "source": "https://aws.amazon.com/about-aws/whats-new/2025/10/claude-4-5-haiku-anthropic-amazon-bedrock", + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true + }, "lambda_ai/deepseek-llama3.3-70b": { "input_cost_per_token": 2e-07, "litellm_provider": "lambda_ai", @@ -14506,6 +14978,54 @@ "/v1/images/generations" ] }, + "low/1024-x-1024/gpt-image-1-mini": { + "input_cost_per_image": 0.005, + "litellm_provider": "openai", + "mode": "image_generation", + "supported_endpoints": [ + "/v1/images/generations" + ] + }, + "low/1024-x-1536/gpt-image-1-mini": { + "input_cost_per_image": 0.006, + "litellm_provider": "openai", + "mode": "image_generation", + "supported_endpoints": [ + "/v1/images/generations" + ] + }, + "low/1536-x-1024/gpt-image-1-mini": { + "input_cost_per_image": 0.006, + "litellm_provider": "openai", + "mode": "image_generation", + "supported_endpoints": [ + "/v1/images/generations" + ] + }, + "medium/1024-x-1024/gpt-image-1-mini": { + "input_cost_per_image": 0.011, + "litellm_provider": "openai", + "mode": "image_generation", + "supported_endpoints": [ + "/v1/images/generations" + ] + }, + "medium/1024-x-1536/gpt-image-1-mini": { + "input_cost_per_image": 0.015, + "litellm_provider": "openai", + "mode": "image_generation", + "supported_endpoints": [ + "/v1/images/generations" + ] + }, + "medium/1536-x-1024/gpt-image-1-mini": { + "input_cost_per_image": 0.015, + "litellm_provider": "openai", + "mode": "image_generation", + "supported_endpoints": [ + "/v1/images/generations" + ] + }, "medlm-large": { "input_cost_per_character": 5e-06, "litellm_provider": "vertex_ai-language-models", @@ -16252,6 +16772,42 @@ "supports_function_calling": true, "supports_response_schema": false }, + "oci/cohere.command-latest": { + "input_cost_per_token": 1.56e-06, + "litellm_provider": "oci", + "max_input_tokens": 128000, + "max_output_tokens": 4000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 1.56e-06, + "source": "https://www.oracle.com/cloud/ai/generative-ai/pricing/", + "supports_function_calling": true, + "supports_response_schema": false + }, + "oci/cohere.command-a-03-2025": { + "input_cost_per_token": 1.56e-06, + "litellm_provider": "oci", + "max_input_tokens": 256000, + "max_output_tokens": 4000, + "max_tokens": 256000, + "mode": "chat", + "output_cost_per_token": 1.56e-06, + "source": "https://www.oracle.com/cloud/ai/generative-ai/pricing/", + "supports_function_calling": true, + "supports_response_schema": false + }, + "oci/cohere.command-plus-latest": { + "input_cost_per_token": 1.56e-06, + "litellm_provider": "oci", + "max_input_tokens": 128000, + "max_output_tokens": 4000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 1.56e-06, + "source": "https://www.oracle.com/cloud/ai/generative-ai/pricing/", + "supports_function_calling": true, + "supports_response_schema": false + }, "ollama/codegeex4": { "input_cost_per_token": 0.0, "litellm_provider": "ollama", @@ -16785,6 +17341,25 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 159 }, + "openrouter/anthropic/claude-sonnet-4.5": { + "input_cost_per_image": 0.0048, + "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 1000000, + "max_tokens": 1000000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_reasoning": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 159 + }, "openrouter/bytedance/ui-tars-1.5-7b": { "input_cost_per_token": 1e-07, "litellm_provider": "openrouter", @@ -18405,6 +18980,20 @@ "mode": "rerank", "output_cost_per_token": 0.0 }, + "nvidia_nim/nvidia/nv-rerankqa-mistral-4b-v3": { + "input_cost_per_query": 0.0, + "input_cost_per_token": 0.0, + "litellm_provider": "nvidia_nim", + "mode": "rerank", + "output_cost_per_token": 0.0 + }, + "nvidia_nim/nvidia/llama-3_2-nv-rerankqa-1b-v2": { + "input_cost_per_query": 0.0, + "input_cost_per_token": 0.0, + "litellm_provider": "nvidia_nim", + "mode": "rerank", + "output_cost_per_token": 0.0 + }, "sagemaker/meta-textgeneration-llama-2-13b": { "input_cost_per_token": 0.0, "litellm_provider": "sagemaker", @@ -19249,6 +19838,22 @@ "mode": "embedding", "output_cost_per_token": 0.0 }, + "together_ai/baai/bge-base-en-v1.5": { + "input_cost_per_token": 8e-09, + "litellm_provider": "together_ai", + "max_input_tokens": 512, + "mode": "embedding", + "output_cost_per_token": 0.0, + "output_vector_size": 768 + }, + "together_ai/BAAI/bge-base-en-v1.5": { + "input_cost_per_token": 8e-09, + "litellm_provider": "together_ai", + "max_input_tokens": 512, + "mode": "embedding", + "output_cost_per_token": 0.0, + "output_vector_size": 768 + }, "together-ai-up-to-4b": { "input_cost_per_token": 1e-07, "litellm_provider": "together_ai", @@ -19509,6 +20114,39 @@ "supports_parallel_function_calling": true, "supports_tool_choice": true }, + "together_ai/moonshotai/Kimi-K2-Instruct-0905": { + "input_cost_per_token": 1e-06, + "litellm_provider": "together_ai", + "max_input_tokens": 262144, + "mode": "chat", + "output_cost_per_token": 3e-06, + "source": "https://www.together.ai/models/kimi-k2-0905", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_tool_choice": true + }, + "together_ai/Qwen/Qwen3-Next-80B-A3B-Instruct": { + "input_cost_per_token": 1.5e-07, + "litellm_provider": "together_ai", + "max_input_tokens": 262144, + "mode": "chat", + "output_cost_per_token": 1.5e-06, + "source": "https://www.together.ai/models/qwen3-next-80b-a3b-instruct", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_tool_choice": true + }, + "together_ai/Qwen/Qwen3-Next-80B-A3B-Thinking": { + "input_cost_per_token": 1.5e-07, + "litellm_provider": "together_ai", + "max_input_tokens": 262144, + "mode": "chat", + "output_cost_per_token": 1.5e-06, + "source": "https://www.together.ai/models/qwen3-next-80b-a3b-thinking", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_tool_choice": true + }, "tts-1": { "input_cost_per_character": 1.5e-05, "litellm_provider": "openai", @@ -19596,6 +20234,25 @@ "supports_response_schema": true, "supports_tool_choice": true }, + "us.anthropic.claude-haiku-4-5-20251001-v1:0": { + "cache_creation_input_token_cost": 1.25e-06, + "cache_read_input_token_cost": 1e-07, + "input_cost_per_token": 1e-06, + "litellm_provider": "bedrock", + "max_input_tokens": 200000, + "max_output_tokens": 8192, + "max_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 5e-06, + "source": "https://aws.amazon.com/about-aws/whats-new/2025/10/claude-4-5-haiku-anthropic-amazon-bedrock", + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true + }, "us.anthropic.claude-3-5-sonnet-20240620-v1:0": { "input_cost_per_token": 3e-06, "litellm_provider": "bedrock", @@ -19717,15 +20374,19 @@ "tool_use_system_prompt_tokens": 159 }, "us.anthropic.claude-sonnet-4-5-20250929-v1:0": { - "cache_creation_input_token_cost": 3.75e-06, - "cache_read_input_token_cost": 3e-07, - "input_cost_per_token": 3e-06, + "cache_creation_input_token_cost": 4.125e-06, + "cache_read_input_token_cost": 3.3e-07, + "input_cost_per_token": 3.3e-06, + "input_cost_per_token_above_200k_tokens": 6.6e-06, + "output_cost_per_token_above_200k_tokens": 2.475e-05, + "cache_creation_input_token_cost_above_200k_tokens": 8.25e-06, + "cache_read_input_token_cost_above_200k_tokens": 6.6e-07, "litellm_provider": "bedrock_converse", "max_input_tokens": 200000, "max_output_tokens": 64000, "max_tokens": 200000, "mode": "chat", - "output_cost_per_token": 1.5e-05, + "output_cost_per_token": 1.65e-05, "search_context_cost_per_query": { "search_context_size_high": 0.01, "search_context_size_low": 0.01, @@ -20863,6 +21524,25 @@ "supports_pdf_input": true, "supports_tool_choice": true }, + "vertex_ai/claude-haiku-4-5@20251001": { + "cache_creation_input_token_cost": 1.25e-06, + "cache_read_input_token_cost": 1e-07, + "input_cost_per_token": 1e-06, + "litellm_provider": "vertex_ai-anthropic_models", + "max_input_tokens": 200000, + "max_output_tokens": 8192, + "max_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 5e-06, + "source": "https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude/haiku-4-5", + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true + }, "vertex_ai/claude-3-5-sonnet": { "input_cost_per_token": 3e-06, "litellm_provider": "vertex_ai-anthropic_models", @@ -21086,6 +21766,10 @@ "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, "input_cost_per_token_batches": 1.5e-06, "litellm_provider": "vertex_ai-anthropic_models", "max_input_tokens": 200000, @@ -21108,6 +21792,10 @@ "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, "input_cost_per_token_batches": 1.5e-06, "litellm_provider": "vertex_ai-anthropic_models", "max_input_tokens": 200000, @@ -22030,6 +22718,307 @@ "supports_tool_choice": true, "supports_vision": false }, + "watsonx/bigscience/mt0-xxl-13b": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.0005, + "output_cost_per_token": 0.002, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/core42/jais-13b-chat": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.0005, + "output_cost_per_token": 0.002, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/google/flan-t5-xl-3b": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.0001, + "output_cost_per_token": 0.00025, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/ibm/granite-13b-chat-v2": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.0005, + "output_cost_per_token": 0.002, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/ibm/granite-13b-instruct-v2": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.0005, + "output_cost_per_token": 0.002, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/ibm/granite-3-3-8b-instruct": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.00025, + "output_cost_per_token": 0.001, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": false + }, + "watsonx/ibm/granite-4-h-small": { + "max_tokens": 20480, + "max_input_tokens": 20480, + "max_output_tokens": 20480, + "input_cost_per_token": 0.000625, + "output_cost_per_token": 0.0025, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": false + }, + "watsonx/ibm/granite-guardian-3-2-2b": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.00015, + "output_cost_per_token": 0.0006, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/ibm/granite-guardian-3-3-8b": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.00025, + "output_cost_per_token": 0.001, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/ibm/granite-ttm-1024-96-r2": { + "max_tokens": 512, + "max_input_tokens": 512, + "max_output_tokens": 512, + "input_cost_per_token": 0.000625, + "output_cost_per_token": 0.000625, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/ibm/granite-ttm-1536-96-r2": { + "max_tokens": 512, + "max_input_tokens": 512, + "max_output_tokens": 512, + "input_cost_per_token": 0.000625, + "output_cost_per_token": 0.000625, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/ibm/granite-ttm-512-96-r2": { + "max_tokens": 512, + "max_input_tokens": 512, + "max_output_tokens": 512, + "input_cost_per_token": 0.000625, + "output_cost_per_token": 0.000625, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/ibm/granite-vision-3-2-2b": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.00015, + "output_cost_per_token": 0.0006, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": true + }, + "watsonx/meta-llama/llama-3-2-11b-vision-instruct": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 0.00025, + "output_cost_per_token": 0.001, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": true + }, + "watsonx/meta-llama/llama-3-2-1b-instruct": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 0.0001, + "output_cost_per_token": 0.0002, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": false + }, + "watsonx/meta-llama/llama-3-2-3b-instruct": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 0.00015, + "output_cost_per_token": 0.0006, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": false + }, + "watsonx/meta-llama/llama-3-2-90b-vision-instruct": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 0.002, + "output_cost_per_token": 0.008, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": true + }, + "watsonx/meta-llama/llama-3-3-70b-instruct": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 0.002, + "output_cost_per_token": 0.006, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": false + }, + "watsonx/meta-llama/llama-4-maverick-17b": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 0.0005, + "output_cost_per_token": 0.002, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": false + }, + "watsonx/meta-llama/llama-guard-3-11b-vision": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 0.00025, + "output_cost_per_token": 0.001, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": true + }, + "watsonx/mistralai/mistral-medium-2505": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 0.00225, + "output_cost_per_token": 0.00675, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": false + }, + "watsonx/mistralai/mistral-small-2503": { + "max_tokens": 32000, + "max_input_tokens": 32000, + "max_output_tokens": 32000, + "input_cost_per_token": 0.0002, + "output_cost_per_token": 0.0006, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_vision": false + }, + "watsonx/mistralai/pixtral-12b-2409": { + "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "input_cost_per_token": 0.00015, + "output_cost_per_token": 0.00015, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": true + }, + "watsonx/openai/gpt-oss-120b": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.004, + "output_cost_per_token": 0.016, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "watsonx/sdaia/allam-1-13b-instruct": { + "max_tokens": 8192, + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "input_cost_per_token": 0.0005, + "output_cost_per_token": 0.002, + "litellm_provider": "watsonx", + "mode": "chat", + "supports_function_calling": false, + "supports_parallel_function_calling": false, + "supports_vision": false + }, + "whisper-1": { "input_cost_per_second": 0.0001, "litellm_provider": "openai", diff --git a/litellm/ocr/__init__.py b/litellm/ocr/__init__.py new file mode 100644 index 00000000000..53f455619d7 --- /dev/null +++ b/litellm/ocr/__init__.py @@ -0,0 +1,5 @@ +"""OCR module for LiteLLM.""" +from .main import aocr, ocr + +__all__ = ["ocr", "aocr"] + diff --git a/litellm/ocr/main.py b/litellm/ocr/main.py new file mode 100644 index 00000000000..62172b0fbae --- /dev/null +++ b/litellm/ocr/main.py @@ -0,0 +1,301 @@ +""" +Main OCR function for LiteLLM. +""" +import asyncio +import contextvars +from functools import partial +from typing import Any, Coroutine, Dict, Optional, Union + +import httpx + +import litellm +from litellm._logging import verbose_logger +from litellm.constants import request_timeout +from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj +from litellm.llms.base_llm.ocr.transformation import BaseOCRConfig, OCRResponse +from litellm.llms.custom_httpx.llm_http_handler import BaseLLMHTTPHandler +from litellm.utils import ProviderConfigManager, client + +####### ENVIRONMENT VARIABLES ################### +base_llm_http_handler = BaseLLMHTTPHandler() +################################################# + + +@client +async def aocr( + model: str, + document: Dict[str, str], + api_key: Optional[str] = None, + api_base: Optional[str] = None, + timeout: Optional[Union[float, httpx.Timeout]] = None, + custom_llm_provider: Optional[str] = None, + extra_headers: Optional[Dict[str, Any]] = None, + **kwargs, +) -> OCRResponse: + """ + Async OCR function. + + Args: + model: Model name (e.g., "mistral/mistral-ocr-latest") + document: Document to process in Mistral format: + {"type": "document_url", "document_url": "https://..."} for PDFs/docs or + {"type": "image_url", "image_url": "https://..."} for images + api_key: Optional API key + api_base: Optional API base URL + timeout: Optional timeout + custom_llm_provider: Optional custom LLM provider + extra_headers: Optional extra headers + **kwargs: Additional parameters (e.g., include_image_base64, pages, image_limit) + + Returns: + OCRResponse in Mistral OCR format with pages, model, usage_info, etc. + + Example: + ```python + import litellm + + # OCR with PDF + response = await litellm.aocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "document_url", + "document_url": "https://arxiv.org/pdf/2201.04234" + }, + include_image_base64=True + ) + + # OCR with image + response = await litellm.aocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "image_url", + "image_url": "https://example.com/image.png" + } + ) + + # OCR with base64 encoded PDF + response = await litellm.aocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "document_url", + "document_url": f"data:application/pdf;base64,{base64_pdf}" + } + ) + ``` + """ + local_vars = locals() + try: + loop = asyncio.get_event_loop() + kwargs["aocr"] = True + + # Get custom llm provider + if custom_llm_provider is None: + _, custom_llm_provider, _, _ = litellm.get_llm_provider( + model=model, api_base=api_base + ) + + func = partial( + ocr, + model=model, + document=document, + api_key=api_key, + api_base=api_base, + timeout=timeout, + custom_llm_provider=custom_llm_provider, + extra_headers=extra_headers, + **kwargs, + ) + + ctx = contextvars.copy_context() + func_with_context = partial(ctx.run, func) + init_response = await loop.run_in_executor(None, func_with_context) + + if asyncio.iscoroutine(init_response): + response = await init_response + else: + response = init_response + + if response is None: + raise ValueError( + f"Got an unexpected None response from the OCR API: {response}" + ) + + return response + except Exception as e: + raise litellm.exception_type( + model=model, + custom_llm_provider=custom_llm_provider, + original_exception=e, + completion_kwargs=local_vars, + extra_kwargs=kwargs, + ) + + +@client +def ocr( + model: str, + document: Dict[str, str], + api_key: Optional[str] = None, + api_base: Optional[str] = None, + timeout: Optional[Union[float, httpx.Timeout]] = None, + custom_llm_provider: Optional[str] = None, + extra_headers: Optional[Dict[str, Any]] = None, + **kwargs, +) -> Union[OCRResponse, Coroutine[Any, Any, OCRResponse]]: + """ + Synchronous OCR function. + + Args: + model: Model name (e.g., "mistral/mistral-ocr-latest") + document: Document to process in Mistral format: + {"type": "document_url", "document_url": "https://..."} for PDFs/docs or + {"type": "image_url", "image_url": "https://..."} for images + api_key: Optional API key + api_base: Optional API base URL + timeout: Optional timeout + custom_llm_provider: Optional custom LLM provider + extra_headers: Optional extra headers + **kwargs: Additional parameters (e.g., include_image_base64, pages, image_limit) + + Returns: + OCRResponse in Mistral OCR format with pages, model, usage_info, etc. + + Example: + ```python + import litellm + + # OCR with PDF + response = litellm.ocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "document_url", + "document_url": "https://arxiv.org/pdf/2201.04234" + }, + include_image_base64=True + ) + + # OCR with image + response = litellm.ocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "image_url", + "image_url": "https://example.com/image.png" + } + ) + + # OCR with base64 encoded PDF + response = litellm.ocr( + model="mistral/mistral-ocr-latest", + document={ + "type": "document_url", + "document_url": f"data:application/pdf;base64,{base64_pdf}" + } + ) + + # Access pages + for page in response.pages: + print(f"Page {page.index}: {page.markdown}") + ``` + """ + local_vars = locals() + try: + litellm_logging_obj: LiteLLMLoggingObj = kwargs.pop("litellm_logging_obj") # type: ignore + litellm_call_id: Optional[str] = kwargs.get("litellm_call_id", None) + _is_async = kwargs.pop("aocr", False) is True + + # Validate document parameter format (Mistral spec) + if not isinstance(document, dict): + raise ValueError(f"document must be a dict with 'type' and URL field, got {type(document)}") + + doc_type = document.get("type") + if doc_type not in ["document_url", "image_url"]: + raise ValueError(f"Invalid document type: {doc_type}. Must be 'document_url' or 'image_url'") + + model, custom_llm_provider, dynamic_api_key, dynamic_api_base = ( + litellm.get_llm_provider( + model=model, + custom_llm_provider=custom_llm_provider, + api_base=api_base, + api_key=api_key, + ) + ) + + # Update with dynamic values if available + if dynamic_api_key: + api_key = dynamic_api_key + if dynamic_api_base: + api_base = dynamic_api_base + + # Get provider config + ocr_provider_config: Optional[BaseOCRConfig] = ( + ProviderConfigManager.get_provider_ocr_config( + model=model, + provider=litellm.LlmProviders(custom_llm_provider), + ) + ) + + if ocr_provider_config is None: + raise ValueError( + f"OCR is not supported for provider: {custom_llm_provider}" + ) + + verbose_logger.debug( + f"OCR call - model: {model}, provider: {custom_llm_provider}" + ) + + # Extract OCR-specific parameters from kwargs + supported_params = ocr_provider_config.get_supported_ocr_params(model=model) + non_default_params = {} + for param in supported_params: + if param in kwargs: + non_default_params[param] = kwargs.pop(param) + + # Map parameters to provider-specific format + optional_params = ocr_provider_config.map_ocr_params( + non_default_params=non_default_params, + optional_params={}, + model=model, + ) + + verbose_logger.debug(f"OCR optional_params after mapping: {optional_params}") + + # Pre Call logging + litellm_logging_obj.update_environment_variables( + model=model, + optional_params=optional_params, + litellm_params={ + "litellm_call_id": litellm_call_id, + "api_base": api_base, + }, + custom_llm_provider=custom_llm_provider, + ) + + # Call the handler - pass document dict directly + response = base_llm_http_handler.ocr( + model=model, + document=document, # Pass the entire document dict + optional_params=optional_params, + timeout=timeout or request_timeout, + logging_obj=litellm_logging_obj, + api_key=api_key, + api_base=api_base, + custom_llm_provider=custom_llm_provider, + aocr=_is_async, + headers=extra_headers, + provider_config=ocr_provider_config, + litellm_params={ + "api_base": api_base, + "api_key": api_key, + }, + ) + + return response + except Exception as e: + raise litellm.exception_type( + model=model, + custom_llm_provider=custom_llm_provider, + original_exception=e, + completion_kwargs=local_vars, + extra_kwargs=kwargs, + ) + diff --git a/litellm/passthrough/main.py b/litellm/passthrough/main.py index f4dc1ef6c84..b4a76822022 100644 --- a/litellm/passthrough/main.py +++ b/litellm/passthrough/main.py @@ -242,12 +242,14 @@ def llm_passthrough_route( request_query_params=request_query_params, litellm_params=litellm_params_dict, ) - - # need to encode the id of application-inference-profile for bedrock + + # [TODO: Refactor to bedrockpassthroughconfig] need to encode the id of application-inference-profile for bedrock if custom_llm_provider == "bedrock" and "application-inference-profile" in endpoint: - encoded_url_str = CommonUtils.encode_bedrock_runtime_modelid_arn(str(updated_url)) + encoded_url_str = CommonUtils.encode_bedrock_runtime_modelid_arn( + str(updated_url) + ) updated_url = httpx.URL(encoded_url_str) - + # Add or update query parameters provider_api_key = provider_config.get_api_key(api_key) 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 31032b27b22..e77ad11fae4 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 @@ -109,10 +109,21 @@ class MCPRequestHandler: request.body = mock_body # type: ignore if ".well-known" in str(request.url): # public routes validated_user_api_key_auth = UserAPIKeyAuth() + # elif litellm_api_key == "": + # from fastapi import HTTPException + + # raise HTTPException( + # status_code=401, + # detail="LiteLLM API key is missing. Please add it or use OAuth authentication.", + # headers={ + # "WWW-Authenticate": f'Bearer resource_metadata=f"{request.base_url}/.well-known/oauth-protected-resource"', + # }, + # ) else: validated_user_api_key_auth = await user_api_key_auth( api_key=litellm_api_key, request=request ) + return ( validated_user_api_key_auth, mcp_auth_header, @@ -333,6 +344,172 @@ class MCPRequestHandler: verbose_logger.warning(f"Failed to get allowed MCP servers: {str(e)}") return [] + @staticmethod + async def _get_key_object_permission( + user_api_key_auth: Optional[UserAPIKeyAuth] = None, + ): + """Helper to get key object_permission from cache or DB.""" + from litellm.proxy.auth.auth_checks import get_object_permission + from litellm.proxy.proxy_server import ( + prisma_client, + proxy_logging_obj, + user_api_key_cache, + ) + + if not user_api_key_auth: + return None + + # Already loaded + if user_api_key_auth.object_permission: + return user_api_key_auth.object_permission + + # Need to fetch from DB + if user_api_key_auth.object_permission_id and prisma_client: + return await get_object_permission( + object_permission_id=user_api_key_auth.object_permission_id, + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + parent_otel_span=user_api_key_auth.parent_otel_span, + proxy_logging_obj=proxy_logging_obj, + ) + + return None + + @staticmethod + async def _get_team_object_permission( + user_api_key_auth: Optional[UserAPIKeyAuth] = None, + ): + """Helper to get team object_permission from cache or DB.""" + from litellm.proxy.auth.auth_checks import ( + get_object_permission, + get_team_object, + ) + from litellm.proxy.proxy_server import ( + prisma_client, + proxy_logging_obj, + user_api_key_cache, + ) + + if not user_api_key_auth or not user_api_key_auth.team_id or not prisma_client: + return None + + # First get the team object (which may have object_permission already loaded) + team_obj: Optional[LiteLLM_TeamTable] = await get_team_object( + team_id=user_api_key_auth.team_id, + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + parent_otel_span=user_api_key_auth.parent_otel_span, + proxy_logging_obj=proxy_logging_obj, + ) + + if not team_obj: + return None + + # Already loaded + if team_obj.object_permission: + return team_obj.object_permission + + # Need to fetch from DB using object_permission_id + if team_obj.object_permission_id: + return await get_object_permission( + object_permission_id=team_obj.object_permission_id, + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + parent_otel_span=user_api_key_auth.parent_otel_span, + proxy_logging_obj=proxy_logging_obj, + ) + + return None + + @staticmethod + async def get_allowed_tools_for_server( + server_id: str, + user_api_key_auth: Optional[UserAPIKeyAuth] = None, + ) -> Optional[List[str]]: + """ + Get list of allowed tool names for a specific server based on key/team permissions. + Follows same inheritance logic as get_allowed_mcp_servers. + + Args: + server_id: Server ID to check permissions for + user_api_key_auth: User auth + + Returns: + List[str] if restrictions exist, None if no restrictions (allow all) + """ + if not user_api_key_auth: + return None + + try: + # Get key and team object permissions + key_obj_perm = await MCPRequestHandler._get_key_object_permission( + user_api_key_auth + ) + team_obj_perm = await MCPRequestHandler._get_team_object_permission( + user_api_key_auth + ) + + # Extract tool permissions for this server + key_tools = ( + key_obj_perm.mcp_tool_permissions.get(server_id) + if key_obj_perm and key_obj_perm.mcp_tool_permissions + else None + ) + team_tools = ( + team_obj_perm.mcp_tool_permissions.get(server_id) + if team_obj_perm and team_obj_perm.mcp_tool_permissions + else None + ) + + # Apply same inheritance logic as get_allowed_mcp_servers + if team_tools: + if key_tools: + # Both have restrictions → intersection + return list(set(team_tools) & set(key_tools)) + else: + # Only team has restrictions → inherit from team + return team_tools + else: + # No team restrictions → use key restrictions + return key_tools + + except Exception as e: + verbose_logger.warning(f"Failed to get allowed tools for server: {str(e)}") + return None + + @staticmethod + async def is_tool_allowed_for_server( + tool_name: str, + server_id: str, + user_api_key_auth: Optional[UserAPIKeyAuth] = None, + ) -> bool: + """ + Check if a specific tool is allowed for a server based on key/team permissions. + + Args: + tool_name: Name of the tool to check + server_id: Server ID + user_api_key_auth: User auth + + Returns: + True if allowed, False if blocked + """ + allowed_tools = await MCPRequestHandler.get_allowed_tools_for_server( + server_id=server_id, + user_api_key_auth=user_api_key_auth, + ) + + # None means no restrictions (allow all) + if allowed_tools is None: + return True + + # Empty list means no tools allowed + if not allowed_tools: + return False + + # Check if tool is in allowed list + return tool_name in allowed_tools + @staticmethod def is_tool_allowed( allowed_mcp_servers: List[str], @@ -403,41 +580,24 @@ class MCPRequestHandler: user_api_key_auth: Optional[UserAPIKeyAuth] = None, ) -> List[str]: """ - The `object_permission` for a team is not stored on the user_api_key_auth object + Get allowed MCP servers for a team. - first we check if the team has a object_permission_id attached - - if it does then we look up the object_permission for the team + Uses the helper _get_team_object_permission which: + 1. First checks if object_permission is already loaded on the team + 2. If not, fetches from DB using object_permission_id if it exists """ - from litellm.proxy.auth.auth_checks import get_team_object - from litellm.proxy.proxy_server import ( - prisma_client, - proxy_logging_obj, - user_api_key_cache, - ) - if user_api_key_auth is None: return [] if user_api_key_auth.team_id is None: return [] - if prisma_client is None: - verbose_logger.debug("prisma_client is None") - return [] - try: - team_obj: Optional[LiteLLM_TeamTable] = await get_team_object( - team_id=user_api_key_auth.team_id, - prisma_client=prisma_client, - user_api_key_cache=user_api_key_cache, - parent_otel_span=user_api_key_auth.parent_otel_span, - proxy_logging_obj=proxy_logging_obj, + # Use the helper method that properly handles fetching from DB if needed + object_permissions = await MCPRequestHandler._get_team_object_permission( + user_api_key_auth ) - if team_obj is None: - verbose_logger.debug("team_obj is None") - return [] - object_permissions = team_obj.object_permission if object_permissions is None: return [] diff --git a/litellm/proxy/_experimental/mcp_server/db.py b/litellm/proxy/_experimental/mcp_server/db.py index 79e3b0f7623..22695485741 100644 --- a/litellm/proxy/_experimental/mcp_server/db.py +++ b/litellm/proxy/_experimental/mcp_server/db.py @@ -1,7 +1,7 @@ -from litellm._uuid import uuid from typing import Any, Dict, Iterable, List, Optional, Set, Union from litellm._logging import verbose_proxy_logger +from litellm._uuid import uuid from litellm.proxy._types import ( LiteLLM_MCPServerTable, LiteLLM_ObjectPermissionTable, @@ -30,7 +30,7 @@ def _prepare_mcp_server_data( from litellm.litellm_core_utils.safe_json_dumps import safe_dumps # Convert model to dict - data_dict = data.model_dump() + data_dict = data.model_dump(exclude_none=True) # Ensure alias is always present in the dict (even if None) if "alias" not in data_dict: data_dict["alias"] = getattr(data, "alias", None) diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py index a88f94be06f..f313a673827 100644 --- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py +++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py @@ -10,7 +10,7 @@ import asyncio import datetime import hashlib import json -from typing import Any, Dict, List, Optional, Union, cast +from typing import Any, Dict, List, Optional, Set, Union, cast from fastapi import HTTPException from mcp.types import CallToolRequestParams as MCPCallToolRequestParams @@ -195,6 +195,7 @@ class MCPServerManager: name=name_for_prefix, alias=alias, server_name=server_name, + spec_path=server_config.get("spec_path", None), url=server_config.get("url", None) or "", command=server_config.get("command", None) or "", args=server_config.get("args", None) or [], @@ -215,15 +216,167 @@ class MCPServerManager: extra_headers=server_config.get("extra_headers", None), allowed_tools=server_config.get("allowed_tools", None), disallowed_tools=server_config.get("disallowed_tools", None), + allowed_params=server_config.get("allowed_params", None), access_groups=server_config.get("access_groups", None), ) self.config_mcp_servers[server_id] = new_server + + # Check if this is an OpenAPI-based server + spec_path = server_config.get("spec_path", None) + if spec_path: + verbose_logger.info( + f"Loading OpenAPI spec from {spec_path} for server {server_name}" + ) + self._register_openapi_tools( + spec_path=spec_path, + server=new_server, + base_url=server_config.get("url", ""), + ) + verbose_logger.debug( f"Loaded MCP Servers: {json.dumps(self.config_mcp_servers, indent=4, default=str)}" ) self.initialize_tool_name_to_mcp_server_name_mapping() + def _register_openapi_tools(self, spec_path: str, server: MCPServer, base_url: str): + """ + Register tools from an OpenAPI specification for a given server. + + This creates "virtual" MCP tools from OpenAPI endpoints that are: + 1. Registered in the global tool registry with server prefix + 2. Mapped to the server for routing + 3. Executed via the local tool handler + + Args: + spec_path: Path to the OpenAPI specification file + server: The MCPServer instance to register tools for + base_url: Base URL for API calls + """ + from litellm.proxy._experimental.mcp_server.openapi_to_mcp_generator import ( + build_input_schema, + create_tool_function, + ) + from litellm.proxy._experimental.mcp_server.openapi_to_mcp_generator import ( + get_base_url as get_openapi_base_url, + ) + from litellm.proxy._experimental.mcp_server.openapi_to_mcp_generator import ( + load_openapi_spec, + ) + from litellm.proxy._experimental.mcp_server.tool_registry import ( + global_mcp_tool_registry, + ) + + try: + # Load OpenAPI spec + spec = load_openapi_spec(spec_path) + + # Use base_url from config if provided, otherwise extract from spec + if not base_url: + base_url = get_openapi_base_url(spec) + + verbose_logger.info( + f"Registering OpenAPI tools for server {server.name} with base URL: {base_url}" + ) + + # Get server prefix for tool naming + server_prefix = get_server_prefix(server) + + # Build headers from server configuration + headers = {} + + # Add authentication headers if configured + if server.authentication_token: + from litellm.types.mcp import MCPAuth + + if server.auth_type == MCPAuth.bearer_token: + headers["Authorization"] = f"Bearer {server.authentication_token}" + elif server.auth_type == MCPAuth.api_key: + headers["Authorization"] = f"ApiKey {server.authentication_token}" + elif server.auth_type == MCPAuth.basic: + headers["Authorization"] = f"Basic {server.authentication_token}" + + # Add any extra headers from server config + # Note: extra_headers is a List[str] of header names to forward, not a dict + # For OpenAPI tools, we'll just use the authentication headers + # If extra_headers were needed, they would be processed separately + + verbose_logger.debug( + f"Using headers for OpenAPI tools (excluding sensitive values): " + f"{list(headers.keys())}" + ) + + # Extract and register tools from OpenAPI paths + paths = spec.get("paths", {}) + registered_count = 0 + + verbose_logger.debug(f"Processing {len(paths)} paths from OpenAPI spec") + + for path, path_item in paths.items(): + for method in ["get", "post", "put", "delete", "patch"]: + if method not in path_item: + continue + + operation = path_item[method] + + # Generate tool name (without prefix initially) + operation_id = operation.get( + "operationId", f"{method}_{path.replace('/', '_')}" + ) + base_tool_name = operation_id.replace(" ", "_").lower() + + # Add server prefix to tool name + prefixed_tool_name = add_server_prefix_to_tool_name( + base_tool_name, server_prefix + ) + + # Get description + description = operation.get( + "summary", + operation.get("description", f"{method.upper()} {path}"), + ) + + # Build input schema using imported function + input_schema = build_input_schema(operation) + + # Create tool function with headers using imported function + tool_func = create_tool_function( + path, method, operation, base_url, headers=headers + ) + tool_func.__name__ = prefixed_tool_name + tool_func.__doc__ = description + + # Register tool with prefixed name in global registry + global_mcp_tool_registry.register_tool( + name=prefixed_tool_name, + description=description, + input_schema=input_schema, + handler=tool_func, + ) + + # Update tool name to server name mapping (for both prefixed and base names) + self.tool_name_to_mcp_server_name_mapping[base_tool_name] = ( + server_prefix + ) + self.tool_name_to_mcp_server_name_mapping[prefixed_tool_name] = ( + server_prefix + ) + + registered_count += 1 + verbose_logger.debug( + f"Registered OpenAPI tool: {prefixed_tool_name} for server {server.name}" + ) + + verbose_logger.info( + f"Successfully registered {registered_count} OpenAPI tools for server {server.name}" + ) + + except Exception as e: + verbose_logger.error( + f"Failed to register OpenAPI tools for server {server.name}: {str(e)}" + ) + raise e + def remove_server(self, mcp_server: LiteLLM_MCPServerTable): """ Remove a server from the registry @@ -240,50 +393,64 @@ class MCPServerManager: ) def add_update_server(self, mcp_server: LiteLLM_MCPServerTable): - if mcp_server.server_id not in self.get_registry(): - _mcp_info: MCPInfo = mcp_server.mcp_info or {} - # Use helper to deserialize environment dictionary - # Safely access env field which may not exist on Prisma model objects - env_data = getattr(mcp_server, "env", None) - env_dict = _deserialize_env_dict(env_data) - # Use alias for name if present, else server_name - name_for_prefix = ( - mcp_server.alias or mcp_server.server_name or mcp_server.server_id - ) - # Preserve all custom fields from database while setting defaults for core fields - mcp_info: MCPInfo = _mcp_info.copy() - # Set default values for core fields if not present - if "server_name" not in mcp_info: - mcp_info["server_name"] = mcp_server.server_name or mcp_server.server_id - if "description" not in mcp_info and mcp_server.description: - mcp_info["description"] = mcp_server.description + try: + if mcp_server.server_id not in self.get_registry(): + _mcp_info: MCPInfo = mcp_server.mcp_info or {} + # Use helper to deserialize environment dictionary + # Safely access env field which may not exist on Prisma model objects + env_data = getattr(mcp_server, "env", None) + env_dict = _deserialize_env_dict(env_data) + # Use alias for name if present, else server_name + name_for_prefix = ( + mcp_server.alias or mcp_server.server_name or mcp_server.server_id + ) + # Preserve all custom fields from database while setting defaults for core fields + mcp_info: MCPInfo = _mcp_info.copy() + # Set default values for core fields if not present + if "server_name" not in mcp_info: + mcp_info["server_name"] = ( + mcp_server.server_name or mcp_server.server_id + ) + if "description" not in mcp_info and mcp_server.description: + mcp_info["description"] = mcp_server.description - new_server = MCPServer( - server_id=mcp_server.server_id, - name=name_for_prefix, - alias=getattr(mcp_server, "alias", None), - server_name=getattr(mcp_server, "server_name", None), - url=mcp_server.url, - transport=cast(MCPTransportType, mcp_server.transport), - auth_type=cast(MCPAuthType, mcp_server.auth_type), - mcp_info=mcp_info, - extra_headers=getattr(mcp_server, "extra_headers", None), - # oauth specific fields - client_id=getattr(mcp_server, "client_id", None), - client_secret=getattr(mcp_server, "client_secret", None), - scopes=getattr(mcp_server, "scopes", None), - authorization_url=getattr(mcp_server, "authorization_url", None), - token_url=getattr(mcp_server, "token_url", None), - # Stdio-specific fields - command=getattr(mcp_server, "command", None), - args=getattr(mcp_server, "args", None) or [], - env=env_dict, - access_groups=getattr(mcp_server, "mcp_access_groups", None), - allowed_tools=getattr(mcp_server, "allowed_tools", None), - disallowed_tools=getattr(mcp_server, "disallowed_tools", None), - ) - self.registry[mcp_server.server_id] = new_server - verbose_logger.debug(f"Added MCP Server: {name_for_prefix}") + new_server = MCPServer( + server_id=mcp_server.server_id, + name=name_for_prefix, + alias=getattr(mcp_server, "alias", None), + server_name=getattr(mcp_server, "server_name", None), + url=mcp_server.url, + transport=cast(MCPTransportType, mcp_server.transport), + auth_type=cast(MCPAuthType, mcp_server.auth_type), + mcp_info=mcp_info, + extra_headers=getattr(mcp_server, "extra_headers", None), + # oauth specific fields + client_id=getattr(mcp_server, "client_id", None), + client_secret=getattr(mcp_server, "client_secret", None), + scopes=getattr(mcp_server, "scopes", None), + authorization_url=getattr(mcp_server, "authorization_url", None), + token_url=getattr(mcp_server, "token_url", None), + # Stdio-specific fields + command=getattr(mcp_server, "command", None), + args=getattr(mcp_server, "args", None) or [], + env=env_dict, + access_groups=getattr(mcp_server, "mcp_access_groups", None), + allowed_tools=getattr(mcp_server, "allowed_tools", None), + disallowed_tools=getattr(mcp_server, "disallowed_tools", None), + ) + self.registry[mcp_server.server_id] = new_server + verbose_logger.debug(f"Added MCP Server: {name_for_prefix}") + + except Exception as e: + verbose_logger.debug(f"Failed to add MCP server: {str(e)}") + raise e + + def get_all_mcp_server_ids(self) -> Set[str]: + """ + Get all MCP server IDs + """ + all_servers = list(self.get_registry().values()) + return {server.server_id for server in all_servers} async def get_allowed_mcp_servers( self, user_api_key_auth: Optional[UserAPIKeyAuth] = None @@ -455,6 +622,10 @@ class MCPServerManager: Returns: List[MCPTool]: List of tools available on the server with prefixed names """ + from litellm.proxy._experimental.mcp_server.tool_registry import ( + global_mcp_tool_registry, + ) + verbose_logger.debug(f"Connecting to url: {server.url}") verbose_logger.info(f"_get_tools_from_server for {server.name}...") @@ -467,7 +638,14 @@ class MCPServerManager: extra_headers=extra_headers, ) - tools = await self._fetch_tools_with_timeout(client, server.name) + ## HANDLE OPENAPI TOOLS + if server.spec_path: + _tools = global_mcp_tool_registry.list_tools(tool_prefix=server.name) + tools = global_mcp_tool_registry.convert_tools_to_mcp_sdk_tool_type( + _tools + ) + else: + tools = await self._fetch_tools_with_timeout(client, server.name) prefixed_or_original_tools = self._create_prefixed_tools( tools, server, add_prefix=add_prefix @@ -583,11 +761,168 @@ class MCPServerManager: Check if the tool is allowed or banned for the given server """ if server.allowed_tools: - return tool_name in server.allowed_tools + return ( + tool_name in server.allowed_tools + or f"{server.name}-{tool_name}" in server.allowed_tools + ) if server.disallowed_tools: - return tool_name not in server.disallowed_tools + return ( + tool_name not in server.disallowed_tools + and f"{server.name}-{tool_name}" not in server.disallowed_tools + ) return True + def validate_allowed_params( + self, tool_name: str, arguments: Dict[str, Any], server: MCPServer + ) -> None: + """ + Filter arguments to only include allowed parameters for the given tool. + + Args: + tool_name: Name of the tool (with or without prefix) + arguments: Dictionary of arguments to filter + server: MCPServer configuration + + Returns: + Filtered dictionary containing only allowed parameters + + Raises: + HTTPException: If allowed_params is configured for this tool but arguments contain disallowed params + """ + from litellm.proxy._experimental.mcp_server.utils import ( + get_server_name_prefix_tool_mcp, + ) + + # If no allowed_params configured, return all arguments + if not server.allowed_params: + return + + # Get the unprefixed tool name to match against config + unprefixed_tool_name, _ = get_server_name_prefix_tool_mcp(tool_name) + + # Check both prefixed and unprefixed tool names + allowed_params_list = server.allowed_params.get( + tool_name + ) or server.allowed_params.get(unprefixed_tool_name) + + # If this tool doesn't have allowed_params specified, allow all params + if allowed_params_list is None: + return None + + # Filter arguments to only include allowed parameters + disallowed_params = [ + param for param in arguments.keys() if param not in allowed_params_list + ] + + if disallowed_params: + raise HTTPException( + status_code=403, + detail={ + "error": f"Parameters {disallowed_params} are not allowed for tool {tool_name}. " + f"Allowed parameters: {allowed_params_list}. " + f"Contact proxy admin to allow these parameters." + }, + ) + + async def check_tool_permission_for_key_team( + self, + tool_name: str, + server: MCPServer, + user_api_key_auth: Optional[UserAPIKeyAuth], + ) -> None: + """ + Check if a tool is allowed based on key/team object_permission.mcp_tool_permissions. + Uses MCPRequestHandler.is_tool_allowed_for_server for consistent inheritance logic. + Raises HTTPException if tool is not allowed. + + Args: + tool_name: Name of the tool to check + server: MCPServer object + user_api_key_auth: User authentication + + Raises: + HTTPException: If tool is not allowed for this key/team + """ + from litellm.proxy._experimental.mcp_server.auth.user_api_key_auth_mcp import ( + MCPRequestHandler, + ) + + if not user_api_key_auth: + return + + # Check if tool is allowed + is_allowed = await MCPRequestHandler.is_tool_allowed_for_server( + tool_name=tool_name, + server_id=server.server_id, + user_api_key_auth=user_api_key_auth, + ) + + if not is_allowed: + raise HTTPException( + status_code=403, + detail={ + "error": f"Tool '{tool_name}' is not allowed for your key/team on server '{server.name}'. Contact proxy admin for access." + }, + ) + + async def _call_openapi_tool_handler( + self, + server: MCPServer, + tool_name: str, + arguments: Dict[str, Any], + ) -> CallToolResult: + """ + Call an OpenAPI tool handler directly. + + For OpenAPI servers, instead of using MCP protocol, we call the tool handler + that was registered during OpenAPI spec parsing. This handler makes direct + HTTP requests to the API. + + Args: + tool_name: The full tool name (with prefix) to call + arguments: Tool arguments to pass to the handler + + Returns: + CallToolResult with the response from the API + """ + from mcp.types import TextContent + + from litellm.proxy._experimental.mcp_server.tool_registry import ( + global_mcp_tool_registry, + ) + + # Get the tool from the registry + tool = global_mcp_tool_registry.get_tool(f"{server.name}-{tool_name}") + if tool is None: + # Tool not found in registry + error_msg = f"OpenAPI tool {tool_name} not found in registry" + verbose_logger.error(error_msg) + return CallToolResult( + content=[TextContent(type="text", text=error_msg)], + isError=True, + ) + + try: + # Call the tool handler with the arguments + # The handler is an async function that makes the HTTP request + handler_result = await tool.handler(**arguments) + + # Convert the handler result (string response) to CallToolResult format + result = CallToolResult( + content=[TextContent(type="text", text=str(handler_result))], + isError=False, + ) + + return result + + except Exception as e: + error_msg = f"Error calling OpenAPI tool {tool_name}: {str(e)}" + verbose_logger.error(error_msg) + return CallToolResult( + content=[TextContent(type="text", text=error_msg)], + isError=True, + ) + async def pre_call_tool_check( self, name: str, @@ -597,7 +932,6 @@ class MCPServerManager: proxy_logging_obj: ProxyLogging, server: MCPServer, ): - ## check if the tool is allowed or banned for the given server if not self.check_allowed_or_banned_tools(name, server): raise HTTPException( @@ -607,6 +941,20 @@ class MCPServerManager: }, ) + ## check tool-level permissions from object_permission + await self.check_tool_permission_for_key_team( + tool_name=name, + server=server, + user_api_key_auth=user_api_key_auth, + ) + + ## filter parameters based on allowed_params configuration + self.validate_allowed_params( + tool_name=name, + arguments=arguments, + server=server, + ) + pre_hook_kwargs = { "name": name, "arguments": arguments, @@ -670,6 +1018,143 @@ class MCPServerManager: verbose_logger.error(f"Guardrail blocked MCP tool call pre call: {str(e)}") raise e + def _create_during_hook_task( + self, + name: str, + arguments: Dict[str, Any], + server_name_from_prefix: Optional[str], + user_api_key_auth: Optional[UserAPIKeyAuth], + proxy_logging_obj: ProxyLogging, + start_time: datetime.datetime, + ): + """Create and return a during hook task for MCP tool calls.""" + from litellm.types.llms.base import HiddenParams + from litellm.types.mcp import MCPDuringCallRequestObject + + request_obj = MCPDuringCallRequestObject( + tool_name=name, + arguments=arguments, + server_name=server_name_from_prefix, + start_time=start_time.timestamp() if start_time else None, + hidden_params=HiddenParams(), + ) + + during_hook_kwargs = { + "name": name, + "arguments": arguments, + "server_name": server_name_from_prefix, + "user_api_key_auth": user_api_key_auth, + } + + synthetic_llm_data = proxy_logging_obj._convert_mcp_to_llm_format( + request_obj, during_hook_kwargs + ) + + return asyncio.create_task( + proxy_logging_obj.during_call_hook( + user_api_key_dict=user_api_key_auth, + data=synthetic_llm_data, + call_type="mcp_call", # type: ignore + ) + ) + + async def _call_regular_mcp_tool( + self, + mcp_server: MCPServer, + original_tool_name: str, + arguments: Dict[str, Any], + tasks: List, + mcp_auth_header: Optional[str], + mcp_server_auth_headers: Optional[Dict[str, Dict[str, str]]], + oauth2_headers: Optional[Dict[str, str]], + raw_headers: Optional[Dict[str, str]], + proxy_logging_obj: Optional[ProxyLogging], + ) -> CallToolResult: + """ + Call a regular MCP tool using the MCP client. + + Args: + mcp_server: The MCP server configuration + original_tool_name: The original tool name (without prefix) + arguments: Tool arguments + tasks: List of async tasks to append to (for during hooks) + mcp_auth_header: MCP auth header (deprecated) + mcp_server_auth_headers: Optional dict of server-specific auth headers + oauth2_headers: Optional OAuth2 headers + raw_headers: Optional raw headers from the request + proxy_logging_obj: Optional ProxyLogging object for hook integration + + Returns: + CallToolResult from the MCP server + + Raises: + BlockedPiiEntityError: If PII is blocked by guardrails + GuardrailRaisedException: If guardrails block the call + HTTPException: If an HTTP error occurs + """ + # Get server-specific auth header if available + server_auth_header: Optional[Union[Dict[str, str], str]] = None + if mcp_server_auth_headers and mcp_server.alias: + server_auth_header = mcp_server_auth_headers.get(mcp_server.alias) + elif mcp_server_auth_headers and mcp_server.server_name: + server_auth_header = mcp_server_auth_headers.get(mcp_server.server_name) + + # Fall back to deprecated mcp_auth_header if no server-specific header found + if server_auth_header is None: + server_auth_header = mcp_auth_header + + # oauth2 headers + extra_headers: Optional[Dict[str, str]] = None + if mcp_server.auth_type == MCPAuth.oauth2: + extra_headers = oauth2_headers + + if mcp_server.extra_headers and raw_headers: + if extra_headers is None: + extra_headers = {} + for header in mcp_server.extra_headers: + if header in raw_headers: + extra_headers[header] = raw_headers[header] + + client = self._create_mcp_client( + server=mcp_server, + mcp_auth_header=server_auth_header, + extra_headers=extra_headers, + ) + + call_tool_params = MCPCallToolRequestParams( + name=original_tool_name, + arguments=arguments, + ) + + async def _call_tool_via_client(client, params): + async with client: + return await client.call_tool(params) + + tasks.append( + asyncio.create_task(_call_tool_via_client(client, call_tool_params)) + ) + + # IMPORTANT: Must await tasks INSIDE the context manager to keep connection alive + try: + mcp_responses = await asyncio.gather(*tasks) + except ( + BlockedPiiEntityError, + GuardrailRaisedException, + HTTPException, + ) as e: + # Re-raise guardrail exceptions to properly fail the MCP call + verbose_logger.error( + f"Guardrail blocked MCP tool call during result check: {str(e)}" + ) + raise e + + # If proxy_logging_obj is None, the tool call result is at index 0 + # If proxy_logging_obj is not None, the tool call result is at index 1 (after the during hook task) + result_index = 1 if proxy_logging_obj else 0 + result = mcp_responses[result_index] + + return cast(CallToolResult, result) + async def call_tool( self, name: str, @@ -733,95 +1218,63 @@ class MCPServerManager: server=mcp_server, ) - # Get server-specific auth header if available - server_auth_header: Optional[Union[Dict[str, str], str]] = None - if mcp_server_auth_headers and mcp_server.alias: - server_auth_header = mcp_server_auth_headers.get(mcp_server.alias) - elif mcp_server_auth_headers and mcp_server.server_name: - server_auth_header = mcp_server_auth_headers.get(mcp_server.server_name) - - # Fall back to deprecated mcp_auth_header if no server-specific header found - if server_auth_header is None: - server_auth_header = mcp_auth_header - - # oauth2 headers - extra_headers: Optional[Dict[str, str]] = None - if mcp_server.auth_type == MCPAuth.oauth2: - extra_headers = oauth2_headers - - if mcp_server.extra_headers and raw_headers: - if extra_headers is None: - extra_headers = {} - for header in mcp_server.extra_headers: - if header in raw_headers: - extra_headers[header] = raw_headers[header] - - client = self._create_mcp_client( - server=mcp_server, - mcp_auth_header=server_auth_header, - extra_headers=extra_headers, - ) - - async with client: - # Use the original tool name (without prefix) for the actual call - call_tool_params = MCPCallToolRequestParams( - name=original_tool_name, + # Prepare tasks for during hooks + tasks = [] + if proxy_logging_obj: + during_hook_task = self._create_during_hook_task( + name=name, arguments=arguments, + server_name_from_prefix=server_name_from_prefix, + user_api_key_auth=user_api_key_auth, + proxy_logging_obj=proxy_logging_obj, + start_time=start_time, ) - tasks = [] - if proxy_logging_obj: - # Create synthetic LLM data for during hook processing - from litellm.types.llms.base import HiddenParams - from litellm.types.mcp import MCPDuringCallRequestObject + tasks.append(during_hook_task) - request_obj = MCPDuringCallRequestObject( - tool_name=name, - arguments=arguments, - server_name=server_name_from_prefix, - start_time=start_time.timestamp() if start_time else None, - hidden_params=HiddenParams(), + # For OpenAPI servers, call the tool handler directly instead of via MCP client + if mcp_server.spec_path: + verbose_logger.debug( + f"Calling OpenAPI tool {name} directly via HTTP handler" + ) + tasks.append( + asyncio.create_task( + self._call_openapi_tool_handler(mcp_server, name, arguments) ) + ) + else: + # For regular MCP servers, use the MCP client + return await self._call_regular_mcp_tool( + mcp_server=mcp_server, + original_tool_name=original_tool_name, + arguments=arguments, + tasks=tasks, + mcp_auth_header=mcp_auth_header, + mcp_server_auth_headers=mcp_server_auth_headers, + oauth2_headers=oauth2_headers, + raw_headers=raw_headers, + proxy_logging_obj=proxy_logging_obj, + ) - during_hook_kwargs = { - "name": name, - "arguments": arguments, - "server_name": server_name_from_prefix, - "user_api_key_auth": user_api_key_auth, - } + # For OpenAPI tools, await outside the client context + try: + mcp_responses = await asyncio.gather(*tasks) - synthetic_llm_data = proxy_logging_obj._convert_mcp_to_llm_format( - request_obj, during_hook_kwargs - ) + # If proxy_logging_obj is None, the tool call result is at index 0 + # If proxy_logging_obj is not None, the tool call result is at index 1 (after the during hook task) + result_index = 1 if proxy_logging_obj else 0 + result = mcp_responses[result_index] - during_hook_task = asyncio.create_task( - proxy_logging_obj.during_call_hook( - user_api_key_dict=user_api_key_auth, - data=synthetic_llm_data, - call_type="mcp_call", # type: ignore - ) - ) - tasks.append(during_hook_task) - - tasks.append(asyncio.create_task(client.call_tool(call_tool_params))) - try: - mcp_responses = await asyncio.gather(*tasks) - - # If proxy_logging_obj is None, the tool call result is at index 0 - # If proxy_logging_obj is not None, the tool call result is at index 1 (after the during hook task) - result_index = 1 if proxy_logging_obj else 0 - result = mcp_responses[result_index] - - return cast(CallToolResult, result) - except ( - BlockedPiiEntityError, - GuardrailRaisedException, - HTTPException, - ) as e: - # Re-raise guardrail exceptions to properly fail the MCP call - verbose_logger.error( - f"Guardrail blocked MCP tool call during result check: {str(e)}" - ) - raise e + return cast(CallToolResult, result) + except ( + BlockedPiiEntityError, + GuardrailRaisedException, + HTTPException, + ) as e: + # Re-raise guardrail exceptions to properly fail the MCP call + verbose_logger.error( + f"Guardrail blocked MCP tool call during result check: {str(e)}" + ) + raise e ######################################################### # End of Methods that call the upstream MCP servers @@ -891,7 +1344,7 @@ class MCPServerManager: get_prisma_client_or_throw, ) - verbose_logger.info("Loading MCP servers from database into registry...") + verbose_logger.debug("Loading MCP servers from database into registry...") # perform authz check to filter the mcp servers user has access to prisma_client = get_prisma_client_or_throw( @@ -907,7 +1360,9 @@ class MCPServerManager: ) self.add_update_server(server) - verbose_logger.info(f"Registry now contains {len(self.get_registry())} servers") + verbose_logger.debug( + f"Registry now contains {len(self.get_registry())} servers" + ) def get_mcp_server_by_id(self, server_id: str) -> Optional[MCPServer]: """ @@ -995,6 +1450,7 @@ class MCPServerManager: if not server: return { "server_id": server_id, + "server_name": None, "status": "unknown", "error": "Server not found", "last_health_check": datetime.now().isoformat(), @@ -1009,6 +1465,7 @@ class MCPServerManager: return { "server_id": server_id, + "server_name": server.name, "status": "healthy", "tools_count": len(tools), "last_health_check": datetime.now().isoformat(), @@ -1021,6 +1478,7 @@ class MCPServerManager: return { "server_id": server_id, + "server_name": server.name, "status": "unhealthy", "last_health_check": datetime.now().isoformat(), "response_time_ms": round(response_time, 2), @@ -1118,25 +1576,23 @@ class MCPServerManager: if _server_id in allowed_server_ids: list_mcp_servers.append( LiteLLM_MCPServerTable( - server_id=_server_id, - server_name=_server_config.name, - alias=_server_config.alias, - url=_server_config.url, - transport=_server_config.transport, - auth_type=_server_config.auth_type, - created_at=datetime.datetime.now(), - updated_at=datetime.datetime.now(), - description=( - _server_config.mcp_info.get("description") - if _server_config.mcp_info - else None - ), - mcp_info=_server_config.mcp_info, - mcp_access_groups=_server_config.access_groups or [], - # Stdio-specific fields - command=getattr(_server_config, "command", None), - args=getattr(_server_config, "args", None) or [], - env=getattr(_server_config, "env", None) or {}, + **{ + **_server_config.model_dump(), + "created_at": datetime.datetime.now(), + "updated_at": datetime.datetime.now(), + "description": ( + _server_config.mcp_info.get("description") + if _server_config.mcp_info + else None + ), + "allowed_tools": _server_config.allowed_tools or [], + "mcp_info": _server_config.mcp_info, + "mcp_access_groups": _server_config.access_groups or [], + "extra_headers": _server_config.extra_headers or [], + "command": getattr(_server_config, "command", None), + "args": getattr(_server_config, "args", None) or [], + "env": getattr(_server_config, "env", None) or {}, + } ) ) @@ -1176,39 +1632,19 @@ class MCPServerManager: } ) - # Map servers to their teams and return with health data - from typing import cast + ## mark invalid servers w/ reason for being invalid + valid_server_ids = self.get_all_mcp_server_ids() + for server in list_mcp_servers: + if server.server_id not in valid_server_ids: + server.status = "unhealthy" + ## try adding server to registry to get error + try: + self.add_update_server(server) + except Exception as e: + server.health_check_error = str(e) + server.health_check_error = "Server is not in in memory registry yet. This could be a temporary sync issue." - return [ - LiteLLM_MCPServerTable( - server_id=server.server_id, - server_name=server.server_name, - alias=server.alias, - description=server.description, - url=server.url, - transport=server.transport, - auth_type=server.auth_type, - created_at=server.created_at, - created_by=server.created_by, - updated_at=server.updated_at, - updated_by=server.updated_by, - mcp_access_groups=( - server.mcp_access_groups - if server.mcp_access_groups is not None - else [] - ), - mcp_info=server.mcp_info, - teams=cast( - List[Dict[str, str | None]], - server_to_teams_map.get(server.server_id, []), - ), - # Stdio-specific fields - command=getattr(server, "command", None), - args=getattr(server, "args", None) or [], - env=getattr(server, "env", None) or {}, - ) - for server in list_mcp_servers - ] + return list_mcp_servers async def reload_servers_from_database(self): """ diff --git a/litellm/proxy/_experimental/mcp_server/openapi_to_mcp_generator.py b/litellm/proxy/_experimental/mcp_server/openapi_to_mcp_generator.py new file mode 100644 index 00000000000..72288f8e673 --- /dev/null +++ b/litellm/proxy/_experimental/mcp_server/openapi_to_mcp_generator.py @@ -0,0 +1,236 @@ +""" +This module is used to generate MCP tools from OpenAPI specs. +""" + +import json +from typing import Any, Dict, Optional + +import httpx + +from litellm._logging import verbose_logger +from litellm.proxy._experimental.mcp_server.tool_registry import ( + global_mcp_tool_registry, +) + +# Store the base URL and headers globally +BASE_URL = "" +HEADERS: Dict[str, str] = {} + + +def load_openapi_spec(filepath: str) -> Dict[str, Any]: + """Load OpenAPI specification from JSON file.""" + with open(filepath, "r") as f: + return json.load(f) + + +def get_base_url(spec: Dict[str, Any]) -> str: + """Extract base URL from OpenAPI spec.""" + # OpenAPI 3.x + if "servers" in spec and spec["servers"]: + return spec["servers"][0]["url"] + # OpenAPI 2.x (Swagger) + elif "host" in spec: + scheme = spec.get("schemes", ["https"])[0] + base_path = spec.get("basePath", "") + return f"{scheme}://{spec['host']}{base_path}" + return "" + + +def extract_parameters(operation: Dict[str, Any]) -> tuple: + """Extract parameter names from OpenAPI operation.""" + path_params = [] + query_params = [] + body_params = [] + + # OpenAPI 3.x and 2.x parameters + if "parameters" in operation: + for param in operation["parameters"]: + param_name = param["name"] + if param.get("in") == "path": + path_params.append(param_name) + elif param.get("in") == "query": + query_params.append(param_name) + elif param.get("in") == "body": + body_params.append(param_name) + + # OpenAPI 3.x requestBody + if "requestBody" in operation: + body_params.append("body") + + return path_params, query_params, body_params + + +def build_input_schema(operation: Dict[str, Any]) -> Dict[str, Any]: + """Build MCP input schema from OpenAPI operation.""" + properties = {} + required = [] + + # Process parameters + if "parameters" in operation: + for param in operation["parameters"]: + param_name = param["name"] + param_schema = param.get("schema", {}) + param_type = param_schema.get("type", "string") + + properties[param_name] = { + "type": param_type, + "description": param.get("description", ""), + } + + if param.get("required", False): + required.append(param_name) + + # Process requestBody (OpenAPI 3.x) + if "requestBody" in operation: + request_body = operation["requestBody"] + content = request_body.get("content", {}) + + # Try to get JSON schema + if "application/json" in content: + schema = content["application/json"].get("schema", {}) + properties["body"] = { + "type": "object", + "description": request_body.get("description", "Request body"), + "properties": schema.get("properties", {}), + } + if request_body.get("required", False): + required.append("body") + + return { + "type": "object", + "properties": properties, + "required": required if required else [], + } + + +def create_tool_function( + path: str, + method: str, + operation: Dict[str, Any], + base_url: str, + headers: Optional[Dict[str, str]] = None, +): + """Create a tool function for an OpenAPI operation. + + Args: + path: API endpoint path + method: HTTP method (get, post, put, delete, patch) + operation: OpenAPI operation object + base_url: Base URL for the API + headers: Optional headers to include in requests (e.g., authentication) + """ + if headers is None: + headers = {} + + path_params, query_params, body_params = extract_parameters(operation) + all_params = path_params + query_params + body_params + + # Build function signature dynamically + if all_params: + params_str = ", ".join(f"{p}: str = ''" for p in all_params) + else: + params_str = "" + + # Create the function code as a string + func_code = f''' +async def tool_function({params_str}) -> str: + """Dynamically generated tool function.""" + url = base_url + path + + # Replace path parameters + path_param_names = {path_params} + for param_name in path_param_names: + param_value = locals().get(param_name, "") + if param_value: + url = url.replace("{{" + param_name + "}}", str(param_value)) + + # Build query params + query_param_names = {query_params} + params = {{}} + for param_name in query_param_names: + param_value = locals().get(param_name, "") + if param_value: + params[param_name] = param_value + + # Build request body + body_param_names = {body_params} + json_body = None + if body_param_names: + body_value = locals().get("body", {{}}) + if isinstance(body_value, dict): + json_body = body_value + elif body_value: + # If it's a string, try to parse as JSON + import json as json_module + try: + json_body = json_module.loads(body_value) if isinstance(body_value, str) else {{"data": body_value}} + except: + json_body = {{"data": body_value}} + + # Make HTTP request + async with httpx.AsyncClient() as client: + if "{method.lower()}" == "get": + response = await client.get(url, params=params, headers=headers) + elif "{method.lower()}" == "post": + response = await client.post(url, params=params, json=json_body, headers=headers) + elif "{method.lower()}" == "put": + response = await client.put(url, params=params, json=json_body, headers=headers) + elif "{method.lower()}" == "delete": + response = await client.delete(url, params=params, headers=headers) + elif "{method.lower()}" == "patch": + response = await client.patch(url, params=params, json=json_body, headers=headers) + else: + return "Unsupported HTTP method: {method}" + + return response.text +''' + + # Execute the function code to create the actual function + local_vars = { + "httpx": httpx, + "headers": headers, + "base_url": base_url, + "path": path, + "method": method, + } + exec(func_code, local_vars) + + return local_vars["tool_function"] + + +def register_tools_from_openapi(spec: Dict[str, Any], base_url: str): + """Register MCP tools from OpenAPI specification.""" + paths = spec.get("paths", {}) + + for path, path_item in paths.items(): + for method in ["get", "post", "put", "delete", "patch"]: + if method in path_item: + operation = path_item[method] + + # Generate tool name + operation_id = operation.get( + "operationId", f"{method}_{path.replace('/', '_')}" + ) + tool_name = operation_id.replace(" ", "_").lower() + + # Get description + description = operation.get( + "summary", operation.get("description", f"{method.upper()} {path}") + ) + + # Build input schema + input_schema = build_input_schema(operation) + + # Create tool function + tool_func = create_tool_function(path, method, operation, base_url) + tool_func.__name__ = tool_name + tool_func.__doc__ = description + + # Register tool with local registry + global_mcp_tool_registry.register_tool( + name=tool_name, + description=description, + input_schema=input_schema, + handler=tool_func, + ) + verbose_logger.debug(f"Registered tool: {tool_name}") diff --git a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py index ecb960ebcf3..6a9c425a81b 100644 --- a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py +++ b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py @@ -28,6 +28,7 @@ if MCP_AVAILABLE: from litellm.proxy._experimental.mcp_server.server import ( ListMCPToolsRestAPIResponseObject, call_mcp_tool, + filter_tools_by_allowed_tools, ) ######################################################## @@ -75,6 +76,12 @@ if MCP_AVAILABLE: mcp_auth_header=server_auth_header, add_prefix=False, ) + + # Filter tools based on allowed_tools configuration + # Only filter if allowed_tools is explicitly configured (not None and not empty) + if server.allowed_tools is not None and len(server.allowed_tools) > 0: + tools = filter_tools_by_allowed_tools(tools, server) + return _create_tool_response_objects(tools, server.mcp_info) ######################################################## diff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.py index 96e4d47a914..77d6abfed62 100644 --- a/litellm/proxy/_experimental/mcp_server/server.py +++ b/litellm/proxy/_experimental/mcp_server/server.py @@ -361,22 +361,68 @@ if MCP_AVAILABLE: return allowed_mcp_servers + def _tool_name_matches(tool_name: str, filter_list: List[str]) -> bool: + """ + Check if a tool name matches any name in the filter list. + + Checks both the full tool name and unprefixed version (without server prefix). + This allows users to configure simple tool names regardless of prefixing. + + Args: + tool_name: The tool name to check (may be prefixed like "server-tool_name") + filter_list: List of tool names to match against + + Returns: + True if the tool name (prefixed or unprefixed) is in the filter list + """ + from litellm.proxy._experimental.mcp_server.utils import ( + get_server_name_prefix_tool_mcp, + ) + + # Check if the full name is in the list + if tool_name in filter_list: + return True + + # Check if the unprefixed name is in the list + unprefixed_name, _ = get_server_name_prefix_tool_mcp(tool_name) + return unprefixed_name in filter_list + def filter_tools_by_allowed_tools( tools: List[MCPTool], mcp_server: MCPServer, ) -> List[MCPTool]: """ - Filter tools by allowed tools + Filter tools by allowed/disallowed tools configuration. + + If allowed_tools is set, only tools in that list are returned. + If disallowed_tools is set, tools in that list are excluded. + Tool names are matched with and without server prefixes for flexibility. + + Args: + tools: List of tools to filter + mcp_server: Server configuration with allowed_tools/disallowed_tools + + Returns: + Filtered list of tools """ tools_to_return = tools + + # Filter by allowed_tools (whitelist) if mcp_server.allowed_tools: tools_to_return = [ - tool for tool in tools if tool.name in mcp_server.allowed_tools + tool + for tool in tools + if _tool_name_matches(tool.name, mcp_server.allowed_tools) ] + + # Filter by disallowed_tools (blacklist) if mcp_server.disallowed_tools: tools_to_return = [ - tool for tool in tools if tool.name not in mcp_server.disallowed_tools + tool + for tool in tools_to_return + if not _tool_name_matches(tool.name, mcp_server.disallowed_tools) ] + return tools_to_return async def _get_tools_from_mcp_servers( @@ -453,9 +499,19 @@ if MCP_AVAILABLE: extra_headers=extra_headers, add_prefix=add_prefix, ) - all_tools.extend(filter_tools_by_allowed_tools(tools, server)) + + filtered_tools = filter_tools_by_allowed_tools(tools, server) + + filtered_tools = await filter_tools_by_key_team_permissions( + tools=filtered_tools, + server_id=server_id, + user_api_key_auth=user_api_key_auth, + ) + + all_tools.extend(filtered_tools) + verbose_logger.debug( - f"Successfully fetched {len(tools)} tools from server {server.name}" + f"Successfully fetched {len(tools)} tools from server {server.name}, {len(filtered_tools)} after filtering" ) except Exception as e: verbose_logger.exception( @@ -466,8 +522,41 @@ if MCP_AVAILABLE: verbose_logger.info( f"Successfully fetched {len(all_tools)} tools total from all MCP servers" ) + return all_tools + async def filter_tools_by_key_team_permissions( + tools: List[MCPTool], + server_id: str, + user_api_key_auth: Optional[UserAPIKeyAuth], + ) -> List[MCPTool]: + """ + Filter tools based on key/team mcp_tool_permissions. + + Note: Tool names in the DB are stored without server prefixes, + but tool names from MCP servers are prefixed. We need to strip + the prefix before comparing. + """ + # Filter by key/team tool-level permissions + allowed_tool_names = await MCPRequestHandler.get_allowed_tools_for_server( + server_id=server_id, + user_api_key_auth=user_api_key_auth, + ) + if allowed_tool_names is not None: + # Strip prefix from tool names before comparing + # Tools are stored in DB without prefix, but come from MCP server with prefix + filtered_tools = [] + for t in tools: + # Get tool name without server prefix + unprefixed_tool_name, _ = get_server_name_prefix_tool_mcp(t.name) + if unprefixed_tool_name in allowed_tool_names: + filtered_tools.append(t) + else: + # No restrictions, return all tools + filtered_tools = tools + + return filtered_tools + async def _list_mcp_tools( user_api_key_auth: Optional[UserAPIKeyAuth] = None, mcp_auth_header: Optional[str] = None, @@ -510,30 +599,7 @@ if MCP_AVAILABLE: ) # Continue with empty managed tools list instead of failing completely - # Get tools from local registry - local_tools = [] - try: - local_tools_raw = global_mcp_tool_registry.list_tools() - - # Convert local tools to MCPTool format - for tool in local_tools_raw: - # Convert from litellm.types.mcp_server.tool_registry.MCPTool to mcp.types.Tool - mcp_tool = MCPTool( - name=tool.name, - description=tool.description, - inputSchema=tool.input_schema, - ) - local_tools.append(mcp_tool) - except Exception as e: - verbose_logger.exception( - f"Error getting tools from local registry: {str(e)}" - ) - # Continue with empty local tools list instead of failing completely - - # Combine all tools - all_tools = managed_tools + local_tools - - return all_tools + return managed_tools @client async def call_mcp_tool( @@ -594,33 +660,42 @@ if MCP_AVAILABLE: standard_logging_mcp_tool_call ) litellm_logging_obj.model = f"MCP: {name}" - # Try managed server tool first (pass the full prefixed name) - # Primary and recommended way to use MCP servers + # Check if tool exists in local registry first (for OpenAPI-based tools) + # These tools are registered with their prefixed names ######################################################### - mcp_server: Optional[MCPServer] = ( - global_mcp_server_manager._get_mcp_server_from_tool_name(name) - ) - if mcp_server: - standard_logging_mcp_tool_call["mcp_server_cost_info"] = ( - mcp_server.mcp_info or {} - ).get("mcp_server_cost_info") - response = await _handle_managed_mcp_tool( - name=name, # Pass the full name (potentially prefixed) - arguments=arguments, - 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, - litellm_logging_obj=litellm_logging_obj, - ) + local_tool = global_mcp_tool_registry.get_tool(name) + if local_tool: + verbose_logger.debug(f"Executing local registry tool: {name}") + response = await _handle_local_mcp_tool(name, arguments) - # Fall back to local tool registry (use original name) - ######################################################### - # Deprecated: Local MCP Server Tool + # Try managed MCP server tool (pass the full prefixed name) + # Primary and recommended way to use external MCP servers ######################################################### else: - response = await _handle_local_mcp_tool(original_tool_name, arguments) + mcp_server: Optional[MCPServer] = ( + global_mcp_server_manager._get_mcp_server_from_tool_name(name) + ) + if mcp_server: + standard_logging_mcp_tool_call["mcp_server_cost_info"] = ( + mcp_server.mcp_info or {} + ).get("mcp_server_cost_info") + response = await _handle_managed_mcp_tool( + name=name, # Pass the full name (potentially prefixed) + arguments=arguments, + 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, + litellm_logging_obj=litellm_logging_obj, + ) + + # Fall back to local tool registry with original name (legacy support) + ######################################################### + # Deprecated: Local MCP Server Tool + ######################################################### + else: + response = await _handle_local_mcp_tool(original_tool_name, arguments) ######################################################### # Post MCP Tool Call Hook @@ -692,14 +767,21 @@ if MCP_AVAILABLE: Handle tool execution for local registry tools Note: Local tools don't use prefixes, so we use the original name """ + import inspect + tool = global_mcp_tool_registry.get_tool(name) if not tool: raise HTTPException(status_code=404, detail=f"Tool '{name}' not found") try: - result = tool.handler(**arguments) + # Check if handler is async or sync + if inspect.iscoroutinefunction(tool.handler): + result = await tool.handler(**arguments) + else: + result = tool.handler(**arguments) return [TextContent(text=str(result), type="text")] except Exception as e: + verbose_logger.exception(f"Error executing local tool {name}: {str(e)}") return [TextContent(text=f"Error: {str(e)}", type="text")] def _get_mcp_servers_in_path(path: str) -> Optional[List[str]]: @@ -820,6 +902,7 @@ if MCP_AVAILABLE: await session_manager.handle_request(scope, receive, send) except Exception as e: + raise e verbose_logger.exception(f"Error handling MCP request: {e}") # Instead of re-raising, try to send a graceful error response try: diff --git a/litellm/proxy/_experimental/mcp_server/tool_registry.py b/litellm/proxy/_experimental/mcp_server/tool_registry.py index c08b7979683..58570aafadf 100644 --- a/litellm/proxy/_experimental/mcp_server/tool_registry.py +++ b/litellm/proxy/_experimental/mcp_server/tool_registry.py @@ -1,10 +1,18 @@ import json -from typing import Any, Callable, Dict, List, Optional +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional from litellm._logging import verbose_logger from litellm.proxy.types_utils.utils import get_instance_fn from litellm.types.mcp_server.tool_registry import MCPTool +if TYPE_CHECKING: + from mcp.types import Tool as MCPToolSDKTool +else: + try: + from mcp.types import Tool as MCPToolSDKTool + except ImportError: + MCPToolSDKTool = None # type: ignore + class MCPToolRegistry: """ @@ -39,12 +47,34 @@ class MCPToolRegistry: """ return self.tools.get(name) - def list_tools(self) -> List[MCPTool]: + def list_tools(self, tool_prefix: Optional[str] = None) -> List[MCPTool]: """ List all registered tools """ + if tool_prefix: + return [ + tool + for tool in self.tools.values() + if tool.name.startswith(tool_prefix) + ] return list(self.tools.values()) + def convert_tools_to_mcp_sdk_tool_type( + self, tools: List[MCPTool] + ) -> List["MCPToolSDKTool"]: + if MCPToolSDKTool is None: + raise ImportError( + "MCP SDK is not installed. Please install it with: pip install 'litellm[proxy]'" + ) + return [ + MCPToolSDKTool( + name=tool.name, + description=tool.description, + inputSchema=tool.input_schema, + ) + for tool in tools + ] + def load_tools_from_config( self, mcp_tools_config: Optional[Dict[str, Any]] = None ) -> None: diff --git a/litellm/proxy/_experimental/out/_next/static/WkpkdsewrdPMuTzVGS_5j/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/WkpkdsewrdPMuTzVGS_5j/_buildManifest.js deleted file mode 100644 index 96ded068de5..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/WkpkdsewrdPMuTzVGS_5j/_buildManifest.js +++ /dev/null @@ -1 +0,0 @@ -self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-28b803cb2479b966.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/ZAqshlHWdpwZy_2QG1xUf/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/ZAqshlHWdpwZy_2QG1xUf/_buildManifest.js new file mode 100644 index 00000000000..1b732be87b0 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/ZAqshlHWdpwZy_2QG1xUf/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-cf5ca766ac8f493f.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/WkpkdsewrdPMuTzVGS_5j/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/ZAqshlHWdpwZy_2QG1xUf/_ssgManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/WkpkdsewrdPMuTzVGS_5j/_ssgManifest.js rename to litellm/proxy/_experimental/out/_next/static/ZAqshlHWdpwZy_2QG1xUf/_ssgManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1052-6c4e848aed27b319.js b/litellm/proxy/_experimental/out/_next/static/chunks/1052-6c4e848aed27b319.js new file mode 100644 index 00000000000..8ab8f6ab8aa --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1052-6c4e848aed27b319.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1052],{19046:function(e,t,s){s.d(t,{Dx:function(){return r.Z},Zb:function(){return a.Z},oi:function(){return l.Z},xv:function(){return n.Z},zx:function(){return o.Z}});var o=s(20831),a=s(12514),n=s(84264),l=s(49566),r=s(96761)},31052:function(e,t,s){s.d(t,{Z:function(){return eA}});var o=s(57437),a=s(2265),n=s(243),l=s(19046),r=s(93837),i=s(64482),c=s(65319),d=s(93192),m=s(52787),g=s(89970),p=s(87908),u=s(82680),x=s(73002),h=s(26433),f=s(19250);async function b(e,t,s,o,a,n,l,r,i,c,d,m,g,p){console.log=function(){},console.log("isLocal:",!1);let u=(0,f.getProxyBaseUrl)(),x={};a&&a.length>0&&(x["x-litellm-tags"]=a.join(","));let b=new h.ZP.OpenAI({apiKey:o,baseURL:u,dangerouslyAllowBrowser:!0,defaultHeaders:x});try{let a;let x=Date.now(),h=!1,f=g&&g.length>0?[{type:"mcp",server_label:"litellm",server_url:"".concat(u,"/mcp"),require_approval:"never",allowed_tools:g,headers:{"x-litellm-api-key":"Bearer ".concat(o)}}]:void 0;for await(let o of(await b.chat.completions.create({model:s,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:c,messages:e,...d?{vector_store_ids:d}:{},...m?{guardrails:m}:{},...f?{tools:f,tool_choice:"auto"}:{}},{signal:n}))){var v,y,j,w,S,N,k,P;console.log("Stream chunk:",o);let e=null===(v=o.choices[0])||void 0===v?void 0:v.delta;if(console.log("Delta content:",null===(j=o.choices[0])||void 0===j?void 0:null===(y=j.delta)||void 0===y?void 0:y.content),console.log("Delta reasoning content:",null==e?void 0:e.reasoning_content),!h&&((null===(S=o.choices[0])||void 0===S?void 0:null===(w=S.delta)||void 0===w?void 0:w.content)||e&&e.reasoning_content)&&(h=!0,a=Date.now()-x,console.log("First token received! Time:",a,"ms"),r?(console.log("Calling onTimingData with:",a),r(a)):console.log("onTimingData callback is not defined!")),null===(k=o.choices[0])||void 0===k?void 0:null===(N=k.delta)||void 0===N?void 0:N.content){let e=o.choices[0].delta.content;t(e,o.model)}if(e&&e.image&&p&&(console.log("Image generated:",e.image),p(e.image.url,o.model)),e&&e.reasoning_content){let t=e.reasoning_content;l&&l(t)}if(o.usage&&i){console.log("Usage data found:",o.usage);let e={completionTokens:o.usage.completion_tokens,promptTokens:o.usage.prompt_tokens,totalTokens:o.usage.total_tokens};(null===(P=o.usage.completion_tokens_details)||void 0===P?void 0:P.reasoning_tokens)&&(e.reasoningTokens=o.usage.completion_tokens_details.reasoning_tokens),i(e)}}}catch(e){throw(null==n?void 0:n.aborted)&&console.log("Chat completion request was cancelled"),e}}var v=s(9114);async function y(e,t,s,o,a,n){console.log=function(){},console.log("isLocal:",!1);let l=(0,f.getProxyBaseUrl)(),r=new h.ZP.OpenAI({apiKey:o,baseURL:l,dangerouslyAllowBrowser:!0,defaultHeaders:a&&a.length>0?{"x-litellm-tags":a.join(",")}:void 0});try{let o=await r.images.generate({model:s,prompt:e},{signal:n});if(console.log(o.data),o.data&&o.data[0]){if(o.data[0].url)t(o.data[0].url,s);else if(o.data[0].b64_json){let e=o.data[0].b64_json;t("data:image/png;base64,".concat(e),s)}else throw Error("No image data found in response")}else throw Error("Invalid response format")}catch(e){throw(null==n?void 0:n.aborted)?console.log("Image generation request was cancelled"):v.Z.fromBackend("Error occurred while generating image. Please try again. Error: ".concat(e)),e}}async function j(e,t,s,o,a,n,l){console.log=function(){},console.log("isLocal:",!1);let r=(0,f.getProxyBaseUrl)(),i=new h.ZP.OpenAI({apiKey:a,baseURL:r,dangerouslyAllowBrowser:!0,defaultHeaders:n&&n.length>0?{"x-litellm-tags":n.join(",")}:void 0});try{let a=Array.isArray(e)?e:[e],n=[];for(let e=0;e1&&v.Z.success("Successfully processed ".concat(n.length," images"))}catch(e){if(console.error("Error making image edit request:",e),null==l?void 0:l.aborted)console.log("Image edits request was cancelled");else{var c;let t="Failed to edit image(s)";(null==e?void 0:null===(c=e.error)||void 0===c?void 0:c.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),v.Z.fromBackend("Image edit failed: ".concat(t))}throw e}}async function w(e,t,s,o){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],n=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0,r=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,g=arguments.length>12?arguments[12]:void 0,p=arguments.length>13?arguments[13]:void 0,u=arguments.length>14?arguments[14]:void 0,x=arguments.length>15?arguments[15]:void 0;if(!o)throw Error("API key is required");console.log=function(){};let b=(0,f.getProxyBaseUrl)(),y={};a&&a.length>0&&(y["x-litellm-tags"]=a.join(","));let j=new h.ZP.OpenAI({apiKey:o,baseURL:b,dangerouslyAllowBrowser:!0,defaultHeaders:y});try{let o=Date.now(),a=!1,h=e.map(e=>(Array.isArray(e.content),{role:e.role,content:e.content,type:"message"})),f=g&&g.length>0?[{type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never",allowed_tools:g}]:void 0,b=await j.responses.create({model:s,input:h,stream:!0,litellm_trace_id:c,...p?{previous_response_id:p}:{},...d?{vector_store_ids:d}:{},...m?{guardrails:m}:{},...f?{tools:f,tool_choice:"required"}:{}},{signal:n}),v="";for await(let e of b)if(console.log("Response event:",e),"object"==typeof e&&null!==e){var w,S,N,k,P,C,I;if(((null===(w=e.type)||void 0===w?void 0:w.startsWith("response.mcp_"))||"response.output_item.done"===e.type&&((null===(S=e.item)||void 0===S?void 0:S.type)==="mcp_list_tools"||(null===(N=e.item)||void 0===N?void 0:N.type)==="mcp_call"))&&(console.log("MCP event received:",e),x)){let t={type:e.type,sequence_number:e.sequence_number,output_index:e.output_index,item_id:e.item_id||(null===(C=e.item)||void 0===C?void 0:C.id),item:e.item,delta:e.delta,arguments:e.arguments,timestamp:Date.now()};x(t)}if("response.output_item.done"===e.type&&(null===(k=e.item)||void 0===k?void 0:k.type)==="mcp_call"&&(null===(P=e.item)||void 0===P?void 0:P.name)&&(v=e.item.name,console.log("MCP tool used:",v)),"response.role.delta"===e.type)continue;if("response.output_text.delta"===e.type&&"string"==typeof e.delta){let n=e.delta;if(console.log("Text delta",n),n.trim().length>0&&(t("assistant",n,s),!a)){a=!0;let e=Date.now()-o;console.log("First token received! Time:",e,"ms"),r&&r(e)}}if("response.reasoning.delta"===e.type&&"delta"in e){let t=e.delta;"string"==typeof t&&l&&l(t)}if("response.completed"===e.type&&"response"in e){let t=e.response,s=t.usage;if(console.log("Usage data:",s),console.log("Response completed event:",t),t.id&&u&&(console.log("Response ID for session management:",t.id),u(t.id)),s&&i){console.log("Usage data:",s);let e={completionTokens:s.output_tokens,promptTokens:s.input_tokens,totalTokens:s.total_tokens};(null===(I=s.completion_tokens_details)||void 0===I?void 0:I.reasoning_tokens)&&(e.reasoningTokens=s.completion_tokens_details.reasoning_tokens),i(e,v)}}}return b}catch(e){throw(null==n?void 0:n.aborted)?console.log("Responses API request was cancelled"):v.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}var S=s(85498);async function N(e,t,s,o){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],n=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0,r=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,g=arguments.length>12?arguments[12]:void 0;if(!o)throw Error("API key is required");console.log=function(){};let p=(0,f.getProxyBaseUrl)(),u={};a&&a.length>0&&(u["x-litellm-tags"]=a.join(","));let x=new S.ZP({apiKey:o,baseURL:p,dangerouslyAllowBrowser:!0,defaultHeaders:u});try{let a=Date.now(),u=!1,h=g&&g.length>0?[{type:"mcp",server_label:"litellm",server_url:"".concat(p,"/mcp"),require_approval:"never",allowed_tools:g,headers:{"x-litellm-api-key":"Bearer ".concat(o)}}]:void 0,f={model:s,messages:e.map(e=>({role:e.role,content:e.content})),stream:!0,max_tokens:1024,litellm_trace_id:c};for await(let e of(d&&(f.vector_store_ids=d),m&&(f.guardrails=m),h&&(f.tools=h,f.tool_choice="auto"),x.messages.stream(f,{signal:n}))){if(console.log("Stream event:",e),"content_block_delta"===e.type){let o=e.delta;if(!u){u=!0;let e=Date.now()-a;console.log("First token received! Time:",e,"ms"),r&&r(e)}"text_delta"===o.type?t("assistant",o.text,s):"reasoning_delta"===o.type&&l&&l(o.text)}if("message_delta"===e.type&&e.usage&&i){let t=e.usage;console.log("Usage data found:",t);let s={completionTokens:t.output_tokens,promptTokens:t.input_tokens,totalTokens:t.input_tokens+t.output_tokens};i(s)}}}catch(e){throw(null==n?void 0:n.aborted)?console.log("Anthropic messages request was cancelled"):v.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}var k=s(51601);async function P(e){try{return(await (0,f.mcpToolsCall)(e)).tools||[]}catch(e){return console.error("Error fetching MCP tools:",e),[]}}var C=s(49817),I=s(17906),_=s(57365),T=s(92280),Z=e=>{let{endpointType:t,onEndpointChange:s,className:a}=e,n=[{value:C.KP.CHAT,label:"/v1/chat/completions"},{value:C.KP.RESPONSES,label:"/v1/responses"},{value:C.KP.ANTHROPIC_MESSAGES,label:"/v1/messages"},{value:C.KP.IMAGE,label:"/v1/images/generations"},{value:C.KP.IMAGE_EDITS,label:"/v1/images/edits"}];return(0,o.jsxs)("div",{className:a,children:[(0,o.jsx)(T.x,{children:"Endpoint Type:"}),(0,o.jsx)(m.default,{showSearch:!0,value:t,style:{width:"100%"},onChange:s,options:n,className:"rounded-md"})]})},E=e=>{let{onChange:t,value:s,className:n,accessToken:l}=e,[r,i]=(0,a.useState)([]),[c,d]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{(async()=>{if(l)try{let e=await (0,f.tagListCall)(l);console.log("List tags response:",e),i(Object.values(e))}catch(e){console.error("Error fetching tags:",e)}})()},[]),(0,o.jsx)(m.default,{mode:"multiple",placeholder:"Select tags",onChange:t,value:s,loading:c,className:n,options:r.map(e=>({label:e.name,value:e.name,title:e.description||e.name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})},A=s(97415),U=s(67479),R=s(88658),L=s(83322),M=s(70464),D=s(77565),K=e=>{let{reasoningContent:t}=e,[s,l]=(0,a.useState)(!0);return t?(0,o.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,o.jsxs)(x.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>l(!s),icon:(0,o.jsx)(L.Z,{}),children:[s?"Hide reasoning":"Show reasoning",s?(0,o.jsx)(M.Z,{className:"ml-1"}):(0,o.jsx)(D.Z,{className:"ml-1"})]}),s&&(0,o.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,o.jsx)(n.U,{components:{code(e){let{node:t,inline:s,className:a,children:n,...l}=e,r=/language-(\w+)/.exec(a||"");return!s&&r?(0,o.jsx)(I.Z,{style:_.Z,language:r[1],PreTag:"div",className:"rounded-md my-2",...l,children:String(n).replace(/\n$/,"")}):(0,o.jsx)("code",{className:"".concat(a," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...l,children:n})}},children:t})})]}):null},z=s(5540),O=s(71282),F=s(11741),H=s(16601),B=s(58630),G=e=>{let{timeToFirstToken:t,usage:s,toolName:a}=e;return t||s?(0,o.jsxs)("div",{className:"response-metrics mt-2 pt-2 border-t border-gray-100 text-xs text-gray-500 flex flex-wrap gap-3",children:[void 0!==t&&(0,o.jsx)(g.Z,{title:"Time to first token",children:(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsx)(z.Z,{className:"mr-1"}),(0,o.jsxs)("span",{children:[(t/1e3).toFixed(2),"s"]})]})}),(null==s?void 0:s.promptTokens)!==void 0&&(0,o.jsx)(g.Z,{title:"Prompt tokens",children:(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsx)(O.Z,{className:"mr-1"}),(0,o.jsxs)("span",{children:["In: ",s.promptTokens]})]})}),(null==s?void 0:s.completionTokens)!==void 0&&(0,o.jsx)(g.Z,{title:"Completion tokens",children:(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsx)(F.Z,{className:"mr-1"}),(0,o.jsxs)("span",{children:["Out: ",s.completionTokens]})]})}),(null==s?void 0:s.reasoningTokens)!==void 0&&(0,o.jsx)(g.Z,{title:"Reasoning tokens",children:(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsx)(L.Z,{className:"mr-1"}),(0,o.jsxs)("span",{children:["Reasoning: ",s.reasoningTokens]})]})}),(null==s?void 0:s.totalTokens)!==void 0&&(0,o.jsx)(g.Z,{title:"Total tokens",children:(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsx)(H.Z,{className:"mr-1"}),(0,o.jsxs)("span",{children:["Total: ",s.totalTokens]})]})}),a&&(0,o.jsx)(g.Z,{title:"Tool used",children:(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsx)(B.Z,{className:"mr-1"}),(0,o.jsxs)("span",{children:["Tool: ",a]})]})})]}):null},q=s(53508);let{Dragger:J}=c.default;var W=e=>{let{responsesUploadedImage:t,responsesImagePreviewUrl:s,onImageUpload:a,onRemoveImage:n}=e;return(0,o.jsx)(o.Fragment,{children:!t&&(0,o.jsx)(J,{beforeUpload:a,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,o.jsx)(g.Z,{title:"Attach image or PDF",children:(0,o.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,o.jsx)(q.Z,{style:{fontSize:"16px"}})})})})})};let V=e=>new Promise((t,s)=>{let o=new FileReader;o.onload=()=>{t(o.result.split(",")[1])},o.onerror=s,o.readAsDataURL(e)}),Y=async(e,t)=>{let s=await V(t),o=t.type||(t.name.toLowerCase().endsWith(".pdf")?"application/pdf":"image/jpeg");return{role:"user",content:[{type:"input_text",text:e},{type:"input_image",image_url:"data:".concat(o,";base64,").concat(s)}]}},X=(e,t,s,o)=>{let a="";t&&o&&(a=o.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let n={role:"user",content:t?"".concat(e," ").concat(a):e};return t&&s&&(n.imagePreviewUrl=s),n},$=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl;var Q=s(50010),ee=e=>{let{message:t}=e;if(!$(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,o.jsx)("div",{className:"mb-2",children:s?(0,o.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,o.jsx)(Q.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,o.jsx)("img",{src:t.imagePreviewUrl,alt:"User uploaded image",className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px"}})})};let{Dragger:et}=c.default;var es=e=>{let{chatUploadedImage:t,chatImagePreviewUrl:s,onImageUpload:a,onRemoveImage:n}=e;return(0,o.jsx)(o.Fragment,{children:!t&&(0,o.jsx)(et,{beforeUpload:a,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,o.jsx)(g.Z,{title:"Attach image or PDF",children:(0,o.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,o.jsx)(q.Z,{style:{fontSize:"16px"}})})})})})};let eo=e=>new Promise((t,s)=>{let o=new FileReader;o.onload=()=>{t(o.result)},o.onerror=s,o.readAsDataURL(e)}),ea=async(e,t)=>({role:"user",content:[{type:"text",text:e},{type:"image_url",image_url:{url:await eo(t)}}]}),en=(e,t,s,o)=>{let a="";t&&o&&(a=o.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let n={role:"user",content:t?"".concat(e," ").concat(a):e};return t&&s&&(n.imagePreviewUrl=s),n},el=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl;var er=e=>{let{message:t}=e;if(!el(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,o.jsx)("div",{className:"mb-2",children:s?(0,o.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,o.jsx)(Q.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,o.jsx)("img",{src:t.imagePreviewUrl,alt:"User uploaded image",className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px"}})})},ei=s(63709),ec=s(15424),ed=s(23639),em=e=>{let{endpointType:t,responsesSessionId:s,useApiSessionManagement:a,onToggleSessionManagement:n}=e;return t!==C.KP.RESPONSES?null:(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Session Management"}),(0,o.jsx)(g.Z,{title:"Choose between LiteLLM API session management (using previous_response_id) or UI-based session management (using chat history)",children:(0,o.jsx)(ec.Z,{className:"text-gray-400",style:{fontSize:"12px"}})})]}),(0,o.jsx)(ei.Z,{checked:a,onChange:n,checkedChildren:"API",unCheckedChildren:"UI",size:"small"})]}),(0,o.jsxs)("div",{className:"text-xs p-2 rounded-md ".concat(s?"bg-green-50 text-green-700 border border-green-200":"bg-blue-50 text-blue-700 border border-blue-200"),children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{className:"flex items-center gap-1",children:[(0,o.jsx)(ec.Z,{style:{fontSize:"12px"}}),(()=>{if(!s)return a?"API Session: Ready":"UI Session: Ready";let e=a?"Response ID":"UI Session",t=s.slice(0,10);return"".concat(e,": ").concat(t,"...")})()]}),s&&(0,o.jsx)(g.Z,{title:(0,o.jsxs)("div",{className:"text-xs",children:[(0,o.jsx)("div",{className:"mb-1",children:"Copy response ID to continue session:"}),(0,o.jsx)("div",{className:"bg-gray-800 text-gray-100 p-2 rounded font-mono text-xs whitespace-pre-wrap",children:'curl -X POST "your-proxy-url/v1/responses" \\\n -H "Authorization: Bearer your-api-key" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "model": "your-model",\n "input": [{"role": "user", "content": "your message", "type": "message"}],\n "previous_response_id": "'.concat(s,'",\n "stream": true\n }\'')})]}),overlayStyle:{maxWidth:"500px"},children:(0,o.jsx)("button",{onClick:()=>{s&&(navigator.clipboard.writeText(s),v.Z.success("Response ID copied to clipboard!"))},className:"ml-2 p-1 hover:bg-green-100 rounded transition-colors",children:(0,o.jsx)(ed.Z,{style:{fontSize:"12px"}})})})]}),(0,o.jsx)("div",{className:"text-xs opacity-75 mt-1",children:s?a?"LiteLLM API session active - context maintained server-side":"UI session active - context maintained client-side":a?"LiteLLM will manage session using previous_response_id":"UI will manage session using chat history"})]})]})},eg=s(29),ep=s.n(eg),eu=s(44851);let{Text:ex}=d.default,{Panel:eh}=eu.default;var ef=e=>{var t,s;let{events:a,className:n}=e;if(console.log("MCPEventsDisplay: Received events:",a),!a||0===a.length)return console.log("MCPEventsDisplay: No events, returning null"),null;let l=a.find(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_list_tools"&&e.item.tools&&e.item.tools.length>0}),r=a.filter(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_call"});return(console.log("MCPEventsDisplay: toolsEvent:",l),console.log("MCPEventsDisplay: mcpCallEvents:",r),l||0!==r.length)?(0,o.jsxs)("div",{className:"jsx-32b14b04f420f3ac "+"mcp-events-display ".concat(n||""),children:[(0,o.jsx)(ep(),{id:"32b14b04f420f3ac",children:'.openai-mcp-tools.jsx-32b14b04f420f3ac{position:relative;margin:0;padding:0}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse.jsx-32b14b04f420f3ac{background:transparent!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-item.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac{padding:0 0 0 20px!important;background:transparent!important;border:none!important;font-size:14px!important;color:#9ca3af!important;font-weight:400!important;line-height:20px!important;min-height:20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac:hover{background:transparent!important;color:#6b7280!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content-box.jsx-32b14b04f420f3ac{padding:4px 0 0 20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac{position:absolute!important;left:2px!important;top:2px!important;color:#9ca3af!important;font-size:10px!important;width:16px!important;height:16px!important;display:-webkit-box!important;display:-webkit-flex!important;display:-moz-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-align:center!important;-webkit-align-items:center!important;-moz-box-align:center!important;-ms-flex-align:center!important;align-items:center!important;-webkit-box-pack:center!important;-webkit-justify-content:center!important;-moz-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac:hover{color:#6b7280!important}.openai-vertical-line.jsx-32b14b04f420f3ac{position:absolute;left:9px;top:18px;bottom:0;width:.5px;background-color:#f3f4f6;opacity:.8}.tool-item.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:13px;color:#4b5563;line-height:18px;padding:0;margin:0;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac{margin-bottom:12px;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac:last-child{margin-bottom:0}.mcp-section-header.jsx-32b14b04f420f3ac{font-size:13px;color:#6b7280;font-weight:500;margin-bottom:4px}.mcp-code-block.jsx-32b14b04f420f3ac{background:#f9fafb;border:1px solid#f3f4f6;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;padding:8px;font-size:12px}.mcp-json.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;color:#374151;margin:0;white-space:pre-wrap;word-wrap:break-word}.mcp-approved.jsx-32b14b04f420f3ac{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;color:#6b7280}.mcp-checkmark.jsx-32b14b04f420f3ac{color:#10b981;margin-right:6px;font-weight:bold}.mcp-response-content.jsx-32b14b04f420f3ac{font-size:13px;color:#374151;line-height:1.5;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace}'}),(0,o.jsxs)("div",{className:"jsx-32b14b04f420f3ac openai-mcp-tools",children:[(0,o.jsx)("div",{className:"jsx-32b14b04f420f3ac openai-vertical-line"}),(0,o.jsxs)(eu.default,{ghost:!0,size:"small",expandIconPosition:"start",defaultActiveKey:l?["list-tools"]:r.map((e,t)=>"mcp-call-".concat(t)),children:[l&&(0,o.jsx)(eh,{header:"List tools",children:(0,o.jsx)("div",{className:"jsx-32b14b04f420f3ac",children:null===(s=l.item)||void 0===s?void 0:null===(t=s.tools)||void 0===t?void 0:t.map((e,t)=>(0,o.jsx)("div",{className:"jsx-32b14b04f420f3ac tool-item",children:e.name},t))})},"list-tools"),r.map((e,t)=>{var s,a,n;return(0,o.jsx)(eh,{header:(null===(s=e.item)||void 0===s?void 0:s.name)||"Tool call",children:(0,o.jsxs)("div",{className:"jsx-32b14b04f420f3ac",children:[(0,o.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,o.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Request"}),(0,o.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-code-block",children:(null===(a=e.item)||void 0===a?void 0:a.arguments)&&(0,o.jsx)("pre",{className:"jsx-32b14b04f420f3ac mcp-json",children:(()=>{try{return JSON.stringify(JSON.parse(e.item.arguments),null,2)}catch(t){return e.item.arguments}})()})})]}),(0,o.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:(0,o.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-approved",children:[(0,o.jsx)("span",{className:"jsx-32b14b04f420f3ac mcp-checkmark",children:"✓"})," Approved"]})}),(null===(n=e.item)||void 0===n?void 0:n.output)&&(0,o.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,o.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Response"}),(0,o.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-response-content",children:e.item.output})]})]})},"mcp-call-".concat(t))})]})]})]}):(console.log("MCPEventsDisplay: No valid events found, returning null"),null)},eb=s(61935),ev=s(92403),ey=s(69993),ej=s(12660),ew=s(71891),eS=s(44625),eN=s(57400),ek=s(26430),eP=s(11894),eC=s(15883),eI=s(99890),e_=s(26349),eT=s(79276);let{TextArea:eZ}=i.default,{Dragger:eE}=c.default;var eA=e=>{let{accessToken:t,token:s,userRole:i,userID:c,disabledPersonalKeyCreation:h}=e,[f,S]=(0,a.useState)(!1),[T,L]=(0,a.useState)([]),[M,D]=(0,a.useState)(()=>{let e=sessionStorage.getItem("selectedMCPTools");try{let t=e?JSON.parse(e):[];return Array.isArray(t)?t:t?[t]:[]}catch(e){return console.error("Error parsing selectedMCPTools from sessionStorage",e),[]}}),[z,O]=(0,a.useState)(!1),[F,H]=(0,a.useState)(()=>{let e=sessionStorage.getItem("apiKeySource");if(e)try{return JSON.parse(e)}catch(e){console.error("Error parsing apiKeySource from sessionStorage",e)}return h?"custom":"session"}),[q,J]=(0,a.useState)(()=>sessionStorage.getItem("apiKey")||""),[V,$]=(0,a.useState)(""),[et,eo]=(0,a.useState)(()=>{try{let e=sessionStorage.getItem("chatHistory");return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing chatHistory from sessionStorage",e),[]}}),[el,ei]=(0,a.useState)(()=>sessionStorage.getItem("selectedModel")||void 0),[ed,eg]=(0,a.useState)(!1),[ep,eu]=(0,a.useState)([]),ex=(0,a.useRef)(null),[eh,eA]=(0,a.useState)(()=>sessionStorage.getItem("endpointType")||C.KP.CHAT),[eU,eR]=(0,a.useState)(!1),eL=(0,a.useRef)(null),[eM,eD]=(0,a.useState)(()=>{let e=sessionStorage.getItem("selectedTags");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedTags from sessionStorage",e),[]}}),[eK,ez]=(0,a.useState)(()=>{let e=sessionStorage.getItem("selectedVectorStores");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedVectorStores from sessionStorage",e),[]}}),[eO,eF]=(0,a.useState)(()=>{let e=sessionStorage.getItem("selectedGuardrails");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedGuardrails from sessionStorage",e),[]}}),[eH,eB]=(0,a.useState)(()=>sessionStorage.getItem("messageTraceId")||null),[eG,eq]=(0,a.useState)(()=>sessionStorage.getItem("responsesSessionId")||null),[eJ,eW]=(0,a.useState)(()=>{let e=sessionStorage.getItem("useApiSessionManagement");return!e||JSON.parse(e)}),[eV,eY]=(0,a.useState)([]),[eX,e$]=(0,a.useState)([]),[eQ,e0]=(0,a.useState)(null),[e1,e4]=(0,a.useState)(null),[e2,e3]=(0,a.useState)(null),[e6,e5]=(0,a.useState)(null),[e8,e7]=(0,a.useState)(!1),[e9,te]=(0,a.useState)(""),[tt,ts]=(0,a.useState)("openai"),[to,ta]=(0,a.useState)([]),tn=(0,a.useRef)(null),tl=async()=>{let e="session"===F?t:q;if(e){O(!0);try{let t=await P(e);L(t)}catch(e){console.error("Error fetching MCP tools:",e)}finally{O(!1)}}};(0,a.useEffect)(()=>{f&&tl()},[f,t,q,F]),(0,a.useEffect)(()=>{e8&&te((0,R.L)({apiKeySource:F,accessToken:t,apiKey:q,inputMessage:V,chatHistory:et,selectedTags:eM,selectedVectorStores:eK,selectedGuardrails:eO,selectedMCPTools:M,endpointType:eh,selectedModel:el,selectedSdk:tt}))},[e8,tt,F,t,q,V,et,eM,eK,eO,M,eh,el]),(0,a.useEffect)(()=>{let e=setTimeout(()=>{sessionStorage.setItem("chatHistory",JSON.stringify(et))},500);return()=>{clearTimeout(e)}},[et]),(0,a.useEffect)(()=>{sessionStorage.setItem("apiKeySource",JSON.stringify(F)),sessionStorage.setItem("apiKey",q),sessionStorage.setItem("endpointType",eh),sessionStorage.setItem("selectedTags",JSON.stringify(eM)),sessionStorage.setItem("selectedVectorStores",JSON.stringify(eK)),sessionStorage.setItem("selectedGuardrails",JSON.stringify(eO)),sessionStorage.setItem("selectedMCPTools",JSON.stringify(M)),el?sessionStorage.setItem("selectedModel",el):sessionStorage.removeItem("selectedModel"),eH?sessionStorage.setItem("messageTraceId",eH):sessionStorage.removeItem("messageTraceId"),eG?sessionStorage.setItem("responsesSessionId",eG):sessionStorage.removeItem("responsesSessionId"),sessionStorage.setItem("useApiSessionManagement",JSON.stringify(eJ))},[F,q,el,eh,eM,eK,eO,eH,eG,eJ,M]),(0,a.useEffect)(()=>{let e="session"===F?t:q;if(!e||!s||!i||!c){console.log("userApiKey or token or userRole or userID is missing = ",e,s,i,c);return}(async()=>{try{if(!e){console.log("userApiKey is missing");return}let t=await (0,k.p)(e);console.log("Fetched models:",t),eu(t);let s=t.some(e=>e.model_group===el);t.length?s||ei(t[0].model_group):ei(void 0)}catch(e){console.error("Error fetching model info:",e)}})(),tl()},[t,c,i,F,q,s]),(0,a.useEffect)(()=>{tn.current&&setTimeout(()=>{var e;null===(e=tn.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})},100)},[et]);let tr=(e,t,s)=>{console.log("updateTextUI called with:",e,t,s),eo(o=>{let a=o[o.length-1];if(!a||a.role!==e||a.isImage)return[...o,{role:e,content:t,model:s}];{var n;let e={...a,content:a.content+t,model:null!==(n=a.model)&&void 0!==n?n:s};return[...o.slice(0,-1),e]}})},ti=e=>{eo(t=>{let s=t[t.length-1];return s&&"assistant"===s.role&&!s.isImage?[...t.slice(0,t.length-1),{...s,reasoningContent:(s.reasoningContent||"")+e}]:t.length>0&&"user"===t[t.length-1].role?[...t,{role:"assistant",content:"",reasoningContent:e}]:t})},tc=e=>{console.log("updateTimingData called with:",e),eo(t=>{let s=t[t.length-1];if(console.log("Current last message:",s),s&&"assistant"===s.role){console.log("Updating assistant message with timeToFirstToken:",e);let o=[...t.slice(0,t.length-1),{...s,timeToFirstToken:e}];return console.log("Updated chat history:",o),o}return s&&"user"===s.role?(console.log("Creating new assistant message with timeToFirstToken:",e),[...t,{role:"assistant",content:"",timeToFirstToken:e}]):(console.log("No appropriate message found to update timing"),t)})},td=(e,t)=>{console.log("Received usage data:",e),eo(s=>{let o=s[s.length-1];if(o&&"assistant"===o.role){console.log("Updating message with usage data:",e);let a={...o,usage:e,toolName:t};return console.log("Updated message:",a),[...s.slice(0,s.length-1),a]}return s})},tm=e=>{console.log("Received response ID for session management:",e),eJ&&eq(e)},tg=e=>{console.log("ChatUI: Received MCP event:",e),ta(t=>{if(t.some(t=>t.item_id===e.item_id&&t.type===e.type&&t.sequence_number===e.sequence_number))return console.log("ChatUI: Duplicate MCP event, skipping"),t;let s=[...t,e];return console.log("ChatUI: Updated MCP events:",s),s})},tp=(e,t)=>{eo(s=>[...s,{role:"assistant",content:e,model:t,isImage:!0}])},tu=(e,t)=>{eo(s=>{let o=s[s.length-1];if(!o||"assistant"!==o.role||o.isImage)return[...s,{role:"assistant",content:"",model:t,image:{url:e,detail:"auto"}}];{var a;let n={...o,image:{url:e,detail:"auto"},model:null!==(a=o.model)&&void 0!==a?a:t};return[...s.slice(0,-1),n]}})},tx=e=>{eY(t=>[...t,e]);let t=URL.createObjectURL(e);return e$(e=>[...e,t]),!1},th=e=>{eX[e]&&URL.revokeObjectURL(eX[e]),eY(t=>t.filter((t,s)=>s!==e)),e$(t=>t.filter((t,s)=>s!==e))},tf=()=>{eX.forEach(e=>{URL.revokeObjectURL(e)}),eY([]),e$([])},tb=()=>{e1&&URL.revokeObjectURL(e1),e0(null),e4(null)},tv=()=>{e6&&URL.revokeObjectURL(e6),e3(null),e5(null)},ty=async()=>{let e;if(""===V.trim())return;if(eh===C.KP.IMAGE_EDITS&&0===eV.length){v.Z.fromBackend("Please upload at least one image for editing");return}if(!s||!i||!c)return;let o="session"===F?t:q;if(!o){v.Z.fromBackend("Please provide an API key or select Current UI Session");return}eL.current=new AbortController;let a=eL.current.signal;if(eh===C.KP.RESPONSES&&eQ)try{e=await Y(V,eQ)}catch(e){v.Z.fromBackend("Failed to process image. Please try again.");return}else if(eh===C.KP.CHAT&&e2)try{e=await ea(V,e2)}catch(e){v.Z.fromBackend("Failed to process image. Please try again.");return}else e={role:"user",content:V};let n=eH||(0,r.Z)();eH||eB(n),eo([...et,eh===C.KP.RESPONSES&&eQ?X(V,!0,e1||void 0,eQ.name):eh===C.KP.CHAT&&e2?en(V,!0,e6||void 0,e2.name):X(V,!1)]),ta([]),eR(!0);try{if(el){if(eh===C.KP.CHAT){let t=[...et.filter(e=>!e.isImage).map(e=>{let{role:t,content:s}=e;return{role:t,content:"string"==typeof s?s:""}}),e];await b(t,(e,t)=>tr("assistant",e,t),el,o,eM,a,ti,tc,td,n,eK.length>0?eK:void 0,eO.length>0?eO:void 0,M,tu)}else if(eh===C.KP.IMAGE)await y(V,(e,t)=>tp(e,t),el,o,eM,a);else if(eh===C.KP.IMAGE_EDITS)eV.length>0&&await j(1===eV.length?eV[0]:eV,V,(e,t)=>tp(e,t),el,o,eM,a);else if(eh===C.KP.RESPONSES){let t;t=eJ&&eG?[e]:[...et.filter(e=>!e.isImage).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e],await w(t,(e,t,s)=>tr(e,t,s),el,o,eM,a,ti,tc,td,n,eK.length>0?eK:void 0,eO.length>0?eO:void 0,M,eJ?eG:null,tm,tg)}else if(eh===C.KP.ANTHROPIC_MESSAGES){let t=[...et.filter(e=>!e.isImage).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e];await N(t,(e,t,s)=>tr(e,t,s),el,o,eM,a,ti,tc,td,n,eK.length>0?eK:void 0,eO.length>0?eO:void 0,M)}}}catch(e){a.aborted?console.log("Request was cancelled"):(console.error("Error fetching response",e),tr("assistant","Error fetching response:"+e))}finally{eR(!1),eL.current=null,eh===C.KP.IMAGE_EDITS&&tf(),eh===C.KP.RESPONSES&&eQ&&tb(),eh===C.KP.CHAT&&e2&&tv()}$("")};if(i&&"Admin Viewer"===i){let{Title:e,Paragraph:t}=d.default;return(0,o.jsxs)("div",{children:[(0,o.jsx)(e,{level:1,children:"Access Denied"}),(0,o.jsx)(t,{children:"Ask your proxy admin for access to test models"})]})}let tj=(0,o.jsx)(eb.Z,{style:{fontSize:24},spin:!0});return(0,o.jsxs)("div",{className:"w-full h-screen p-4 bg-white",children:[(0,o.jsx)(l.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,o.jsxs)("div",{className:"flex h-[80vh] w-full gap-4",children:[(0,o.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 overflow-y-auto",children:[(0,o.jsx)(l.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"Configurations"}),(0,o.jsxs)("div",{className:"space-y-4",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)(l.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,o.jsx)(ev.Z,{className:"mr-2"})," API Key Source"]}),(0,o.jsx)(m.default,{disabled:h,value:F,style:{width:"100%"},onChange:e=>{H(e)},options:[{value:"session",label:"Current UI Session"},{value:"custom",label:"Virtual Key"}],className:"rounded-md"}),"custom"===F&&(0,o.jsx)(l.oi,{className:"mt-2",placeholder:"Enter custom API key",type:"password",onValueChange:J,value:q,icon:ev.Z})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(l.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,o.jsx)(ey.Z,{className:"mr-2"})," Select Model"]}),(0,o.jsx)(m.default,{value:el,placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),ei(e),eg("custom"===e)},options:[...Array.from(new Set(ep.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%"},showSearch:!0,className:"rounded-md"}),ed&&(0,o.jsx)(l.oi,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{ex.current&&clearTimeout(ex.current),ex.current=setTimeout(()=>{ei(e)},500)}})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(l.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,o.jsx)(ej.Z,{className:"mr-2"})," Endpoint Type"]}),(0,o.jsx)(Z,{endpointType:eh,onEndpointChange:e=>{eA(e)},className:"mb-4"}),(0,o.jsx)(em,{endpointType:eh,responsesSessionId:eG,useApiSessionManagement:eJ,onToggleSessionManagement:e=>{eW(e),e||eq(null)}})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(l.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,o.jsx)(ew.Z,{className:"mr-2"})," Tags"]}),(0,o.jsx)(E,{value:eM,onChange:eD,className:"mb-4",accessToken:t||""})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(l.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,o.jsx)(B.Z,{className:"mr-2"})," MCP Tool",(0,o.jsx)(g.Z,{className:"ml-1",title:"Select MCP tools to use in your conversation, only available for /v1/responses endpoint",children:(0,o.jsx)(ec.Z,{})})]}),(0,o.jsx)(m.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP tools",value:M,onChange:e=>D(e),loading:z,className:"mb-4",allowClear:!0,optionLabelProp:"label",disabled:eh!==C.KP.RESPONSES,maxTagCount:"responsive",children:Array.isArray(T)&&T.map(e=>(0,o.jsx)(m.default.Option,{value:e.name,label:(0,o.jsx)("div",{className:"font-medium",children:e.name}),children:(0,o.jsxs)("div",{className:"flex flex-col py-1",children:[(0,o.jsx)("span",{className:"font-medium",children:e.name}),(0,o.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.name))})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(l.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,o.jsx)(eS.Z,{className:"mr-2"})," Vector Store",(0,o.jsx)(g.Z,{className:"ml-1",title:(0,o.jsxs)("span",{children:["Select vector store(s) to use for this LLM API call. You can set up your vector store"," ",(0,o.jsx)("a",{href:"?page=vector-stores",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,o.jsx)(ec.Z,{})})]}),(0,o.jsx)(A.Z,{value:eK,onChange:ez,className:"mb-4",accessToken:t||""})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(l.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,o.jsx)(eN.Z,{className:"mr-2"})," Guardrails",(0,o.jsx)(g.Z,{className:"ml-1",title:(0,o.jsxs)("span",{children:["Select guardrail(s) to use for this LLM API call. You can set up your guardrails"," ",(0,o.jsx)("a",{href:"?page=guardrails",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,o.jsx)(ec.Z,{})})]}),(0,o.jsx)(U.Z,{value:eO,onChange:eF,className:"mb-4",accessToken:t||""})]})]})]}),(0,o.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,o.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,o.jsx)(l.Dx,{className:"text-xl font-semibold mb-0",children:"Test Key"}),(0,o.jsxs)("div",{className:"flex gap-2",children:[(0,o.jsx)(l.zx,{onClick:()=>{eo([]),eB(null),eq(null),ta([]),tf(),tb(),tv(),sessionStorage.removeItem("chatHistory"),sessionStorage.removeItem("messageTraceId"),sessionStorage.removeItem("responsesSessionId"),v.Z.success("Chat history cleared.")},className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:ek.Z,children:"Clear Chat"}),(0,o.jsx)(l.zx,{onClick:()=>e7(!0),className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:eP.Z,children:"Get Code"})]})]}),(0,o.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===et.length&&(0,o.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,o.jsx)(ey.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,o.jsx)(l.xv,{children:"Start a conversation or generate an image"})]}),et.map((e,t)=>(0,o.jsx)("div",{children:(0,o.jsx)("div",{className:"mb-4 ".concat("user"===e.role?"text-right":"text-left"),children:(0,o.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===e.role?"#f0f8ff":"#ffffff",border:"user"===e.role?"1px solid #e6f0fa":"1px solid #f0f0f0",textAlign:"left"},children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,o.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===e.role?"#e6f0fa":"#f5f5f5"},children:"user"===e.role?(0,o.jsx)(eC.Z,{style:{fontSize:"12px",color:"#2563eb"}}):(0,o.jsx)(ey.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,o.jsx)("strong",{className:"text-sm capitalize",children:e.role}),"assistant"===e.role&&e.model&&(0,o.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:e.model})]}),e.reasoningContent&&(0,o.jsx)(K,{reasoningContent:e.reasoningContent}),"assistant"===e.role&&t===et.length-1&&to.length>0&&eh===C.KP.RESPONSES&&(0,o.jsx)("div",{className:"mb-3",children:(0,o.jsx)(ef,{events:to})}),(0,o.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[e.isImage?(0,o.jsx)("img",{src:"string"==typeof e.content?e.content:"",alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}}):(0,o.jsxs)(o.Fragment,{children:[eh===C.KP.RESPONSES&&(0,o.jsx)(ee,{message:e}),eh===C.KP.CHAT&&(0,o.jsx)(er,{message:e}),(0,o.jsx)(n.U,{components:{code(e){let{node:t,inline:s,className:a,children:n,...l}=e,r=/language-(\w+)/.exec(a||"");return!s&&r?(0,o.jsx)(I.Z,{style:_.Z,language:r[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(n).replace(/\n$/,"")}):(0,o.jsx)("code",{className:"".concat(a," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),style:{wordBreak:"break-word"},...l,children:n})},pre:e=>{let{node:t,...s}=e;return(0,o.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})}},children:"string"==typeof e.content?e.content:""}),e.image&&(0,o.jsx)("div",{className:"mt-3",children:(0,o.jsx)("img",{src:e.image.url,alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}})})]}),"assistant"===e.role&&(e.timeToFirstToken||e.usage)&&(0,o.jsx)(G,{timeToFirstToken:e.timeToFirstToken,usage:e.usage,toolName:e.toolName})]})]})})},t)),eU&&to.length>0&&eh===C.KP.RESPONSES&&et.length>0&&"user"===et[et.length-1].role&&(0,o.jsx)("div",{className:"text-left mb-4",children:(0,o.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"#ffffff",border:"1px solid #f0f0f0",textAlign:"left"},children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,o.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"#f5f5f5"},children:(0,o.jsx)(ey.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,o.jsx)("strong",{className:"text-sm capitalize",children:"Assistant"})]}),(0,o.jsx)(ef,{events:to})]})}),eU&&(0,o.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,o.jsx)(p.Z,{indicator:tj})}),(0,o.jsx)("div",{ref:tn,style:{height:"1px"}})]}),(0,o.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[eh===C.KP.IMAGE_EDITS&&(0,o.jsx)("div",{className:"mb-4",children:0===eV.length?(0,o.jsxs)(eE,{beforeUpload:tx,accept:"image/*",showUploadList:!1,className:"border-dashed border-2 border-gray-300 rounded-lg p-4",children:[(0,o.jsx)("p",{className:"ant-upload-drag-icon",children:(0,o.jsx)(eI.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,o.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag images to upload"}),(0,o.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for PNG, JPG, JPEG formats. Multiple images supported."})]}):(0,o.jsxs)("div",{className:"flex flex-wrap gap-2",children:[eV.map((e,t)=>(0,o.jsxs)("div",{className:"relative inline-block",children:[(0,o.jsx)("img",{src:eX[t]||"",alt:"Upload preview ".concat(t+1),className:"max-w-32 max-h-32 rounded-md border border-gray-200 object-cover"}),(0,o.jsx)("button",{className:"absolute top-1 right-1 bg-white shadow-sm border border-gray-200 rounded px-1 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:()=>th(t),children:(0,o.jsx)(e_.Z,{})})]},t)),(0,o.jsxs)("div",{className:"flex items-center justify-center w-32 h-32 border-2 border-dashed border-gray-300 rounded-md hover:border-gray-400 cursor-pointer",onClick:()=>{var e;return null===(e=document.getElementById("additional-image-upload"))||void 0===e?void 0:e.click()},children:[(0,o.jsxs)("div",{className:"text-center",children:[(0,o.jsx)(eI.Z,{style:{fontSize:"24px",color:"#666"}}),(0,o.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Add more"})]}),(0,o.jsx)("input",{id:"additional-image-upload",type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>{Array.from(e.target.files||[]).forEach(e=>tx(e))}})]})]})}),eh===C.KP.RESPONSES&&eQ&&(0,o.jsx)("div",{className:"mb-2",children:(0,o.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,o.jsx)("div",{className:"relative inline-block",children:eQ.name.toLowerCase().endsWith(".pdf")?(0,o.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,o.jsx)(Q.Z,{style:{fontSize:"16px",color:"white"}})}):(0,o.jsx)("img",{src:e1||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:eQ.name}),(0,o.jsx)("div",{className:"text-xs text-gray-500",children:eQ.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,o.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:tb,children:(0,o.jsx)(e_.Z,{style:{fontSize:"12px"}})})]})}),eh===C.KP.CHAT&&e2&&(0,o.jsx)("div",{className:"mb-2",children:(0,o.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,o.jsx)("div",{className:"relative inline-block",children:e2.name.toLowerCase().endsWith(".pdf")?(0,o.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,o.jsx)(Q.Z,{style:{fontSize:"16px",color:"white"}})}):(0,o.jsx)("img",{src:e6||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:e2.name}),(0,o.jsx)("div",{className:"text-xs text-gray-500",children:e2.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,o.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:tv,children:(0,o.jsx)(e_.Z,{style:{fontSize:"12px"}})})]})}),(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,o.jsxs)("div",{className:"flex-shrink-0 mr-2",children:[eh===C.KP.RESPONSES&&!eQ&&(0,o.jsx)(W,{responsesUploadedImage:eQ,responsesImagePreviewUrl:e1,onImageUpload:e=>(e0(e),e4(URL.createObjectURL(e)),!1),onRemoveImage:tb}),eh===C.KP.CHAT&&!e2&&(0,o.jsx)(es,{chatUploadedImage:e2,chatImagePreviewUrl:e6,onImageUpload:e=>(e3(e),e5(URL.createObjectURL(e)),!1),onRemoveImage:tv})]}),(0,o.jsx)(eZ,{value:V,onChange:e=>$(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ty())},placeholder:eh===C.KP.CHAT||eh===C.KP.RESPONSES||eh===C.KP.ANTHROPIC_MESSAGES?"Type your message... (Shift+Enter for new line)":eh===C.KP.IMAGE_EDITS?"Describe how you want to edit the image...":"Describe the image you want to generate...",disabled:eU,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,o.jsx)(l.zx,{onClick:ty,disabled:eU||!V.trim(),className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,o.jsx)(eT.Z,{style:{fontSize:"14px"}})})]}),eU&&(0,o.jsx)(l.zx,{onClick:()=>{eL.current&&(eL.current.abort(),eL.current=null,eR(!1),v.Z.info("Request cancelled"))},className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",icon:e_.Z,children:"Cancel"})]})]})]})]})}),(0,o.jsxs)(u.Z,{title:"Generated Code",visible:e8,onCancel:()=>e7(!1),footer:null,width:800,children:[(0,o.jsxs)("div",{className:"flex justify-between items-end my-4",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)(l.xv,{className:"font-medium block mb-1 text-gray-700",children:"SDK Type"}),(0,o.jsx)(m.default,{value:tt,onChange:e=>ts(e),style:{width:150},options:[{value:"openai",label:"OpenAI SDK"},{value:"azure",label:"Azure SDK"}]})]}),(0,o.jsx)(x.ZP,{onClick:()=>{navigator.clipboard.writeText(e9),v.Z.success("Copied to clipboard!")},children:"Copy to Clipboard"})]}),(0,o.jsx)(I.Z,{language:"python",style:_.Z,wrapLines:!0,wrapLongLines:!0,className:"rounded-md",customStyle:{maxHeight:"60vh",overflowY:"auto"},children:e9})]}),"custom"===F&&(0,o.jsx)(u.Z,{title:"Select MCP Tool",visible:f,onCancel:()=>S(!1),onOk:()=>{S(!1),v.Z.success("MCP tool selection updated")},width:800,children:z?(0,o.jsx)("div",{className:"flex justify-center items-center py-8",children:(0,o.jsx)(p.Z,{indicator:(0,o.jsx)(eb.Z,{style:{fontSize:24},spin:!0})})}):(0,o.jsxs)("div",{className:"space-y-4",children:[(0,o.jsx)(l.xv,{className:"text-gray-600 block mb-4",children:"Select the MCP tools you want to use in your conversation."}),(0,o.jsx)(m.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP tools",value:M,onChange:e=>D(e),optionLabelProp:"label",allowClear:!0,maxTagCount:"responsive",children:T.map(e=>(0,o.jsx)(m.default.Option,{value:e.name,label:(0,o.jsx)("div",{className:"font-medium",children:e.name}),children:(0,o.jsxs)("div",{className:"flex flex-col py-1",children:[(0,o.jsx)("span",{className:"font-medium",children:e.name}),(0,o.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.name))})]})})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1160-3efb81c958413447.js b/litellm/proxy/_experimental/out/_next/static/chunks/1160-3efb81c958413447.js new file mode 100644 index 00000000000..2a26d9fe08b --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1160-3efb81c958413447.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1160],{69993:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(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"},a=n(55015),c=o.forwardRef(function(e,t){return o.createElement(a.Z,(0,r.Z)({},e,{ref:t,icon:i}))})},14042:function(e,t,n){"use strict";n.d(t,{Z:function(){return eM}});var r=n(5853),o=n(7084),i=n(26898),a=n(97324),c=n(1153),l=n(2265),s=n(60474),u=n(47625),p=n(93765),f=n(86757),d=n.n(f),y=n(9841),m=n(81889),h=n(87602),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){x(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),x(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},j=function(e,t){var n=k(e);t&&(n=[n.reduce(function(e,t){return[].concat(A(e),A(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},w=function(e,t,n){var r=j(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(j(t.reverse(),n).slice(1))},P=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,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(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,h.Z)("recharts-polygon",n);if(r&&r.length){var c=i.stroke&&"none"!==i.stroke,s=w(t,r,o);return l.createElement("g",{className:a},l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"Z"===s.slice(-1)?i.fill:"none",stroke:"none",d:s})),c?l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"none",d:j(t,o)})):null,c?l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"none",d:j(r,o)})):null)}var u=j(t,o);return l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"Z"===u.slice(-1)?i.fill:"none",className:a,d:u}))},E=n(58811),S=n(41637),T=n(39206);function R(e){return(R="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 L(){return(L=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=I(I({},(0,v.L6)(this.props,!1)),{},{fill:"none"},(0,v.L6)(o,!1));if("circle"===i)return l.createElement(m.o,L({className:"recharts-polar-angle-axis-line"},a,{cx:t,cy:n,r:r}));var c=this.props.ticks.map(function(e){return(0,T.op)(t,n,r,e.coordinate)});return l.createElement(P,L({className:"recharts-polar-angle-axis-line"},a,{points:c}))}},{key:"renderTicks",value:function(){var e=this,t=this.props,n=t.ticks,r=t.tick,o=t.tickLine,a=t.tickFormatter,c=t.stroke,s=(0,v.L6)(this.props,!1),u=(0,v.L6)(r,!1),p=I(I({},s),{},{fill:"none"},(0,v.L6)(o,!1)),f=n.map(function(t,n){var f=e.getTickLineCoord(t),d=I(I(I({textAnchor:e.getTickTextAnchor(t)},s),{},{stroke:"none",fill:c},u),{},{index:n,payload:t,x:f.x2,y:f.y2});return l.createElement(y.m,L({className:"recharts-polar-angle-axis-tick",key:"tick-".concat(t.coordinate)},(0,S.bw)(e.props,t,n)),o&&l.createElement("line",L({className:"recharts-polar-angle-axis-tick-line"},p,f)),r&&i.renderTickItem(r,d,a?a(t.value,n):t.value))});return l.createElement(y.m,{className:"recharts-polar-angle-axis-ticks"},f)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return!(n<=0)&&t&&t.length?l.createElement(y.m,{className:"recharts-polar-angle-axis"},r&&this.renderAxisLine(),this.renderTicks()):null}}],r=[{key:"renderTickItem",value:function(e,t,n){return l.isValidElement(e)?l.cloneElement(e,t):d()(e)?e(t):l.createElement(E.x,L({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],n&&C(i.prototype,n),r&&C(i,r),Object.defineProperty(i,"prototype",{writable:!1}),i}(l.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 K=n(35802),V=n.n(K),z=n(37891),$=n.n(z),H=n(26680),q=["cx","cy","angle","ticks","axisLine"],G=["ticks","tick","angle","tickFormatter","stroke"];function Y(e){return(Y="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||(o[n]=e[n]);return o}(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 Q(e,t){for(var n=0;n0?ec()(e,"paddingAngle",0):0;if(n){var c=(0,eh.k4)(n.endAngle-n.startAngle,e.endAngle-e.startAngle),l=ek(ek({},e),{},{startAngle:i+a,endAngle:i+c(r)+a});o.push(l),i=l.endAngle}else{var s=e.endAngle,p=e.startAngle,f=(0,eh.k4)(0,s-p)(r),d=ek(ek({},e),{},{startAngle:i+a,endAngle:i+f+a});o.push(d),i=d.endAngle}}),l.createElement(y.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||!es()(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,c=t.cy,s=t.innerRadius,u=t.outerRadius,p=t.isAnimationActive,f=this.state.isAnimationFinished;if(n||!r||!r.length||!(0,eh.hj)(a)||!(0,eh.hj)(c)||!(0,eh.hj)(s)||!(0,eh.hj)(u))return null;var d=(0,h.Z)("recharts-pie",o);return l.createElement(y.m,{tabIndex:this.props.rootTabIndex,className:d,ref:function(t){e.pieRef=t}},this.renderSectors(),i&&this.renderLabels(r),H._.renderCallByParent(this.props,null,!1),(!p||f)&&ed.e.renderCallByParent(this.props,r,!1))}}],r=[{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?A:A-1)*u,x=i.reduce(function(e,t){var n=(0,ev.F$)(t,g,0);return e+((0,eh.hj)(n)?n:0)},0);return x>0&&(t=i.map(function(e,t){var r,o=(0,ev.F$)(e,g,0),i=(0,ev.F$)(e,f,t),a=((0,eh.hj)(o)?o:0)/x,s=(r=t?n.endAngle+(0,eh.uY)(v)*u*(0!==o?1:0):l)+(0,eh.uY)(v)*((0!==o?m:0)+a*O),p=(r+s)/2,d=(h.innerRadius+h.outerRadius)/2,b=[{name:i,value:o,payload:e,dataKey:g,type:y}],A=(0,T.op)(h.cx,h.cy,d,p);return n=ek(ek(ek({percent:a,cornerRadius:c,name:i,tooltipPayload:b,midAngle:p,middleRadius:d,tooltipPosition:A},e),h),{},{value:(0,ev.F$)(e,g),startAngle:r,endAngle:s,payload:e,paddingAngle:(0,eh.uY)(v)*u})})),ek(ek({},h),{},{sectors:t,data:i})});var eL=(0,p.z)({chartName:"PieChart",GraphicalChild:eR,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:B},{axisType:"radiusAxis",AxisComp:eo}],formatAxisMap:T.t9,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),eN=n(8147),eI=n(69448),eC=n(98593);let eD=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 l.createElement(eC.$B,null,l.createElement("div",{className:(0,a.q)("px-4 py-2")},l.createElement(eC.zX,{value:r(e.value),name:e.name,color:e.payload.color})))}return null},eF=(e,t)=>e.map((e,n)=>{let r=ne||t((0,c.vP)(n.map(e=>e[r]))),eZ=e=>{let{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c}=e;return l.createElement("g",null,l.createElement(s.L,{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c,fill:"",opacity:.3,style:{outline:"none"}}))},eM=l.forwardRef((e,t)=>{let{data:n=[],category:s="value",index:p="name",colors:f=i.s,variant:d="donut",valueFormatter:y=c.Cj,label:m,showLabel:h=!0,animationDuration:v=900,showAnimation:b=!1,showTooltip:g=!0,noDataText:A,onValueChange:O,customTooltip:x,className:k}=e,j=(0,r._T)(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),w="donut"==d,P=e_(m,y,n,s),[E,S]=l.useState(void 0),T=!!O;return(0,l.useEffect)(()=>{let e=document.querySelectorAll(".recharts-pie-sector");e&&e.forEach(e=>{e.setAttribute("style","outline: none")})},[E]),l.createElement("div",Object.assign({ref:t,className:(0,a.q)("w-full h-40",k)},j),l.createElement(u.h,{className:"h-full w-full"},(null==n?void 0:n.length)?l.createElement(eL,{onClick:T&&E?()=>{S(void 0),null==O||O(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},h&&w?l.createElement("text",{className:(0,a.q)("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},P):null,l.createElement(eR,{className:(0,a.q)("stroke-tremor-background dark:stroke-dark-tremor-background",O?"cursor-pointer":"cursor-default"),data:eF(n,f),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:w?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:s,nameKey:p,isAnimationActive:b,animationDuration:v,onClick:function(e,t,n){n.stopPropagation(),T&&(E===t?(S(void 0),null==O||O(null)):(S(t),null==O||O(Object.assign({eventType:"slice"},e.payload.payload))))},activeIndex:E,inactiveShape:eZ,style:{outline:"none"}}),l.createElement(eN.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:g?e=>{var t;let{active:n,payload:r}=e;return x?l.createElement(x,{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}):l.createElement(eD,{active:n,payload:r,valueFormatter:y})}:l.createElement(l.Fragment,null)})):l.createElement(eI.Z,{noDataText:A})))});eM.displayName="DonutChart"},7366:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(41154),o=n(25721),i=n(55463),a=n(99735),c=n(7656),l=n(47869);function s(e,t){if((0,c.Z)(2,arguments),!t||"object"!==(0,r.Z)(t))return new Date(NaN);var n=t.years?(0,l.Z)(t.years):0,s=t.months?(0,l.Z)(t.months):0,u=t.weeks?(0,l.Z)(t.weeks):0,p=t.days?(0,l.Z)(t.days):0,f=t.hours?(0,l.Z)(t.hours):0,d=t.minutes?(0,l.Z)(t.minutes):0,y=t.seconds?(0,l.Z)(t.seconds):0,m=(0,a.Z)(e),h=s||n?(0,i.Z)(m,s+12*n):m;return new Date((p||u?(0,o.Z)(h,p+7*u):h).getTime()+1e3*(y+60*(d+60*f)))}},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}},58710:function(e,t,n){"use strict";var r=n(2265);let o=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/117-6a9f6a591033d4a0.js b/litellm/proxy/_experimental/out/_next/static/chunks/117-6a9f6a591033d4a0.js deleted file mode 100644 index 54b5be82634..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/117-6a9f6a591033d4a0.js +++ /dev/null @@ -1,2 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[117],{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.32",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 S=new ReadableStream({start(e){r&&(r.forEach(t=>{e.enqueue(b.encode(t))}),g&&!m&&(e.close(),m=!0,r=void 0)),o=e}}),E=(0,s.createFromReadableStream)(S,{callServer:p.callServer});function w(){return(0,c.use)(E)}let T=c.default.StrictMode;function M(e){let{children:t}=e;return t}function x(){let e=(0,y.createMutableActionQueue)(),t=(0,a.jsx)(T,{children:(0,a.jsx)(f.HeadManagerContext.Provider,{value:{appDir:!0},children:(0,a.jsx)(y.ActionQueueContext.Provider,{value:e,children:(0,a.jsx)(M,{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 E},urlToUrlWithoutFlightMarker:function(){return T}});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,S=null;function E(){return S}let w={};function T(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 M(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:E,assetPrefix:T,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:E}),[n,g,f,i,r,E]),[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]),$=(0,u.useCallback)(e=>{let{previousTree:t,serverResponse:n}=e;(0,u.startTransition)(()=>{U({type:a.ACTION_SERVER_PATCH,previousTree:t,serverResponse:n})})},[U]),G=(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:M(r),locationSearch:location.search,shouldScroll:null==n||n,navigateType:t})},[U]);S=(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.")}M(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;G(e,"replace",null==(n=t.scroll)||n)})},push:(e,t)=>{void 0===t&&(t={}),(0,u.startTransition)(()=>{var n;G(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,G]);(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:$,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 S}});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 S(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:S,loading:E}=g,w=m.get(t);w||(w=new Map,m.set(t,w));let T=R[1][t][0],M=(0,_.getSegmentValue)(T),x=[T];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:!!E,loading:null==E?void 0:E[0],loadingStyles:null==E?void 0:E[1],loadingScripts:null==E?void 0:E[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:S,tree:R,childNodes:w,segmentPath:n,cacheKey:g,isActive:M===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 s}});let r=n(6866),o=n(12846),u=n(83079),l=n(24673),a=n(37207),{createFromFetch:i}=n(6671);function c(e){return[(0,o.urlToUrlWithoutFlightMarker)(e).toString(),void 0,!1,!1]}async function s(e,t,n,s,f){let d={[r.RSC_HEADER]:"1",[r.NEXT_ROUTER_STATE_TREE]:encodeURIComponent(JSON.stringify(t))};f===l.PrefetchKind.AUTO&&(d[r.NEXT_ROUTER_PREFETCH_HEADER]="1"),n&&(d[r.NEXT_URL]=n);let p=(0,a.hexHash)([d[r.NEXT_ROUTER_PREFETCH_HEADER]||"0",d[r.NEXT_ROUTER_STATE_TREE],d[r.NEXT_URL]].join(","));try{var h;let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="index.txt":t.pathname+=".txt",t.searchParams.set(r.NEXT_RSC_UNION_QUERY,p);let n=await fetch(t,{credentials:"same-origin",headers:d}),l=(0,o.urlToUrlWithoutFlightMarker)(n.url),a=n.redirected?l:void 0,f=n.headers.get("content-type")||"",y=!!n.headers.get(r.NEXT_DID_POSTPONE_HEADER),_=!!(null==(h=n.headers.get("vary"))?void 0:h.includes(r.NEXT_URL)),v=f===r.RSC_CONTENT_TYPE_HEADER;if(v||(v=f.startsWith("text/plain")),!v||!n.ok)return e.hash&&(l.hash=e.hash),c(l.toString());let[b,g]=await i(Promise.resolve(n),{callServer:u.callServer});if(s!==b)return c(n.url);return[g,a,y,_]}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(S.lastUsedTime||(S.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,E,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(S.status!==i.PrefetchCacheEntryStatus.stale||h?m=(0,s.applyFlightData)(g,u,t,S):(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),S.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 g}});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),{createFromFetch:_,encodeReply:v}=n(6671);async function b(e,t,n){let l,{actionId:a,actionArgs:i}=n,c=await v(i),s=await fetch("",{method:"POST",headers:{Accept:o.RSC_CONTENT_TYPE_HEADER,[o.ACTION]:a,[o.NEXT_ROUTER_STATE_TREE]:encodeURIComponent(JSON.stringify(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 _(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 g(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=b(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)},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,S=5,E=-1;function w(){return!(t.unstable_now()-Ee&&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(T)};else if("undefined"!=typeof MessageChannel){var M=new MessageChannel,x=M.port2;M.port1.onmessage=T,l=function(){x.postMessage(null)}}else l=function(){b(T,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":E(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(-1{let{defaultValue:n,value:d,onValueChange:v,placeholder:b="Select...",disabled:g=!1,icon:h,enableClear:x=!0,children:O,className:I}=e,y=(0,o._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","children","className"]),[S,R]=(0,r.useState)(""),[T,E]=(0,i.Z)(n,d),{reactElementChildren:C,valueToNameMapping:k}=(0,r.useMemo)(()=>{let e=r.Children.toArray(O).filter(r.isValidElement);return{reactElementChildren:e,valueToNameMapping:(0,f.sl)(e)}},[O]),M=(0,r.useMemo)(()=>(0,f.n0)(S,C),[S,C]);return r.createElement(l.h,Object.assign({as:"div",ref:t,defaultValue:T,value:T,onChange:e=>{null==v||v(e),E(e)},disabled:g,className:(0,c.q)("w-full min-w-[10rem] relative text-tremor-default",I)},y),e=>{let{value:t}=e;return r.createElement(r.Fragment,null,r.createElement(l.h.Button,{className:"w-full"},h&&r.createElement("span",{className:(0,c.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},r.createElement(h,{className:(0,c.q)(p("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),r.createElement(l.h.Input,{className:(0,c.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 text-tremor-default pr-14 border 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",h?"pl-10":"pl-3",g?"placeholder:text-tremor-content-subtle dark:placeholder:text-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-tremor-content",(0,f.um)((0,f.Uh)(t),g)),placeholder:b,onChange:e=>R(e.target.value),displayValue:e=>{var t;return null!==(t=k.get(e))&&void 0!==t?t:""}}),r.createElement("div",{className:(0,c.q)("absolute inset-y-0 right-0 flex items-center pr-2.5")},r.createElement(u.Z,{className:(0,c.q)(p("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),x&&T?r.createElement("button",{type:"button",className:(0,c.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),E(""),R(""),null==v||v("")}},r.createElement(s.Z,{className:(0,c.q)(m("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,M.length>0&&r.createElement(a.u,{className:"absolute z-10 w-full",enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},r.createElement(l.h.Options,{className:(0,c.q)("divide-y overflow-y-auto outline-none rounded-tremor-default text-tremor-default max-h-[228px] left-0 border my-1","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")},M)))})});v.displayName="SearchSelect"},70450:function(e,t,n){n.d(t,{Z:function(){return s}});var o=n(5853),r=n(2265),i=n(97324),l=n(1153),a=n(34237);let u=(0,l.fn)("SearchSelectItem"),s=r.forwardRef((e,t)=>{let{value:n,icon:l,className:s,children:c}=e,d=(0,o._T)(e,["value","icon","className","children"]);return r.createElement(a.h.Option,Object.assign({className:(0,i.q)(u("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","ui-active:bg-tremor-background-muted ui-active:text-tremor-content-strong ui-selected:text-tremor-content-strong ui-selected:bg-tremor-background-muted text-tremor-content-emphasis","dark:ui-active:bg-dark-tremor-background-muted dark:ui-active:text-dark-tremor-content-strong dark:ui-selected:text-dark-tremor-content-strong dark:ui-selected:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",s),ref:t,key:n,value:n},d),l&&r.createElement(l,{className:(0,i.q)(u("icon"),"flex-none h-5 w-5 mr-3","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}),r.createElement("span",{className:"whitespace-nowrap truncate"},null!=c?c:n))});s.displayName="SearchSelectItem"},34237:function(e,t,n){let o,r,i,l;function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0;i--){var l=e[i];if(!n.has(l.lane)){var a=r.get(l.lane);if(null==a||l.end>a.end?r.set(l.lane,l):l.end0?Math.min.apply(Math,o.pendingMeasuredCacheIndexes):0;o.pendingMeasuredCacheIndexes=[];for(var u=o.measurementsCache.slice(0,a),s=a;s0&&t>0?function(e){for(var t=e.measurements,n=e.outerSize,o=e.scrollOffset,r=t.length-1,i=O(0,r,function(e){return t[e].start},o),l=i;l=o.scrollOffset+n?"end":"start"),"start"===t||("end"===t?e-=n:"center"===t&&(e-=n/2));var r=o.options.horizontal?"scrollWidth":"scrollHeight";return Math.max(Math.min((o.scrollElement?"document"in o.scrollElement?o.scrollElement.document.documentElement[r]:o.scrollElement[r]:0)-o.getSize(),e),0)},this.getOffsetForIndex=function(e,t){void 0===t&&(t="auto"),e=Math.max(0,Math.min(e,o.options.count-1));var n=f(o.getMeasurements()[e]);if("auto"===t){if(n.end>=o.scrollOffset+o.getSize()-o.options.scrollPaddingEnd)t="end";else{if(!(n.start<=o.scrollOffset+o.options.scrollPaddingStart))return[o.scrollOffset,t];t="start"}}var r="end"===t?n.end+o.options.scrollPaddingEnd:n.start-o.options.scrollPaddingStart;return[o.getOffsetForAlignment(r,t),t]},this.isDynamicMode=function(){return o.measureElementCache.size>0},this.cancelScrollToIndex=function(){null!==o.scrollToIndexTimeoutId&&(clearTimeout(o.scrollToIndexTimeoutId),o.scrollToIndexTimeoutId=null)},this.scrollToOffset=function(e,t){var n=void 0===t?{}:t,r=n.align,i=n.behavior;o.cancelScrollToIndex(),"smooth"===i&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),o._scrollToOffset(o.getOffsetForAlignment(e,void 0===r?"start":r),{adjustments:void 0,behavior:i})},this.scrollToIndex=function(e,t){var n=void 0===t?{}:t,r=n.align,i=n.behavior;e=Math.max(0,Math.min(e,o.options.count-1)),o.cancelScrollToIndex(),"smooth"===i&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var l=o.getOffsetForIndex(e,void 0===r?"auto":r),a=l[0],u=l[1];o._scrollToOffset(a,{adjustments:void 0,behavior:i}),"smooth"!==i&&o.isDynamicMode()&&(o.scrollToIndexTimeoutId=setTimeout(function(){o.scrollToIndexTimeoutId=null,o.measureElementCache.has(o.options.getItemKey(e))&&1>Math.abs(o.getOffsetForIndex(e,u)[0]-o.scrollOffset)||o.scrollToIndex(e,{align:u,behavior:i})}))},this.scrollBy=function(e,t){var n=(void 0===t?{}:t).behavior;o.cancelScrollToIndex(),"smooth"===n&&o.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),o._scrollToOffset(o.scrollOffset+e,{adjustments:void 0,behavior:n})},this.getTotalSize=function(){var e;return((null==(e=o.getMeasurements()[o.options.count-1])?void 0:e.end)||o.options.paddingStart)-o.options.scrollMargin+o.options.paddingEnd},this._scrollToOffset=function(e,t){var n=t.adjustments,r=t.behavior;o.options.scrollToFn(e,{behavior:r,adjustments:n},o)},this.measure=function(){o.itemSizeCache=new Map,o.notify(!1)},this.setOptions(e),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(e){o.itemSizeCache.set(e.key,e.size)}),this.maybeNotify()},O=function(e,t,n,o){for(;e<=t;){var r=(e+t)/2|0,i=n(r);if(io))return r;t=r-1}}return e>0?e-1:0},I="undefined"!=typeof document?u.useLayoutEffect:u.useEffect,y=n(78138),S=n(62963),R=n(90945),T=n(13323),E=n(17684),C=n(64518),k=n(31948),M=n(32539),w=n(40048),z=n(80004),P=n(93689),F=n(15518),D=n(40293);function N(e,t){let n=(0,u.useRef)([]),o=(0,T.z)(e);(0,u.useEffect)(()=>{let e=[...n.current];for(let[r,i]of t.entries())if(n.current[r]!==i){let r=o(t,e);return n.current=t,r}},[o,...t])}var A=n(38198),_=n(37863);let L=[];!function(e){function t(){"loading"!==document.readyState&&(e(),document.removeEventListener("DOMContentLoaded",t))}"undefined"!=typeof window&&"undefined"!=typeof document&&(document.addEventListener("DOMContentLoaded",t),t())}(()=>{function e(e){e.target instanceof HTMLElement&&e.target!==document.body&&L[0]!==e.target&&(L.unshift(e.target),(L=L.filter(e=>null!=e&&e.isConnected)).splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});var V=n(47634),j=n(34778),q=n(16015),B=n(37105),K=n(56314),U=n(24536),Z=n(52108),Y=n(27847),G=n(37388),H=n(40257),W=((o=W||{})[o.Open=0]="Open",o[o.Closed=1]="Closed",o),J=((r=J||{})[r.Single=0]="Single",r[r.Multi=1]="Multi",r),Q=((i=Q||{})[i.Pointer=0]="Pointer",i[i.Focus=1]="Focus",i[i.Other=2]="Other",i),X=((l=X||{})[l.OpenCombobox=0]="OpenCombobox",l[l.CloseCombobox=1]="CloseCombobox",l[l.GoToOption=2]="GoToOption",l[l.RegisterOption=3]="RegisterOption",l[l.UnregisterOption=4]="UnregisterOption",l[l.RegisterLabel=5]="RegisterLabel",l[l.SetActivationTrigger=6]="SetActivationTrigger",l[l.UpdateVirtualOptions=7]="UpdateVirtualOptions",l);function $(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e,n=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,o=t(e.options.slice()),r=o.length>0&&null!==o[0].dataRef.current.order?o.sort((e,t)=>e.dataRef.current.order-t.dataRef.current.order):(0,B.z2)(o,e=>e.dataRef.current.domRef.current),i=n?r.indexOf(n):null;return -1===i&&(i=null),{options:r,activeOptionIndex:i}}let ee={1(e){var t;return null!=(t=e.dataRef.current)&&t.disabled||1===e.comboboxState?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if(null!=(t=e.dataRef.current)&&t.disabled||0===e.comboboxState)return e;if(null!=(n=e.dataRef.current)&&n.value){let t=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(-1!==t)return{...e,activeOptionIndex:t,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,o,r,i,l;if(null!=(n=e.dataRef.current)&&n.disabled||null!=(o=e.dataRef.current)&&o.optionsRef.current&&!(null!=(r=e.dataRef.current)&&r.optionsPropsRef.current.static)&&1===e.comboboxState)return e;if(e.virtual){let n=t.focus===j.T.Specific?t.idx:(0,j.d)(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var t,n;return null!=(n=null!=(t=e.activeOptionIndex)?t:e.virtual.options.findIndex(t=>!e.virtual.disabled(t)))?n:null},resolveDisabled:e.virtual.disabled,resolveId(){throw Error("Function not implemented.")}}),o=null!=(i=t.trigger)?i:2;return e.activeOptionIndex===n&&e.activationTrigger===o?e:{...e,activeOptionIndex:n,activationTrigger:o}}let a=$(e);if(null===a.activeOptionIndex){let e=a.options.findIndex(e=>!e.dataRef.current.disabled);-1!==e&&(a.activeOptionIndex=e)}let u=t.focus===j.T.Specific?t.idx:(0,j.d)(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled}),s=null!=(l=t.trigger)?l:2;return e.activeOptionIndex===u&&e.activationTrigger===s?e:{...e,...a,activeOptionIndex:u,activationTrigger:s}},3:(e,t)=>{var n,o,r;if(null!=(n=e.dataRef.current)&&n.virtual)return{...e,options:[...e.options,t.payload]};let i=t.payload,l=$(e,e=>(e.push(i),e));null===e.activeOptionIndex&&null!=(o=e.dataRef.current)&&o.isSelected(t.payload.dataRef.current.value)&&(l.activeOptionIndex=l.options.indexOf(i));let a={...e,...l,activationTrigger:2};return null!=(r=e.dataRef.current)&&r.__demoMode&&void 0===e.dataRef.current.value&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if(null!=(n=e.dataRef.current)&&n.virtual)return{...e,options:e.options.filter(e=>e.id!==t.id)};let o=$(e,e=>{let n=e.findIndex(e=>e.id===t.id);return -1!==n&&e.splice(n,1),e});return{...e,...o,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if((null==(n=e.virtual)?void 0:n.options)===t.options)return e;let o=e.activeOptionIndex;if(null!==e.activeOptionIndex){let n=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o=-1!==n?n:null}return{...e,activeOptionIndex:o,virtual:Object.assign({},e.virtual,{options:t.options})}}},et=(0,u.createContext)(null);function en(e){let t=(0,u.useContext)(et);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,en),t}return t}et.displayName="ComboboxActionsContext";let eo=(0,u.createContext)(null);function er(e){var t,n,o,r,i,l;let c=el("VirtualProvider"),[d,f]=(0,u.useMemo)(()=>{let e=c.optionsRef.current;if(!e)return[0,0];let t=window.getComputedStyle(e);return[parseFloat(t.paddingBlockStart||t.paddingTop),parseFloat(t.paddingBlockEnd||t.paddingBottom)]},[c.optionsRef.current]),p=(n={scrollPaddingStart:d,scrollPaddingEnd:f,count:c.virtual.options.length,estimateSize:()=>40,getScrollElement(){var e;return null!=(e=c.optionsRef.current)?e:null},overscan:12},o=a({observeElementRect:v,observeElementOffset:b,scrollToFn:h},n),r=u.useReducer(function(){return{}},{})[1],i=a({},o,{onChange:function(e,t){t?(0,s.flushSync)(r):r(),null==o.onChange||o.onChange(e,t)}}),(l=u.useState(function(){return new x(i)})[0]).setOptions(i),u.useEffect(function(){return l._didMount()},[]),I(function(){return l._willUpdate()}),l),[m,g]=(0,u.useState)(0);return(0,C.e)(()=>{g(e=>e+1)},[null==(t=c.virtual)?void 0:t.options]),u.createElement(eo.Provider,{value:p},u.createElement("div",{style:{position:"relative",width:"100%",height:"".concat(p.getTotalSize(),"px")},ref:e=>{e&&(void 0===H||void 0===H.env.JEST_WORKER_ID)&&0!==c.activationTrigger&&null!==c.activeOptionIndex&&c.virtual.options.length>c.activeOptionIndex&&p.scrollToIndex(c.activeOptionIndex)}},p.getVirtualItems().map(t=>{var n;return u.createElement(u.Fragment,{key:t.key},u.cloneElement(null==(n=e.children)?void 0:n.call(e,{option:c.virtual.options[t.index],open:0===c.comboboxState}),{key:"".concat(m,"-").concat(t.key),"data-index":t.index,"aria-setsize":c.virtual.options.length,"aria-posinset":t.index+1,style:{position:"absolute",top:0,left:0,transform:"translateY(".concat(t.start,"px)"),overflowAnchor:"none"}}))})))}let ei=(0,u.createContext)(null);function el(e){let t=(0,u.useContext)(ei);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,el),t}return t}function ea(e,t){return(0,U.E)(t.type,ee,e,t)}ei.displayName="ComboboxDataContext";let eu=u.Fragment,es=Y.AN.RenderStrategy|Y.AN.Static,ec=(0,Y.yV)(function(e,t){let{value:n,defaultValue:o,onChange:r,form:i,name:l,by:a=null,disabled:s=!1,__demoMode:c=!1,nullable:d=!1,multiple:f=!1,immediate:p=!1,virtual:m=null,...v}=e,[b=f?[]:void 0,g]=(0,S.q)(n,r,o),[h,x]=(0,u.useReducer)(ea,{dataRef:(0,u.createRef)(),comboboxState:c?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),O=(0,u.useRef)(!1),I=(0,u.useRef)({static:!1,hold:!1}),y=(0,u.useRef)(null),E=(0,u.useRef)(null),k=(0,u.useRef)(null),w=(0,u.useRef)(null),z=(0,T.z)("string"==typeof a?(e,t)=>(null==e?void 0:e[a])===(null==t?void 0:t[a]):null!=a?a:(e,t)=>e===t),P=(0,T.z)(e=>h.options.findIndex(t=>z(t.dataRef.current.value,e))),F=(0,u.useCallback)(e=>(0,U.E)(N.mode,{1:()=>b.some(t=>z(t,e)),0:()=>z(b,e)}),[b]),D=(0,T.z)(e=>h.activeOptionIndex===P(e)),N=(0,u.useMemo)(()=>({...h,immediate:!1,optionsPropsRef:I,labelRef:y,inputRef:E,buttonRef:k,optionsRef:w,value:b,defaultValue:o,disabled:s,mode:f?1:0,virtual:h.virtual,get activeOptionIndex(){if(O.current&&null===h.activeOptionIndex&&h.options.length>0){let e=h.options.findIndex(e=>!e.dataRef.current.disabled);if(-1!==e)return e}return h.activeOptionIndex},calculateIndex:P,compare:z,isSelected:F,isActive:D,nullable:d,__demoMode:c}),[b,o,s,f,d,c,h,null]);(0,C.e)(()=>{},[null,void 0]),(0,C.e)(()=>{h.dataRef.current=N},[N]),(0,M.O)([N.buttonRef,N.inputRef,N.optionsRef],()=>Q.closeCombobox(),0===N.comboboxState);let L=(0,u.useMemo)(()=>{var e,t,n;return{open:0===N.comboboxState,disabled:s,activeIndex:N.activeOptionIndex,activeOption:null===N.activeOptionIndex?null:N.virtual?N.virtual.options[null!=(e=N.activeOptionIndex)?e:0]:null!=(n=null==(t=N.options[N.activeOptionIndex])?void 0:t.dataRef.current.value)?n:null,value:b}},[N,s,b]),V=(0,T.z)(()=>{if(null!==N.activeOptionIndex){if(N.virtual)W(N.virtual.options[N.activeOptionIndex]);else{let{dataRef:e}=N.options[N.activeOptionIndex];W(e.current.value)}Q.goToOption(j.T.Specific,N.activeOptionIndex)}}),q=(0,T.z)(()=>{x({type:0}),O.current=!0}),B=(0,T.z)(()=>{x({type:1}),O.current=!1}),Z=(0,T.z)((e,t,n)=>(O.current=!1,e===j.T.Specific?x({type:2,focus:j.T.Specific,idx:t,trigger:n}):x({type:2,focus:e,trigger:n}))),G=(0,T.z)((e,t)=>(x({type:3,payload:{id:e,dataRef:t}}),()=>{N.isActive(t.current.value)&&(O.current=!0),x({type:4,id:e})})),H=(0,T.z)(e=>(x({type:5,id:e}),()=>x({type:5,id:null}))),W=(0,T.z)(e=>(0,U.E)(N.mode,{0:()=>null==g?void 0:g(e),1(){let t=N.value.slice(),n=t.findIndex(t=>z(t,e));return -1===n?t.push(e):t.splice(n,1),null==g?void 0:g(t)}})),J=(0,T.z)(e=>{x({type:6,trigger:e})}),Q=(0,u.useMemo)(()=>({onChange:W,registerOption:G,registerLabel:H,goToOption:Z,closeCombobox:B,openCombobox:q,setActivationTrigger:J,selectActiveOption:V}),[]),X=(0,u.useRef)(null),$=(0,R.G)();return(0,u.useEffect)(()=>{X.current&&void 0!==o&&$.addEventListener(X.current,"reset",()=>{null==g||g(o)})},[X,g]),u.createElement(et.Provider,{value:Q},u.createElement(ei.Provider,{value:N},u.createElement(_.up,{value:(0,U.E)(N.comboboxState,{0:_.ZM.Open,1:_.ZM.Closed})},null!=l&&null!=b&&(0,K.t)({[l]:b}).map((e,t)=>{let[n,o]=e;return u.createElement(A._,{features:A.A.Hidden,ref:0===t?e=>{var t;X.current=null!=(t=null==e?void 0:e.closest("form"))?t:null}:void 0,...(0,Y.oA)({key:n,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:i,name:n,value:o})})}),(0,Y.sY)({ourProps:null===t?{}:{ref:t},theirProps:v,slot:L,defaultTag:eu,name:"Combobox"}))))}),ed=(0,Y.yV)(function(e,t){var n;let o=el("Combobox.Button"),r=en("Combobox.Button"),i=(0,P.T)(o.buttonRef,t),l=(0,E.M)(),{id:a="headlessui-combobox-button-".concat(l),...s}=e,c=(0,R.G)(),d=(0,T.z)(e=>{switch(e.key){case G.R.ArrowDown:return e.preventDefault(),e.stopPropagation(),1===o.comboboxState&&r.openCombobox(),c.nextFrame(()=>{var e;return null==(e=o.inputRef.current)?void 0:e.focus({preventScroll:!0})});case G.R.ArrowUp:return e.preventDefault(),e.stopPropagation(),1===o.comboboxState&&(r.openCombobox(),c.nextFrame(()=>{o.value||r.goToOption(j.T.Last)})),c.nextFrame(()=>{var e;return null==(e=o.inputRef.current)?void 0:e.focus({preventScroll:!0})});case G.R.Escape:return 0!==o.comboboxState?void 0:(e.preventDefault(),o.optionsRef.current&&!o.optionsPropsRef.current.static&&e.stopPropagation(),r.closeCombobox(),c.nextFrame(()=>{var e;return null==(e=o.inputRef.current)?void 0:e.focus({preventScroll:!0})}));default:return}}),f=(0,T.z)(e=>{if((0,V.P)(e.currentTarget))return e.preventDefault();0===o.comboboxState?r.closeCombobox():(e.preventDefault(),r.openCombobox()),c.nextFrame(()=>{var e;return null==(e=o.inputRef.current)?void 0:e.focus({preventScroll:!0})})}),p=(0,y.v)(()=>{if(o.labelId)return[o.labelId,a].join(" ")},[o.labelId,a]),m=(0,u.useMemo)(()=>({open:0===o.comboboxState,disabled:o.disabled,value:o.value}),[o]),v={ref:i,id:a,type:(0,z.f)(e,o.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":null==(n=o.optionsRef.current)?void 0:n.id,"aria-expanded":0===o.comboboxState,"aria-labelledby":p,disabled:o.disabled,onClick:f,onKeyDown:d};return(0,Y.sY)({ourProps:v,theirProps:s,slot:m,defaultTag:"button",name:"Combobox.Button"})}),ef=Object.assign(ec,{Input:(0,Y.yV)(function(e,t){var n,o,r,i,l,a;let s=(0,E.M)(),{id:c="headlessui-combobox-input-".concat(s),onChange:d,displayValue:f,type:p="text",...m}=e,v=el("Combobox.Input"),b=en("Combobox.Input"),g=(0,P.T)(v.inputRef,t),h=(0,w.i)(v.inputRef),x=(0,u.useRef)(!1),O=(0,R.G)(),I=(0,T.z)(()=>{b.onChange(null),v.optionsRef.current&&(v.optionsRef.current.scrollTop=0),b.goToOption(j.T.Nothing)});N((e,t)=>{let[n,o]=e,[r,i]=t;if(x.current)return;let l=v.inputRef.current;l&&((0===i&&1===o||n!==r)&&(l.value=n),requestAnimationFrame(()=>{if(x.current||!l||(null==h?void 0:h.activeElement)!==l)return;let{selectionStart:e,selectionEnd:t}=l;0===Math.abs((null!=t?t:0)-(null!=e?e:0))&&0===e&&l.setSelectionRange(l.value.length,l.value.length)}))},["function"==typeof f&&void 0!==v.value?null!=(a=f(v.value))?a:"":"string"==typeof v.value?v.value:"",v.comboboxState,h]),N((e,t)=>{let[n]=e,[o]=t;if(0===n&&1===o){if(x.current)return;let e=v.inputRef.current;if(!e)return;let t=e.value,{selectionStart:n,selectionEnd:o,selectionDirection:r}=e;e.value="",e.value=t,null!==r?e.setSelectionRange(n,o,r):e.setSelectionRange(n,o)}},[v.comboboxState]);let S=(0,u.useRef)(!1),C=(0,T.z)(()=>{S.current=!0}),k=(0,T.z)(()=>{O.nextFrame(()=>{S.current=!1})}),M=(0,T.z)(e=>{switch(x.current=!0,e.key){case G.R.Enter:if(x.current=!1,0!==v.comboboxState||S.current)return;if(e.preventDefault(),e.stopPropagation(),null===v.activeOptionIndex){b.closeCombobox();return}b.selectActiveOption(),0===v.mode&&b.closeCombobox();break;case G.R.ArrowDown:return x.current=!1,e.preventDefault(),e.stopPropagation(),(0,U.E)(v.comboboxState,{0:()=>b.goToOption(j.T.Next),1:()=>b.openCombobox()});case G.R.ArrowUp:return x.current=!1,e.preventDefault(),e.stopPropagation(),(0,U.E)(v.comboboxState,{0:()=>b.goToOption(j.T.Previous),1:()=>{b.openCombobox(),O.nextFrame(()=>{v.value||b.goToOption(j.T.Last)})}});case G.R.Home:if(e.shiftKey)break;return x.current=!1,e.preventDefault(),e.stopPropagation(),b.goToOption(j.T.First);case G.R.PageUp:return x.current=!1,e.preventDefault(),e.stopPropagation(),b.goToOption(j.T.First);case G.R.End:if(e.shiftKey)break;return x.current=!1,e.preventDefault(),e.stopPropagation(),b.goToOption(j.T.Last);case G.R.PageDown:return x.current=!1,e.preventDefault(),e.stopPropagation(),b.goToOption(j.T.Last);case G.R.Escape:return x.current=!1,0!==v.comboboxState?void 0:(e.preventDefault(),v.optionsRef.current&&!v.optionsPropsRef.current.static&&e.stopPropagation(),v.nullable&&0===v.mode&&null===v.value&&I(),b.closeCombobox());case G.R.Tab:if(x.current=!1,0!==v.comboboxState)return;0===v.mode&&1!==v.activationTrigger&&b.selectActiveOption(),b.closeCombobox()}}),z=(0,T.z)(e=>{null==d||d(e),v.nullable&&0===v.mode&&""===e.target.value&&I(),b.openCombobox()}),F=(0,T.z)(e=>{var t,n,o;let r=null!=(t=e.relatedTarget)?t:L.find(t=>t!==e.currentTarget);if(x.current=!1,!(null!=(n=v.optionsRef.current)&&n.contains(r))&&!(null!=(o=v.buttonRef.current)&&o.contains(r))&&0===v.comboboxState)return e.preventDefault(),0===v.mode&&(v.nullable&&null===v.value?I():1!==v.activationTrigger&&b.selectActiveOption()),b.closeCombobox()}),D=(0,T.z)(e=>{var t,n,o;let r=null!=(t=e.relatedTarget)?t:L.find(t=>t!==e.currentTarget);null!=(n=v.buttonRef.current)&&n.contains(r)||null!=(o=v.optionsRef.current)&&o.contains(r)||v.disabled||v.immediate&&0!==v.comboboxState&&(b.openCombobox(),O.nextFrame(()=>{b.setActivationTrigger(1)}))}),A=(0,y.v)(()=>{if(v.labelId)return[v.labelId].join(" ")},[v.labelId]),_=(0,u.useMemo)(()=>({open:0===v.comboboxState,disabled:v.disabled}),[v]),V={ref:g,id:c,role:"combobox",type:p,"aria-controls":null==(n=v.optionsRef.current)?void 0:n.id,"aria-expanded":0===v.comboboxState,"aria-activedescendant":null===v.activeOptionIndex?void 0:v.virtual?null==(o=v.options.find(e=>{var t;return!(null!=(t=v.virtual)&&t.disabled(e.dataRef.current.value))&&v.compare(e.dataRef.current.value,v.virtual.options[v.activeOptionIndex])}))?void 0:o.id:null==(r=v.options[v.activeOptionIndex])?void 0:r.id,"aria-labelledby":A,"aria-autocomplete":"list",defaultValue:null!=(l=null!=(i=e.defaultValue)?i:void 0!==v.defaultValue?null==f?void 0:f(v.defaultValue):null)?l:v.defaultValue,disabled:v.disabled,onCompositionStart:C,onCompositionEnd:k,onKeyDown:M,onChange:z,onFocus:D,onBlur:F};return(0,Y.sY)({ourProps:V,theirProps:m,slot:_,defaultTag:"input",name:"Combobox.Input"})}),Button:ed,Label:(0,Y.yV)(function(e,t){let n=(0,E.M)(),{id:o="headlessui-combobox-label-".concat(n),...r}=e,i=el("Combobox.Label"),l=en("Combobox.Label"),a=(0,P.T)(i.labelRef,t);(0,C.e)(()=>l.registerLabel(o),[o]);let s=(0,T.z)(()=>{var e;return null==(e=i.inputRef.current)?void 0:e.focus({preventScroll:!0})}),c=(0,u.useMemo)(()=>({open:0===i.comboboxState,disabled:i.disabled}),[i]);return(0,Y.sY)({ourProps:{ref:a,id:o,onClick:s},theirProps:r,slot:c,defaultTag:"label",name:"Combobox.Label"})}),Options:(0,Y.yV)(function(e,t){let n=(0,E.M)(),{id:o="headlessui-combobox-options-".concat(n),hold:r=!1,...i}=e,l=el("Combobox.Options"),a=(0,P.T)(l.optionsRef,t),s=(0,_.oJ)(),c=null!==s?(s&_.ZM.Open)===_.ZM.Open:0===l.comboboxState;(0,C.e)(()=>{var t;l.optionsPropsRef.current.static=null!=(t=e.static)&&t},[l.optionsPropsRef,e.static]),(0,C.e)(()=>{l.optionsPropsRef.current.hold=r},[l.optionsPropsRef,r]),function(e){let{container:t,accept:n,walk:o,enabled:r=!0}=e,i=(0,u.useRef)(n),l=(0,u.useRef)(o);(0,u.useEffect)(()=>{i.current=n,l.current=o},[n,o]),(0,C.e)(()=>{if(!t||!r)return;let e=(0,D.r)(t);if(!e)return;let n=i.current,o=l.current,a=Object.assign(e=>n(e),{acceptNode:n}),u=e.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,a,!1);for(;u.nextNode();)o(u.currentNode)},[t,r,i,l])}({container:l.optionsRef.current,enabled:0===l.comboboxState,accept:e=>"option"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let d=(0,y.v)(()=>{var e,t;return null!=(t=l.labelId)?t:null==(e=l.buttonRef.current)?void 0:e.id},[l.labelId,l.buttonRef.current]),f=(0,u.useMemo)(()=>({open:0===l.comboboxState,option:void 0}),[l]),p={"aria-labelledby":d,role:"listbox","aria-multiselectable":1===l.mode||void 0,id:o,ref:a};return l.virtual&&0===l.comboboxState&&Object.assign(i,{children:u.createElement(er,null,i.children)}),(0,Y.sY)({ourProps:p,theirProps:i,slot:f,defaultTag:"ul",features:es,visible:c,name:"Combobox.Options"})}),Option:(0,Y.yV)(function(e,t){var n;let o=(0,E.M)(),{id:r="headlessui-combobox-option-".concat(o),disabled:i=!1,value:l,order:a=null,...s}=e,c=el("Combobox.Option"),d=en("Combobox.Option"),f=c.virtual?c.activeOptionIndex===c.calculateIndex(l):null!==c.activeOptionIndex&&(null==(n=c.options[c.activeOptionIndex])?void 0:n.id)===r,p=c.isSelected(l),m=(0,u.useRef)(null),v=(0,k.E)({disabled:i,value:l,domRef:m,order:a}),b=(0,u.useContext)(eo),g=(0,P.T)(t,m,b?b.measureElement:null),h=(0,T.z)(()=>d.onChange(l));(0,C.e)(()=>d.registerOption(r,v),[v,r]);let x=(0,u.useRef)(!(c.virtual||c.__demoMode));(0,C.e)(()=>{if(!c.virtual||!c.__demoMode)return;let e=(0,q.k)();return e.requestAnimationFrame(()=>{x.current=!0}),e.dispose},[c.virtual,c.__demoMode]),(0,C.e)(()=>{if(!x.current||0!==c.comboboxState||!f||0===c.activationTrigger)return;let e=(0,q.k)();return e.requestAnimationFrame(()=>{var e,t;null==(t=null==(e=m.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})}),e.dispose},[m,f,c.comboboxState,c.activationTrigger,c.activeOptionIndex]);let O=(0,T.z)(e=>{var t;if(i||null!=(t=c.virtual)&&t.disabled(l))return e.preventDefault();h(),(0,Z.tq)()||requestAnimationFrame(()=>{var e;return null==(e=c.inputRef.current)?void 0:e.focus({preventScroll:!0})}),0===c.mode&&requestAnimationFrame(()=>d.closeCombobox())}),I=(0,T.z)(()=>{var e;if(i||null!=(e=c.virtual)&&e.disabled(l))return d.goToOption(j.T.Nothing);let t=c.calculateIndex(l);d.goToOption(j.T.Specific,t)}),y=(0,F.g)(),S=(0,T.z)(e=>y.update(e)),R=(0,T.z)(e=>{var t;if(!y.wasMoved(e)||i||null!=(t=c.virtual)&&t.disabled(l)||f)return;let n=c.calculateIndex(l);d.goToOption(j.T.Specific,n,0)}),M=(0,T.z)(e=>{var t;y.wasMoved(e)&&(i||null!=(t=c.virtual)&&t.disabled(l)||f&&(c.optionsPropsRef.current.hold||d.goToOption(j.T.Nothing)))}),w=(0,u.useMemo)(()=>({active:f,selected:p,disabled:i}),[f,p,i]);return(0,Y.sY)({ourProps:{id:r,ref:g,role:"option",tabIndex:!0===i?void 0:-1,"aria-disabled":!0===i||void 0,"aria-selected":p,disabled:void 0,onClick:O,onFocus:I,onPointerEnter:S,onMouseEnter:S,onPointerMove:R,onMouseMove:R,onPointerLeave:M,onMouseLeave:M},theirProps:s,slot:w,defaultTag:"li",name:"Combobox.Option"})})})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1264-2979d95e0b56a75c.js b/litellm/proxy/_experimental/out/_next/static/chunks/1264-2979d95e0b56a75c.js new file mode 100644 index 00000000000..fd249f9de97 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1264-2979d95e0b56a75c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1264],{87045:function(t,e,s){s.d(e,{j:function(){return n}});var i=s(24112),r=s(45345),n=new class extends i.l{#t;#e;#s;constructor(){super(),this.#s=t=>{if(!r.sk&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return"boolean"==typeof this.#t?this.#t:globalThis.document?.visibilityState!=="hidden"}}},2894:function(t,e,s){s.d(e,{R:function(){return u},m:function(){return a}});var i=s(18238),r=s(7989),n=s(11255),a=class extends r.F{#i;#r;#n;constructor(t){super(),this.mutationId=t.mutationId,this.#r=t.mutationCache,this.#i=[],this.state=t.state||u(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#i.includes(t)||(this.#i.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#i=this.#i.filter(e=>e!==t),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#i.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(t){this.#n=(0,n.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#a({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let e="pending"===this.state.status,s=!this.#n.canStart();try{if(!e){this.#a({type:"pending",variables:t,isPaused:s}),await this.#r.config.onMutate?.(t,this);let e=await this.options.onMutate?.(t);e!==this.state.context&&this.#a({type:"pending",context:e,variables:t,isPaused:s})}let i=await this.#n.start();return await this.#r.config.onSuccess?.(i,t,this.state.context,this),await this.options.onSuccess?.(i,t,this.state.context),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(i,null,t,this.state.context),this.#a({type:"success",data:i}),i}catch(e){try{throw await this.#r.config.onError?.(e,t,this.state.context,this),await this.options.onError?.(e,t,this.state.context),await this.#r.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,e,t,this.state.context),e}finally{this.#a({type:"error",error:e})}}finally{this.#r.runNext(this)}}#a(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),i.V.batch(()=>{this.#i.forEach(e=>{e.onMutationUpdate(t)}),this.#r.notify({mutation:this,type:"updated",action:t})})}};function u(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},18238:function(t,e,s){s.d(e,{V:function(){return i}});var i=function(){let t=[],e=0,s=t=>{t()},i=t=>{t()},r=t=>setTimeout(t,0),n=i=>{e?t.push(i):r(()=>{s(i)})},a=()=>{let e=t;t=[],e.length&&r(()=>{i(()=>{e.forEach(t=>{s(t)})})})};return{batch:t=>{let s;e++;try{s=t()}finally{--e||a()}return s},batchCalls:t=>(...e)=>{n(()=>{t(...e)})},schedule:n,setNotifyFunction:t=>{s=t},setBatchNotifyFunction:t=>{i=t},setScheduler:t=>{r=t}}}()},57853:function(t,e,s){s.d(e,{N:function(){return n}});var i=s(24112),r=s(45345),n=new class extends i.l{#u=!0;#e;#s;constructor(){super(),this.#s=t=>{if(!r.sk&&window.addEventListener){let e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#u!==t&&(this.#u=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#u}}},21733:function(t,e,s){s.d(e,{A:function(){return u},z:function(){return o}});var i=s(45345),r=s(18238),n=s(11255),a=s(7989),u=class extends a.F{#o;#h;#c;#n;#l;#d;constructor(t){super(),this.#d=!1,this.#l=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#c=t.cache,this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#o=function(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,s=void 0!==e,i=s?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=t.state??this.#o,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(t){this.options={...this.#l,...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#c.remove(this)}setData(t,e){let s=(0,i.oE)(this.state.data,t,this.options);return this.#a({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#a({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(i.ZT).catch(i.ZT):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#o)}isActive(){return this.observers.some(t=>!1!==(0,i.Nc)(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===i.CN||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data)}isStaleByTime(t=0){return this.state.isInvalidated||void 0===this.state.data||!(0,i.Kp)(this.state.dataUpdatedAt,t)}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#c.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#n&&(this.#d?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#c.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#a({type:"invalidate"})}fetch(t,e){if("idle"!==this.state.fetchStatus){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let s=new AbortController,r=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#d=!0,s.signal)})},a={fetchOptions:e,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>{let t=(0,i.cG)(this.options,e),s={queryKey:this.queryKey,meta:this.meta};return(r(s),this.#d=!1,this.options.persister)?this.options.persister(t,s,this):t(s)}};r(a),this.options.behavior?.onFetch(a,this),this.#h=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#a({type:"fetch",meta:a.fetchOptions?.meta});let u=t=>{(0,n.DV)(t)&&t.silent||this.#a({type:"error",error:t}),(0,n.DV)(t)||(this.#c.config.onError?.(t,this),this.#c.config.onSettled?.(this.state.data,t,this)),this.scheduleGc()};return this.#n=(0,n.Mz)({initialPromise:e?.initialPromise,fn:a.fetchFn,abort:s.abort.bind(s),onSuccess:t=>{if(void 0===t){u(Error(`${this.queryHash} data is undefined`));return}try{this.setData(t)}catch(t){u(t);return}this.#c.config.onSuccess?.(t,this),this.#c.config.onSettled?.(t,this.state.error,this),this.scheduleGc()},onError:u,onFail:(t,e)=>{this.#a({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),this.#n.start()}#a(t){this.state=(e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...o(e.data,this.options),fetchMeta:t.meta??null};case"success":return{...e,data:t.data,dataUpdateCount:e.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let s=t.error;if((0,n.DV)(s)&&s.revert&&this.#h)return{...this.#h,fetchStatus:"idle"};return{...e,error:s,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}})(this.state),r.V.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#c.notify({query:this,type:"updated",action:t})})}};function o(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,n.Kw)(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}},21623:function(t,e,s){s.d(e,{S:function(){return y}});var i=s(45345),r=s(21733),n=s(18238),a=s(24112),u=class extends a.l{constructor(t={}){super(),this.config=t,this.#f=new Map}#f;build(t,e,s){let n=e.queryKey,a=e.queryHash??(0,i.Rm)(n,e),u=this.get(a);return u||(u=new r.A({cache:this,queryKey:n,queryHash:a,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(n)}),this.add(u)),u}add(t){this.#f.has(t.queryHash)||(this.#f.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#f.get(t.queryHash);e&&(t.destroy(),e===t&&this.#f.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){n.V.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#f.get(t)}getAll(){return[...this.#f.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,i._x)(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>(0,i._x)(t,e)):e}notify(t){n.V.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){n.V.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){n.V.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},o=s(2894),h=class extends a.l{constructor(t={}){super(),this.config=t,this.#p=new Set,this.#y=new Map,this.#m=0}#p;#y;#m;build(t,e,s){let i=new o.m({mutationCache:this,mutationId:++this.#m,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#p.add(t);let e=c(t);if("string"==typeof e){let s=this.#y.get(e);s?s.push(t):this.#y.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#p.delete(t)){let e=c(t);if("string"==typeof e){let s=this.#y.get(e);if(s){if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#y.delete(e)}}}this.notify({type:"removed",mutation:t})}canRun(t){let e=c(t);if("string"!=typeof e)return!0;{let s=this.#y.get(e),i=s?.find(t=>"pending"===t.state.status);return!i||i===t}}runNext(t){let e=c(t);if("string"!=typeof e)return Promise.resolve();{let s=this.#y.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){n.V.batch(()=>{this.#p.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#p.clear(),this.#y.clear()})}getAll(){return Array.from(this.#p)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,i.X7)(e,t))}findAll(t={}){return this.getAll().filter(e=>(0,i.X7)(t,e))}notify(t){n.V.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return n.V.batch(()=>Promise.all(t.map(t=>t.continue().catch(i.ZT))))}};function c(t){return t.options.scope?.id}var l=s(87045),d=s(57853);function f(t){return{onFetch:(e,s)=>{let r=e.options,n=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],u=e.state.data?.pageParams||[],o={pages:[],pageParams:[]},h=0,c=async()=>{let s=!1,c=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(e.signal.aborted?s=!0:e.signal.addEventListener("abort",()=>{s=!0}),e.signal)})},l=(0,i.cG)(e.options,e.fetchOptions),d=async(t,r,n)=>{if(s)return Promise.reject();if(null==r&&t.pages.length)return Promise.resolve(t);let a={queryKey:e.queryKey,pageParam:r,direction:n?"backward":"forward",meta:e.options.meta};c(a);let u=await l(a),{maxPages:o}=e.options,h=n?i.Ht:i.VX;return{pages:h(t.pages,u,o),pageParams:h(t.pageParams,r,o)}};if(n&&a.length){let t="backward"===n,e={pages:a,pageParams:u},s=(t?function(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}:p)(r,e);o=await d(e,s,t)}else{let e=t??a.length;do{let t=0===h?u[0]??r.initialPageParam:p(r,o);if(h>0&&null==t)break;o=await d(o,t),h++}while(he.options.persister?.(c,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=c}}}function p(t,{pages:e,pageParams:s}){let i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}var y=class{#v;#r;#l;#b;#g;#C;#O;#R;constructor(t={}){this.#v=t.queryCache||new u,this.#r=t.mutationCache||new h,this.#l=t.defaultOptions||{},this.#b=new Map,this.#g=new Map,this.#C=0}mount(){this.#C++,1===this.#C&&(this.#O=l.j.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#v.onFocus())}),this.#R=d.N.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#v.onOnline())}))}unmount(){this.#C--,0===this.#C&&(this.#O?.(),this.#O=void 0,this.#R?.(),this.#R=void 0)}isFetching(t){return this.#v.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#r.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#v.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#v.build(this,e),r=s.state.data;return void 0===r?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime((0,i.KC)(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#v.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),n=this.#v.get(r.queryHash),a=n?.state.data,u=(0,i.SE)(e,a);if(void 0!==u)return this.#v.build(this,r).setData(u,{...s,manual:!0})}setQueriesData(t,e,s){return n.V.batch(()=>this.#v.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#v.get(e.queryHash)?.state}removeQueries(t){let e=this.#v;n.V.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#v,i={type:"active",...t};return n.V.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries(i,e)))}cancelQueries(t,e={}){let s={revert:!0,...e};return Promise.all(n.V.batch(()=>this.#v.findAll(t).map(t=>t.cancel(s)))).then(i.ZT).catch(i.ZT)}invalidateQueries(t,e={}){return n.V.batch(()=>{if(this.#v.findAll(t).forEach(t=>{t.invalidate()}),t?.refetchType==="none")return Promise.resolve();let s={...t,type:t?.refetchType??t?.type??"active"};return this.refetchQueries(s,e)})}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0};return Promise.all(n.V.batch(()=>this.#v.findAll(t).filter(t=>!t.isDisabled()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(i.ZT)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(i.ZT)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#v.build(this,e);return s.isStaleByTime((0,i.KC)(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(i.ZT).catch(i.ZT)}fetchInfiniteQuery(t){return t.behavior=f(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(i.ZT).catch(i.ZT)}ensureInfiniteQueryData(t){return t.behavior=f(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return d.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#v}getMutationCache(){return this.#r}getDefaultOptions(){return this.#l}setDefaultOptions(t){this.#l=t}setQueryDefaults(t,e){this.#b.set((0,i.Ym)(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#b.values()],s={};return e.forEach(e=>{(0,i.to)(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#g.set((0,i.Ym)(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#g.values()],s={};return e.forEach(e=>{(0,i.to)(t,e.mutationKey)&&(s={...s,...e.defaultOptions})}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#l.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=(0,i.Rm)(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===i.CN&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#l.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#v.clear(),this.#r.clear()}}},7989:function(t,e,s){s.d(e,{F:function(){return r}});var i=s(45345),r=class{#w;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,i.PN)(this.gcTime)&&(this.#w=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(i.sk?1/0:3e5))}clearGcTimeout(){this.#w&&(clearTimeout(this.#w),this.#w=void 0)}}},11255:function(t,e,s){s.d(e,{DV:function(){return c},Kw:function(){return o},Mz:function(){return l}});var i=s(87045),r=s(57853),n=s(16803),a=s(45345);function u(t){return Math.min(1e3*2**t,3e4)}function o(t){return(t??"online")!=="online"||r.N.isOnline()}var h=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function c(t){return t instanceof h}function l(t){let e,s=!1,c=0,l=!1,d=(0,n.O)(),f=()=>i.j.isFocused()&&("always"===t.networkMode||r.N.isOnline())&&t.canRun(),p=()=>o(t.networkMode)&&t.canRun(),y=s=>{l||(l=!0,t.onSuccess?.(s),e?.(),d.resolve(s))},m=s=>{l||(l=!0,t.onError?.(s),e?.(),d.reject(s))},v=()=>new Promise(s=>{e=t=>{(l||f())&&s(t)},t.onPause?.()}).then(()=>{e=void 0,l||t.onContinue?.()}),b=()=>{let e;if(l)return;let i=0===c?t.initialPromise:void 0;try{e=i??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(y).catch(e=>{if(l)return;let i=t.retry??(a.sk?0:3),r=t.retryDelay??u,n="function"==typeof r?r(c,e):r,o=!0===i||"number"==typeof i&&cf()?void 0:v()).then(()=>{s?m(e):b()})})};return{promise:d,cancel:e=>{l||(m(new h(e)),t.abort?.())},continue:()=>(e?.(),d),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:p,start:()=>(p()?b():v().then(b),d)}}},24112:function(t,e,s){s.d(e,{l:function(){return i}});var i=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},16803:function(t,e,s){s.d(e,{O:function(){return i}});function i(){let t,e;let s=new Promise((s,i)=>{t=s,e=i});function i(t){Object.assign(s,t),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=e=>{i({status:"fulfilled",value:e}),t(e)},s.reject=t=>{i({status:"rejected",reason:t}),e(t)},s}},45345:function(t,e,s){s.d(e,{CN:function(){return w},Ht:function(){return R},KC:function(){return o},Kp:function(){return u},Nc:function(){return h},PN:function(){return a},Rm:function(){return d},SE:function(){return n},VS:function(){return y},VX:function(){return O},X7:function(){return l},Ym:function(){return f},ZT:function(){return r},_v:function(){return g},_x:function(){return c},cG:function(){return S},oE:function(){return C},sk:function(){return i},to:function(){return p}});var i="undefined"==typeof window||"Deno"in globalThis;function r(){}function n(t,e){return"function"==typeof t?t(e):t}function a(t){return"number"==typeof t&&t>=0&&t!==1/0}function u(t,e){return Math.max(t+(e||0)-Date.now(),0)}function o(t,e){return"function"==typeof t?t(e):t}function h(t,e){return"function"==typeof t?t(e):t}function c(t,e){let{type:s="all",exact:i,fetchStatus:r,predicate:n,queryKey:a,stale:u}=t;if(a){if(i){if(e.queryHash!==d(a,e.options))return!1}else if(!p(e.queryKey,a))return!1}if("all"!==s){let t=e.isActive();if("active"===s&&!t||"inactive"===s&&t)return!1}return("boolean"!=typeof u||e.isStale()===u)&&(!r||r===e.state.fetchStatus)&&(!n||!!n(e))}function l(t,e){let{exact:s,status:i,predicate:r,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(f(e.options.mutationKey)!==f(n))return!1}else if(!p(e.options.mutationKey,n))return!1}return(!i||e.state.status===i)&&(!r||!!r(e))}function d(t,e){return(e?.queryKeyHashFn||f)(t)}function f(t){return JSON.stringify(t,(t,e)=>v(e)?Object.keys(e).sort().reduce((t,s)=>(t[s]=e[s],t),{}):e)}function p(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&!Object.keys(e).some(s=>!p(t[s],e[s]))}function y(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}function m(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function v(t){if(!b(t))return!1;let e=t.constructor;if(void 0===e)return!0;let s=e.prototype;return!!(b(s)&&s.hasOwnProperty("isPrototypeOf"))&&Object.getPrototypeOf(t)===Object.prototype}function b(t){return"[object Object]"===Object.prototype.toString.call(t)}function g(t){return new Promise(e=>{setTimeout(e,t)})}function C(t,e,s){return"function"==typeof s.structuralSharing?s.structuralSharing(t,e):!1!==s.structuralSharing?function t(e,s){if(e===s)return e;let i=m(e)&&m(s);if(i||v(e)&&v(s)){let r=i?e:Object.keys(e),n=r.length,a=i?s:Object.keys(s),u=a.length,o=i?[]:{},h=0;for(let n=0;ns?i.slice(1):i}function R(t,e,s=0){let i=[e,...t];return s&&i.length>s?i.slice(0,-1):i}var w=Symbol();function S(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==w?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}},16593:function(t,e,s){let i;s.d(e,{a:function(){return E}});var r=s(87045),n=s(18238),a=s(21733),u=s(24112),o=s(16803),h=s(45345),c=class extends u.l{constructor(t,e){super(),this.options=e,this.#S=t,this.#Q=null,this.#q=(0,o.O)(),this.options.experimental_prefetchInRender||this.#q.reject(Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(e)}#S;#F=void 0;#P=void 0;#E=void 0;#T;#D;#q;#Q;#I;#x;#A;#M;#k;#U;#j=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#F.addObserver(this),l(this.#F,this.options)?this.#K():this.updateResult(),this.#N())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return d(this.#F,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return d(this.#F,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#V(),this.#L(),this.#F.removeObserver(this)}setOptions(t,e){let s=this.options,i=this.#F;if(this.options=this.#S.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,h.Nc)(this.options.enabled,this.#F))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#_(),this.#F.setOptions(this.options),s._defaulted&&!(0,h.VS)(this.options,s)&&this.#S.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#F,observer:this});let r=this.hasListeners();r&&f(this.#F,i,this.options,s)&&this.#K(),this.updateResult(e),r&&(this.#F!==i||(0,h.Nc)(this.options.enabled,this.#F)!==(0,h.Nc)(s.enabled,this.#F)||(0,h.KC)(this.options.staleTime,this.#F)!==(0,h.KC)(s.staleTime,this.#F))&&this.#H();let n=this.#G();r&&(this.#F!==i||(0,h.Nc)(this.options.enabled,this.#F)!==(0,h.Nc)(s.enabled,this.#F)||n!==this.#U)&&this.#Z(n)}getOptimisticResult(t){let e=this.#S.getQueryCache().build(this.#S,t),s=this.createResult(e,t);return(0,h.VS)(this.getCurrentResult(),s)||(this.#E=s,this.#D=this.options,this.#T=this.#F.state),s}getCurrentResult(){return this.#E}trackResult(t,e){let s={};return Object.keys(t).forEach(i=>{Object.defineProperty(s,i,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(i),e?.(i),t[i])})}),s}trackProp(t){this.#j.add(t)}getCurrentQuery(){return this.#F}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#S.defaultQueryOptions(t),s=this.#S.getQueryCache().build(this.#S,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#K({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#E))}#K(t){this.#_();let e=this.#F.fetch(this.options,t);return t?.throwOnError||(e=e.catch(h.ZT)),e}#H(){this.#V();let t=(0,h.KC)(this.options.staleTime,this.#F);if(h.sk||this.#E.isStale||!(0,h.PN)(t))return;let e=(0,h.Kp)(this.#E.dataUpdatedAt,t);this.#M=setTimeout(()=>{this.#E.isStale||this.updateResult()},e+1)}#G(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#F):this.options.refetchInterval)??!1}#Z(t){this.#L(),this.#U=t,!h.sk&&!1!==(0,h.Nc)(this.options.enabled,this.#F)&&(0,h.PN)(this.#U)&&0!==this.#U&&(this.#k=setInterval(()=>{(this.options.refetchIntervalInBackground||r.j.isFocused())&&this.#K()},this.#U))}#N(){this.#H(),this.#Z(this.#G())}#V(){this.#M&&(clearTimeout(this.#M),this.#M=void 0)}#L(){this.#k&&(clearInterval(this.#k),this.#k=void 0)}createResult(t,e){let s;let i=this.#F,r=this.options,n=this.#E,u=this.#T,c=this.#D,d=t!==i?t.state:this.#P,{state:y}=t,m={...y},v=!1;if(e._optimisticResults){let s=this.hasListeners(),n=!s&&l(t,e),u=s&&f(t,i,e,r);(n||u)&&(m={...m,...(0,a.z)(y.data,t.options)}),"isRestoring"===e._optimisticResults&&(m.fetchStatus="idle")}let{error:b,errorUpdatedAt:g,status:C}=m;if(e.select&&void 0!==m.data){if(n&&m.data===u?.data&&e.select===this.#I)s=this.#x;else try{this.#I=e.select,s=e.select(m.data),s=(0,h.oE)(n?.data,s,e),this.#x=s,this.#Q=null}catch(t){this.#Q=t}}else s=m.data;if(void 0!==e.placeholderData&&void 0===s&&"pending"===C){let t;if(n?.isPlaceholderData&&e.placeholderData===c?.placeholderData)t=n.data;else if(t="function"==typeof e.placeholderData?e.placeholderData(this.#A?.state.data,this.#A):e.placeholderData,e.select&&void 0!==t)try{t=e.select(t),this.#Q=null}catch(t){this.#Q=t}void 0!==t&&(C="success",s=(0,h.oE)(n?.data,t,e),v=!0)}this.#Q&&(b=this.#Q,s=this.#x,g=Date.now(),C="error");let O="fetching"===m.fetchStatus,R="pending"===C,w="error"===C,S=R&&O,Q=void 0!==s,q={status:C,fetchStatus:m.fetchStatus,isPending:R,isSuccess:"success"===C,isError:w,isInitialLoading:S,isLoading:S,data:s,dataUpdatedAt:m.dataUpdatedAt,error:b,errorUpdatedAt:g,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:O,isRefetching:O&&!R,isLoadingError:w&&!Q,isPaused:"paused"===m.fetchStatus,isPlaceholderData:v,isRefetchError:w&&Q,isStale:p(t,e),refetch:this.refetch,promise:this.#q};if(this.options.experimental_prefetchInRender){let e=t=>{"error"===q.status?t.reject(q.error):void 0!==q.data&&t.resolve(q.data)},s=()=>{e(this.#q=q.promise=(0,o.O)())},r=this.#q;switch(r.status){case"pending":t.queryHash===i.queryHash&&e(r);break;case"fulfilled":("error"===q.status||q.data!==r.value)&&s();break;case"rejected":("error"!==q.status||q.error!==r.reason)&&s()}}return q}updateResult(t){let e=this.#E,s=this.createResult(this.#F,this.options);if(this.#T=this.#F.state,this.#D=this.options,void 0!==this.#T.data&&(this.#A=this.#F),(0,h.VS)(s,e))return;this.#E=s;let i={};t?.listeners!==!1&&(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,s="function"==typeof t?t():t;if("all"===s||!s&&!this.#j.size)return!0;let i=new Set(s??this.#j);return this.options.throwOnError&&i.add("error"),Object.keys(this.#E).some(t=>this.#E[t]!==e[t]&&i.has(t))})()&&(i.listeners=!0),this.#z({...i,...t})}#_(){let t=this.#S.getQueryCache().build(this.#S,this.options);if(t===this.#F)return;let e=this.#F;this.#F=t,this.#P=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#N()}#z(t){n.V.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#E)}),this.#S.getQueryCache().notify({query:this.#F,type:"observerResultsUpdated"})})}};function l(t,e){return!1!==(0,h.Nc)(e.enabled,t)&&void 0===t.state.data&&!("error"===t.state.status&&!1===e.retryOnMount)||void 0!==t.state.data&&d(t,e,e.refetchOnMount)}function d(t,e,s){if(!1!==(0,h.Nc)(e.enabled,t)){let i="function"==typeof s?s(t):s;return"always"===i||!1!==i&&p(t,e)}return!1}function f(t,e,s,i){return(t!==e||!1===(0,h.Nc)(i.enabled,t))&&(!s.suspense||"error"!==t.state.status)&&p(t,s)}function p(t,e){return!1!==(0,h.Nc)(e.enabled,t)&&t.isStaleByTime((0,h.KC)(e.staleTime,t))}var y=s(2265),m=s(29827);s(57437);var v=y.createContext((i=!1,{clearReset:()=>{i=!1},reset:()=>{i=!0},isReset:()=>i})),b=()=>y.useContext(v),g=s(51172),C=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&!e.isReset()&&(t.retryOnMount=!1)},O=t=>{y.useEffect(()=>{t.clearReset()},[t])},R=t=>{let{result:e,errorResetBoundary:s,throwOnError:i,query:r}=t;return e.isError&&!s.isReset()&&!e.isFetching&&r&&(0,g.L)(i,[e.error,r])},w=y.createContext(!1),S=()=>y.useContext(w);w.Provider;var Q=t=>{let e=t.staleTime;t.suspense&&(t.staleTime="function"==typeof e?(...t)=>Math.max(e(...t),1e3):Math.max(e??1e3,1e3),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3)))},q=(t,e)=>t.isLoading&&t.isFetching&&!e,F=(t,e)=>t?.suspense&&e.isPending,P=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function E(t,e){return function(t,e,s){var i,r,a,u,o;let c=(0,m.NL)(s),l=S(),d=b(),f=c.defaultQueryOptions(t);null===(r=c.getDefaultOptions().queries)||void 0===r||null===(i=r._experimental_beforeQuery)||void 0===i||i.call(r,f),f._optimisticResults=l?"isRestoring":"optimistic",Q(f),C(f,d),O(d);let p=!c.getQueryCache().get(f.queryHash),[v]=y.useState(()=>new e(c,f)),w=v.getOptimisticResult(f),E=!l&&!1!==t.subscribed;if(y.useSyncExternalStore(y.useCallback(t=>{let e=E?v.subscribe(n.V.batchCalls(t)):g.Z;return v.updateResult(),e},[v,E]),()=>v.getCurrentResult(),()=>v.getCurrentResult()),y.useEffect(()=>{v.setOptions(f,{listeners:!1})},[f,v]),F(f,w))throw P(f,v,d);if(R({result:w,errorResetBoundary:d,throwOnError:f.throwOnError,query:c.getQueryCache().get(f.queryHash)}))throw w.error;if(null===(u=c.getDefaultOptions().queries)||void 0===u||null===(a=u._experimental_afterQuery)||void 0===a||a.call(u,f,w),f.experimental_prefetchInRender&&!h.sk&&q(w,l)){let t=p?P(f,v,d):null===(o=c.getQueryCache().get(f.queryHash))||void 0===o?void 0:o.promise;null==t||t.catch(g.Z).finally(()=>{v.updateResult()})}return f.notifyOnChangeProps?w:v.trackResult(w)}(t,c,e)}},51172:function(t,e,s){function i(t,e){return"function"==typeof t?t(...e):!!t}function r(){}s.d(e,{L:function(){return i},Z:function(){return r}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1307-6127ab4e0e743a22.js b/litellm/proxy/_experimental/out/_next/static/chunks/1307-6127ab4e0e743a22.js new file mode 100644 index 00000000000..6b6de2bd74d --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1307-6127ab4e0e743a22.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1307],{21307:function(e,s,r){r.d(s,{d:function(){return eR},o:function(){return eY}});var l=r(57437),t=r(2265),a=r(16593),n=r(52787),i=r(82680),o=r(89970),c=r(20831),d=r(12485),m=r(18135),x=r(35242),u=r(29706),h=r(77991),p=r(49804),j=r(67101),g=r(84264),v=r(96761),f=r(60493),b=r(47323),y=r(53410),N=r(74998);let _=e=>{try{let s=e.indexOf("/mcp/");if(-1===s)return{token:null,baseUrl:e};let r=e.split("/mcp/");if(2!==r.length)return{token:null,baseUrl:e};let l=r[0]+"/mcp/",t=r[1];if(!t)return{token:null,baseUrl:e};return{token:t,baseUrl:l}}catch(s){return console.error("Error parsing MCP URL:",s),{token:null,baseUrl:e}}},Z=e=>{let{token:s,baseUrl:r}=_(e);return s?r+"...":e},w=e=>{let{token:s}=_(e);return{maskedUrl:Z(e),hasToken:!!s}},C=e=>e?/^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(e)?Promise.resolve():Promise.reject("Please enter a valid URL (e.g., http://service-name.domain:1234/path or https://example.com)"):Promise.resolve(),S=e=>e&&e.includes("-")?Promise.reject("Server name cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve(),k=(e,s,r,t)=>[{accessorKey:"server_id",header:"Server ID",cell:e=>{let{row:r}=e;return(0,l.jsxs)("button",{onClick:()=>s(r.original.server_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[r.original.server_id.slice(0,7),"..."]})}},{accessorKey:"server_name",header:"Name"},{accessorKey:"alias",header:"Alias"},{id:"url",header:"URL",cell:e=>{let{row:s}=e,{maskedUrl:r}=w(s.original.url);return(0,l.jsx)("span",{className:"font-mono text-sm",children:r})}},{accessorKey:"transport",header:"Transport",cell:e=>{let{getValue:s}=e;return(0,l.jsx)("span",{children:(s()||"http").toUpperCase()})}},{accessorKey:"auth_type",header:"Auth Type",cell:e=>{let{getValue:s}=e;return(0,l.jsx)("span",{children:s()||"none"})}},{id:"health_status",header:"Health Status",cell:e=>{let{row:s}=e,r=s.original,t=r.status||"unknown",a=r.last_health_check,n=r.health_check_error,i=(0,l.jsxs)("div",{className:"max-w-xs",children:[(0,l.jsxs)("div",{className:"font-semibold mb-1",children:["Health Status: ",t]}),a&&(0,l.jsxs)("div",{className:"text-xs mb-1",children:["Last Check: ",new Date(a).toLocaleString()]}),n&&(0,l.jsxs)("div",{className:"text-xs",children:[(0,l.jsx)("div",{className:"font-medium text-red-400 mb-1",children:"Error:"}),(0,l.jsx)("div",{className:"break-words",children:n})]}),!a&&!n&&(0,l.jsx)("div",{className:"text-xs text-gray-400",children:"No health check data available"})]});return(0,l.jsx)(o.Z,{title:i,placement:"top",children:(0,l.jsxs)("button",{className:"font-mono text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[10ch] ".concat((e=>{switch(e){case"healthy":return"text-green-500 bg-green-50 hover:bg-green-100";case"unhealthy":return"text-red-500 bg-red-50 hover:bg-red-100";default:return"text-gray-500 bg-gray-50 hover:bg-gray-100"}})(t)),children:[(0,l.jsx)("span",{className:"mr-1",children:"●"}),t.charAt(0).toUpperCase()+t.slice(1)]})})}},{id:"mcp_access_groups",header:"Access Groups",cell:e=>{let{row:s}=e,r=s.original.mcp_access_groups;if(Array.isArray(r)&&r.length>0&&"string"==typeof r[0]){let e=r.join(", ");return(0,l.jsx)(o.Z,{title:e,children:(0,l.jsx)("span",{className:"max-w-[200px] truncate block",children:e.length>30?"".concat(e.slice(0,30),"..."):e})})}return(0,l.jsx)("span",{className:"text-gray-400 italic",children:"None"})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,l.jsx)("span",{className:"text-xs",children:r.created_at?new Date(r.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,l.jsx)("span",{className:"text-xs",children:r.updated_at?new Date(r.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:s}=e;return(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(b.Z,{icon:y.Z,size:"sm",onClick:()=>r(s.original.server_id),className:"cursor-pointer"}),(0,l.jsx)(b.Z,{icon:N.Z,size:"sm",onClick:()=>t(s.original.server_id),className:"cursor-pointer"})]})}}];var P=r(19250),A=r(20347),L=r(77331),M=r(82376),T=r(71437),I=r(12514);let E={NONE:"none",API_KEY:"api_key",BEARER_TOKEN:"bearer_token",BASIC:"basic"},z={SSE:"sse"},q=e=>(console.log(e),null==e)?z.SSE:e,O=e=>null==e?E.NONE:e,R=e=>O(e)!==E.NONE;var U=r(13634),F=r(73002),B=r(49566),K=r(20577),V=r(44851),D=r(33866),H=r(62670),G=r(15424),Y=r(58630),J=e=>{let{value:s={},onChange:r,tools:t=[],disabled:a=!1}=e,n=(e,l)=>{let t={...s,tool_name_to_cost_per_query:{...s.tool_name_to_cost_per_query,[e]:l}};null==r||r(t)};return(0,l.jsx)(I.Z,{children:(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,l.jsx)(H.Z,{className:"text-green-600"}),(0,l.jsx)(v.Z,{children:"Cost Configuration"}),(0,l.jsx)(o.Z,{title:"Configure costs for this MCP server's tool calls. Set a default rate and per-tool overrides.",children:(0,l.jsx)(G.Z,{className:"text-gray-400"})})]}),(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Default Cost per Query ($)",(0,l.jsx)(o.Z,{title:"Default cost charged for each tool call to this server.",children:(0,l.jsx)(G.Z,{className:"ml-1 text-gray-400"})})]}),(0,l.jsx)(K.Z,{min:0,step:1e-4,precision:4,placeholder:"0.0000",value:s.default_cost_per_query,onChange:e=>{let l={...s,default_cost_per_query:e};null==r||r(l)},disabled:a,style:{width:"200px"},addonBefore:"$"}),(0,l.jsx)(g.Z,{className:"block mt-1 text-gray-500 text-sm",children:"Set a default cost for all tool calls to this server"})]}),t.length>0&&(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:["Tool-Specific Costs ($)",(0,l.jsx)(o.Z,{title:"Override the default cost for specific tools. Leave blank to use the default rate.",children:(0,l.jsx)(G.Z,{className:"ml-1 text-gray-400"})})]}),(0,l.jsx)(V.default,{items:[{key:"1",label:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(Y.Z,{className:"mr-2 text-blue-500"}),(0,l.jsx)("span",{className:"font-medium",children:"Available Tools"}),(0,l.jsx)(D.Z,{count:t.length,style:{backgroundColor:"#52c41a",marginLeft:"8px"}})]}),children:(0,l.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:t.map((e,r)=>{var t;return(0,l.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)(g.Z,{className:"font-medium text-gray-900",children:e.name}),e.description&&(0,l.jsx)(g.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description})]}),(0,l.jsx)("div",{className:"ml-4",children:(0,l.jsx)(K.Z,{min:0,step:1e-4,precision:4,placeholder:"Use default",value:null===(t=s.tool_name_to_cost_per_query)||void 0===t?void 0:t[e.name],onChange:s=>n(e.name,s),disabled:a,style:{width:"120px"},addonBefore:"$"})})]},r)})})}]})]})]}),(s.default_cost_per_query||s.tool_name_to_cost_per_query&&Object.keys(s.tool_name_to_cost_per_query).length>0)&&(0,l.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,l.jsx)(g.Z,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,l.jsxs)("div",{className:"mt-2 space-y-1",children:[s.default_cost_per_query&&(0,l.jsxs)(g.Z,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),s.tool_name_to_cost_per_query&&Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,l.jsxs)(g.Z,{className:"text-blue-700",children:["• ",s,": $",r.toFixed(4)," per query"]},s)})]})]})]})})};let{Panel:$}=V.default;var W=e=>{let{availableAccessGroups:s,mcpServer:r,searchValue:a,setSearchValue:i,getAccessGroupOptions:c}=e,d=U.Z.useFormInstance();return(0,t.useEffect)(()=>{r&&r.extra_headers&&d.setFieldValue("extra_headers",r.extra_headers)},[r,d]),(0,l.jsx)(V.default,{className:"bg-gray-50 border border-gray-200 rounded-lg",expandIconPosition:"end",ghost:!1,children:(0,l.jsx)($,{header:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Permission Management / Access Control"})]}),(0,l.jsx)("p",{className:"text-sm text-gray-600 ml-4",children:"Configure access permissions and security settings (Optional)"})]}),className:"border-0",children:(0,l.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,l.jsx)(U.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Access Groups",(0,l.jsx)(o.Z,{title:"Specify access groups for this MCP server. Users must be in at least one of these groups to access the server.",children:(0,l.jsx)(G.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"mcp_access_groups",className:"mb-4",children:(0,l.jsx)(n.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"value",filterOption:(e,s)=>{var r;return(null!==(r=null==s?void 0:s.value)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},onSearch:e=>i(e),tokenSeparators:[","],options:c(),maxTagCount:"responsive",allowClear:!0})}),(0,l.jsx)(U.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Extra Headers",(0,l.jsx)(o.Z,{title:"Forward custom headers from incoming requests to this MCP server (e.g., Authorization, X-Custom-Header, User-Agent)",children:(0,l.jsx)(G.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})}),(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0&&(0,l.jsxs)("span",{className:"ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:[r.extra_headers.length," configured"]})]}),name:"extra_headers",children:(0,l.jsx)(n.default,{mode:"tags",placeholder:(null==r?void 0:r.extra_headers)&&r.extra_headers.length>0?"Currently: ".concat(r.extra_headers.join(", ")):"Enter header names (e.g., Authorization, X-Custom-Header)",className:"rounded-lg",size:"large",tokenSeparators:[","],allowClear:!0})})]})},"permissions")})},Q=r(83669),X=r(87908),ee=r(61994);let es=e=>{let{accessToken:s,formValues:r,enabled:l=!0}=e,[a,n]=(0,t.useState)([]),[i,o]=(0,t.useState)(!1),[c,d]=(0,t.useState)(null),[m,x]=(0,t.useState)(!1),u=!!(r.url&&r.transport&&r.auth_type&&s),h=async()=>{if(s&&r.url){o(!0),d(null);try{let e={server_id:r.server_id||"",server_name:r.server_name||"",url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info},l=await (0,P.testMCPToolsListRequest)(s,e);if(l.tools&&!l.error)n(l.tools),d(null),l.tools.length>0&&!m&&x(!0);else{let e=l.message||"Failed to retrieve tools list";d(e),n([]),x(!1)}}catch(e){console.error("Tools fetch error:",e),d(e instanceof Error?e.message:String(e)),n([]),x(!1)}finally{o(!1)}}},p=()=>{n([]),d(null),x(!1)};return(0,t.useEffect)(()=>{l&&(u?h():p())},[r.url,r.transport,r.auth_type,s,l,u]),{tools:a,isLoadingTools:i,toolsError:c,hasShownSuccessMessage:m,canFetchTools:u,fetchTools:h,clearTools:p}};var er=e=>{let{accessToken:s,formValues:r,allowedTools:a,existingAllowedTools:n,onAllowedToolsChange:i}=e,o=(0,t.useRef)(0),{tools:c,isLoadingTools:d,toolsError:m,canFetchTools:x}=es({accessToken:s,formValues:r,enabled:!0});(0,t.useEffect)(()=>{if(c.length>0&&c.length!==o.current&&0===a.length){if(n&&n.length>0){let e=c.map(e=>e.name);i(n.filter(s=>e.includes(s)))}else i(c.map(e=>e.name))}o.current=c.length},[c,a.length,n,i]);let u=e=>{a.includes(e)?i(a.filter(s=>s!==e)):i([...a,e])};return x||r.url?(0,l.jsx)(I.Z,{children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(Y.Z,{className:"text-blue-600"}),(0,l.jsx)(v.Z,{children:"Tool Configuration"}),c.length>0&&(0,l.jsx)(D.Z,{count:c.length,style:{backgroundColor:"#52c41a"}})]})}),(0,l.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,l.jsxs)(g.Z,{className:"text-blue-800 text-sm",children:[(0,l.jsx)("strong",{children:"Select which tools users can call:"})," Only checked tools will be available for users to invoke. Unchecked tools will be blocked from execution."]})}),d&&(0,l.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,l.jsx)(X.Z,{size:"large"}),(0,l.jsx)(g.Z,{className:"ml-3",children:"Loading tools..."})]}),m&&!d&&(0,l.jsxs)("div",{className:"text-center py-6 text-red-500 border rounded-lg border-dashed border-red-300 bg-red-50",children:[(0,l.jsx)(Y.Z,{className:"text-2xl mb-2"}),(0,l.jsx)(g.Z,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-sm text-red-500",children:m})]}),!d&&!m&&0===c.length&&x&&(0,l.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,l.jsx)(Y.Z,{className:"text-2xl mb-2"}),(0,l.jsx)(g.Z,{children:"No tools available for configuration"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-sm",children:"Connect to an MCP server with tools to configure them"})]}),!x&&r.url&&(0,l.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,l.jsx)(Y.Z,{className:"text-2xl mb-2"}),(0,l.jsx)(g.Z,{children:"Complete required fields to configure tools"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to load available tools"})]}),!d&&!m&&c.length>0&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200 flex-1",children:[(0,l.jsx)(Q.Z,{className:"text-green-600"}),(0,l.jsxs)(g.Z,{className:"text-green-700 font-medium",children:[a.length," of ",c.length," ",1===c.length?"tool":"tools"," enabled for user access"]})]}),(0,l.jsxs)("div",{className:"flex gap-2 ml-3",children:[(0,l.jsx)("button",{type:"button",onClick:()=>{i(c.map(e=>e.name))},className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors",children:"Enable All"}),(0,l.jsx)("button",{type:"button",onClick:()=>{i([])},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-700 hover:bg-gray-100 rounded-md transition-colors",children:"Disable All"})]})]}),(0,l.jsx)("div",{className:"space-y-2",children:c.map((e,s)=>(0,l.jsx)("div",{className:"p-4 rounded-lg border transition-colors cursor-pointer ".concat(a.includes(e.name)?"bg-blue-50 border-blue-300 hover:border-blue-400":"bg-gray-50 border-gray-200 hover:border-gray-300"),onClick:()=>u(e.name),children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)(ee.Z,{checked:a.includes(e.name),onChange:()=>u(e.name)}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(g.Z,{className:"font-medium text-gray-900",children:e.name}),(0,l.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium ".concat(a.includes(e.name)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:a.includes(e.name)?"Enabled":"Disabled"})]}),e.description&&(0,l.jsx)(g.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description}),(0,l.jsx)(g.Z,{className:"text-gray-400 text-xs block mt-1",children:a.includes(e.name)?"✓ Users can call this tool":"✗ Users cannot call this tool"})]})]})},s))})]})]})}):null},el=r(9114),et=e=>{let{mcpServer:s,accessToken:r,onCancel:a,onSuccess:i,availableAccessGroups:o}=e,[p]=U.Z.useForm(),[j,g]=(0,t.useState)({}),[v,f]=(0,t.useState)([]),[b,y]=(0,t.useState)(!1),[N,_]=(0,t.useState)(""),[Z,w]=(0,t.useState)(!1),[k,A]=(0,t.useState)([]);(0,t.useEffect)(()=>{var e;(null===(e=s.mcp_info)||void 0===e?void 0:e.mcp_server_cost_info)&&g(s.mcp_info.mcp_server_cost_info)},[s]),(0,t.useEffect)(()=>{s.allowed_tools&&A(s.allowed_tools)},[s]),(0,t.useEffect)(()=>{if(s.mcp_access_groups){let e=s.mcp_access_groups.map(e=>"string"==typeof e?e:e.name||String(e));p.setFieldValue("mcp_access_groups",e)}},[s]),(0,t.useEffect)(()=>{L()},[s,r]);let L=async()=>{if(r&&s.url){y(!0);try{let e={server_id:s.server_id,server_name:s.server_name,url:s.url,transport:s.transport,auth_type:s.auth_type,mcp_info:s.mcp_info},l=await (0,P.testMCPToolsListRequest)(r,e);l.tools&&!l.error?f(l.tools):(console.error("Failed to fetch tools:",l.message),f([]))}catch(e){console.error("Tools fetch error:",e),f([])}finally{y(!1)}}},M=async e=>{if(r)try{let l=(e.mcp_access_groups||[]).map(e=>"string"==typeof e?e:e.name||String(e)),t={...e,server_id:s.server_id,mcp_info:{server_name:e.server_name||e.url,description:e.description,mcp_server_cost_info:Object.keys(j).length>0?j:null},mcp_access_groups:l,alias:e.alias,extra_headers:e.extra_headers||[],allowed_tools:k.length>0?k:null,disallowed_tools:e.disallowed_tools||[]},a=await (0,P.updateMCPServer)(r,t);el.Z.success("MCP Server updated successfully"),i(a)}catch(e){el.Z.fromBackend("Failed to update MCP Server"+((null==e?void 0:e.message)?": ".concat(e.message):""))}};return(0,l.jsxs)(m.Z,{children:[(0,l.jsxs)(x.Z,{className:"grid w-full grid-cols-2",children:[(0,l.jsx)(d.Z,{children:"Server Configuration"}),(0,l.jsx)(d.Z,{children:"Cost Configuration"})]}),(0,l.jsxs)(h.Z,{className:"mt-6",children:[(0,l.jsx)(u.Z,{children:(0,l.jsxs)(U.Z,{form:p,onFinish:M,initialValues:s,layout:"vertical",children:[(0,l.jsx)(U.Z.Item,{label:"MCP Server Name",name:"server_name",rules:[{validator:(e,s)=>S(s)}],children:(0,l.jsx)(B.Z,{})}),(0,l.jsx)(U.Z.Item,{label:"Alias",name:"alias",rules:[{validator:(e,s)=>S(s)}],children:(0,l.jsx)(B.Z,{onChange:()=>w(!0)})}),(0,l.jsx)(U.Z.Item,{label:"Description",name:"description",children:(0,l.jsx)(B.Z,{})}),(0,l.jsx)(U.Z.Item,{label:"MCP Server URL",name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>C(s)}],children:(0,l.jsx)(B.Z,{})}),(0,l.jsx)(U.Z.Item,{label:"Transport Type",name:"transport",rules:[{required:!0}],children:(0,l.jsxs)(n.default,{children:[(0,l.jsx)(n.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,l.jsx)(n.default.Option,{value:"http",children:"HTTP"})]})}),(0,l.jsx)(U.Z.Item,{label:"Authentication",name:"auth_type",rules:[{required:!0}],children:(0,l.jsxs)(n.default,{children:[(0,l.jsx)(n.default.Option,{value:"none",children:"None"}),(0,l.jsx)(n.default.Option,{value:"api_key",children:"API Key"}),(0,l.jsx)(n.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,l.jsx)(n.default.Option,{value:"basic",children:"Basic Auth"})]})}),(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)(W,{availableAccessGroups:o,mcpServer:s,searchValue:N,setSearchValue:_,getAccessGroupOptions:()=>{let e=o.map(e=>({value:e,label:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:e})]})}));return N&&!o.some(e=>e.toLowerCase().includes(N.toLowerCase()))&&e.push({value:N,label:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:N}),(0,l.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)(er,{accessToken:r,formValues:{server_id:s.server_id,server_name:s.server_name,url:s.url,transport:s.transport,auth_type:s.auth_type,mcp_info:s.mcp_info},allowedTools:k,existingAllowedTools:s.allowed_tools||null,onAllowedToolsChange:A})}),(0,l.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,l.jsx)(F.ZP,{onClick:a,children:"Cancel"}),(0,l.jsx)(c.Z,{type:"submit",children:"Save Changes"})]})]})}),(0,l.jsx)(u.Z,{children:(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)(J,{value:j,onChange:g,tools:v,disabled:b}),(0,l.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,l.jsx)(F.ZP,{onClick:a,children:"Cancel"}),(0,l.jsx)(c.Z,{onClick:()=>p.submit(),children:"Save Changes"})]})]})})]})]})},ea=r(92280),en=e=>{let{costConfig:s}=e,r=(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null,t=(null==s?void 0:s.tool_name_to_cost_per_query)&&Object.keys(s.tool_name_to_cost_per_query).length>0;return r||t?(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,l.jsxs)("div",{className:"space-y-4",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,l.jsxs)("div",{children:[(0,l.jsx)(ea.x,{className:"font-medium",children:"Default Cost per Query"}),(0,l.jsxs)("div",{className:"text-green-600 font-mono",children:["$",s.default_cost_per_query.toFixed(4)]})]}),t&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,l.jsxs)("div",{children:[(0,l.jsx)(ea.x,{className:"font-medium",children:"Tool-Specific Costs"}),(0,l.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,l.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,l.jsx)(ea.x,{className:"font-medium",children:s}),(0,l.jsxs)(ea.x,{className:"text-green-600 font-mono",children:["$",r.toFixed(4)," per query"]})]},s)})})]}),(0,l.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,l.jsx)(ea.x,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,l.jsxs)("div",{className:"mt-2 space-y-1",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,l.jsxs)(ea.x,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),t&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,l.jsxs)(ea.x,{className:"text-blue-700",children:["• ",Object.keys(s.tool_name_to_cost_per_query).length," tool(s) with custom pricing"]})]})]})]})}):(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,l.jsx)("div",{className:"space-y-4",children:(0,l.jsx)("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg",children:(0,l.jsx)(ea.x,{className:"text-gray-600",children:"No cost configuration set for this server. Tool calls will be charged at $0.00 per tool call."})})})})},ei=r(59872),eo=r(30401),ec=r(78867);let ed=e=>{var s,r,a,n,i;let{mcpServer:o,onBack:p,isEditing:f,isProxyAdmin:y,accessToken:N,userRole:_,userID:Z,availableAccessGroups:C}=e,[S,k]=(0,t.useState)(f),[P,A]=(0,t.useState)(!1),[E,z]=(0,t.useState)({}),{maskedUrl:R,hasToken:U}=w(o.url),B=(e,s)=>U?s?e:R:e,K=async(e,s)=>{await (0,ei.vQ)(e)&&(z(e=>({...e,[s]:!0})),setTimeout(()=>{z(e=>({...e,[s]:!1}))},2e3))};return(0,l.jsxs)("div",{className:"p-4 max-w-full",children:[(0,l.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,l.jsxs)("div",{children:[(0,l.jsx)(c.Z,{icon:L.Z,variant:"light",className:"mb-4",onClick:p,children:"Back to All Servers"}),(0,l.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,l.jsx)(v.Z,{children:o.server_name}),(0,l.jsx)(F.ZP,{type:"text",size:"small",icon:E["mcp-server_name"]?(0,l.jsx)(eo.Z,{size:12}):(0,l.jsx)(ec.Z,{size:12}),onClick:()=>K(o.server_name,"mcp-server_name"),className:"left-2 z-10 transition-all duration-200 ".concat(E["mcp-server_name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),o.alias&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"ml-4 text-gray-500",children:"Alias:"}),(0,l.jsx)("span",{className:"ml-1 font-mono text-blue-600",children:o.alias}),(0,l.jsx)(F.ZP,{type:"text",size:"small",icon:E["mcp-alias"]?(0,l.jsx)(eo.Z,{size:12}):(0,l.jsx)(ec.Z,{size:12}),onClick:()=>K(o.alias,"mcp-alias"),className:"left-2 z-10 transition-all duration-200 ".concat(E["mcp-alias"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,l.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,l.jsx)(g.Z,{className:"text-gray-500 font-mono",children:o.server_id}),(0,l.jsx)(F.ZP,{type:"text",size:"small",icon:E["mcp-server-id"]?(0,l.jsx)(eo.Z,{size:12}):(0,l.jsx)(ec.Z,{size:12}),onClick:()=>K(o.server_id,"mcp-server-id"),className:"left-2 z-10 transition-all duration-200 ".concat(E["mcp-server-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,l.jsxs)(m.Z,{defaultIndex:S?2:0,children:[(0,l.jsx)(x.Z,{className:"mb-4",children:[(0,l.jsx)(d.Z,{children:"Overview"},"overview"),(0,l.jsx)(d.Z,{children:"MCP Tools"},"tools"),...y?[(0,l.jsx)(d.Z,{children:"Settings"},"settings")]:[]]}),(0,l.jsxs)(h.Z,{children:[(0,l.jsxs)(u.Z,{children:[(0,l.jsxs)(j.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,l.jsxs)(I.Z,{children:[(0,l.jsx)(g.Z,{children:"Transport"}),(0,l.jsx)("div",{className:"mt-2",children:(0,l.jsx)(v.Z,{children:q(null!==(n=o.transport)&&void 0!==n?n:void 0)})})]}),(0,l.jsxs)(I.Z,{children:[(0,l.jsx)(g.Z,{children:"Auth Type"}),(0,l.jsx)("div",{className:"mt-2",children:(0,l.jsx)(g.Z,{children:O(null!==(i=o.auth_type)&&void 0!==i?i:void 0)})})]}),(0,l.jsxs)(I.Z,{children:[(0,l.jsx)(g.Z,{children:"Host Url"}),(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)(g.Z,{className:"break-all overflow-wrap-anywhere",children:B(o.url,P)}),U&&(0,l.jsx)("button",{onClick:()=>A(!P),className:"p-1 hover:bg-gray-100 rounded",children:(0,l.jsx)(b.Z,{icon:P?M.Z:T.Z,size:"sm",className:"text-gray-500"})})]})]})]}),(0,l.jsxs)(I.Z,{className:"mt-2",children:[(0,l.jsx)(v.Z,{children:"Cost Configuration"}),(0,l.jsx)(en,{costConfig:null===(s=o.mcp_info)||void 0===s?void 0:s.mcp_server_cost_info})]})]}),(0,l.jsx)(u.Z,{children:(0,l.jsx)(eY,{serverId:o.server_id,accessToken:N,auth_type:o.auth_type,userRole:_,userID:Z,serverAlias:o.alias})}),(0,l.jsx)(u.Z,{children:(0,l.jsxs)(I.Z,{children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,l.jsx)(v.Z,{children:"MCP Server Settings"}),S?null:(0,l.jsx)(c.Z,{variant:"light",onClick:()=>k(!0),children:"Edit Settings"})]}),S?(0,l.jsx)(et,{mcpServer:o,accessToken:N,onCancel:()=>k(!1),onSuccess:e=>{k(!1),p()},availableAccessGroups:C}):(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Server Name"}),(0,l.jsx)("div",{children:o.server_name})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Alias"}),(0,l.jsx)("div",{children:o.alias})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Description"}),(0,l.jsx)("div",{children:o.description})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"URL"}),(0,l.jsxs)("div",{className:"font-mono break-all overflow-wrap-anywhere max-w-full flex items-center gap-2",children:[B(o.url,P),U&&(0,l.jsx)("button",{onClick:()=>A(!P),className:"p-1 hover:bg-gray-100 rounded",children:(0,l.jsx)(b.Z,{icon:P?M.Z:T.Z,size:"sm",className:"text-gray-500"})})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Transport"}),(0,l.jsx)("div",{children:q(o.transport)})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Extra Headers"}),(0,l.jsx)("div",{children:null===(r=o.extra_headers)||void 0===r?void 0:r.join(", ")})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Auth Type"}),(0,l.jsx)("div",{children:O(o.auth_type)})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Access Groups"}),(0,l.jsx)("div",{children:o.mcp_access_groups&&o.mcp_access_groups.length>0?(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:o.mcp_access_groups.map((e,s)=>{var r;return(0,l.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded-md text-sm",children:"string"==typeof e?e:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},s)})}):(0,l.jsx)(g.Z,{className:"text-gray-500",children:"No access groups defined"})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Allowed Tools"}),(0,l.jsx)("div",{children:o.allowed_tools&&o.allowed_tools.length>0?(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:o.allowed_tools.map((e,s)=>(0,l.jsx)("span",{className:"px-2 py-1 bg-blue-50 border border-blue-200 rounded-md text-sm",children:e},s))}):(0,l.jsx)(g.Z,{className:"text-gray-500",children:"All tools enabled"})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"font-medium",children:"Cost Configuration"}),(0,l.jsx)(en,{costConfig:null===(a=o.mcp_info)||void 0===a?void 0:a.mcp_server_cost_info})]})]})]})})]})]})]})};var em=r(64504),ex=r(61778),eu=r(29271),eh=r(89245),ep=e=>{let{accessToken:s,formValues:r,onToolsLoaded:a}=e,{tools:n,isLoadingTools:i,toolsError:o,canFetchTools:c,fetchTools:d}=es({accessToken:s,formValues:r,enabled:!0});return((0,t.useEffect)(()=>{null==a||a(n)},[n,a]),c||r.url)?(0,l.jsx)(I.Z,{children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(Q.Z,{className:"text-blue-600"}),(0,l.jsx)(v.Z,{children:"Connection Status"})]}),!c&&r.url&&(0,l.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,l.jsx)(Y.Z,{className:"text-2xl mb-2"}),(0,l.jsx)(g.Z,{children:"Complete required fields to test connection"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to test MCP server connection"})]}),c&&(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(g.Z,{className:"text-gray-700 font-medium",children:i?"Testing connection to MCP server...":n.length>0?"Connection successful":o?"Connection failed":"Ready to test connection"}),(0,l.jsx)("br",{}),(0,l.jsxs)(g.Z,{className:"text-gray-500 text-sm",children:["Server: ",r.url]})]}),i&&(0,l.jsxs)("div",{className:"flex items-center text-blue-600",children:[(0,l.jsx)(X.Z,{size:"small",className:"mr-2"}),(0,l.jsx)(g.Z,{className:"text-blue-600",children:"Connecting..."})]}),!i&&!o&&n.length>0&&(0,l.jsxs)("div",{className:"flex items-center text-green-600",children:[(0,l.jsx)(Q.Z,{className:"mr-1"}),(0,l.jsx)(g.Z,{className:"text-green-600 font-medium",children:"Connected"})]}),o&&(0,l.jsxs)("div",{className:"flex items-center text-red-600",children:[(0,l.jsx)(eu.Z,{className:"mr-1"}),(0,l.jsx)(g.Z,{className:"text-red-600 font-medium",children:"Failed"})]})]}),i&&(0,l.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,l.jsx)(X.Z,{size:"large"}),(0,l.jsx)(g.Z,{className:"ml-3",children:"Testing connection and loading tools..."})]}),o&&(0,l.jsx)(ex.Z,{message:"Connection Failed",description:o,type:"error",showIcon:!0,action:(0,l.jsx)(F.ZP,{icon:(0,l.jsx)(eh.Z,{}),onClick:d,size:"small",children:"Retry"})}),!i&&0===n.length&&!o&&(0,l.jsxs)("div",{className:"text-center py-6 text-gray-500 border rounded-lg border-dashed",children:[(0,l.jsx)(Q.Z,{className:"text-2xl mb-2 text-green-500"}),(0,l.jsx)(g.Z,{className:"text-green-600 font-medium",children:"Connection successful!"}),(0,l.jsx)("br",{}),(0,l.jsx)(g.Z,{className:"text-gray-500",children:"No tools found for this MCP server"})]})]})]})}):null},ej=r(64482),eg=e=>{let{isVisible:s}=e;return s?(0,l.jsx)(U.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Stdio Configuration (JSON)",(0,l.jsx)(o.Z,{title:"Paste your stdio MCP server configuration in JSON format. You can use the full mcpServers structure from config.yaml or just the inner server configuration.",children:(0,l.jsx)(G.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"stdio_config",rules:[{required:!0,message:"Please enter stdio configuration"},{validator:(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}}}],children:(0,l.jsx)(ej.default.TextArea,{placeholder:'{\n "mcpServers": {\n "circleci-mcp-server": {\n "command": "npx",\n "args": ["-y", "@circleci/mcp-server-circleci"],\n "env": {\n "CIRCLECI_TOKEN": "your-circleci-token",\n "CIRCLECI_BASE_URL": "https://circleci.com"\n }\n }\n }\n}',rows:12,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm"})}):null};let ev="".concat("../ui/assets/logos/","mcp_logo.png");var ef=e=>{let{userRole:s,accessToken:r,onCreateSuccess:a,isModalVisible:c,setModalVisible:d,availableAccessGroups:m}=e,[x]=U.Z.useForm(),[u,h]=(0,t.useState)(!1),[p,j]=(0,t.useState)({}),[g,v]=(0,t.useState)({}),[f,b]=(0,t.useState)(!1),[y,N]=(0,t.useState)([]),[_,Z]=(0,t.useState)([]),[w,k]=(0,t.useState)(""),[L,M]=(0,t.useState)(""),[T,I]=(0,t.useState)(""),E=(e,s)=>{if(!e){I("");return}"sse"!==s||e.endsWith("/sse")?"http"!==s||e.endsWith("/mcp")?I(""):I("Typically MCP HTTP URLs end with /mcp. You can add this url but this is a warning."):I("Typically MCP SSE URLs end with /sse. You can add this url but this is a warning.")},z=async e=>{h(!0);try{let s=e.mcp_access_groups,l={};if(e.stdio_config&&"stdio"===w)try{let s=JSON.parse(e.stdio_config),r=s;if(s.mcpServers&&"object"==typeof s.mcpServers){let l=Object.keys(s.mcpServers);if(l.length>0){let t=l[0];r=s.mcpServers[t],e.server_name||(e.server_name=t.replace(/-/g,"_"))}}l={command:r.command,args:r.args,env:r.env},console.log("Parsed stdio config:",l)}catch(e){el.Z.fromBackend("Invalid JSON in stdio configuration");return}let t={...e,...l,stdio_config:void 0,mcp_info:{server_name:e.server_name||e.url,description:e.description,mcp_server_cost_info:Object.keys(p).length>0?p:null},mcp_access_groups:s,alias:e.alias,allowed_tools:_.length>0?_:null};if(console.log("Payload: ".concat(JSON.stringify(t))),null!=r){let e=await (0,P.createMCPServer)(r,t);el.Z.success("MCP Server created successfully"),x.resetFields(),j({}),N([]),Z([]),I(""),b(!1),d(!1),a(e)}}catch(e){el.Z.fromBackend("Error creating MCP Server: "+e)}finally{h(!1)}},q=()=>{x.resetFields(),j({}),N([]),Z([]),I(""),b(!1),d(!1)};return(t.useEffect(()=>{if(!f&&g.server_name){let e=g.server_name.replace(/\s+/g,"_");x.setFieldsValue({alias:e}),v(s=>({...s,alias:e}))}},[g.server_name]),t.useEffect(()=>{c||v({})},[c]),(0,A.tY)(s))?(0,l.jsx)(i.Z,{title:(0,l.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,l.jsx)("img",{src:ev,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"}}),(0,l.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New MCP Server"})]}),open:c,width:1e3,onCancel:q,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsxs)(U.Z,{form:x,onFinish:z,onValuesChange:(e,s)=>v(s),layout:"vertical",className:"space-y-6",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,l.jsx)(U.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Server Name",(0,l.jsx)(o.Z,{title:"Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Hyphens '-' are not allowed; use underscores '_' instead.",children:(0,l.jsx)(G.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"server_name",rules:[{required:!1,message:"Please enter a server name"},{validator:(e,s)=>S(s)}],children:(0,l.jsx)(em.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,l.jsx)(U.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Alias",(0,l.jsx)(o.Z,{title:"A short, unique identifier for this server. Defaults to the server name with spaces replaced by underscores.",children:(0,l.jsx)(G.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"alias",rules:[{required:!1},{validator:(e,s)=>s&&s.includes("-")?Promise.reject("Alias cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve()}],children:(0,l.jsx)(em.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>b(!0)})}),(0,l.jsx)(U.Z.Item,{label:(0,l.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description"}),name:"description",rules:[{required:!1,message:"Please enter a server description!!!!!!!!!"}],children:(0,l.jsx)(em.o,{placeholder:"Brief description of what this server does",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,l.jsx)(U.Z.Item,{label:(0,l.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Transport Type"}),name:"transport",rules:[{required:!0,message:"Please select a transport type"}],children:(0,l.jsxs)(n.default,{placeholder:"Select transport",className:"rounded-lg",size:"large",onChange:e=>{if(k(e),"stdio"===e)x.setFieldsValue({url:void 0,auth_type:void 0}),I("");else{x.setFieldsValue({command:void 0,args:void 0,env:void 0});let s=x.getFieldValue("url");s&&E(s,e)}},value:w,children:[(0,l.jsx)(n.default.Option,{value:"http",children:"HTTP"}),(0,l.jsx)(n.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,l.jsx)(n.default.Option,{value:"stdio",children:"Standard Input/Output (stdio)"})]})}),"stdio"!==w&&(0,l.jsx)(U.Z.Item,{label:(0,l.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"MCP Server URL"}),name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>C(s)}],children:(0,l.jsxs)("div",{children:[(0,l.jsx)(em.o,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:e=>E(e.target.value,w)}),T&&(0,l.jsx)("div",{className:"mt-1 text-red-500 text-sm font-medium",children:T})]})}),"stdio"!==w&&(0,l.jsx)(U.Z.Item,{label:(0,l.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Authentication"}),name:"auth_type",rules:[{required:!0,message:"Please select an auth type"}],children:(0,l.jsxs)(n.default,{placeholder:"Select auth type",className:"rounded-lg",size:"large",children:[(0,l.jsx)(n.default.Option,{value:"none",children:"None"}),(0,l.jsx)(n.default.Option,{value:"api_key",children:"API Key"}),(0,l.jsx)(n.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,l.jsx)(n.default.Option,{value:"basic",children:"Basic Auth"})]})}),(0,l.jsx)(eg,{isVisible:"stdio"===w})]}),(0,l.jsx)("div",{className:"mt-8",children:(0,l.jsx)(W,{availableAccessGroups:m,mcpServer:null,searchValue:L,setSearchValue:M,getAccessGroupOptions:()=>{let e=m.map(e=>({value:e,label:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:e})]})}));return L&&!m.some(e=>e.toLowerCase().includes(L.toLowerCase()))&&e.push({value:L,label:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:L}),(0,l.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,l.jsx)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:(0,l.jsx)(ep,{accessToken:r,formValues:g,onToolsLoaded:N})}),(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)(er,{accessToken:r,formValues:g,allowedTools:_,existingAllowedTools:null,onAllowedToolsChange:Z})}),(0,l.jsx)("div",{className:"mt-6",children:(0,l.jsx)(J,{value:p,onChange:j,tools:y.filter(e=>_.includes(e.name)),disabled:!1})}),(0,l.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,l.jsx)(em.z,{variant:"secondary",onClick:q,children:"Cancel"}),(0,l.jsx)(em.z,{variant:"primary",loading:u,children:u?"Creating...":"Add MCP Server"})]})]})})}):null},eb=r(93192),ey=r(67960),eN=r(63709),e_=r(93142),eZ=r(64935),ew=r(11239),eC=r(54001),eS=r(96137),ek=r(96362),eP=r(80221),eA=r(29202);let{Title:eL,Text:eM}=eb.default,{Panel:eT}=V.default,eI=e=>{let{icon:s,title:r,description:a,children:n,serverName:i,accessGroups:o=["dev"]}=e,[c,d]=(0,t.useState)(!1),m=()=>{let e={"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"};if(c&&i){let s=[i.replace(/\s+/g,"_"),...o].join(",");e["x-mcp-servers"]=[s]}return e};return(0,l.jsxs)(ey.Z,{className:"border border-gray-200",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)("span",{className:"p-2 rounded-lg bg-gray-50",children:s}),(0,l.jsxs)("div",{children:[(0,l.jsx)(eL,{level:5,className:"mb-0",children:r}),(0,l.jsx)(eM,{className:"text-gray-600",children:a})]})]}),i&&("Implementation Example"===r||"Configuration"===r)&&(0,l.jsxs)(U.Z.Item,{className:"mb-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,l.jsx)(eN.Z,{size:"small",checked:c,onChange:d}),(0,l.jsxs)(eM,{className:"text-sm",children:["Limit tools to specific MCP servers or MCP groups by passing the ",(0,l.jsx)("code",{children:"x-mcp-servers"})," header"]})]}),c&&(0,l.jsx)(ex.Z,{className:"mt-2",type:"info",showIcon:!0,message:"Two Options",description:(0,l.jsxs)("div",{children:[(0,l.jsxs)("p",{children:[(0,l.jsx)("strong",{children:"Option 1:"})," Get a specific server: ",(0,l.jsxs)("code",{children:['["',i.replace(/\s+/g,"_"),'"]']})]}),(0,l.jsxs)("p",{children:[(0,l.jsx)("strong",{children:"Option 2:"})," Get a group of MCPs: ",(0,l.jsx)("code",{children:'["dev-group"]'})]}),(0,l.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You can also mix both: ",(0,l.jsx)("code",{children:'["Server1,dev-group"]'})]})]})})]}),t.Children.map(n,e=>{if(t.isValidElement(e)&&e.props.hasOwnProperty("code")&&e.props.hasOwnProperty("copyKey")){let s=e.props.code;if(s&&s.includes('"headers":'))return t.cloneElement(e,{code:s.replace(/"headers":\s*{[^}]*}/,'"headers": '.concat(JSON.stringify(m(),null,8)))})}return e})]})};var eE=e=>{let{currentServerAccessGroups:s=[]}=e,r=(0,P.getProxyBaseUrl)(),[a,n]=(0,t.useState)({}),[i,o]=(0,t.useState)({openai:[],litellm:[],cursor:[],http:[]}),[c]=(0,t.useState)("Zapier_MCP"),p=async(e,s)=>{await (0,ei.vQ)(e)&&(n(e=>({...e,[s]:!0})),setTimeout(()=>{n(e=>({...e,[s]:!1}))},2e3))},j=e=>{let{code:s,copyKey:r,title:t,className:n=""}=e;return(0,l.jsxs)("div",{className:"relative group",children:[t&&(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,l.jsx)(eZ.Z,{size:16,className:"text-blue-600"}),(0,l.jsx)(eM,{strong:!0,className:"text-gray-700",children:t})]}),(0,l.jsxs)(ey.Z,{className:"bg-gray-50 border border-gray-200 relative ".concat(n),children:[(0,l.jsx)(F.ZP,{type:"text",size:"small",icon:a[r]?(0,l.jsx)(eo.Z,{size:12}):(0,l.jsx)(ec.Z,{size:12}),onClick:()=>p(s,r),className:"absolute top-2 right-2 z-10 transition-all duration-200 ".concat(a[r]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),(0,l.jsx)("pre",{className:"text-sm overflow-x-auto pr-10 text-gray-800 font-mono leading-relaxed",children:s})]})]})},f=e=>{let{step:s,title:r,children:t}=e;return(0,l.jsxs)("div",{className:"flex gap-4",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("div",{className:"w-8 h-8 bg-blue-600 text-white rounded-full flex items-center justify-center text-sm font-semibold",children:s})}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)(eM,{strong:!0,className:"text-gray-800 block mb-2",children:r}),t]})]})};return(0,l.jsx)("div",{children:(0,l.jsxs)(e_.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(v.Z,{className:"text-3xl font-bold text-gray-900 mb-3",children:"Connect to your MCP client"}),(0,l.jsx)(g.Z,{className:"text-lg text-gray-600",children:"Use tools directly from any MCP client with LiteLLM MCP. Enable your AI assistant to perform real-world tasks through a simple, secure connection."})]}),(0,l.jsxs)(m.Z,{className:"w-full",children:[(0,l.jsx)(x.Z,{className:"flex justify-start mt-8 mb-6",children:(0,l.jsxs)("div",{className:"flex bg-gray-100 p-1 rounded-lg",children:[(0,l.jsx)(d.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,l.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(eZ.Z,{size:18}),"OpenAI API"]})}),(0,l.jsx)(d.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,l.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(ew.Z,{size:18}),"LiteLLM Proxy"]})}),(0,l.jsx)(d.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,l.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(eP.Z,{size:18}),"Cursor"]})}),(0,l.jsx)(d.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,l.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,l.jsx)(eA.Z,{size:18}),"Streamable HTTP"]})})]})}),(0,l.jsxs)(h.Z,{children:[(0,l.jsx)(u.Z,{className:"mt-6",children:(0,l.jsx)(()=>(0,l.jsxs)(e_.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)(eZ.Z,{className:"text-blue-600",size:24}),(0,l.jsx)(eL,{level:4,className:"mb-0 text-blue-900",children:"OpenAI Responses API Integration"})]}),(0,l.jsx)(eM,{className:"text-blue-700",children:"Connect OpenAI Responses API to your LiteLLM MCP server for seamless tool integration"})]}),(0,l.jsxs)(e_.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsx)(eI,{icon:(0,l.jsx)(eC.Z,{className:"text-blue-600",size:16}),title:"API Key Setup",description:"Configure your OpenAI API key for authentication",children:(0,l.jsxs)(e_.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,l.jsx)("div",{children:(0,l.jsxs)(eM,{children:["Get your API key from the"," ",(0,l.jsxs)("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 inline-flex items-center gap-1",children:["OpenAI platform ",(0,l.jsx)(ek.Z,{size:12})]})]})}),(0,l.jsx)(j,{title:"Environment Variable",code:'export OPENAI_API_KEY="sk-..."',copyKey:"openai-env"})]})}),(0,l.jsx)(eI,{icon:(0,l.jsx)(eS.Z,{className:"text-blue-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,l.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"openai-server-url"})}),(0,l.jsx)(eI,{icon:(0,l.jsx)(eZ.Z,{className:"text-blue-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the Responses API",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,l.jsx)(j,{code:'curl --location \'https://api.openai.com/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $OPENAI_API_KEY" \\\n--data \'{\n "model": "gpt-4.1",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "'.concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"openai-curl",className:"text-xs"})})]})]}),{})}),(0,l.jsx)(u.Z,{className:"mt-6",children:(0,l.jsx)(()=>(0,l.jsxs)(e_.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-green-50 p-6 rounded-lg border border-emerald-100",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)(ew.Z,{className:"text-emerald-600",size:24}),(0,l.jsx)(eL,{level:4,className:"mb-0 text-emerald-900",children:"LiteLLM Proxy API Integration"})]}),(0,l.jsx)(eM,{className:"text-emerald-700",children:"Connect to LiteLLM Proxy Responses API for seamless tool integration with multiple model providers"})]}),(0,l.jsxs)(e_.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsx)(eI,{icon:(0,l.jsx)(eC.Z,{className:"text-emerald-600",size:16}),title:"API Key Setup",description:"Configure your LiteLLM Proxy API key for authentication",children:(0,l.jsxs)(e_.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,l.jsx)("div",{children:(0,l.jsx)(eM,{children:"Get your API key from your LiteLLM Proxy dashboard or contact your administrator"})}),(0,l.jsx)(j,{title:"Environment Variable",code:'export LITELLM_API_KEY="sk-..."',copyKey:"litellm-env"})]})}),(0,l.jsx)(eI,{icon:(0,l.jsx)(eS.Z,{className:"text-emerald-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,l.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"litellm-server-url"})}),(0,l.jsx)(eI,{icon:(0,l.jsx)(eZ.Z,{className:"text-emerald-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the LiteLLM Proxy Responses API",serverName:c,accessGroups:["dev"],children:(0,l.jsx)(j,{code:"curl --location '".concat(r,'/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $LITELLM_API_KEY" \\\n--data \'{\n "model": "gpt-4",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "').concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"litellm-curl",className:"text-xs"})})]})]}),{})}),(0,l.jsx)(u.Z,{className:"mt-6",children:(0,l.jsx)(()=>(0,l.jsxs)(e_.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 p-6 rounded-lg border border-purple-100",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)(eP.Z,{className:"text-purple-600",size:24}),(0,l.jsx)(eL,{level:4,className:"mb-0 text-purple-900",children:"Cursor IDE Integration"})]}),(0,l.jsx)(eM,{className:"text-purple-700",children:"Use tools directly from Cursor IDE with LiteLLM MCP. Enable your AI assistant to perform real-world tasks without leaving your coding environment."})]}),(0,l.jsxs)(ey.Z,{className:"border border-gray-200",children:[(0,l.jsx)(eL,{level:5,className:"mb-4 text-gray-800",children:"Setup Instructions"}),(0,l.jsxs)(e_.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsx)(f,{step:1,title:"Open Cursor Settings",children:(0,l.jsxs)(eM,{className:"text-gray-600",children:["Use the keyboard shortcut ",(0,l.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"⇧+⌘+J"})," (Mac) or"," ",(0,l.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+Shift+J"})," (Windows/Linux)"]})}),(0,l.jsx)(f,{step:2,title:"Navigate to MCP Tools",children:(0,l.jsx)(eM,{className:"text-gray-600",children:'Go to the "MCP Tools" tab and click "New MCP Server"'})}),(0,l.jsxs)(f,{step:3,title:"Add Configuration",children:[(0,l.jsxs)(eM,{className:"text-gray-600 mb-3",children:["Copy the JSON configuration below and paste it into Cursor, then save with"," ",(0,l.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Cmd+S"})," or"," ",(0,l.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+S"})]}),(0,l.jsx)(eI,{icon:(0,l.jsx)(eZ.Z,{className:"text-purple-600",size:16}),title:"Configuration",description:"Cursor MCP configuration",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,l.jsx)(j,{code:'{\n "mcpServers": {\n "Zapier_MCP": {\n "server_url": "'.concat(r,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n }\n}'),copyKey:"cursor-config",className:"text-xs"})})]})]})]})]}),{})}),(0,l.jsx)(u.Z,{className:"mt-6",children:(0,l.jsx)(()=>(0,l.jsxs)(e_.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,l.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-lg border border-green-100",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,l.jsx)(eA.Z,{className:"text-green-600",size:24}),(0,l.jsx)(eL,{level:4,className:"mb-0 text-green-900",children:"Streamable HTTP Transport"})]}),(0,l.jsx)(eM,{className:"text-green-700",children:"Connect to LiteLLM MCP using HTTP transport. Compatible with any MCP client that supports HTTP streaming."})]}),(0,l.jsx)(eI,{icon:(0,l.jsx)(eA.Z,{className:"text-green-600",size:16}),title:"Universal MCP Connection",description:"Use this URL with any MCP client that supports HTTP transport",children:(0,l.jsxs)(e_.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,l.jsx)("div",{children:(0,l.jsx)(eM,{children:"Each MCP client supports different transports. Refer to your client documentation to determine the appropriate transport method."})}),(0,l.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"http-server-url"}),(0,l.jsx)(j,{title:"Headers Configuration",code:JSON.stringify({"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"},null,2),copyKey:"http-headers"}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(F.ZP,{type:"link",className:"p-0 h-auto text-blue-600 hover:text-blue-700",href:"https://modelcontextprotocol.io/docs/concepts/transports",icon:(0,l.jsx)(ek.Z,{size:14}),children:"Learn more about MCP transports"})})]})})]}),{})})]})]})]})})},ez=r(67187);let{Option:eq}=n.default,eO=e=>{let{isModalOpen:s,title:r,confirmDelete:t,cancelDelete:a}=e;return s?(0,l.jsx)(i.Z,{open:s,onOk:t,okType:"danger",onCancel:a,children:(0,l.jsxs)(j.Z,{numItems:1,className:"gap-2 w-full",children:[(0,l.jsx)(v.Z,{children:r}),(0,l.jsx)(p.Z,{numColSpan:1,children:(0,l.jsx)("p",{children:"Are you sure you want to delete this MCP Server?"})})]})}):null};var eR=e=>{let{accessToken:s,userRole:r,userID:i}=e,{data:p,isLoading:j,refetch:b,dataUpdatedAt:y}=(0,a.a)({queryKey:["mcpServers"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,P.fetchMCPServers)(s)},enabled:!!s});t.useEffect(()=>{p&&(console.log("MCP Servers fetched:",p),p.forEach(e=>{console.log("Server: ".concat(e.server_name||e.server_id)),console.log(" allowed_tools:",e.allowed_tools)}))},[p]);let[N,_]=(0,t.useState)(null),[Z,w]=(0,t.useState)(!1),[C,S]=(0,t.useState)(null),[L,M]=(0,t.useState)(!1),[T,I]=(0,t.useState)("all"),[E,z]=(0,t.useState)("all"),[q,O]=(0,t.useState)([]),[R,U]=(0,t.useState)(!1),F="Internal User"===r,B=t.useMemo(()=>{if(!p)return[];let e=new Set,s=[];return p.forEach(r=>{r.teams&&r.teams.forEach(r=>{let l=r.team_id;e.has(l)||(e.add(l),s.push(r))})}),s},[p]),K=t.useMemo(()=>p?Array.from(new Set(p.flatMap(e=>e.mcp_access_groups).filter(e=>null!=e))):[],[p]),V=e=>{I(e),H(e,E)},D=e=>{z(e),H(T,e)},H=(e,s)=>{if(!p)return O([]);let r=p;if("personal"===e){O([]);return}"all"!==e&&(r=r.filter(s=>{var r;return null===(r=s.teams)||void 0===r?void 0:r.some(s=>s.team_id===e)})),"all"!==s&&(r=r.filter(e=>{var r;return null===(r=e.mcp_access_groups)||void 0===r?void 0:r.some(e=>"string"==typeof e?e===s:e&&e.name===s)})),O(r)};(0,t.useEffect)(()=>{H(T,E)},[y]);let G=t.useMemo(()=>k(null!=r?r:"",e=>{S(e),M(!1)},e=>{S(e),M(!0)},Y),[r]);function Y(e){_(e),w(!0)}let J=async()=>{if(null!=N&&null!=s){try{await (0,P.deleteMCPServer)(s,N),el.Z.success("Deleted MCP Server successfully"),b()}catch(e){console.error("Error deleting the mcp server:",e)}w(!1),_(null)}};return s&&r&&i?(0,l.jsxs)("div",{className:"w-full h-full p-6",children:[(0,l.jsx)(eO,{isModalOpen:Z,title:"Delete MCP Server",confirmDelete:J,cancelDelete:()=>{w(!1),_(null)}}),(0,l.jsx)(ef,{userRole:r,accessToken:s,onCreateSuccess:e=>{O(s=>[...s,e]),U(!1)},isModalVisible:R,setModalVisible:U,availableAccessGroups:K}),(0,l.jsx)(v.Z,{children:"MCP Servers"}),(0,l.jsx)(g.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your MCP servers"}),(0,A.tY)(r)&&(0,l.jsx)(c.Z,{className:"mt-4 mb-4",onClick:()=>U(!0),children:"+ Add New MCP Server"}),(0,l.jsxs)(m.Z,{className:"w-full h-full",children:[(0,l.jsx)(x.Z,{className:"flex justify-between mt-2 w-full items-center",children:(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)(d.Z,{children:"All Servers"}),(0,l.jsx)(d.Z,{children:"Connect"})]})}),(0,l.jsxs)(h.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(()=>C?(0,l.jsx)(ed,{mcpServer:q.find(e=>e.server_id===C)||{server_id:"",server_name:"",alias:"",url:"",transport:"",auth_type:"",created_at:"",created_by:"",updated_at:"",updated_by:""},onBack:()=>{M(!1),S(null),b()},isProxyAdmin:(0,A.tY)(r),isEditing:L,accessToken:s,userID:i,userRole:r,availableAccessGroups:K}):(0,l.jsxs)("div",{className:"w-full h-full",children:[(0,l.jsx)("div",{className:"w-full px-6",children:(0,l.jsx)("div",{className:"flex flex-col space-y-4",children:(0,l.jsx)("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg p-4 border-2 border-gray-200",children:(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)(g.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,l.jsxs)(n.default,{value:T,onChange:V,style:{width:300},children:[(0,l.jsx)(eq,{value:"all",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:F?"All Available Servers":"All Servers"})]})}),(0,l.jsx)(eq,{value:"personal",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:"Personal"})]})}),B.map(e=>(0,l.jsx)(eq,{value:e.team_id,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:e.team_alias||e.team_id})]})},e.team_id))]}),(0,l.jsxs)(g.Z,{className:"text-lg font-semibold text-gray-900 ml-6",children:["Access Group:",(0,l.jsx)(o.Z,{title:"An MCP Access Group is a set of users or teams that have permission to access specific MCP servers. Use access groups to control and organize who can connect to which servers.",children:(0,l.jsx)(ez.Z,{style:{marginLeft:4,color:"#888"}})})]}),(0,l.jsxs)(n.default,{value:E,onChange:D,style:{width:300},children:[(0,l.jsx)(eq,{value:"all",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:"All Access Groups"})]})}),K.map(e=>(0,l.jsx)(eq,{value:e,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,l.jsx)("span",{className:"font-medium",children:e})]})},e))]})]})})})}),(0,l.jsx)("div",{className:"w-full px-6 mt-6",children:(0,l.jsx)(f.w,{data:q,columns:G,renderSubComponent:()=>(0,l.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:j,noDataMessage:"No MCP servers configured"})})]}),{})}),(0,l.jsx)(u.Z,{children:(0,l.jsx)(eE,{})})]})]})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:r,userID:i}),(0,l.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))},eU=r(21770);function eF(e){let{tool:s,needsAuth:r,authValue:a,onSubmit:n,isLoading:i,result:c,error:d,onClose:m}=e,[x]=U.Z.useForm(),[u,h]=t.useState("formatted"),[p,j]=t.useState(null),[g,v]=t.useState(null),f=t.useMemo(()=>"string"==typeof s.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:s.inputSchema,[s.inputSchema]),b=t.useMemo(()=>f.properties&&f.properties.params&&"object"===f.properties.params.type&&f.properties.params.properties?{type:"object",properties:f.properties.params.properties,required:f.properties.params.required||[]}:f,[f]);t.useEffect(()=>{p&&(c||d)&&v(Date.now()-p)},[c,d,p]);let y=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let r=document.execCommand("copy");if(document.body.removeChild(s),!r)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},N=async()=>{await y(JSON.stringify(c,null,2))?el.Z.success("Result copied to clipboard"):el.Z.fromBackend("Failed to copy result")},_=async()=>{await y(s.name)?el.Z.success("Tool name copied to clipboard"):el.Z.fromBackend("Failed to copy tool name")};return(0,l.jsxs)("div",{className:"space-y-4 h-full",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-3",children:[s.mcp_info.logo_url&&(0,l.jsx)("img",{src:s.mcp_info.logo_url,alt:"".concat(s.mcp_info.server_name," logo"),className:"w-6 h-6 object-contain"}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,l.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Tool:"}),(0,l.jsxs)("div",{className:"group inline-flex items-center space-x-1 bg-slate-50 hover:bg-slate-100 px-3 py-1 rounded-md cursor-pointer transition-colors border border-slate-200",onClick:_,title:"Click to copy tool name",children:[(0,l.jsx)("span",{className:"font-mono text-slate-700 font-medium text-sm",children:s.name}),(0,l.jsx)("svg",{className:"w-3 h-3 text-slate-400 group-hover:text-slate-600 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})]})]}),(0,l.jsx)("p",{className:"text-xs text-gray-600",children:s.description}),(0,l.jsxs)("p",{className:"text-xs text-gray-500",children:["Provider: ",s.mcp_info.server_name]})]})]}),(0,l.jsx)(em.z,{onClick:m,variant:"light",size:"sm",className:"text-gray-500 hover:text-gray-700",children:(0,l.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4 h-full",children:[(0,l.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,l.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Input Parameters"}),(0,l.jsx)(o.Z,{title:"Configure the input parameters for this tool call",children:(0,l.jsx)(G.Z,{className:"text-gray-400 hover:text-gray-600"})})]})}),(0,l.jsx)("div",{className:"p-4",children:(0,l.jsxs)(U.Z,{form:x,onFinish:e=>{j(Date.now()),v(null);let s={};Object.entries(e).forEach(e=>{var r;let[l,t]=e,a=null===(r=b.properties)||void 0===r?void 0:r[l];if(a&&null!=t&&""!==t)switch(a.type){case"boolean":s[l]="true"===t||!0===t;break;case"number":s[l]=Number(t);break;case"string":s[l]=String(t);break;default:s[l]=t}else null!=t&&""!==t&&(s[l]=t)}),n(f.properties&&f.properties.params&&"object"===f.properties.params.type&&f.properties.params.properties?{params:s}:s)},layout:"vertical",className:"space-y-3",children:["string"==typeof s.inputSchema?(0,l.jsx)("div",{className:"space-y-3",children:(0,l.jsx)(U.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,l.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],className:"mb-3",children:(0,l.jsx)(em.o,{placeholder:"Enter input for this tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})}):void 0===b.properties?(0,l.jsx)("div",{className:"text-center py-6 bg-gray-50 rounded-lg border border-gray-200",children:(0,l.jsxs)("div",{className:"max-w-sm mx-auto",children:[(0,l.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Parameters Required"}),(0,l.jsx)("p",{className:"text-xs text-gray-500",children:"This tool can be called without any input parameters."})]})}):(0,l.jsx)("div",{className:"space-y-3",children:Object.entries(b.properties).map(e=>{var s,r,t,a,n;let[i,c]=e;return(0,l.jsxs)(U.Z.Item,{label:(0,l.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[i," ",(null===(s=b.required)||void 0===s?void 0:s.includes(i))&&(0,l.jsx)("span",{className:"text-red-500",children:"*"}),c.description&&(0,l.jsx)(o.Z,{title:c.description,children:(0,l.jsx)(G.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:i,rules:[{required:null===(r=b.required)||void 0===r?void 0:r.includes(i),message:"Please enter ".concat(i)}],className:"mb-3",children:["string"===c.type&&c.enum&&(0,l.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:c.default,children:[!(null===(t=b.required)||void 0===t?void 0:t.includes(i))&&(0,l.jsxs)("option",{value:"",children:["Select ",i]}),c.enum.map(e=>(0,l.jsx)("option",{value:e,children:e},e))]}),"string"===c.type&&!c.enum&&(0,l.jsx)(em.o,{placeholder:c.description||"Enter ".concat(i),className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"}),"number"===c.type&&(0,l.jsx)("input",{type:"number",placeholder:c.description||"Enter ".concat(i),className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors"}),"boolean"===c.type&&(0,l.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:(null===(a=c.default)||void 0===a?void 0:a.toString())||"",children:[!(null===(n=b.required)||void 0===n?void 0:n.includes(i))&&(0,l.jsxs)("option",{value:"",children:["Select ",i]}),(0,l.jsx)("option",{value:"true",children:"True"}),(0,l.jsx)("option",{value:"false",children:"False"})]})]},i)})}),(0,l.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,l.jsx)(em.z,{onClick:()=>x.submit(),disabled:i,variant:"primary",className:"w-full",loading:i,children:i?"Calling Tool...":c||d?"Call Again":"Call Tool"})})]})})]}),(0,l.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,l.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,l.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Tool Result"})}),(0,l.jsx)("div",{className:"p-4",children:c||d||i?(0,l.jsxs)("div",{className:"space-y-3",children:[c&&!i&&!d&&(0,l.jsx)("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsx)("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,l.jsx)("h4",{className:"text-xs font-medium text-green-900",children:"Tool executed successfully"}),null!==g&&(0,l.jsxs)("span",{className:"text-xs text-green-600 ml-1",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,l.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,l.jsxs)("div",{className:"flex bg-white rounded border border-green-300 p-0.5",children:[(0,l.jsx)("button",{onClick:()=>h("formatted"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("formatted"===u?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"Formatted"}),(0,l.jsx)("button",{onClick:()=>h("json"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("json"===u?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"JSON"})]}),(0,l.jsx)("button",{onClick:N,className:"p-1 hover:bg-green-100 rounded text-green-700",title:"Copy response",children:(0,l.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,l.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})}),(0,l.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[i&&(0,l.jsxs)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-200"}),(0,l.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,l.jsx)("p",{className:"text-sm font-medium mt-3",children:"Calling tool..."}),(0,l.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Please wait while we process your request"})]}),d&&(0,l.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:(0,l.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("svg",{className:"h-4 w-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,l.jsx)("h4",{className:"text-xs font-medium text-red-900",children:"Tool Call Failed"}),null!==g&&(0,l.jsxs)("span",{className:"text-xs text-red-600",children:["• ",(g/1e3).toFixed(2),"s"]})]}),(0,l.jsx)("div",{className:"bg-white border border-red-200 rounded p-2 max-h-48 overflow-y-auto",children:(0,l.jsx)("pre",{className:"text-xs whitespace-pre-wrap text-red-700 font-mono",children:d.message})})]})]})}),c&&!i&&!d&&(0,l.jsx)("div",{className:"space-y-3",children:"formatted"===u?c.map((e,s)=>(0,l.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:["text"===e.type&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,l.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Text Response"})}),(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)("div",{className:"bg-white rounded border border-gray-200 max-h-64 overflow-y-auto",children:(0,l.jsx)("div",{className:"p-3 space-y-2",children:e.text.split("\n\n").map((e,s)=>{if(""===e.trim())return null;if(e.startsWith("##")){let r=e.replace(/^#+\s/,"");return(0,l.jsx)("div",{className:"border-b border-gray-200 pb-1 mb-2",children:(0,l.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:r})},s)}let r=/(https?:\/\/[^\s\)]+)/g;if(r.test(e)){let t=e.split(r);return(0,l.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded p-2",children:(0,l.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:t.map((e,s)=>r.test(e)?(0,l.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline break-all",children:e},s):e)})},s)}return e.includes("Score:")?(0,l.jsx)("div",{className:"bg-green-50 border-l-4 border-green-400 p-2 rounded-r",children:(0,l.jsx)("p",{className:"text-xs text-green-800 font-medium whitespace-pre-wrap",children:e})},s):(0,l.jsx)("div",{className:"bg-gray-50 rounded p-2 border border-gray-200",children:(0,l.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:e})},s)}).filter(Boolean)})})})]}),"image"===e.type&&e.url&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,l.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Image Response"})}),(0,l.jsx)("div",{className:"p-3",children:(0,l.jsx)("div",{className:"bg-gray-50 rounded p-3 border border-gray-200",children:(0,l.jsx)("img",{src:e.url,alt:"Tool result",className:"max-w-full h-auto rounded shadow-sm"})})})]}),"embedded_resource"===e.type&&(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,l.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Embedded Resource"})}),(0,l.jsx)("div",{className:"p-3",children:(0,l.jsxs)("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 border border-blue-200 rounded",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("svg",{className:"h-5 w-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.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,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsxs)("p",{className:"text-xs font-medium text-blue-900",children:["Resource Type: ",e.resource_type]}),e.url&&(0,l.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-xs text-blue-600 hover:text-blue-800 hover:underline mt-1 transition-colors",children:["View Resource",(0,l.jsxs)("svg",{className:"ml-1 h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:[(0,l.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,l.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})})]})]},s)):(0,l.jsx)("div",{className:"bg-white rounded border border-gray-200",children:(0,l.jsx)("div",{className:"p-3 overflow-auto max-h-80 bg-gray-50",children:(0,l.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all text-gray-800",children:JSON.stringify(c,null,2)})})})})]})]}):(0,l.jsx)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:(0,l.jsxs)("div",{className:"text-center max-w-sm",children:[(0,l.jsx)("div",{className:"mb-3",children:(0,l.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,l.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"Ready to Call Tool"}),(0,l.jsx)("p",{className:"text-xs text-gray-500 leading-relaxed",children:'Configure the input parameters and click "Call Tool" to see the results here.'})]})})})]})]})]})}var eB=r(29488),eK=r(36724),eV=r(57400),eD=r(69993);let eH=e=>{let s,{visible:r,onOk:t,onCancel:a,authType:n}=e,[o]=U.Z.useForm();if(n===E.API_KEY||n===E.BEARER_TOKEN){let e=n===E.API_KEY?"API Key":"Bearer Token";s=(0,l.jsx)(U.Z.Item,{name:"authValue",label:e,rules:[{required:!0,message:"Please input your ".concat(e)}],children:(0,l.jsx)(ej.default.Password,{})})}else n===E.BASIC&&(s=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(U.Z.Item,{name:"username",label:"Username",rules:[{required:!0,message:"Please input your username"}],children:(0,l.jsx)(ej.default,{})}),(0,l.jsx)(U.Z.Item,{name:"password",label:"Password",rules:[{required:!0,message:"Please input your password"}],children:(0,l.jsx)(ej.default.Password,{})})]}));return(0,l.jsx)(i.Z,{open:r,title:"Authentication",onOk:()=>{o.validateFields().then(e=>{n===E.BASIC?t("".concat(e.username.trim(),":").concat(e.password.trim())):t(e.authValue.trim())})},onCancel:a,destroyOnClose:!0,children:(0,l.jsx)(U.Z,{form:o,layout:"vertical",children:s})})},eG=e=>{let{authType:s,onAuthSubmit:r,onClearAuth:a,hasAuth:n}=e,[i,o]=(0,t.useState)(!1);return(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)(eK.xv,{className:"text-sm font-medium text-gray-700",children:["Authentication ",n?"✓":""]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[n&&(0,l.jsx)(eK.zx,{onClick:()=>{a()},size:"sm",variant:"secondary",className:"text-xs text-red-600 hover:text-red-700",children:"Clear"}),(0,l.jsx)(eK.zx,{onClick:()=>o(!0),size:"sm",variant:"secondary",className:"text-xs",children:n?"Update":"Add Auth"})]})]}),(0,l.jsx)(eK.xv,{className:"text-xs text-gray-500",children:n?"Authentication configured and saved locally":"Some tools may require authentication"}),(0,l.jsx)(eH,{visible:i,onOk:e=>{r(e),o(!1)},onCancel:()=>o(!1),authType:s})]})};var eY=e=>{let{serverId:s,accessToken:r,auth_type:n,userRole:i,userID:o,serverAlias:c}=e,[d,m]=(0,t.useState)(""),[x,u]=(0,t.useState)(null),[h,p]=(0,t.useState)(null),[j,g]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(R(n)){let e=(0,eB.Ui)(s,c||void 0);e&&m(e)}},[s,c,n]);let v=e=>{m(e),e&&R(n)&&((0,eB.Hc)(s,e,n||"none",c||void 0),el.Z.success("Authentication token saved locally"))},f=()=>{m(""),(0,eB.e4)(s),el.Z.info("Authentication token cleared")},{data:b,isLoading:y,error:N}=(0,a.a)({queryKey:["mcpTools",s,d,c],queryFn:()=>{if(!r)throw Error("Access Token required");return(0,P.listMCPTools)(r,s,d,c||void 0)},enabled:!!r,staleTime:3e4}),{mutate:_,isPending:Z}=(0,eU.D)({mutationFn:async e=>{if(!r)throw Error("Access Token required");try{return await (0,P.callMCPTool)(r,e.tool.name,e.arguments,e.authValue,c||void 0)}catch(e){throw e}},onSuccess:e=>{p(e),g(null)},onError:e=>{g(e),p(null)}}),w=(null==b?void 0:b.tools)||[],C=""!==d;return(0,l.jsx)("div",{className:"w-full h-screen p-4 bg-white",children:(0,l.jsx)(eK.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,l.jsxs)("div",{className:"flex h-auto w-full gap-4",children:[(0,l.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 flex flex-col",children:[(0,l.jsx)(eK.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"MCP Tools"}),(0,l.jsxs)("div",{className:"flex flex-col flex-1",children:[(0,l.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,l.jsxs)(eK.xv,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,l.jsx)(Y.Z,{className:"mr-2"})," Available Tools",w.length>0&&(0,l.jsx)("span",{className:"ml-2 bg-blue-100 text-blue-800 text-xs font-medium px-2 py-0.5 rounded-full",children:w.length})]}),y&&(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 bg-white border border-gray-200 rounded-lg",children:[(0,l.jsxs)("div",{className:"relative mb-3",children:[(0,l.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-gray-200"}),(0,l.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,l.jsx)("p",{className:"text-xs font-medium text-gray-700",children:"Loading tools..."})]}),(null==b?void 0:b.error)&&!y&&!w.length&&(0,l.jsx)("div",{className:"p-3 text-xs text-red-800 rounded-lg bg-red-50 border border-red-200",children:(0,l.jsxs)("p",{className:"font-medium",children:["Error: ",b.message]})}),!y&&!(null==b?void 0:b.error)&&(!w||0===w.length)&&(0,l.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,l.jsx)("div",{className:"mx-auto w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center mb-2",children:(0,l.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 8.172V5L8 4z"})})}),(0,l.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools available"}),(0,l.jsx)("p",{className:"text-xs text-gray-500",children:"No tools found for this server"})]}),!y&&!(null==b?void 0:b.error)&&w.length>0&&(0,l.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto min-h-0 mcp-tools-scrollable",style:{maxHeight:"400px",scrollbarWidth:"auto",scrollbarColor:"#cbd5e0 #f7fafc"},children:w.map(e=>(0,l.jsxs)("div",{className:"border rounded-lg p-3 cursor-pointer transition-all hover:shadow-sm ".concat((null==x?void 0:x.name)===e.name?"border-blue-500 bg-blue-50 ring-1 ring-blue-200":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>{u(e),p(null),g(null)},children:[(0,l.jsxs)("div",{className:"flex items-start space-x-2",children:[e.mcp_info.logo_url&&(0,l.jsx)("img",{src:e.mcp_info.logo_url,alt:"".concat(e.mcp_info.server_name," logo"),className:"w-4 h-4 object-contain flex-shrink-0 mt-0.5"}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("h4",{className:"font-mono text-xs font-medium text-gray-900 truncate",children:e.name}),(0,l.jsx)("p",{className:"text-xs text-gray-500 truncate",children:e.mcp_info.server_name}),(0,l.jsx)("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2 leading-relaxed",children:e.description})]})]}),(null==x?void 0:x.name)===e.name&&(0,l.jsx)("div",{className:"mt-2 pt-2 border-t border-blue-200",children:(0,l.jsxs)("div",{className:"flex items-center text-xs font-medium text-blue-700",children:[(0,l.jsx)("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Selected"]})})]},e.name))})]}),R(n)&&(0,l.jsx)("div",{className:"pt-4 border-t border-gray-200 flex-shrink-0 mt-6",children:C?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(eK.xv,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,l.jsx)(eV.Z,{className:"mr-2"})," Authentication"]}),(0,l.jsx)(eG,{authType:n,onAuthSubmit:v,onClearAuth:f,hasAuth:C})]}):(0,l.jsxs)("div",{className:"p-4 bg-gradient-to-r from-orange-50 to-red-50 border border-orange-200 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-center mb-3",children:[(0,l.jsx)(eV.Z,{className:"mr-2 text-orange-600 text-lg"}),(0,l.jsx)(eK.xv,{className:"font-semibold text-orange-800",children:"Authentication Required"})]}),(0,l.jsx)(eK.xv,{className:"text-sm text-orange-700 mb-4",children:"This MCP server requires authentication. You must add your credentials below to access the tools."}),(0,l.jsx)(eG,{authType:n,onAuthSubmit:v,onClearAuth:f,hasAuth:C})]})})]})]}),(0,l.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,l.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,l.jsx)(eK.Dx,{className:"text-xl font-semibold mb-0",children:"Tool Testing Playground"})}),(0,l.jsx)("div",{className:"flex-1 overflow-auto p-4",children:x?(0,l.jsx)("div",{className:"h-full",children:(0,l.jsx)(eF,{tool:x,needsAuth:R(n),authValue:d,onSubmit:e=>{_({tool:x,arguments:e,authValue:d})},result:h,error:j,isLoading:Z,onClose:()=>u(null)})}):(0,l.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,l.jsx)(eD.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,l.jsx)(eK.xv,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select a Tool to Test"}),(0,l.jsx)(eK.xv,{className:"text-center text-gray-500 max-w-md",children:"Choose a tool from the left sidebar to start testing its functionality with custom inputs."})]})})]})]})})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/13b76428-e1bf383848c17260.js b/litellm/proxy/_experimental/out/_next/static/chunks/13b76428-e1bf383848c17260.js new file mode 100644 index 00000000000..76cea35732a --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/13b76428-e1bf383848c17260.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6990],{77398:function(e,t,n){var s;e=n.nmd(e),s=function(){"use strict";function t(){return V.apply(null,arguments)}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function s(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function r(e){var t;if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(t in e)if(i(e,t))return!1;return!0}function a(e){return void 0===e}function o(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var n,s=[],i=e.length;for(n=0;n>>0;for(t=0;t0)for(n=0;n=0?n?"+":"":"-")+Math.pow(10,Math.max(0,t-s.length)).toString().substr(1)+s}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null,A=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)i(e,t)&&n.push(t);return n};var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,W=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,P={},R={};function C(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(R[e]=i),t&&(R[t[0]]=function(){return x(i.apply(this,arguments),t[1],t[2])}),n&&(R[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function U(e,t){return e.isValid()?(P[t=H(t,e.localeData())]=P[t]||function(e){var t,n,s,i=e.match(N);for(n=0,s=i.length;n=0&&W.test(e);)e=e.replace(W,s),W.lastIndex=0,n-=1;return e}var F={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function L(e){return"string"==typeof e?F[e]||F[e.toLowerCase()]:void 0}function E(e){var t,n,s={};for(n in e)i(e,n)&&(t=L(n))&&(s[t]=e[n]);return s}var V,G,A,I,j={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1},Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,B=/[+-]?\d{6}/,J=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,et=/[+-]?\d{1,6}/,en=/\d+/,es=/[+-]?\d+/,ei=/Z|[+-]\d\d:?\d\d/gi,er=/Z|[+-]\d\d(?::?\d\d)?/gi,ea=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,eo=/^[1-9]\d?/,eu=/^([1-9]\d|\d)/;function el(e,t,n){I[e]=O(t)?t:function(e,s){return e&&n?n:t}}function eh(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ed(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function ec(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=ed(t)),n}I={};var ef={};function em(e,t){var n,s,i=t;for("string"==typeof e&&(e=[e]),o(t)&&(i=function(e,n){n[t]=ec(e)}),s=e.length,n=0;n68?1900:2e3)};var ew=ep("FullYear",!0);function ep(e,n){return function(s){return null!=s?(ek(this,e,s),t.updateOffset(this,n),this):ev(this,e)}}function ev(e,t){if(!e.isValid())return NaN;var n=e._d,s=e._isUTC;switch(t){case"Milliseconds":return s?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return s?n.getUTCSeconds():n.getSeconds();case"Minutes":return s?n.getUTCMinutes():n.getMinutes();case"Hours":return s?n.getUTCHours():n.getHours();case"Date":return s?n.getUTCDate():n.getDate();case"Day":return s?n.getUTCDay():n.getDay();case"Month":return s?n.getUTCMonth():n.getMonth();case"FullYear":return s?n.getUTCFullYear():n.getFullYear();default:return NaN}}function ek(e,t,n){var s,i,r,a;if(!(!e.isValid()||isNaN(n))){switch(s=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?s.setUTCMilliseconds(n):s.setMilliseconds(n));case"Seconds":return void(i?s.setUTCSeconds(n):s.setSeconds(n));case"Minutes":return void(i?s.setUTCMinutes(n):s.setMinutes(n));case"Hours":return void(i?s.setUTCHours(n):s.setHours(n));case"Date":return void(i?s.setUTCDate(n):s.setDate(n));case"FullYear":break;default:return}r=e.month(),a=29!==(a=e.date())||1!==r||ey(n)?a:28,i?s.setUTCFullYear(n,r,a):s.setFullYear(n,r,a)}}function eM(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=(t%12+12)%12;return e+=(t-n)/12,1===n?ey(e)?29:28:31-n%7%2}eA=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t=0?isFinite((o=new Date(e+400,t,n,s,i,r,a)).getFullYear())&&o.setFullYear(e):o=new Date(e,t,n,s,i,r,a),o}function eN(e){var t,n;return e<100&&e>=0?(n=Array.prototype.slice.call(arguments),n[0]=e+400,isFinite((t=new Date(Date.UTC.apply(null,n))).getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function eW(e,t,n){var s=7+t-n;return-((7+eN(e,0,s).getUTCDay()-t)%7)+s-1}function eP(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+eW(e,s,i);return o<=0?a=eg(r=e-1)+o:o>eg(e)?(r=e+1,a=o-eg(e)):(r=e,a=o),{year:r,dayOfYear:a}}function eR(e,t,n){var s,i,r=eW(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+eC(i=e.year()-1,t,n):a>eC(e.year(),t,n)?(s=a-eC(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function eC(e,t,n){var s=eW(e,t,n),i=eW(e+1,t,n);return(eg(e)-s+i)/7}function eU(e,t){return e.slice(t,7).concat(e.slice(0,t))}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),el("w",J,eo),el("ww",J,z),el("W",J,eo),el("WW",J,z),e_(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=ec(e)}),C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),el("d",J),el("e",J),el("E",J),el("dd",function(e,t){return t.weekdaysMinRegex(e)}),el("ddd",function(e,t){return t.weekdaysShortRegex(e)}),el("dddd",function(e,t){return t.weekdaysRegex(e)}),e_(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:c(n).invalidWeekday=e}),e_(["d","e","E"],function(e,t,n,s){t[s]=ec(e)});var eH="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function eF(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(s=0,this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[];s<7;++s)r=d([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=eA.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=eA.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=eA.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=eA.call(this._weekdaysParse,a))||-1!==(i=eA.call(this._shortWeekdaysParse,a))?i:-1!==(i=eA.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=eA.call(this._shortWeekdaysParse,a))||-1!==(i=eA.call(this._weekdaysParse,a))?i:-1!==(i=eA.call(this._minWeekdaysParse,a))?i:null:-1!==(i=eA.call(this._minWeekdaysParse,a))||-1!==(i=eA.call(this._weekdaysParse,a))?i:-1!==(i=eA.call(this._shortWeekdaysParse,a))?i:null}function eL(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=d([2e3,1]).day(t),s=eh(this.weekdaysMin(n,"")),i=eh(this.weekdaysShort(n,"")),r=eh(this.weekdays(n,"")),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);a.sort(e),o.sort(e),u.sort(e),l.sort(e),this._weekdaysRegex=RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=RegExp("^("+a.join("|")+")","i")}function eE(){return this.hours()%12||12}function eV(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function eG(e,t){return t._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,eE),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+eE.apply(this)+x(this.minutes(),2)}),C("hmmss",0,0,function(){return""+eE.apply(this)+x(this.minutes(),2)+x(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+x(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+x(this.minutes(),2)+x(this.seconds(),2)}),eV("a",!0),eV("A",!1),el("a",eG),el("A",eG),el("H",J,eu),el("h",J,eo),el("k",J,eo),el("HH",J,z),el("hh",J,z),el("kk",J,z),el("hmm",Q),el("hmmss",X),el("Hmm",Q),el("Hmmss",X),em(["H","HH"],3),em(["k","kk"],function(e,t,n){var s=ec(e);t[3]=24===s?0:s}),em(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),em(["h","hh"],function(e,t,n){t[3]=ec(e),c(n).bigHour=!0}),em("hmm",function(e,t,n){var s=e.length-2;t[3]=ec(e.substr(0,s)),t[4]=ec(e.substr(s)),c(n).bigHour=!0}),em("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[3]=ec(e.substr(0,s)),t[4]=ec(e.substr(s,2)),t[5]=ec(e.substr(i)),c(n).bigHour=!0}),em("Hmm",function(e,t,n){var s=e.length-2;t[3]=ec(e.substr(0,s)),t[4]=ec(e.substr(s))}),em("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[3]=ec(e.substr(0,s)),t[4]=ec(e.substr(s,2)),t[5]=ec(e.substr(i))});var eA,eI,ej=ep("Hours",!0),eZ={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:eD,week:{dow:0,doy:6},weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysShort:eH,meridiemParse:/[ap]\.?m?\.?/i},ez={},e$={};function eq(e){return e?e.toLowerCase().replace("_","-"):e}function eB(t){var n=null;if(void 0===ez[t]&&e&&e.exports&&t&&t.match("^[^/\\\\]*$"))try{n=eI._abbr,function(){var e=Error("Cannot find module 'undefined'");throw e.code="MODULE_NOT_FOUND",e}(),eJ(n)}catch(e){ez[t]=null}return ez[t]}function eJ(e,t){var n;return e&&((n=a(t)?eX(e):eQ(e,t))?eI=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),eI._abbr}function eQ(e,t){if(null===t)return delete ez[e],null;var n,s=eZ;if(t.abbr=e,null!=ez[e])S("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=ez[e]._config;else if(null!=t.parentLocale){if(null!=ez[t.parentLocale])s=ez[t.parentLocale]._config;else{if(null==(n=eB(t.parentLocale)))return e$[t.parentLocale]||(e$[t.parentLocale]=[]),e$[t.parentLocale].push({name:e,config:t}),null;s=n._config}}return ez[e]=new T(b(s,t)),e$[e]&&e$[e].forEach(function(e){eQ(e.name,e.config)}),eJ(e),ez[e]}function eX(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return eI;if(!n(e)){if(t=eB(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r0;){if(s=eB(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&function(e,t){var n,s=Math.min(e.length,t.length);for(n=0;n=t-1)break;t--}r++}return eI}(e)}function eK(e){var t,n=e._a;return n&&-2===c(e).overflow&&(t=n[1]<0||n[1]>11?1:n[2]<1||n[2]>eM(n[0],n[1])?2:n[3]<0||n[3]>24||24===n[3]&&(0!==n[4]||0!==n[5]||0!==n[6])?3:n[4]<0||n[4]>59?4:n[5]<0||n[5]>59?5:n[6]<0||n[6]>999?6:-1,c(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),c(e)._overflowWeeks&&-1===t&&(t=7),c(e)._overflowWeekday&&-1===t&&(t=8),c(e).overflow=t),e}var e0=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e1=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e2=/Z|[+-]\d\d(?::?\d\d)?/,e4=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],e6=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],e3=/^\/?Date\((-?\d+)/i,e5=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,e7={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function e9(e){var t,n,s,i,r,a,o=e._i,u=e0.exec(o)||e1.exec(o),l=e4.length,h=e6.length;if(u){for(t=0,c(e).iso=!0,n=l;t7)&&(l=!0)):(a=e._locale._week.dow,o=e._locale._week.doy,h=eR(tr(),a,o),s=te(n.gg,e._a[0],h.year),i=te(n.w,h.week),null!=n.d?((r=n.d)<0||r>6)&&(l=!0):null!=n.e?(r=n.e+a,(n.e<0||n.e>6)&&(l=!0)):r=a),i<1||i>eC(s,a,o)?c(e)._overflowWeeks=!0:null!=l?c(e)._overflowWeekday=!0:(u=eP(s,i,r,a,o),e._a[0]=u.year,e._dayOfYear=u.dayOfYear)),null!=e._dayOfYear&&(g=te(e._a[0],_[0]),(e._dayOfYear>eg(g)||0===e._dayOfYear)&&(c(e)._overflowDayOfYear=!0),m=eN(g,0,e._dayOfYear),e._a[1]=m.getUTCMonth(),e._a[2]=m.getUTCDate()),f=0;f<3&&null==e._a[f];++f)e._a[f]=w[f]=_[f];for(;f<7;f++)e._a[f]=w[f]=null==e._a[f]?2===f?1:0:e._a[f];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?eN:ex).apply(null,w),y=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==y&&(c(e).weekdayMismatch=!0)}}function tn(e){if(e._f===t.ISO_8601){e9(e);return}if(e._f===t.RFC_2822){e8(e);return}e._a=[],c(e).empty=!0;var n,s,r,a,o,u,l,h,d,f,m,_=""+e._i,y=_.length,g=0;for(o=0,m=(l=H(e._f,e._locale).match(N)||[]).length;o0&&c(e).unusedInput.push(d),_=_.slice(_.indexOf(u)+u.length),g+=u.length),R[h])?(u?c(e).empty=!1:c(e).unusedTokens.push(h),null!=u&&i(ef,h)&&ef[h](u,e._a,e,h)):e._strict&&!u&&c(e).unusedTokens.push(h);c(e).charsLeftOver=y-g,_.length>0&&c(e).unusedInput.push(_),e._a[3]<=12&&!0===c(e).bigHour&&e._a[3]>0&&(c(e).bigHour=void 0),c(e).parsedDateParts=e._a.slice(0),c(e).meridiem=e._meridiem,e._a[3]=(n=e._locale,s=e._a[3],null==(r=e._meridiem)?s:null!=n.meridiemHour?n.meridiemHour(s,r):(null!=n.isPM&&((a=n.isPM(r))&&s<12&&(s+=12),a||12!==s||(s=0)),s)),null!==(f=c(e).era)&&(e._a[0]=e._locale.erasConvertYear(f,e._a[0])),tt(e),eK(e)}function ts(e){var i,r=e._i,d=e._f;return(e._locale=e._locale||eX(e._l),null===r||void 0===d&&""===r)?m({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),k(r))?new v(eK(r)):(u(r)?e._d=r:n(d)?function(e){var t,n,s,i,r,a,o=!1,u=e._f.length;if(0===u){c(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;ithis?this:e:m()});function tu(e,t){var s,i;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return tr();for(i=1,s=t[0];i=0?new Date(e+400,t,n)-126227808e5:new Date(e,t,n).valueOf()}function tC(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-126227808e5:Date.UTC(e,t,n)}function tU(e,t){return t.erasAbbrRegex(e)}function tH(){var e,t,n,s,i,r=[],a=[],o=[],u=[],l=this.eras();for(e=0,t=l.length;e(r=eC(e,s,i))&&(t=r),tE.call(this,e,t,n,s,i))}function tE(e,t,n,s,i){var r=eP(e,t,n,s,i),a=eN(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}C("N",0,0,"eraAbbr"),C("NN",0,0,"eraAbbr"),C("NNN",0,0,"eraAbbr"),C("NNNN",0,0,"eraName"),C("NNNNN",0,0,"eraNarrow"),C("y",["y",1],"yo","eraYear"),C("y",["yy",2],0,"eraYear"),C("y",["yyy",3],0,"eraYear"),C("y",["yyyy",4],0,"eraYear"),el("N",tU),el("NN",tU),el("NNN",tU),el("NNNN",function(e,t){return t.erasNameRegex(e)}),el("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),em(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){var i=n._locale.erasParse(e,s,n._strict);i?c(n).era=i:c(n).invalidEra=e}),el("y",en),el("yy",en),el("yyy",en),el("yyyy",en),el("yo",function(e,t){return t._eraYearOrdinalRegex||en}),em(["y","yy","yyy","yyyy"],0),em(["yo"],function(e,t,n,s){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[0]=n._locale.eraYearOrdinalParse(e,i):t[0]=parseInt(e,10)}),C(0,["gg",2],0,function(){return this.weekYear()%100}),C(0,["GG",2],0,function(){return this.isoWeekYear()%100}),tF("gggg","weekYear"),tF("ggggg","weekYear"),tF("GGGG","isoWeekYear"),tF("GGGGG","isoWeekYear"),el("G",es),el("g",es),el("GG",J,z),el("gg",J,z),el("GGGG",ee,q),el("gggg",ee,q),el("GGGGG",et,B),el("ggggg",et,B),e_(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=ec(e)}),e_(["gg","GG"],function(e,n,s,i){n[i]=t.parseTwoDigitYear(e)}),C("Q",0,"Qo","quarter"),el("Q",Z),em("Q",function(e,t){t[1]=(ec(e)-1)*3}),C("D",["DD",2],"Do","date"),el("D",J,eo),el("DD",J,z),el("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),em(["D","DD"],2),em("Do",function(e,t){t[2]=ec(e.match(J)[0])});var tV=ep("Date",!0);C("DDD",["DDDD",3],"DDDo","dayOfYear"),el("DDD",K),el("DDDD",$),em(["DDD","DDDD"],function(e,t,n){n._dayOfYear=ec(e)}),C("m",["mm",2],0,"minute"),el("m",J,eu),el("mm",J,z),em(["m","mm"],4);var tG=ep("Minutes",!1);C("s",["ss",2],0,"second"),el("s",J,eu),el("ss",J,z),em(["s","ss"],5);var tA=ep("Seconds",!1);for(C("S",0,0,function(){return~~(this.millisecond()/100)}),C(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),C(0,["SSS",3],0,"millisecond"),C(0,["SSSS",4],0,function(){return 10*this.millisecond()}),C(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),C(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),C(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),C(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),C(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),el("S",K,Z),el("SS",K,z),el("SSS",K,$),_="SSSS";_.length<=9;_+="S")el(_,en);function tI(e,t){t[6]=ec(("0."+e)*1e3)}for(_="S";_.length<=9;_+="S")em(_,tI);y=ep("Milliseconds",!1),C("z",0,0,"zoneAbbr"),C("zz",0,0,"zoneName");var tj=v.prototype;function tZ(e){return e}tj.add=tO,tj.calendar=function(e,a){if(1==arguments.length){if(arguments[0]){var l,h,d;(l=arguments[0],k(l)||u(l)||tT(l)||o(l)||(h=n(l),d=!1,h&&(d=0===l.filter(function(e){return!o(e)&&tT(l)}).length),h&&d)||function(e){var t,n,a=s(e)&&!r(e),o=!1,u=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],l=u.length;for(t=0;tn.valueOf():n.valueOf()n.year()||n.year()>9999?U(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):O(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+6e4*this.utcOffset()).toISOString().replace("Z",U(n,"Z")):U(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},tj.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,n,s,i="moment",r="";return this.isLocal()||(i=0===this.utcOffset()?"moment.utc":"moment.parseZone",r="Z"),e="["+i+'("]',t=0<=this.year()&&9999>=this.year()?"YYYY":"YYYYYY",n="-MM-DD[T]HH:mm:ss.SSS",s=r+'[")]',this.format(e+t+n+s)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(tj[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),tj.toJSON=function(){return this.isValid()?this.toISOString():null},tj.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},tj.unix=function(){return Math.floor(this.valueOf()/1e3)},tj.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},tj.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},tj.eraName=function(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;eMath.abs(e)&&!s&&(e*=60);return!this._isUTC&&n&&(i=tg(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),r===e||(!n||this._changeInProgress?tS(this,tk(e-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this},tj.utc=function(e){return this.utcOffset(0,e)},tj.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(tg(this),"m")),this},tj.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=t_(ei,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},tj.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?tr(e).utcOffset():0,(this.utcOffset()-e)%60==0)},tj.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},tj.isLocal=function(){return!!this.isValid()&&!this._isUTC},tj.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},tj.isUtc=tw,tj.isUTC=tw,tj.zoneAbbr=function(){return this._isUTC?"UTC":""},tj.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},tj.dates=D("dates accessor is deprecated. Use date instead.",tV),tj.months=D("months accessor is deprecated. Use month instead",eb),tj.years=D("years accessor is deprecated. Use year instead",ew),tj.zone=D("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),tj.isDSTShifted=D("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!a(this._isDSTShifted))return this._isDSTShifted;var e,t={};return p(t,this),(t=ts(t))._a?(e=t._isUTC?d(t._a):tr(t._a),this._isDSTShifted=this.isValid()&&function(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s0):this._isDSTShifted=!1,this._isDSTShifted});var tz=T.prototype;function t$(e,t,n,s){var i=eX(),r=d().set(s,t);return i[n](r,e)}function tq(e,t,n){if(o(e)&&(t=e,e=void 0),e=e||"",null!=t)return t$(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=t$(e,s,n,"month");return i}function tB(e,t,n,s){"boolean"==typeof e||(n=t=e,e=!1),o(t)&&(n=t,t=void 0),t=t||"";var i,r=eX(),a=e?r._week.dow:0,u=[];if(null!=n)return t$(t,(n+a)%7,s,"day");for(i=0;i<7;i++)u[i]=t$(t,(i+a)%7,s,"day");return u}tz.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return O(s)?s.call(t,n):s},tz.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(N).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},tz.invalidDate=function(){return this._invalidDate},tz.ordinal=function(e){return this._ordinal.replace("%d",e)},tz.preparse=tZ,tz.postformat=tZ,tz.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return O(i)?i(e,t,n,s):i.replace(/%d/i,e)},tz.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return O(n)?n(t):n.replace(/%s/i,t)},tz.set=function(e){var t,n;for(n in e)i(e,n)&&(O(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},tz.eras=function(e,n){var s,i,r,a=this._eras||eX("en")._eras;for(s=0,i=a.length;s=0)return u[s]},tz.erasConvertYear=function(e,n){var s=e.since<=e.until?1:-1;return void 0===n?t(e.since).year():t(e.since).year()+(n-e.offset)*s},tz.erasAbbrRegex=function(e){return i(this,"_erasAbbrRegex")||tH.call(this),e?this._erasAbbrRegex:this._erasRegex},tz.erasNameRegex=function(e){return i(this,"_erasNameRegex")||tH.call(this),e?this._erasNameRegex:this._erasRegex},tz.erasNarrowRegex=function(e){return i(this,"_erasNarrowRegex")||tH.call(this),e?this._erasNarrowRegex:this._erasRegex},tz.months=function(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||eY).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone},tz.monthsShort=function(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[eY.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},tz.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return eS.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++)if(i=d([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e)||n&&"MMM"===t&&this._shortMonthsParse[s].test(e)||!n&&this._monthsParse[s].test(e))return s},tz.monthsRegex=function(e){return this._monthsParseExact?(i(this,"_monthsRegex")||eT.call(this),e)?this._monthsStrictRegex:this._monthsRegex:(i(this,"_monthsRegex")||(this._monthsRegex=ea),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},tz.monthsShortRegex=function(e){return this._monthsParseExact?(i(this,"_monthsRegex")||eT.call(this),e)?this._monthsShortStrictRegex:this._monthsShortRegex:(i(this,"_monthsShortRegex")||(this._monthsShortRegex=ea),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},tz.week=function(e){return eR(e,this._week.dow,this._week.doy).week},tz.firstDayOfYear=function(){return this._week.doy},tz.firstDayOfWeek=function(){return this._week.dow},tz.weekdays=function(e,t){var s=n(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?eU(s,this._week.dow):e?s[e.day()]:s},tz.weekdaysMin=function(e){return!0===e?eU(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},tz.weekdaysShort=function(e){return!0===e?eU(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},tz.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return eF.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=d([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e)||n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},tz.weekdaysRegex=function(e){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||eL.call(this),e)?this._weekdaysStrictRegex:this._weekdaysRegex:(i(this,"_weekdaysRegex")||(this._weekdaysRegex=ea),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},tz.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||eL.call(this),e)?this._weekdaysShortStrictRegex:this._weekdaysShortRegex:(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ea),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},tz.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||eL.call(this),e)?this._weekdaysMinStrictRegex:this._weekdaysMinRegex:(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=ea),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},tz.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},tz.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},eJ("en",{eras:[{since:"0001-01-01",until:Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=1===ec(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+n}}),t.lang=D("moment.lang is deprecated. Use moment.locale instead.",eJ),t.langData=D("moment.langData is deprecated. Use moment.localeData instead.",eX);var tJ=Math.abs;function tQ(e,t,n,s){var i=tk(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function tX(e){return e<0?Math.floor(e):Math.ceil(e)}function tK(e){return 4800*e/146097}function t0(e){return 146097*e/4800}function t1(e){return function(){return this.as(e)}}var t2=t1("ms"),t4=t1("s"),t6=t1("m"),t3=t1("h"),t5=t1("d"),t7=t1("w"),t9=t1("M"),t8=t1("Q"),ne=t1("y");function nt(e){return function(){return this.isValid()?this._data[e]:NaN}}var nn=nt("milliseconds"),ns=nt("seconds"),ni=nt("minutes"),nr=nt("hours"),na=nt("days"),no=nt("months"),nu=nt("years"),nl=Math.round,nh={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function nd(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}var nc=Math.abs;function nf(e){return(e>0)-(e<0)||+e}function nm(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,s,i,r,a,o,u=nc(this._milliseconds)/1e3,l=nc(this._days),h=nc(this._months),d=this.asSeconds();return d?(e=ed(u/60),t=ed(e/60),u%=60,e%=60,n=ed(h/12),h%=12,s=u?u.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",r=nf(this._months)!==nf(d)?"-":"",a=nf(this._days)!==nf(d)?"-":"",o=nf(this._milliseconds)!==nf(d)?"-":"",i+"P"+(n?r+n+"Y":"")+(h?r+h+"M":"")+(l?a+l+"D":"")+(t||e||u?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(u?o+s+"S":"")):"P0D"}var n_=th.prototype;return n_.isValid=function(){return this._isValid},n_.abs=function(){var e=this._data;return this._milliseconds=tJ(this._milliseconds),this._days=tJ(this._days),this._months=tJ(this._months),e.milliseconds=tJ(e.milliseconds),e.seconds=tJ(e.seconds),e.minutes=tJ(e.minutes),e.hours=tJ(e.hours),e.months=tJ(e.months),e.years=tJ(e.years),this},n_.add=function(e,t){return tQ(this,e,t,1)},n_.subtract=function(e,t){return tQ(this,e,t,-1)},n_.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=L(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+tK(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(t0(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw Error("Unknown unit "+e)}},n_.asMilliseconds=t2,n_.asSeconds=t4,n_.asMinutes=t6,n_.asHours=t3,n_.asDays=t5,n_.asWeeks=t7,n_.asMonths=t9,n_.asQuarters=t8,n_.asYears=ne,n_.valueOf=t2,n_._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return r>=0&&a>=0&&o>=0||r<=0&&a<=0&&o<=0||(r+=864e5*tX(t0(o)+a),a=0,o=0),u.milliseconds=r%1e3,e=ed(r/1e3),u.seconds=e%60,t=ed(e/60),u.minutes=t%60,n=ed(t/60),u.hours=n%24,a+=ed(n/24),o+=i=ed(tK(a)),a-=tX(t0(i)),s=ed(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},n_.clone=function(){return tk(this)},n_.get=function(e){return e=L(e),this.isValid()?this[e+"s"]():NaN},n_.milliseconds=nn,n_.seconds=ns,n_.minutes=ni,n_.hours=nr,n_.days=na,n_.weeks=function(){return ed(this.days()/7)},n_.months=no,n_.years=nu,n_.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,s,i,r,a,o,u,l,h,d,c,f,m,_=!1,y=nh;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(_=e),"object"==typeof t&&(y=Object.assign({},nh,t),null!=t.s&&null==t.ss&&(y.ss=t.s-1)),f=this.localeData(),n=!_,s=y,i=tk(this).abs(),r=nl(i.as("s")),a=nl(i.as("m")),o=nl(i.as("h")),u=nl(i.as("d")),l=nl(i.as("M")),h=nl(i.as("w")),d=nl(i.as("y")),c=r<=s.ss&&["s",r]||r0,c[4]=f,m=nd.apply(null,c),_&&(m=f.pastFuture(+this,m)),f.postformat(m)},n_.toISOString=nm,n_.toString=nm,n_.toJSON=nm,n_.locale=tN,n_.localeData=tP,n_.toIsoString=D("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",nm),n_.lang=tW,C("X",0,0,"unix"),C("x",0,0,"valueOf"),el("x",es),el("X",/[+-]?\d+(\.\d{1,3})?/),em("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e))}),em("x",function(e,t,n){n._d=new Date(ec(e))}),t.version="2.30.1",V=tr,t.fn=tj,t.min=function(){var e=[].slice.call(arguments,0);return tu("isBefore",e)},t.max=function(){var e=[].slice.call(arguments,0);return tu("isAfter",e)},t.now=function(){return Date.now?Date.now():+new Date},t.utc=d,t.unix=function(e){return tr(1e3*e)},t.months=function(e,t){return tq(e,t,"months")},t.isDate=u,t.locale=eJ,t.invalid=m,t.duration=tk,t.isMoment=k,t.weekdays=function(e,t,n){return tB(e,t,n,"weekdays")},t.parseZone=function(){return tr.apply(null,arguments).parseZone()},t.localeData=eX,t.isDuration=td,t.monthsShort=function(e,t){return tq(e,t,"monthsShort")},t.weekdaysMin=function(e,t,n){return tB(e,t,n,"weekdaysMin")},t.defineLocale=eQ,t.updateLocale=function(e,t){if(null!=t){var n,s,i=eZ;null!=ez[e]&&null!=ez[e].parentLocale?ez[e].set(b(ez[e]._config,t)):(null!=(s=eB(e))&&(i=s._config),t=b(i,t),null==s&&(t.abbr=e),(n=new T(t)).parentLocale=ez[e],ez[e]=n),eJ(e)}else null!=ez[e]&&(null!=ez[e].parentLocale?(ez[e]=ez[e].parentLocale,e===eJ()&&eJ(e)):null!=ez[e]&&delete ez[e]);return ez[e]},t.locales=function(){return A(ez)},t.weekdaysShort=function(e,t,n){return tB(e,t,n,"weekdaysShort")},t.normalizeUnits=L,t.relativeTimeRounding=function(e){return void 0===e?nl:"function"==typeof e&&(nl=e,!0)},t.relativeTimeThreshold=function(e,t){return void 0!==nh[e]&&(void 0===t?nh[e]:(nh[e]=t,"s"===e&&(nh.ss=t-1),!0))},t.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},t.prototype=tj,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t},e.exports=s()}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/13b76428-ebdf3012af0e4489.js b/litellm/proxy/_experimental/out/_next/static/chunks/13b76428-ebdf3012af0e4489.js deleted file mode 100644 index 307379053b6..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/13b76428-ebdf3012af0e4489.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[990],{77398:function(e,t,n){var s;e=n.nmd(e),s=function(){"use strict";function t(){return V.apply(null,arguments)}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function s(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function r(e){var t;if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(t in e)if(i(e,t))return!1;return!0}function a(e){return void 0===e}function o(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var n,s=[],i=e.length;for(n=0;n>>0;for(t=0;t0)for(n=0;n=0?n?"+":"":"-")+Math.pow(10,Math.max(0,t-s.length)).toString().substr(1)+s}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null,A=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)i(e,t)&&n.push(t);return n};var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,W=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,P={},R={};function C(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(R[e]=i),t&&(R[t[0]]=function(){return x(i.apply(this,arguments),t[1],t[2])}),n&&(R[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function U(e,t){return e.isValid()?(P[t=H(t,e.localeData())]=P[t]||function(e){var t,n,s,i=e.match(N);for(n=0,s=i.length;n=0&&W.test(e);)e=e.replace(W,s),W.lastIndex=0,n-=1;return e}var F={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function L(e){return"string"==typeof e?F[e]||F[e.toLowerCase()]:void 0}function E(e){var t,n,s={};for(n in e)i(e,n)&&(t=L(n))&&(s[t]=e[n]);return s}var V,G,A,I,j={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1},Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,B=/[+-]?\d{6}/,J=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,et=/[+-]?\d{1,6}/,en=/\d+/,es=/[+-]?\d+/,ei=/Z|[+-]\d\d:?\d\d/gi,er=/Z|[+-]\d\d(?::?\d\d)?/gi,ea=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,eo=/^[1-9]\d?/,eu=/^([1-9]\d|\d)/;function el(e,t,n){I[e]=O(t)?t:function(e,s){return e&&n?n:t}}function eh(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ed(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function ec(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=ed(t)),n}I={};var ef={};function em(e,t){var n,s,i=t;for("string"==typeof e&&(e=[e]),o(t)&&(i=function(e,n){n[t]=ec(e)}),s=e.length,n=0;n68?1900:2e3)};var ew=ep("FullYear",!0);function ep(e,n){return function(s){return null!=s?(ek(this,e,s),t.updateOffset(this,n),this):ev(this,e)}}function ev(e,t){if(!e.isValid())return NaN;var n=e._d,s=e._isUTC;switch(t){case"Milliseconds":return s?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return s?n.getUTCSeconds():n.getSeconds();case"Minutes":return s?n.getUTCMinutes():n.getMinutes();case"Hours":return s?n.getUTCHours():n.getHours();case"Date":return s?n.getUTCDate():n.getDate();case"Day":return s?n.getUTCDay():n.getDay();case"Month":return s?n.getUTCMonth():n.getMonth();case"FullYear":return s?n.getUTCFullYear():n.getFullYear();default:return NaN}}function ek(e,t,n){var s,i,r,a;if(!(!e.isValid()||isNaN(n))){switch(s=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?s.setUTCMilliseconds(n):s.setMilliseconds(n));case"Seconds":return void(i?s.setUTCSeconds(n):s.setSeconds(n));case"Minutes":return void(i?s.setUTCMinutes(n):s.setMinutes(n));case"Hours":return void(i?s.setUTCHours(n):s.setHours(n));case"Date":return void(i?s.setUTCDate(n):s.setDate(n));case"FullYear":break;default:return}r=e.month(),a=29!==(a=e.date())||1!==r||ey(n)?a:28,i?s.setUTCFullYear(n,r,a):s.setFullYear(n,r,a)}}function eM(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=(t%12+12)%12;return e+=(t-n)/12,1===n?ey(e)?29:28:31-n%7%2}eA=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t=0?isFinite((o=new Date(e+400,t,n,s,i,r,a)).getFullYear())&&o.setFullYear(e):o=new Date(e,t,n,s,i,r,a),o}function eN(e){var t,n;return e<100&&e>=0?(n=Array.prototype.slice.call(arguments),n[0]=e+400,isFinite((t=new Date(Date.UTC.apply(null,n))).getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function eW(e,t,n){var s=7+t-n;return-((7+eN(e,0,s).getUTCDay()-t)%7)+s-1}function eP(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+eW(e,s,i);return o<=0?a=eg(r=e-1)+o:o>eg(e)?(r=e+1,a=o-eg(e)):(r=e,a=o),{year:r,dayOfYear:a}}function eR(e,t,n){var s,i,r=eW(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+eC(i=e.year()-1,t,n):a>eC(e.year(),t,n)?(s=a-eC(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function eC(e,t,n){var s=eW(e,t,n),i=eW(e+1,t,n);return(eg(e)-s+i)/7}function eU(e,t){return e.slice(t,7).concat(e.slice(0,t))}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),el("w",J,eo),el("ww",J,z),el("W",J,eo),el("WW",J,z),e_(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=ec(e)}),C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),el("d",J),el("e",J),el("E",J),el("dd",function(e,t){return t.weekdaysMinRegex(e)}),el("ddd",function(e,t){return t.weekdaysShortRegex(e)}),el("dddd",function(e,t){return t.weekdaysRegex(e)}),e_(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:c(n).invalidWeekday=e}),e_(["d","e","E"],function(e,t,n,s){t[s]=ec(e)});var eH="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function eF(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(s=0,this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[];s<7;++s)r=d([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=eA.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=eA.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=eA.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=eA.call(this._weekdaysParse,a))||-1!==(i=eA.call(this._shortWeekdaysParse,a))?i:-1!==(i=eA.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=eA.call(this._shortWeekdaysParse,a))||-1!==(i=eA.call(this._weekdaysParse,a))?i:-1!==(i=eA.call(this._minWeekdaysParse,a))?i:null:-1!==(i=eA.call(this._minWeekdaysParse,a))||-1!==(i=eA.call(this._weekdaysParse,a))?i:-1!==(i=eA.call(this._shortWeekdaysParse,a))?i:null}function eL(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=d([2e3,1]).day(t),s=eh(this.weekdaysMin(n,"")),i=eh(this.weekdaysShort(n,"")),r=eh(this.weekdays(n,"")),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);a.sort(e),o.sort(e),u.sort(e),l.sort(e),this._weekdaysRegex=RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=RegExp("^("+a.join("|")+")","i")}function eE(){return this.hours()%12||12}function eV(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function eG(e,t){return t._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,eE),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+eE.apply(this)+x(this.minutes(),2)}),C("hmmss",0,0,function(){return""+eE.apply(this)+x(this.minutes(),2)+x(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+x(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+x(this.minutes(),2)+x(this.seconds(),2)}),eV("a",!0),eV("A",!1),el("a",eG),el("A",eG),el("H",J,eu),el("h",J,eo),el("k",J,eo),el("HH",J,z),el("hh",J,z),el("kk",J,z),el("hmm",Q),el("hmmss",X),el("Hmm",Q),el("Hmmss",X),em(["H","HH"],3),em(["k","kk"],function(e,t,n){var s=ec(e);t[3]=24===s?0:s}),em(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),em(["h","hh"],function(e,t,n){t[3]=ec(e),c(n).bigHour=!0}),em("hmm",function(e,t,n){var s=e.length-2;t[3]=ec(e.substr(0,s)),t[4]=ec(e.substr(s)),c(n).bigHour=!0}),em("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[3]=ec(e.substr(0,s)),t[4]=ec(e.substr(s,2)),t[5]=ec(e.substr(i)),c(n).bigHour=!0}),em("Hmm",function(e,t,n){var s=e.length-2;t[3]=ec(e.substr(0,s)),t[4]=ec(e.substr(s))}),em("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[3]=ec(e.substr(0,s)),t[4]=ec(e.substr(s,2)),t[5]=ec(e.substr(i))});var eA,eI,ej=ep("Hours",!0),eZ={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:eD,week:{dow:0,doy:6},weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysShort:eH,meridiemParse:/[ap]\.?m?\.?/i},ez={},e$={};function eq(e){return e?e.toLowerCase().replace("_","-"):e}function eB(t){var n=null;if(void 0===ez[t]&&e&&e.exports&&t&&t.match("^[^/\\\\]*$"))try{n=eI._abbr,function(){var e=Error("Cannot find module 'undefined'");throw e.code="MODULE_NOT_FOUND",e}(),eJ(n)}catch(e){ez[t]=null}return ez[t]}function eJ(e,t){var n;return e&&((n=a(t)?eX(e):eQ(e,t))?eI=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),eI._abbr}function eQ(e,t){if(null===t)return delete ez[e],null;var n,s=eZ;if(t.abbr=e,null!=ez[e])S("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=ez[e]._config;else if(null!=t.parentLocale){if(null!=ez[t.parentLocale])s=ez[t.parentLocale]._config;else{if(null==(n=eB(t.parentLocale)))return e$[t.parentLocale]||(e$[t.parentLocale]=[]),e$[t.parentLocale].push({name:e,config:t}),null;s=n._config}}return ez[e]=new T(b(s,t)),e$[e]&&e$[e].forEach(function(e){eQ(e.name,e.config)}),eJ(e),ez[e]}function eX(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return eI;if(!n(e)){if(t=eB(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r0;){if(s=eB(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&function(e,t){var n,s=Math.min(e.length,t.length);for(n=0;n=t-1)break;t--}r++}return eI}(e)}function eK(e){var t,n=e._a;return n&&-2===c(e).overflow&&(t=n[1]<0||n[1]>11?1:n[2]<1||n[2]>eM(n[0],n[1])?2:n[3]<0||n[3]>24||24===n[3]&&(0!==n[4]||0!==n[5]||0!==n[6])?3:n[4]<0||n[4]>59?4:n[5]<0||n[5]>59?5:n[6]<0||n[6]>999?6:-1,c(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),c(e)._overflowWeeks&&-1===t&&(t=7),c(e)._overflowWeekday&&-1===t&&(t=8),c(e).overflow=t),e}var e0=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e1=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e2=/Z|[+-]\d\d(?::?\d\d)?/,e4=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],e3=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],e6=/^\/?Date\((-?\d+)/i,e5=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,e7={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function e9(e){var t,n,s,i,r,a,o=e._i,u=e0.exec(o)||e1.exec(o),l=e4.length,h=e3.length;if(u){for(t=0,c(e).iso=!0,n=l;t7)&&(l=!0)):(a=e._locale._week.dow,o=e._locale._week.doy,h=eR(tr(),a,o),s=te(n.gg,e._a[0],h.year),i=te(n.w,h.week),null!=n.d?((r=n.d)<0||r>6)&&(l=!0):null!=n.e?(r=n.e+a,(n.e<0||n.e>6)&&(l=!0)):r=a),i<1||i>eC(s,a,o)?c(e)._overflowWeeks=!0:null!=l?c(e)._overflowWeekday=!0:(u=eP(s,i,r,a,o),e._a[0]=u.year,e._dayOfYear=u.dayOfYear)),null!=e._dayOfYear&&(g=te(e._a[0],_[0]),(e._dayOfYear>eg(g)||0===e._dayOfYear)&&(c(e)._overflowDayOfYear=!0),m=eN(g,0,e._dayOfYear),e._a[1]=m.getUTCMonth(),e._a[2]=m.getUTCDate()),f=0;f<3&&null==e._a[f];++f)e._a[f]=w[f]=_[f];for(;f<7;f++)e._a[f]=w[f]=null==e._a[f]?2===f?1:0:e._a[f];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?eN:ex).apply(null,w),y=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==y&&(c(e).weekdayMismatch=!0)}}function tn(e){if(e._f===t.ISO_8601){e9(e);return}if(e._f===t.RFC_2822){e8(e);return}e._a=[],c(e).empty=!0;var n,s,r,a,o,u,l,h,d,f,m,_=""+e._i,y=_.length,g=0;for(o=0,m=(l=H(e._f,e._locale).match(N)||[]).length;o0&&c(e).unusedInput.push(d),_=_.slice(_.indexOf(u)+u.length),g+=u.length),R[h])?(u?c(e).empty=!1:c(e).unusedTokens.push(h),null!=u&&i(ef,h)&&ef[h](u,e._a,e,h)):e._strict&&!u&&c(e).unusedTokens.push(h);c(e).charsLeftOver=y-g,_.length>0&&c(e).unusedInput.push(_),e._a[3]<=12&&!0===c(e).bigHour&&e._a[3]>0&&(c(e).bigHour=void 0),c(e).parsedDateParts=e._a.slice(0),c(e).meridiem=e._meridiem,e._a[3]=(n=e._locale,s=e._a[3],null==(r=e._meridiem)?s:null!=n.meridiemHour?n.meridiemHour(s,r):(null!=n.isPM&&((a=n.isPM(r))&&s<12&&(s+=12),a||12!==s||(s=0)),s)),null!==(f=c(e).era)&&(e._a[0]=e._locale.erasConvertYear(f,e._a[0])),tt(e),eK(e)}function ts(e){var i,r=e._i,d=e._f;return(e._locale=e._locale||eX(e._l),null===r||void 0===d&&""===r)?m({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),k(r))?new v(eK(r)):(u(r)?e._d=r:n(d)?function(e){var t,n,s,i,r,a,o=!1,u=e._f.length;if(0===u){c(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;ithis?this:e:m()});function tu(e,t){var s,i;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return tr();for(i=1,s=t[0];i=0?new Date(e+400,t,n)-126227808e5:new Date(e,t,n).valueOf()}function tC(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-126227808e5:Date.UTC(e,t,n)}function tU(e,t){return t.erasAbbrRegex(e)}function tH(){var e,t,n,s,i,r=[],a=[],o=[],u=[],l=this.eras();for(e=0,t=l.length;e(r=eC(e,s,i))&&(t=r),tE.call(this,e,t,n,s,i))}function tE(e,t,n,s,i){var r=eP(e,t,n,s,i),a=eN(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}C("N",0,0,"eraAbbr"),C("NN",0,0,"eraAbbr"),C("NNN",0,0,"eraAbbr"),C("NNNN",0,0,"eraName"),C("NNNNN",0,0,"eraNarrow"),C("y",["y",1],"yo","eraYear"),C("y",["yy",2],0,"eraYear"),C("y",["yyy",3],0,"eraYear"),C("y",["yyyy",4],0,"eraYear"),el("N",tU),el("NN",tU),el("NNN",tU),el("NNNN",function(e,t){return t.erasNameRegex(e)}),el("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),em(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){var i=n._locale.erasParse(e,s,n._strict);i?c(n).era=i:c(n).invalidEra=e}),el("y",en),el("yy",en),el("yyy",en),el("yyyy",en),el("yo",function(e,t){return t._eraYearOrdinalRegex||en}),em(["y","yy","yyy","yyyy"],0),em(["yo"],function(e,t,n,s){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[0]=n._locale.eraYearOrdinalParse(e,i):t[0]=parseInt(e,10)}),C(0,["gg",2],0,function(){return this.weekYear()%100}),C(0,["GG",2],0,function(){return this.isoWeekYear()%100}),tF("gggg","weekYear"),tF("ggggg","weekYear"),tF("GGGG","isoWeekYear"),tF("GGGGG","isoWeekYear"),el("G",es),el("g",es),el("GG",J,z),el("gg",J,z),el("GGGG",ee,q),el("gggg",ee,q),el("GGGGG",et,B),el("ggggg",et,B),e_(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=ec(e)}),e_(["gg","GG"],function(e,n,s,i){n[i]=t.parseTwoDigitYear(e)}),C("Q",0,"Qo","quarter"),el("Q",Z),em("Q",function(e,t){t[1]=(ec(e)-1)*3}),C("D",["DD",2],"Do","date"),el("D",J,eo),el("DD",J,z),el("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),em(["D","DD"],2),em("Do",function(e,t){t[2]=ec(e.match(J)[0])});var tV=ep("Date",!0);C("DDD",["DDDD",3],"DDDo","dayOfYear"),el("DDD",K),el("DDDD",$),em(["DDD","DDDD"],function(e,t,n){n._dayOfYear=ec(e)}),C("m",["mm",2],0,"minute"),el("m",J,eu),el("mm",J,z),em(["m","mm"],4);var tG=ep("Minutes",!1);C("s",["ss",2],0,"second"),el("s",J,eu),el("ss",J,z),em(["s","ss"],5);var tA=ep("Seconds",!1);for(C("S",0,0,function(){return~~(this.millisecond()/100)}),C(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),C(0,["SSS",3],0,"millisecond"),C(0,["SSSS",4],0,function(){return 10*this.millisecond()}),C(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),C(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),C(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),C(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),C(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),el("S",K,Z),el("SS",K,z),el("SSS",K,$),_="SSSS";_.length<=9;_+="S")el(_,en);function tI(e,t){t[6]=ec(("0."+e)*1e3)}for(_="S";_.length<=9;_+="S")em(_,tI);y=ep("Milliseconds",!1),C("z",0,0,"zoneAbbr"),C("zz",0,0,"zoneName");var tj=v.prototype;function tZ(e){return e}tj.add=tO,tj.calendar=function(e,a){if(1==arguments.length){if(arguments[0]){var l,h,d;(l=arguments[0],k(l)||u(l)||tT(l)||o(l)||(h=n(l),d=!1,h&&(d=0===l.filter(function(e){return!o(e)&&tT(l)}).length),h&&d)||function(e){var t,n,a=s(e)&&!r(e),o=!1,u=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],l=u.length;for(t=0;tn.valueOf():n.valueOf()n.year()||n.year()>9999?U(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):O(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+6e4*this.utcOffset()).toISOString().replace("Z",U(n,"Z")):U(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},tj.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,n,s,i="moment",r="";return this.isLocal()||(i=0===this.utcOffset()?"moment.utc":"moment.parseZone",r="Z"),e="["+i+'("]',t=0<=this.year()&&9999>=this.year()?"YYYY":"YYYYYY",n="-MM-DD[T]HH:mm:ss.SSS",s=r+'[")]',this.format(e+t+n+s)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(tj[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),tj.toJSON=function(){return this.isValid()?this.toISOString():null},tj.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},tj.unix=function(){return Math.floor(this.valueOf()/1e3)},tj.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},tj.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},tj.eraName=function(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;eMath.abs(e)&&!s&&(e*=60);return!this._isUTC&&n&&(i=tg(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),r===e||(!n||this._changeInProgress?tS(this,tk(e-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this},tj.utc=function(e){return this.utcOffset(0,e)},tj.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(tg(this),"m")),this},tj.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=t_(ei,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},tj.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?tr(e).utcOffset():0,(this.utcOffset()-e)%60==0)},tj.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},tj.isLocal=function(){return!!this.isValid()&&!this._isUTC},tj.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},tj.isUtc=tw,tj.isUTC=tw,tj.zoneAbbr=function(){return this._isUTC?"UTC":""},tj.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},tj.dates=D("dates accessor is deprecated. Use date instead.",tV),tj.months=D("months accessor is deprecated. Use month instead",eb),tj.years=D("years accessor is deprecated. Use year instead",ew),tj.zone=D("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),tj.isDSTShifted=D("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!a(this._isDSTShifted))return this._isDSTShifted;var e,t={};return p(t,this),(t=ts(t))._a?(e=t._isUTC?d(t._a):tr(t._a),this._isDSTShifted=this.isValid()&&function(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s0):this._isDSTShifted=!1,this._isDSTShifted});var tz=T.prototype;function t$(e,t,n,s){var i=eX(),r=d().set(s,t);return i[n](r,e)}function tq(e,t,n){if(o(e)&&(t=e,e=void 0),e=e||"",null!=t)return t$(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=t$(e,s,n,"month");return i}function tB(e,t,n,s){"boolean"==typeof e||(n=t=e,e=!1),o(t)&&(n=t,t=void 0),t=t||"";var i,r=eX(),a=e?r._week.dow:0,u=[];if(null!=n)return t$(t,(n+a)%7,s,"day");for(i=0;i<7;i++)u[i]=t$(t,(i+a)%7,s,"day");return u}tz.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return O(s)?s.call(t,n):s},tz.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(N).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},tz.invalidDate=function(){return this._invalidDate},tz.ordinal=function(e){return this._ordinal.replace("%d",e)},tz.preparse=tZ,tz.postformat=tZ,tz.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return O(i)?i(e,t,n,s):i.replace(/%d/i,e)},tz.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return O(n)?n(t):n.replace(/%s/i,t)},tz.set=function(e){var t,n;for(n in e)i(e,n)&&(O(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},tz.eras=function(e,n){var s,i,r,a=this._eras||eX("en")._eras;for(s=0,i=a.length;s=0)return u[s]},tz.erasConvertYear=function(e,n){var s=e.since<=e.until?1:-1;return void 0===n?t(e.since).year():t(e.since).year()+(n-e.offset)*s},tz.erasAbbrRegex=function(e){return i(this,"_erasAbbrRegex")||tH.call(this),e?this._erasAbbrRegex:this._erasRegex},tz.erasNameRegex=function(e){return i(this,"_erasNameRegex")||tH.call(this),e?this._erasNameRegex:this._erasRegex},tz.erasNarrowRegex=function(e){return i(this,"_erasNarrowRegex")||tH.call(this),e?this._erasNarrowRegex:this._erasRegex},tz.months=function(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||eY).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone},tz.monthsShort=function(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[eY.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},tz.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return eS.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++)if(i=d([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e)||n&&"MMM"===t&&this._shortMonthsParse[s].test(e)||!n&&this._monthsParse[s].test(e))return s},tz.monthsRegex=function(e){return this._monthsParseExact?(i(this,"_monthsRegex")||eT.call(this),e)?this._monthsStrictRegex:this._monthsRegex:(i(this,"_monthsRegex")||(this._monthsRegex=ea),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},tz.monthsShortRegex=function(e){return this._monthsParseExact?(i(this,"_monthsRegex")||eT.call(this),e)?this._monthsShortStrictRegex:this._monthsShortRegex:(i(this,"_monthsShortRegex")||(this._monthsShortRegex=ea),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},tz.week=function(e){return eR(e,this._week.dow,this._week.doy).week},tz.firstDayOfYear=function(){return this._week.doy},tz.firstDayOfWeek=function(){return this._week.dow},tz.weekdays=function(e,t){var s=n(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?eU(s,this._week.dow):e?s[e.day()]:s},tz.weekdaysMin=function(e){return!0===e?eU(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},tz.weekdaysShort=function(e){return!0===e?eU(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},tz.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return eF.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=d([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e)||n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},tz.weekdaysRegex=function(e){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||eL.call(this),e)?this._weekdaysStrictRegex:this._weekdaysRegex:(i(this,"_weekdaysRegex")||(this._weekdaysRegex=ea),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},tz.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||eL.call(this),e)?this._weekdaysShortStrictRegex:this._weekdaysShortRegex:(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ea),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},tz.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||eL.call(this),e)?this._weekdaysMinStrictRegex:this._weekdaysMinRegex:(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=ea),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},tz.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},tz.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},eJ("en",{eras:[{since:"0001-01-01",until:Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=1===ec(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+n}}),t.lang=D("moment.lang is deprecated. Use moment.locale instead.",eJ),t.langData=D("moment.langData is deprecated. Use moment.localeData instead.",eX);var tJ=Math.abs;function tQ(e,t,n,s){var i=tk(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function tX(e){return e<0?Math.floor(e):Math.ceil(e)}function tK(e){return 4800*e/146097}function t0(e){return 146097*e/4800}function t1(e){return function(){return this.as(e)}}var t2=t1("ms"),t4=t1("s"),t3=t1("m"),t6=t1("h"),t5=t1("d"),t7=t1("w"),t9=t1("M"),t8=t1("Q"),ne=t1("y");function nt(e){return function(){return this.isValid()?this._data[e]:NaN}}var nn=nt("milliseconds"),ns=nt("seconds"),ni=nt("minutes"),nr=nt("hours"),na=nt("days"),no=nt("months"),nu=nt("years"),nl=Math.round,nh={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function nd(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}var nc=Math.abs;function nf(e){return(e>0)-(e<0)||+e}function nm(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,s,i,r,a,o,u=nc(this._milliseconds)/1e3,l=nc(this._days),h=nc(this._months),d=this.asSeconds();return d?(e=ed(u/60),t=ed(e/60),u%=60,e%=60,n=ed(h/12),h%=12,s=u?u.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",r=nf(this._months)!==nf(d)?"-":"",a=nf(this._days)!==nf(d)?"-":"",o=nf(this._milliseconds)!==nf(d)?"-":"",i+"P"+(n?r+n+"Y":"")+(h?r+h+"M":"")+(l?a+l+"D":"")+(t||e||u?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(u?o+s+"S":"")):"P0D"}var n_=th.prototype;return n_.isValid=function(){return this._isValid},n_.abs=function(){var e=this._data;return this._milliseconds=tJ(this._milliseconds),this._days=tJ(this._days),this._months=tJ(this._months),e.milliseconds=tJ(e.milliseconds),e.seconds=tJ(e.seconds),e.minutes=tJ(e.minutes),e.hours=tJ(e.hours),e.months=tJ(e.months),e.years=tJ(e.years),this},n_.add=function(e,t){return tQ(this,e,t,1)},n_.subtract=function(e,t){return tQ(this,e,t,-1)},n_.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=L(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+tK(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(t0(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw Error("Unknown unit "+e)}},n_.asMilliseconds=t2,n_.asSeconds=t4,n_.asMinutes=t3,n_.asHours=t6,n_.asDays=t5,n_.asWeeks=t7,n_.asMonths=t9,n_.asQuarters=t8,n_.asYears=ne,n_.valueOf=t2,n_._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return r>=0&&a>=0&&o>=0||r<=0&&a<=0&&o<=0||(r+=864e5*tX(t0(o)+a),a=0,o=0),u.milliseconds=r%1e3,e=ed(r/1e3),u.seconds=e%60,t=ed(e/60),u.minutes=t%60,n=ed(t/60),u.hours=n%24,a+=ed(n/24),o+=i=ed(tK(a)),a-=tX(t0(i)),s=ed(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},n_.clone=function(){return tk(this)},n_.get=function(e){return e=L(e),this.isValid()?this[e+"s"]():NaN},n_.milliseconds=nn,n_.seconds=ns,n_.minutes=ni,n_.hours=nr,n_.days=na,n_.weeks=function(){return ed(this.days()/7)},n_.months=no,n_.years=nu,n_.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,s,i,r,a,o,u,l,h,d,c,f,m,_=!1,y=nh;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(_=e),"object"==typeof t&&(y=Object.assign({},nh,t),null!=t.s&&null==t.ss&&(y.ss=t.s-1)),f=this.localeData(),n=!_,s=y,i=tk(this).abs(),r=nl(i.as("s")),a=nl(i.as("m")),o=nl(i.as("h")),u=nl(i.as("d")),l=nl(i.as("M")),h=nl(i.as("w")),d=nl(i.as("y")),c=r<=s.ss&&["s",r]||r0,c[4]=f,m=nd.apply(null,c),_&&(m=f.pastFuture(+this,m)),f.postformat(m)},n_.toISOString=nm,n_.toString=nm,n_.toJSON=nm,n_.locale=tN,n_.localeData=tP,n_.toIsoString=D("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",nm),n_.lang=tW,C("X",0,0,"unix"),C("x",0,0,"valueOf"),el("x",es),el("X",/[+-]?\d+(\.\d{1,3})?/),em("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e))}),em("x",function(e,t,n){n._d=new Date(ec(e))}),t.version="2.30.1",V=tr,t.fn=tj,t.min=function(){var e=[].slice.call(arguments,0);return tu("isBefore",e)},t.max=function(){var e=[].slice.call(arguments,0);return tu("isAfter",e)},t.now=function(){return Date.now?Date.now():+new Date},t.utc=d,t.unix=function(e){return tr(1e3*e)},t.months=function(e,t){return tq(e,t,"months")},t.isDate=u,t.locale=eJ,t.invalid=m,t.duration=tk,t.isMoment=k,t.weekdays=function(e,t,n){return tB(e,t,n,"weekdays")},t.parseZone=function(){return tr.apply(null,arguments).parseZone()},t.localeData=eX,t.isDuration=td,t.monthsShort=function(e,t){return tq(e,t,"monthsShort")},t.weekdaysMin=function(e,t,n){return tB(e,t,n,"weekdaysMin")},t.defineLocale=eQ,t.updateLocale=function(e,t){if(null!=t){var n,s,i=eZ;null!=ez[e]&&null!=ez[e].parentLocale?ez[e].set(b(ez[e]._config,t)):(null!=(s=eB(e))&&(i=s._config),t=b(i,t),null==s&&(t.abbr=e),(n=new T(t)).parentLocale=ez[e],ez[e]=n),eJ(e)}else null!=ez[e]&&(null!=ez[e].parentLocale?(ez[e]=ez[e].parentLocale,e===eJ()&&eJ(e)):null!=ez[e]&&delete ez[e]);return ez[e]},t.locales=function(){return A(ez)},t.weekdaysShort=function(e,t,n){return tB(e,t,n,"weekdaysShort")},t.normalizeUnits=L,t.relativeTimeRounding=function(e){return void 0===e?nl:"function"==typeof e&&(nl=e,!0)},t.relativeTimeThreshold=function(e,t){return void 0!==nh[e]&&(void 0===t?nh[e]:(nh[e]=t,"s"===e&&(nh.ss=t-1),!0))},t.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},t.prototype=tj,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t},e.exports=s()}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1487-2f4bad651391939b.js b/litellm/proxy/_experimental/out/_next/static/chunks/1487-2f4bad651391939b.js new file mode 100644 index 00000000000..eee3c8a3eb7 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1487-2f4bad651391939b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1487],{21487:function(e,t,n){let r,o,a;n.d(t,{Z:function(){return nU}});var i,l,u,s,d=n(5853),c=n(2265),f=n(54887),m=n(13323),v=n(64518),h=n(96822),p=n(40048),g=n(72238),b=n(93689);let y=(0,c.createContext)(!1);var w=n(61424),x=n(27847);let k=c.Fragment,M=c.Fragment,C=(0,c.createContext)(null),D=(0,c.createContext)(null);Object.assign((0,x.yV)(function(e,t){var n;let r,o,a=(0,c.useRef)(null),i=(0,b.T)((0,b.h)(e=>{a.current=e}),t),l=(0,p.i)(a),u=function(e){let t=(0,c.useContext)(y),n=(0,c.useContext)(C),r=(0,p.i)(e),[o,a]=(0,c.useState)(()=>{if(!t&&null!==n||w.O.isServer)return null;let e=null==r?void 0:r.getElementById("headlessui-portal-root");if(e)return e;if(null===r)return null;let o=r.createElement("div");return o.setAttribute("id","headlessui-portal-root"),r.body.appendChild(o)});return(0,c.useEffect)(()=>{null!==o&&(null!=r&&r.body.contains(o)||null==r||r.body.appendChild(o))},[o,r]),(0,c.useEffect)(()=>{t||null!==n&&a(n.current)},[n,a,t]),o}(a),[s]=(0,c.useState)(()=>{var e;return w.O.isServer?null:null!=(e=null==l?void 0:l.createElement("div"))?e:null}),d=(0,c.useContext)(D),M=(0,g.H)();return(0,v.e)(()=>{!u||!s||u.contains(s)||(s.setAttribute("data-headlessui-portal",""),u.appendChild(s))},[u,s]),(0,v.e)(()=>{if(s&&d)return d.register(s)},[d,s]),n=()=>{var e;u&&s&&(s instanceof Node&&u.contains(s)&&u.removeChild(s),u.childNodes.length<=0&&(null==(e=u.parentElement)||e.removeChild(u)))},r=(0,m.z)(n),o=(0,c.useRef)(!1),(0,c.useEffect)(()=>(o.current=!1,()=>{o.current=!0,(0,h.Y)(()=>{o.current&&r()})}),[r]),M&&u&&s?(0,f.createPortal)((0,x.sY)({ourProps:{ref:i},theirProps:e,defaultTag:k,name:"Portal"}),s):null}),{Group:(0,x.yV)(function(e,t){let{target:n,...r}=e,o={ref:(0,b.T)(t)};return c.createElement(C.Provider,{value:n},(0,x.sY)({ourProps:o,theirProps:r,defaultTag:M,name:"Popover.Group"}))})});var T=n(31948),N=n(17684),P=n(32539),E=n(80004),S=n(38198),_=n(3141),j=((r=j||{})[r.Forwards=0]="Forwards",r[r.Backwards=1]="Backwards",r);function O(){let e=(0,c.useRef)(0);return(0,_.s)("keydown",t=>{"Tab"===t.key&&(e.current=t.shiftKey?1:0)},!0),e}var Z=n(37863),L=n(47634),Y=n(37105),F=n(24536),W=n(40293),R=n(37388),I=((o=I||{})[o.Open=0]="Open",o[o.Closed=1]="Closed",o),U=((a=U||{})[a.TogglePopover=0]="TogglePopover",a[a.ClosePopover=1]="ClosePopover",a[a.SetButton=2]="SetButton",a[a.SetButtonId=3]="SetButtonId",a[a.SetPanel=4]="SetPanel",a[a.SetPanelId=5]="SetPanelId",a);let H={0:e=>{let t={...e,popoverState:(0,F.E)(e.popoverState,{0:1,1:0})};return 0===t.popoverState&&(t.__demoMode=!1),t},1:e=>1===e.popoverState?e:{...e,popoverState:1},2:(e,t)=>e.button===t.button?e:{...e,button:t.button},3:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},4:(e,t)=>e.panel===t.panel?e:{...e,panel:t.panel},5:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}},B=(0,c.createContext)(null);function z(e){let t=(0,c.useContext)(B);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,z),t}return t}B.displayName="PopoverContext";let A=(0,c.createContext)(null);function q(e){let t=(0,c.useContext)(A);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,q),t}return t}A.displayName="PopoverAPIContext";let V=(0,c.createContext)(null);function G(){return(0,c.useContext)(V)}V.displayName="PopoverGroupContext";let X=(0,c.createContext)(null);function K(e,t){return(0,F.E)(t.type,H,e,t)}X.displayName="PopoverPanelContext";let Q=x.AN.RenderStrategy|x.AN.Static,J=x.AN.RenderStrategy|x.AN.Static,$=Object.assign((0,x.yV)(function(e,t){var n,r,o,a;let i,l,u,s,d,f;let{__demoMode:v=!1,...h}=e,g=(0,c.useRef)(null),y=(0,b.T)(t,(0,b.h)(e=>{g.current=e})),w=(0,c.useRef)([]),k=(0,c.useReducer)(K,{__demoMode:v,popoverState:v?0:1,buttons:w,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:(0,c.createRef)(),afterPanelSentinel:(0,c.createRef)()}),[{popoverState:M,button:C,buttonId:N,panel:E,panelId:_,beforePanelSentinel:j,afterPanelSentinel:O},L]=k,W=(0,p.i)(null!=(n=g.current)?n:C),R=(0,c.useMemo)(()=>{if(!C||!E)return!1;for(let e of document.querySelectorAll("body > *"))if(Number(null==e?void 0:e.contains(C))^Number(null==e?void 0:e.contains(E)))return!0;let e=(0,Y.GO)(),t=e.indexOf(C),n=(t+e.length-1)%e.length,r=(t+1)%e.length,o=e[n],a=e[r];return!E.contains(o)&&!E.contains(a)},[C,E]),I=(0,T.E)(N),U=(0,T.E)(_),H=(0,c.useMemo)(()=>({buttonId:I,panelId:U,close:()=>L({type:1})}),[I,U,L]),z=G(),q=null==z?void 0:z.registerPopover,V=(0,m.z)(()=>{var e;return null!=(e=null==z?void 0:z.isFocusWithinPopoverGroup())?e:(null==W?void 0:W.activeElement)&&((null==C?void 0:C.contains(W.activeElement))||(null==E?void 0:E.contains(W.activeElement)))});(0,c.useEffect)(()=>null==q?void 0:q(H),[q,H]);let[Q,J]=(i=(0,c.useContext)(D),l=(0,c.useRef)([]),u=(0,m.z)(e=>(l.current.push(e),i&&i.register(e),()=>s(e))),s=(0,m.z)(e=>{let t=l.current.indexOf(e);-1!==t&&l.current.splice(t,1),i&&i.unregister(e)}),d=(0,c.useMemo)(()=>({register:u,unregister:s,portals:l}),[u,s,l]),[l,(0,c.useMemo)(()=>function(e){let{children:t}=e;return c.createElement(D.Provider,{value:d},t)},[d])]),$=function(){var e;let{defaultContainers:t=[],portals:n,mainTreeNodeRef:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=(0,c.useRef)(null!=(e=null==r?void 0:r.current)?e:null),a=(0,p.i)(o),i=(0,m.z)(()=>{var e,r,i;let l=[];for(let e of t)null!==e&&(e instanceof HTMLElement?l.push(e):"current"in e&&e.current instanceof HTMLElement&&l.push(e.current));if(null!=n&&n.current)for(let e of n.current)l.push(e);for(let t of null!=(e=null==a?void 0:a.querySelectorAll("html > *, body > *"))?e:[])t!==document.body&&t!==document.head&&t instanceof HTMLElement&&"headlessui-portal-root"!==t.id&&(t.contains(o.current)||t.contains(null==(i=null==(r=o.current)?void 0:r.getRootNode())?void 0:i.host)||l.some(e=>t.contains(e))||l.push(t));return l});return{resolveContainers:i,contains:(0,m.z)(e=>i().some(t=>t.contains(e))),mainTreeNodeRef:o,MainTreeNode:(0,c.useMemo)(()=>function(){return null!=r?null:c.createElement(S._,{features:S.A.Hidden,ref:o})},[o,r])}}({mainTreeNodeRef:null==z?void 0:z.mainTreeNodeRef,portals:Q,defaultContainers:[C,E]});r=null==W?void 0:W.defaultView,o="focus",a=e=>{var t,n,r,o;e.target!==window&&e.target instanceof HTMLElement&&0===M&&(V()||C&&E&&($.contains(e.target)||null!=(n=null==(t=j.current)?void 0:t.contains)&&n.call(t,e.target)||null!=(o=null==(r=O.current)?void 0:r.contains)&&o.call(r,e.target)||L({type:1})))},f=(0,T.E)(a),(0,c.useEffect)(()=>{function e(e){f.current(e)}return(r=null!=r?r:window).addEventListener(o,e,!0),()=>r.removeEventListener(o,e,!0)},[r,o,!0]),(0,P.O)($.resolveContainers,(e,t)=>{L({type:1}),(0,Y.sP)(t,Y.tJ.Loose)||(e.preventDefault(),null==C||C.focus())},0===M);let ee=(0,m.z)(e=>{L({type:1});let t=e?e instanceof HTMLElement?e:"current"in e&&e.current instanceof HTMLElement?e.current:C:C;null==t||t.focus()}),et=(0,c.useMemo)(()=>({close:ee,isPortalled:R}),[ee,R]),en=(0,c.useMemo)(()=>({open:0===M,close:ee}),[M,ee]);return c.createElement(X.Provider,{value:null},c.createElement(B.Provider,{value:k},c.createElement(A.Provider,{value:et},c.createElement(Z.up,{value:(0,F.E)(M,{0:Z.ZM.Open,1:Z.ZM.Closed})},c.createElement(J,null,(0,x.sY)({ourProps:{ref:y},theirProps:h,slot:en,defaultTag:"div",name:"Popover"}),c.createElement($.MainTreeNode,null))))))}),{Button:(0,x.yV)(function(e,t){let n=(0,N.M)(),{id:r="headlessui-popover-button-".concat(n),...o}=e,[a,i]=z("Popover.Button"),{isPortalled:l}=q("Popover.Button"),u=(0,c.useRef)(null),s="headlessui-focus-sentinel-".concat((0,N.M)()),d=G(),f=null==d?void 0:d.closeOthers,v=null!==(0,c.useContext)(X);(0,c.useEffect)(()=>{if(!v)return i({type:3,buttonId:r}),()=>{i({type:3,buttonId:null})}},[v,r,i]);let[h]=(0,c.useState)(()=>Symbol()),g=(0,b.T)(u,t,v?null:e=>{if(e)a.buttons.current.push(h);else{let e=a.buttons.current.indexOf(h);-1!==e&&a.buttons.current.splice(e,1)}a.buttons.current.length>1&&console.warn("You are already using a but only 1 is supported."),e&&i({type:2,button:e})}),y=(0,b.T)(u,t),w=(0,p.i)(u),k=(0,m.z)(e=>{var t,n,r;if(v){if(1===a.popoverState)return;switch(e.key){case R.R.Space:case R.R.Enter:e.preventDefault(),null==(n=(t=e.target).click)||n.call(t),i({type:1}),null==(r=a.button)||r.focus()}}else switch(e.key){case R.R.Space:case R.R.Enter:e.preventDefault(),e.stopPropagation(),1===a.popoverState&&(null==f||f(a.buttonId)),i({type:0});break;case R.R.Escape:if(0!==a.popoverState)return null==f?void 0:f(a.buttonId);if(!u.current||null!=w&&w.activeElement&&!u.current.contains(w.activeElement))return;e.preventDefault(),e.stopPropagation(),i({type:1})}}),M=(0,m.z)(e=>{v||e.key===R.R.Space&&e.preventDefault()}),C=(0,m.z)(t=>{var n,r;(0,L.P)(t.currentTarget)||e.disabled||(v?(i({type:1}),null==(n=a.button)||n.focus()):(t.preventDefault(),t.stopPropagation(),1===a.popoverState&&(null==f||f(a.buttonId)),i({type:0}),null==(r=a.button)||r.focus()))}),D=(0,m.z)(e=>{e.preventDefault(),e.stopPropagation()}),T=0===a.popoverState,P=(0,c.useMemo)(()=>({open:T}),[T]),_=(0,E.f)(e,u),Z=v?{ref:y,type:_,onKeyDown:k,onClick:C}:{ref:g,id:a.buttonId,type:_,"aria-expanded":0===a.popoverState,"aria-controls":a.panel?a.panelId:void 0,onKeyDown:k,onKeyUp:M,onClick:C,onMouseDown:D},W=O(),I=(0,m.z)(()=>{let e=a.panel;e&&(0,F.E)(W.current,{[j.Forwards]:()=>(0,Y.jA)(e,Y.TO.First),[j.Backwards]:()=>(0,Y.jA)(e,Y.TO.Last)})===Y.fE.Error&&(0,Y.jA)((0,Y.GO)().filter(e=>"true"!==e.dataset.headlessuiFocusGuard),(0,F.E)(W.current,{[j.Forwards]:Y.TO.Next,[j.Backwards]:Y.TO.Previous}),{relativeTo:a.button})});return c.createElement(c.Fragment,null,(0,x.sY)({ourProps:Z,theirProps:o,slot:P,defaultTag:"button",name:"Popover.Button"}),T&&!v&&l&&c.createElement(S._,{id:s,features:S.A.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:I}))}),Overlay:(0,x.yV)(function(e,t){let n=(0,N.M)(),{id:r="headlessui-popover-overlay-".concat(n),...o}=e,[{popoverState:a},i]=z("Popover.Overlay"),l=(0,b.T)(t),u=(0,Z.oJ)(),s=null!==u?(u&Z.ZM.Open)===Z.ZM.Open:0===a,d=(0,m.z)(e=>{if((0,L.P)(e.currentTarget))return e.preventDefault();i({type:1})}),f=(0,c.useMemo)(()=>({open:0===a}),[a]);return(0,x.sY)({ourProps:{ref:l,id:r,"aria-hidden":!0,onClick:d},theirProps:o,slot:f,defaultTag:"div",features:Q,visible:s,name:"Popover.Overlay"})}),Panel:(0,x.yV)(function(e,t){let n=(0,N.M)(),{id:r="headlessui-popover-panel-".concat(n),focus:o=!1,...a}=e,[i,l]=z("Popover.Panel"),{close:u,isPortalled:s}=q("Popover.Panel"),d="headlessui-focus-sentinel-before-".concat((0,N.M)()),f="headlessui-focus-sentinel-after-".concat((0,N.M)()),h=(0,c.useRef)(null),g=(0,b.T)(h,t,e=>{l({type:4,panel:e})}),y=(0,p.i)(h),w=(0,x.Y2)();(0,v.e)(()=>(l({type:5,panelId:r}),()=>{l({type:5,panelId:null})}),[r,l]);let k=(0,Z.oJ)(),M=null!==k?(k&Z.ZM.Open)===Z.ZM.Open:0===i.popoverState,C=(0,m.z)(e=>{var t;if(e.key===R.R.Escape){if(0!==i.popoverState||!h.current||null!=y&&y.activeElement&&!h.current.contains(y.activeElement))return;e.preventDefault(),e.stopPropagation(),l({type:1}),null==(t=i.button)||t.focus()}});(0,c.useEffect)(()=>{var t;e.static||1===i.popoverState&&(null==(t=e.unmount)||t)&&l({type:4,panel:null})},[i.popoverState,e.unmount,e.static,l]),(0,c.useEffect)(()=>{if(i.__demoMode||!o||0!==i.popoverState||!h.current)return;let e=null==y?void 0:y.activeElement;h.current.contains(e)||(0,Y.jA)(h.current,Y.TO.First)},[i.__demoMode,o,h,i.popoverState]);let D=(0,c.useMemo)(()=>({open:0===i.popoverState,close:u}),[i,u]),T={ref:g,id:r,onKeyDown:C,onBlur:o&&0===i.popoverState?e=>{var t,n,r,o,a;let u=e.relatedTarget;u&&h.current&&(null!=(t=h.current)&&t.contains(u)||(l({type:1}),(null!=(r=null==(n=i.beforePanelSentinel.current)?void 0:n.contains)&&r.call(n,u)||null!=(a=null==(o=i.afterPanelSentinel.current)?void 0:o.contains)&&a.call(o,u))&&u.focus({preventScroll:!0})))}:void 0,tabIndex:-1},P=O(),E=(0,m.z)(()=>{let e=h.current;e&&(0,F.E)(P.current,{[j.Forwards]:()=>{var t;(0,Y.jA)(e,Y.TO.First)===Y.fE.Error&&(null==(t=i.afterPanelSentinel.current)||t.focus())},[j.Backwards]:()=>{var e;null==(e=i.button)||e.focus({preventScroll:!0})}})}),_=(0,m.z)(()=>{let e=h.current;e&&(0,F.E)(P.current,{[j.Forwards]:()=>{var e;if(!i.button)return;let t=(0,Y.GO)(),n=t.indexOf(i.button),r=t.slice(0,n+1),o=[...t.slice(n+1),...r];for(let t of o.slice())if("true"===t.dataset.headlessuiFocusGuard||null!=(e=i.panel)&&e.contains(t)){let e=o.indexOf(t);-1!==e&&o.splice(e,1)}(0,Y.jA)(o,Y.TO.First,{sorted:!1})},[j.Backwards]:()=>{var t;(0,Y.jA)(e,Y.TO.Previous)===Y.fE.Error&&(null==(t=i.button)||t.focus())}})});return c.createElement(X.Provider,{value:r},M&&s&&c.createElement(S._,{id:d,ref:i.beforePanelSentinel,features:S.A.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}),(0,x.sY)({mergeRefs:w,ourProps:T,theirProps:a,slot:D,defaultTag:"div",features:J,visible:M,name:"Popover.Panel"}),M&&s&&c.createElement(S._,{id:f,ref:i.afterPanelSentinel,features:S.A.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:_}))}),Group:(0,x.yV)(function(e,t){let n;let r=(0,c.useRef)(null),o=(0,b.T)(r,t),[a,i]=(0,c.useState)([]),l={mainTreeNodeRef:n=(0,c.useRef)(null),MainTreeNode:(0,c.useMemo)(()=>function(){return c.createElement(S._,{features:S.A.Hidden,ref:n})},[n])},u=(0,m.z)(e=>{i(t=>{let n=t.indexOf(e);if(-1!==n){let e=t.slice();return e.splice(n,1),e}return t})}),s=(0,m.z)(e=>(i(t=>[...t,e]),()=>u(e))),d=(0,m.z)(()=>{var e;let t=(0,W.r)(r);if(!t)return!1;let n=t.activeElement;return!!(null!=(e=r.current)&&e.contains(n))||a.some(e=>{var r,o;return(null==(r=t.getElementById(e.buttonId.current))?void 0:r.contains(n))||(null==(o=t.getElementById(e.panelId.current))?void 0:o.contains(n))})}),f=(0,m.z)(e=>{for(let t of a)t.buttonId.current!==e&&t.close()}),v=(0,c.useMemo)(()=>({registerPopover:s,unregisterPopover:u,isFocusWithinPopoverGroup:d,closeOthers:f,mainTreeNodeRef:l.mainTreeNodeRef}),[s,u,d,f,l.mainTreeNodeRef]),h=(0,c.useMemo)(()=>({}),[]);return c.createElement(V.Provider,{value:v},(0,x.sY)({ourProps:{ref:o},theirProps:e,slot:h,defaultTag:"div",name:"Popover.Group"}),c.createElement(l.MainTreeNode,null))})});var ee=n(33044),et=n(9528);let en=e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}),c.createElement("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"}))};var er=n(4537),eo=n(99735),ea=n(7656);function ei(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e);return t.setHours(0,0,0,0),t}function el(){return ei(Date.now())}function eu(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e);return t.setDate(1),t.setHours(0,0,0,0),t}var es=n(97324),ed=n(96398),ec=n(41154);function ef(e){var t,n;if((0,ea.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==(0,ec.Z)(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach(function(e){var t=(0,eo.Z)(e);(void 0===n||nt||isNaN(t.getDate()))&&(n=t)}),n||new Date(NaN)}var ev=n(25721),eh=n(47869);function ep(e,t){(0,ea.Z)(2,arguments);var n=(0,eh.Z)(t);return(0,ev.Z)(e,-n)}var eg=n(55463);function eb(e,t){if((0,ea.Z)(2,arguments),!t||"object"!==(0,ec.Z)(t))return new Date(NaN);var n=t.years?(0,eh.Z)(t.years):0,r=t.months?(0,eh.Z)(t.months):0,o=t.weeks?(0,eh.Z)(t.weeks):0,a=t.days?(0,eh.Z)(t.days):0,i=t.hours?(0,eh.Z)(t.hours):0,l=t.minutes?(0,eh.Z)(t.minutes):0,u=t.seconds?(0,eh.Z)(t.seconds):0;return new Date(ep(function(e,t){(0,ea.Z)(2,arguments);var n=(0,eh.Z)(t);return(0,eg.Z)(e,-n)}(e,r+12*n),a+7*o).getTime()-1e3*(u+60*(l+60*i)))}function ey(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ew(e){return(0,ea.Z)(1,arguments),e instanceof Date||"object"===(0,ec.Z)(e)&&"[object Date]"===Object.prototype.toString.call(e)}function ex(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e),n=t.getUTCDay();return t.setUTCDate(t.getUTCDate()-((n<1?7:0)+n-1)),t.setUTCHours(0,0,0,0),t}function ek(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=ex(r),a=new Date(0);a.setUTCFullYear(n,0,4),a.setUTCHours(0,0,0,0);var i=ex(a);return t.getTime()>=o.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}var eM={};function eC(e,t){(0,ea.Z)(1,arguments);var n,r,o,a,i,l,u,s,d=(0,eh.Z)(null!==(n=null!==(r=null!==(o=null!==(a=null==t?void 0:t.weekStartsOn)&&void 0!==a?a:null==t?void 0:null===(i=t.locale)||void 0===i?void 0:null===(l=i.options)||void 0===l?void 0:l.weekStartsOn)&&void 0!==o?o:eM.weekStartsOn)&&void 0!==r?r:null===(u=eM.locale)||void 0===u?void 0:null===(s=u.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=(0,eo.Z)(e),f=c.getUTCDay();return c.setUTCDate(c.getUTCDate()-((f=1&&f<=7))throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(c+1,0,f),m.setUTCHours(0,0,0,0);var v=eC(m,t),h=new Date(0);h.setUTCFullYear(c,0,f),h.setUTCHours(0,0,0,0);var p=eC(h,t);return d.getTime()>=v.getTime()?c+1:d.getTime()>=p.getTime()?c:c-1}function eT(e,t){for(var n=Math.abs(e).toString();n.length0?n:1-n;return eT("yy"===t?r%100:r,t.length)},M:function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):eT(n+1,2)},d:function(e,t){return eT(e.getUTCDate(),t.length)},h:function(e,t){return eT(e.getUTCHours()%12||12,t.length)},H:function(e,t){return eT(e.getUTCHours(),t.length)},m:function(e,t){return eT(e.getUTCMinutes(),t.length)},s:function(e,t){return eT(e.getUTCSeconds(),t.length)},S:function(e,t){var n=t.length;return eT(Math.floor(e.getUTCMilliseconds()*Math.pow(10,n-3)),t.length)}},eP={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"};function eE(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),a=r%60;return 0===a?n+String(o):n+String(o)+(t||"")+eT(a,2)}function eS(e,t){return e%60==0?(e>0?"-":"+")+eT(Math.abs(e)/60,2):e_(e,t)}function e_(e,t){var n=Math.abs(e);return(e>0?"-":"+")+eT(Math.floor(n/60),2)+(t||"")+eT(n%60,2)}var ej={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear();return n.ordinalNumber(r>0?r:1-r,{unit:"year"})}return eN.y(e,t)},Y:function(e,t,n,r){var o=eD(e,r),a=o>0?o:1-o;return"YY"===t?eT(a%100,2):"Yo"===t?n.ordinalNumber(a,{unit:"year"}):eT(a,t.length)},R:function(e,t){return eT(ek(e),t.length)},u:function(e,t){return eT(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return eT(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return eT(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return eN.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return eT(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){var o=function(e,t){(0,ea.Z)(1,arguments);var n=(0,eo.Z)(e);return Math.round((eC(n,t).getTime()-(function(e,t){(0,ea.Z)(1,arguments);var n,r,o,a,i,l,u,s,d=(0,eh.Z)(null!==(n=null!==(r=null!==(o=null!==(a=null==t?void 0:t.firstWeekContainsDate)&&void 0!==a?a:null==t?void 0:null===(i=t.locale)||void 0===i?void 0:null===(l=i.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==o?o:eM.firstWeekContainsDate)&&void 0!==r?r:null===(u=eM.locale)||void 0===u?void 0:null===(s=u.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==n?n:1),c=eD(e,t),f=new Date(0);return f.setUTCFullYear(c,0,d),f.setUTCHours(0,0,0,0),eC(f,t)})(n,t).getTime())/6048e5)+1}(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):eT(o,t.length)},I:function(e,t,n){var r=function(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e);return Math.round((ex(t).getTime()-(function(e){(0,ea.Z)(1,arguments);var t=ek(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),ex(n)})(t).getTime())/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):eT(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):eN.d(e,t)},D:function(e,t,n){var r=function(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e),n=t.getTime();return t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),Math.floor((n-t.getTime())/864e5)+1}(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):eT(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var o=e.getUTCDay(),a=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return eT(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var o=e.getUTCDay(),a=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return eT(a,t.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return eT(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,o=e.getUTCHours();switch(r=12===o?eP.noon:0===o?eP.midnight:o/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,o=e.getUTCHours();switch(r=o>=17?eP.evening:o>=12?eP.afternoon:o>=4?eP.morning:eP.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return eN.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):eN.H(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):eT(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return(0===r&&(r=24),"ko"===t)?n.ordinalNumber(r,{unit:"hour"}):eT(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):eN.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):eN.s(e,t)},S:function(e,t){return eN.S(e,t)},X:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return eS(o);case"XXXX":case"XX":return e_(o);default:return e_(o,":")}},x:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return eS(o);case"xxxx":case"xx":return e_(o);default:return e_(o,":")}},O:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+eE(o,":");default:return"GMT"+e_(o,":")}},z:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+eE(o,":");default:return"GMT"+e_(o,":")}},t:function(e,t,n,r){return eT(Math.floor((r._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,r){return eT((r._originalDate||e).getTime(),t.length)}},eO=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},eZ=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},eL={p:eZ,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],o=r[1],a=r[2];if(!a)return eO(e,t);switch(o){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",eO(o,t)).replace("{{time}}",eZ(a,t))}};function eY(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}var eF=["D","DD"],eW=["YY","YYYY"];function eR(e,t,n){if("YYYY"===e)throw RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var eI={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function eU(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var eH={date:eU({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:eU({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:eU({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},eB={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function ez(e){return function(t,n){var r;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,a=null!=n&&n.width?String(n.width):o;r=e.formattingValues[a]||e.formattingValues[o]}else{var i=e.defaultWidth,l=null!=n&&n.width?String(n.width):e.defaultWidth;r=e.values[l]||e.values[i]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function eA(e){return function(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.width,a=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;var l=i[0],u=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(u)?function(e,t){for(var n=0;n0?"in "+r:r+" ago":r},formatLong:eH,formatRelative:function(e,t,n,r){return eB[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:ez({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:ez({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:ez({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:ez({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:ez({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(i={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(i.matchPattern);if(!n)return null;var r=n[0],o=e.match(i.parsePattern);if(!o)return null;var a=i.valueCallback?i.valueCallback(o[0]):o[0];return{value:a=t.valueCallback?t.valueCallback(a):a,rest:e.slice(r.length)}}),era:eA({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:eA({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:eA({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:eA({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:eA({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},eV=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,eG=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,eX=/^'([^]*?)'?$/,eK=/''/g,eQ=/[a-zA-Z]/;function eJ(e,t,n){(0,ea.Z)(2,arguments);var r,o,a,i,l,u,s,d,c,f,m,v,h,p,g,b,y,w,x=String(t),k=null!==(r=null!==(o=null==n?void 0:n.locale)&&void 0!==o?o:eM.locale)&&void 0!==r?r:eq,M=(0,eh.Z)(null!==(a=null!==(i=null!==(l=null!==(u=null==n?void 0:n.firstWeekContainsDate)&&void 0!==u?u:null==n?void 0:null===(s=n.locale)||void 0===s?void 0:null===(d=s.options)||void 0===d?void 0:d.firstWeekContainsDate)&&void 0!==l?l:eM.firstWeekContainsDate)&&void 0!==i?i:null===(c=eM.locale)||void 0===c?void 0:null===(f=c.options)||void 0===f?void 0:f.firstWeekContainsDate)&&void 0!==a?a:1);if(!(M>=1&&M<=7))throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var C=(0,eh.Z)(null!==(m=null!==(v=null!==(h=null!==(p=null==n?void 0:n.weekStartsOn)&&void 0!==p?p:null==n?void 0:null===(g=n.locale)||void 0===g?void 0:null===(b=g.options)||void 0===b?void 0:b.weekStartsOn)&&void 0!==h?h:eM.weekStartsOn)&&void 0!==v?v:null===(y=eM.locale)||void 0===y?void 0:null===(w=y.options)||void 0===w?void 0:w.weekStartsOn)&&void 0!==m?m:0);if(!(C>=0&&C<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!k.localize)throw RangeError("locale must contain localize property");if(!k.formatLong)throw RangeError("locale must contain formatLong property");var D=(0,eo.Z)(e);if(!function(e){return(0,ea.Z)(1,arguments),(!!ew(e)||"number"==typeof e)&&!isNaN(Number((0,eo.Z)(e)))}(D))throw RangeError("Invalid time value");var T=eY(D),N=function(e,t){return(0,ea.Z)(2,arguments),function(e,t){return(0,ea.Z)(2,arguments),new Date((0,eo.Z)(e).getTime()+(0,eh.Z)(t))}(e,-(0,eh.Z)(t))}(D,T),P={firstWeekContainsDate:M,weekStartsOn:C,locale:k,_originalDate:D};return x.match(eG).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,eL[t])(e,k.formatLong):e}).join("").match(eV).map(function(r){if("''"===r)return"'";var o,a=r[0];if("'"===a)return(o=r.match(eX))?o[1].replace(eK,"'"):r;var i=ej[a];if(i)return null!=n&&n.useAdditionalWeekYearTokens||-1===eW.indexOf(r)||eR(r,t,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||-1===eF.indexOf(r)||eR(r,t,String(e)),i(N,r,k.localize,P);if(a.match(eQ))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return r}).join("")}var e$=n(1153);let e0=(0,e$.fn)("DateRangePicker"),e1=(e,t,n,r)=>{var o;if(n&&(e=null===(o=r.get(n))||void 0===o?void 0:o.from),e)return ei(e&&!t?e:ef([e,t]))},e2=(e,t,n,r)=>{var o,a;if(n&&(e=ei(null!==(a=null===(o=r.get(n))||void 0===o?void 0:o.to)&&void 0!==a?a:el())),e)return ei(e&&!t?e:em([e,t]))},e4=[{value:"tdy",text:"Today",from:el()},{value:"w",text:"Last 7 days",from:eb(el(),{days:7})},{value:"t",text:"Last 30 days",from:eb(el(),{days:30})},{value:"m",text:"Month to Date",from:eu(el())},{value:"y",text:"Year to Date",from:ey(el())}],e3=(e,t,n,r)=>{let o=(null==n?void 0:n.code)||"en-US";if(!e&&!t)return"";if(e&&!t)return r?eJ(e,r):e.toLocaleDateString(o,{year:"numeric",month:"short",day:"numeric"});if(e&&t){if(function(e,t){(0,ea.Z)(2,arguments);var n=(0,eo.Z)(e),r=(0,eo.Z)(t);return n.getTime()===r.getTime()}(e,t))return r?eJ(e,r):e.toLocaleDateString(o,{year:"numeric",month:"short",day:"numeric"});if(e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear())return r?"".concat(eJ(e,r)," - ").concat(eJ(t,r)):"".concat(e.toLocaleDateString(o,{month:"short",day:"numeric"})," - \n ").concat(t.getDate(),", ").concat(t.getFullYear());{if(r)return"".concat(eJ(e,r)," - ").concat(eJ(t,r));let n={year:"numeric",month:"short",day:"numeric"};return"".concat(e.toLocaleDateString(o,n)," - \n ").concat(t.toLocaleDateString(o,n))}}return""};function e8(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function e6(e,t){(0,ea.Z)(2,arguments);var n=(0,eo.Z)(e),r=(0,eh.Z)(t),o=n.getFullYear(),a=n.getDate(),i=new Date(0);i.setFullYear(o,r,15),i.setHours(0,0,0,0);var l=function(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}(i);return n.setMonth(r,Math.min(a,l)),n}function e5(e,t){(0,ea.Z)(2,arguments);var n=(0,eo.Z)(e),r=(0,eh.Z)(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}function e7(e,t){(0,ea.Z)(2,arguments);var n=(0,eo.Z)(e),r=(0,eo.Z)(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}function e9(e,t){(0,ea.Z)(2,arguments);var n=(0,eo.Z)(e),r=(0,eo.Z)(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function te(e,t){(0,ea.Z)(2,arguments);var n=(0,eo.Z)(e),r=(0,eo.Z)(t);return n.getTime()=0&&d<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=(0,eo.Z)(e),f=c.getDay();return c.setDate(c.getDate()-((fr.getTime()}function ta(e,t){(0,ea.Z)(2,arguments);var n=ei(e),r=ei(t);return Math.round((n.getTime()-eY(n)-(r.getTime()-eY(r)))/864e5)}function ti(e,t){(0,ea.Z)(2,arguments);var n=(0,eh.Z)(t);return(0,ev.Z)(e,7*n)}function tl(e,t){(0,ea.Z)(2,arguments);var n=(0,eh.Z)(t);return(0,eg.Z)(e,12*n)}function tu(e,t){(0,ea.Z)(1,arguments);var n,r,o,a,i,l,u,s,d=(0,eh.Z)(null!==(n=null!==(r=null!==(o=null!==(a=null==t?void 0:t.weekStartsOn)&&void 0!==a?a:null==t?void 0:null===(i=t.locale)||void 0===i?void 0:null===(l=i.options)||void 0===l?void 0:l.weekStartsOn)&&void 0!==o?o:eM.weekStartsOn)&&void 0!==r?r:null===(u=eM.locale)||void 0===u?void 0:null===(s=u.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=(0,eo.Z)(e),f=c.getDay();return c.setDate(c.getDate()+((fe7(l,i)&&(i=(0,eg.Z)(l,-1*((void 0===s?1:s)-1))),u&&0>e7(i,u)&&(i=u),d=eu(i),f=t.month,v=(m=(0,c.useState)(d))[0],h=[void 0===f?v:f,m[1]])[0],g=h[1],[p,function(e){if(!t.disableNavigation){var n,r=eu(e);g(r),null===(n=t.onMonthChange)||void 0===n||n.call(t,r)}}]),w=y[0],x=y[1],k=function(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=eu(e),a=e7(eu((0,eg.Z)(o,r)),o),i=[],l=0;l=e7(a,n)))return(0,eg.Z)(a,-(r?void 0===o?1:o:1))}}(w,b),D=function(e){return k.some(function(t){return e9(e,t)})};return tv.jsx(tE.Provider,{value:{currentMonth:w,displayMonths:k,goToMonth:x,goToDate:function(e,t){D(e)||(t&&te(e,t)?x((0,eg.Z)(e,1+-1*b.numberOfMonths)):x(e))},previousMonth:C,nextMonth:M,isDateDisplayed:D},children:e.children})}function t_(){var e=(0,c.useContext)(tE);if(!e)throw Error("useNavigation must be used within a NavigationProvider");return e}function tj(e){var t,n=tM(),r=n.classNames,o=n.styles,a=n.components,i=t_().goToMonth,l=function(t){i((0,eg.Z)(t,e.displayIndex?-e.displayIndex:0))},u=null!==(t=null==a?void 0:a.CaptionLabel)&&void 0!==t?t:tC,s=tv.jsx(u,{id:e.id,displayMonth:e.displayMonth});return tv.jsxs("div",{className:r.caption_dropdowns,style:o.caption_dropdowns,children:[tv.jsx("div",{className:r.vhidden,children:s}),tv.jsx(tN,{onChange:l,displayMonth:e.displayMonth}),tv.jsx(tP,{onChange:l,displayMonth:e.displayMonth})]})}function tO(e){return tv.jsx("svg",td({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:tv.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function tZ(e){return tv.jsx("svg",td({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:tv.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var tL=(0,c.forwardRef)(function(e,t){var n=tM(),r=n.classNames,o=n.styles,a=[r.button_reset,r.button];e.className&&a.push(e.className);var i=a.join(" "),l=td(td({},o.button_reset),o.button);return e.style&&Object.assign(l,e.style),tv.jsx("button",td({},e,{ref:t,type:"button",className:i,style:l}))});function tY(e){var t,n,r=tM(),o=r.dir,a=r.locale,i=r.classNames,l=r.styles,u=r.labels,s=u.labelPrevious,d=u.labelNext,c=r.components;if(!e.nextMonth&&!e.previousMonth)return tv.jsx(tv.Fragment,{});var f=s(e.previousMonth,{locale:a}),m=[i.nav_button,i.nav_button_previous].join(" "),v=d(e.nextMonth,{locale:a}),h=[i.nav_button,i.nav_button_next].join(" "),p=null!==(t=null==c?void 0:c.IconRight)&&void 0!==t?t:tZ,g=null!==(n=null==c?void 0:c.IconLeft)&&void 0!==n?n:tO;return tv.jsxs("div",{className:i.nav,style:l.nav,children:[!e.hidePrevious&&tv.jsx(tL,{name:"previous-month","aria-label":f,className:m,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:"rtl"===o?tv.jsx(p,{className:i.nav_icon,style:l.nav_icon}):tv.jsx(g,{className:i.nav_icon,style:l.nav_icon})}),!e.hideNext&&tv.jsx(tL,{name:"next-month","aria-label":v,className:h,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:"rtl"===o?tv.jsx(g,{className:i.nav_icon,style:l.nav_icon}):tv.jsx(p,{className:i.nav_icon,style:l.nav_icon})})]})}function tF(e){var t=tM().numberOfMonths,n=t_(),r=n.previousMonth,o=n.nextMonth,a=n.goToMonth,i=n.displayMonths,l=i.findIndex(function(t){return e9(e.displayMonth,t)}),u=0===l,s=l===i.length-1;return tv.jsx(tY,{displayMonth:e.displayMonth,hideNext:t>1&&(u||!s),hidePrevious:t>1&&(s||!u),nextMonth:o,previousMonth:r,onPreviousClick:function(){r&&a(r)},onNextClick:function(){o&&a(o)}})}function tW(e){var t,n,r=tM(),o=r.classNames,a=r.disableNavigation,i=r.styles,l=r.captionLayout,u=r.components,s=null!==(t=null==u?void 0:u.CaptionLabel)&&void 0!==t?t:tC;return n=a?tv.jsx(s,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===l?tv.jsx(tj,{displayMonth:e.displayMonth,id:e.id}):"dropdown-buttons"===l?tv.jsxs(tv.Fragment,{children:[tv.jsx(tj,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),tv.jsx(tF,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):tv.jsxs(tv.Fragment,{children:[tv.jsx(s,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),tv.jsx(tF,{displayMonth:e.displayMonth,id:e.id})]}),tv.jsx("div",{className:o.caption,style:i.caption,children:n})}function tR(e){var t=tM(),n=t.footer,r=t.styles,o=t.classNames.tfoot;return n?tv.jsx("tfoot",{className:o,style:r.tfoot,children:tv.jsx("tr",{children:tv.jsx("td",{colSpan:8,children:n})})}):tv.jsx(tv.Fragment,{})}function tI(){var e=tM(),t=e.classNames,n=e.styles,r=e.showWeekNumber,o=e.locale,a=e.weekStartsOn,i=e.ISOWeek,l=e.formatters.formatWeekdayName,u=e.labels.labelWeekday,s=function(e,t,n){for(var r=n?tn(new Date):tt(new Date,{locale:e,weekStartsOn:t}),o=[],a=0;a<7;a++){var i=(0,ev.Z)(r,a);o.push(i)}return o}(o,a,i);return tv.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&tv.jsx("td",{style:n.head_cell,className:t.head_cell}),s.map(function(e,r){return tv.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":u(e,{locale:o}),children:l(e,{locale:o})},r)})]})}function tU(){var e,t=tM(),n=t.classNames,r=t.styles,o=t.components,a=null!==(e=null==o?void 0:o.HeadRow)&&void 0!==e?e:tI;return tv.jsx("thead",{style:r.head,className:n.head,children:tv.jsx(a,{})})}function tH(e){var t=tM(),n=t.locale,r=t.formatters.formatDay;return tv.jsx(tv.Fragment,{children:r(e.date,{locale:n})})}var tB=(0,c.createContext)(void 0);function tz(e){return th(e.initialProps)?tv.jsx(tA,{initialProps:e.initialProps,children:e.children}):tv.jsx(tB.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}function tA(e){var t=e.initialProps,n=e.children,r=t.selected,o=t.min,a=t.max,i={disabled:[]};return r&&i.disabled.push(function(e){var t=a&&r.length>a-1,n=r.some(function(t){return tr(t,e)});return!!(t&&!n)}),tv.jsx(tB.Provider,{value:{selected:r,onDayClick:function(e,n,i){if(null===(l=t.onDayClick)||void 0===l||l.call(t,e,n,i),(!n.selected||!o||(null==r?void 0:r.length)!==o)&&(n.selected||!a||(null==r?void 0:r.length)!==a)){var l,u,s=r?tc([],r,!0):[];if(n.selected){var d=s.findIndex(function(t){return tr(e,t)});s.splice(d,1)}else s.push(e);null===(u=t.onSelect)||void 0===u||u.call(t,s,e,n,i)}},modifiers:i},children:n})}function tq(){var e=(0,c.useContext)(tB);if(!e)throw Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var tV=(0,c.createContext)(void 0);function tG(e){return tp(e.initialProps)?tv.jsx(tX,{initialProps:e.initialProps,children:e.children}):tv.jsx(tV.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}function tX(e){var t=e.initialProps,n=e.children,r=t.selected,o=r||{},a=o.from,i=o.to,l=t.min,u=t.max,s={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(s.range_start=[a],i?(s.range_end=[i],tr(a,i)||(s.range_middle=[{after:a,before:i}])):s.range_end=[a]):i&&(s.range_start=[i],s.range_end=[i]),l&&(a&&!i&&s.disabled.push({after:ep(a,l-1),before:(0,ev.Z)(a,l-1)}),a&&i&&s.disabled.push({after:a,before:(0,ev.Z)(a,l-1)}),!a&&i&&s.disabled.push({after:ep(i,l-1),before:(0,ev.Z)(i,l-1)})),u){if(a&&!i&&(s.disabled.push({before:(0,ev.Z)(a,-u+1)}),s.disabled.push({after:(0,ev.Z)(a,u-1)})),a&&i){var d=u-(ta(i,a)+1);s.disabled.push({before:ep(a,d)}),s.disabled.push({after:(0,ev.Z)(i,d)})}!a&&i&&(s.disabled.push({before:(0,ev.Z)(i,-u+1)}),s.disabled.push({after:(0,ev.Z)(i,u-1)}))}return tv.jsx(tV.Provider,{value:{selected:r,onDayClick:function(e,n,o){null===(u=t.onDayClick)||void 0===u||u.call(t,e,n,o);var a,i,l,u,s,d=(i=(a=r||{}).from,l=a.to,i&&l?tr(l,e)&&tr(i,e)?void 0:tr(l,e)?{from:l,to:void 0}:tr(i,e)?void 0:to(i,e)?{from:e,to:l}:{from:i,to:e}:l?to(e,l)?{from:l,to:e}:{from:e,to:l}:i?te(e,i)?{from:e,to:i}:{from:i,to:e}:{from:e,to:void 0});null===(s=t.onSelect)||void 0===s||s.call(t,d,e,n,o)},modifiers:s},children:n})}function tK(){var e=(0,c.useContext)(tV);if(!e)throw Error("useSelectRange must be used within a SelectRangeProvider");return e}function tQ(e){return Array.isArray(e)?tc([],e,!0):void 0!==e?[e]:[]}(l=s||(s={})).Outside="outside",l.Disabled="disabled",l.Selected="selected",l.Hidden="hidden",l.Today="today",l.RangeStart="range_start",l.RangeEnd="range_end",l.RangeMiddle="range_middle";var tJ=s.Selected,t$=s.Disabled,t0=s.Hidden,t1=s.Today,t2=s.RangeEnd,t4=s.RangeMiddle,t3=s.RangeStart,t8=s.Outside,t6=(0,c.createContext)(void 0);function t5(e){var t,n,r,o=tM(),a=tq(),i=tK(),l=((t={})[tJ]=tQ(o.selected),t[t$]=tQ(o.disabled),t[t0]=tQ(o.hidden),t[t1]=[o.today],t[t2]=[],t[t4]=[],t[t3]=[],t[t8]=[],o.fromDate&&t[t$].push({before:o.fromDate}),o.toDate&&t[t$].push({after:o.toDate}),th(o)?t[t$]=t[t$].concat(a.modifiers[t$]):tp(o)&&(t[t$]=t[t$].concat(i.modifiers[t$]),t[t3]=i.modifiers[t3],t[t4]=i.modifiers[t4],t[t2]=i.modifiers[t2]),t),u=(n=o.modifiers,r={},Object.entries(n).forEach(function(e){var t=e[0],n=e[1];r[t]=tQ(n)}),r),s=td(td({},l),u);return tv.jsx(t6.Provider,{value:s,children:e.children})}function t7(){var e=(0,c.useContext)(t6);if(!e)throw Error("useModifiers must be used within a ModifiersProvider");return e}function t9(e,t,n){var r=Object.keys(t).reduce(function(n,r){return t[r].some(function(t){if("boolean"==typeof t)return t;if(ew(t))return tr(e,t);if(Array.isArray(t)&&t.every(ew))return t.includes(e);if(t&&"object"==typeof t&&"from"in t)return r=t.from,o=t.to,r&&o?(0>ta(o,r)&&(r=(n=[o,r])[0],o=n[1]),ta(e,r)>=0&&ta(o,e)>=0):o?tr(o,e):!!r&&tr(r,e);if(t&&"object"==typeof t&&"dayOfWeek"in t)return t.dayOfWeek.includes(e.getDay());if(t&&"object"==typeof t&&"before"in t&&"after"in t){var n,r,o,a=ta(t.before,e),i=ta(t.after,e),l=a>0,u=i<0;return to(t.before,t.after)?u&&l:l||u}return t&&"object"==typeof t&&"after"in t?ta(e,t.after)>0:t&&"object"==typeof t&&"before"in t?ta(t.before,e)>0:"function"==typeof t&&t(e)})&&n.push(r),n},[]),o={};return r.forEach(function(e){return o[e]=!0}),n&&!e9(e,n)&&(o.outside=!0),o}var ne=(0,c.createContext)(void 0);function nt(e){var t=t_(),n=t7(),r=(0,c.useState)(),o=r[0],a=r[1],i=(0,c.useState)(),l=i[0],u=i[1],s=function(e,t){for(var n,r,o=eu(e[0]),a=e8(e[e.length-1]),i=o;i<=a;){var l=t9(i,t);if(!(!l.disabled&&!l.hidden)){i=(0,ev.Z)(i,1);continue}if(l.selected)return i;l.today&&!r&&(r=i),n||(n=i),i=(0,ev.Z)(i,1)}return r||n}(t.displayMonths,n),d=(null!=o?o:l&&t.isDateDisplayed(l))?l:s,f=function(e){a(e)},m=tM(),v=function(e,r){if(o){var a=function e(t,n){var r=n.moveBy,o=n.direction,a=n.context,i=n.modifiers,l=n.retry,u=void 0===l?{count:0,lastFocused:t}:l,s=a.weekStartsOn,d=a.fromDate,c=a.toDate,f=a.locale,m=({day:ev.Z,week:ti,month:eg.Z,year:tl,startOfWeek:function(e){return a.ISOWeek?tn(e):tt(e,{locale:f,weekStartsOn:s})},endOfWeek:function(e){return a.ISOWeek?ts(e):tu(e,{locale:f,weekStartsOn:s})}})[r](t,"after"===o?1:-1);"before"===o&&d?m=ef([d,m]):"after"===o&&c&&(m=em([c,m]));var v=!0;if(i){var h=t9(m,i);v=!h.disabled&&!h.hidden}return v?m:u.count>365?u.lastFocused:e(m,{moveBy:r,direction:o,context:a,modifiers:i,retry:td(td({},u),{count:u.count+1})})}(o,{moveBy:e,direction:r,context:m,modifiers:n});tr(o,a)||(t.goToDate(a,o),f(a))}};return tv.jsx(ne.Provider,{value:{focusedDay:o,focusTarget:d,blur:function(){u(o),a(void 0)},focus:f,focusDayAfter:function(){return v("day","after")},focusDayBefore:function(){return v("day","before")},focusWeekAfter:function(){return v("week","after")},focusWeekBefore:function(){return v("week","before")},focusMonthBefore:function(){return v("month","before")},focusMonthAfter:function(){return v("month","after")},focusYearBefore:function(){return v("year","before")},focusYearAfter:function(){return v("year","after")},focusStartOfWeek:function(){return v("startOfWeek","before")},focusEndOfWeek:function(){return v("endOfWeek","after")}},children:e.children})}function nn(){var e=(0,c.useContext)(ne);if(!e)throw Error("useFocusContext must be used within a FocusProvider");return e}var nr=(0,c.createContext)(void 0);function no(e){return tg(e.initialProps)?tv.jsx(na,{initialProps:e.initialProps,children:e.children}):tv.jsx(nr.Provider,{value:{selected:void 0},children:e.children})}function na(e){var t=e.initialProps,n=e.children,r={selected:t.selected,onDayClick:function(e,n,r){var o,a,i;if(null===(o=t.onDayClick)||void 0===o||o.call(t,e,n,r),n.selected&&!t.required){null===(a=t.onSelect)||void 0===a||a.call(t,void 0,e,n,r);return}null===(i=t.onSelect)||void 0===i||i.call(t,e,e,n,r)}};return tv.jsx(nr.Provider,{value:r,children:n})}function ni(){var e=(0,c.useContext)(nr);if(!e)throw Error("useSelectSingle must be used within a SelectSingleProvider");return e}function nl(e){var t,n,r,o,a,i,l,u,d,f,m,v,h,p,g,b,y,w,x,k,M,C,D,T,N,P,E,S,_,j,O,Z,L,Y,F,W,R,I,U,H,B,z,A=(0,c.useRef)(null),q=(t=e.date,n=e.displayMonth,i=tM(),l=nn(),u=t9(t,t7(),n),d=tM(),f=ni(),m=tq(),v=tK(),p=(h=nn()).focusDayAfter,g=h.focusDayBefore,b=h.focusWeekAfter,y=h.focusWeekBefore,w=h.blur,x=h.focus,k=h.focusMonthBefore,M=h.focusMonthAfter,C=h.focusYearBefore,D=h.focusYearAfter,T=h.focusStartOfWeek,N=h.focusEndOfWeek,P={onClick:function(e){var n,r,o,a;tg(d)?null===(n=f.onDayClick)||void 0===n||n.call(f,t,u,e):th(d)?null===(r=m.onDayClick)||void 0===r||r.call(m,t,u,e):tp(d)?null===(o=v.onDayClick)||void 0===o||o.call(v,t,u,e):null===(a=d.onDayClick)||void 0===a||a.call(d,t,u,e)},onFocus:function(e){var n;x(t),null===(n=d.onDayFocus)||void 0===n||n.call(d,t,u,e)},onBlur:function(e){var n;w(),null===(n=d.onDayBlur)||void 0===n||n.call(d,t,u,e)},onKeyDown:function(e){var n;switch(e.key){case"ArrowLeft":e.preventDefault(),e.stopPropagation(),"rtl"===d.dir?p():g();break;case"ArrowRight":e.preventDefault(),e.stopPropagation(),"rtl"===d.dir?g():p();break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),b();break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),y();break;case"PageUp":e.preventDefault(),e.stopPropagation(),e.shiftKey?C():k();break;case"PageDown":e.preventDefault(),e.stopPropagation(),e.shiftKey?D():M();break;case"Home":e.preventDefault(),e.stopPropagation(),T();break;case"End":e.preventDefault(),e.stopPropagation(),N()}null===(n=d.onDayKeyDown)||void 0===n||n.call(d,t,u,e)},onKeyUp:function(e){var n;null===(n=d.onDayKeyUp)||void 0===n||n.call(d,t,u,e)},onMouseEnter:function(e){var n;null===(n=d.onDayMouseEnter)||void 0===n||n.call(d,t,u,e)},onMouseLeave:function(e){var n;null===(n=d.onDayMouseLeave)||void 0===n||n.call(d,t,u,e)},onPointerEnter:function(e){var n;null===(n=d.onDayPointerEnter)||void 0===n||n.call(d,t,u,e)},onPointerLeave:function(e){var n;null===(n=d.onDayPointerLeave)||void 0===n||n.call(d,t,u,e)},onTouchCancel:function(e){var n;null===(n=d.onDayTouchCancel)||void 0===n||n.call(d,t,u,e)},onTouchEnd:function(e){var n;null===(n=d.onDayTouchEnd)||void 0===n||n.call(d,t,u,e)},onTouchMove:function(e){var n;null===(n=d.onDayTouchMove)||void 0===n||n.call(d,t,u,e)},onTouchStart:function(e){var n;null===(n=d.onDayTouchStart)||void 0===n||n.call(d,t,u,e)}},E=tM(),S=ni(),_=tq(),j=tK(),O=tg(E)?S.selected:th(E)?_.selected:tp(E)?j.selected:void 0,Z=!!(i.onDayClick||"default"!==i.mode),(0,c.useEffect)(function(){var e;!u.outside&&l.focusedDay&&Z&&tr(l.focusedDay,t)&&(null===(e=A.current)||void 0===e||e.focus())},[l.focusedDay,t,A,Z,u.outside]),Y=(L=[i.classNames.day],Object.keys(u).forEach(function(e){var t=i.modifiersClassNames[e];if(t)L.push(t);else if(Object.values(s).includes(e)){var n=i.classNames["day_".concat(e)];n&&L.push(n)}}),L).join(" "),F=td({},i.styles.day),Object.keys(u).forEach(function(e){var t;F=td(td({},F),null===(t=i.modifiersStyles)||void 0===t?void 0:t[e])}),W=F,R=!!(u.outside&&!i.showOutsideDays||u.hidden),I=null!==(a=null===(o=i.components)||void 0===o?void 0:o.DayContent)&&void 0!==a?a:tH,U={style:W,className:Y,children:tv.jsx(I,{date:t,displayMonth:n,activeModifiers:u}),role:"gridcell"},H=l.focusTarget&&tr(l.focusTarget,t)&&!u.outside,B=l.focusedDay&&tr(l.focusedDay,t),z=td(td(td({},U),((r={disabled:u.disabled,role:"gridcell"})["aria-selected"]=u.selected,r.tabIndex=B||H?0:-1,r)),P),{isButton:Z,isHidden:R,activeModifiers:u,selectedDays:O,buttonProps:z,divProps:U});return q.isHidden?tv.jsx("div",{role:"gridcell"}):q.isButton?tv.jsx(tL,td({name:"day",ref:A},q.buttonProps)):tv.jsx("div",td({},q.divProps))}function nu(e){var t=e.number,n=e.dates,r=tM(),o=r.onWeekNumberClick,a=r.styles,i=r.classNames,l=r.locale,u=r.labels.labelWeekNumber,s=(0,r.formatters.formatWeekNumber)(Number(t),{locale:l});if(!o)return tv.jsx("span",{className:i.weeknumber,style:a.weeknumber,children:s});var d=u(Number(t),{locale:l});return tv.jsx(tL,{name:"week-number","aria-label":d,className:i.weeknumber,style:a.weeknumber,onClick:function(e){o(t,n,e)},children:s})}function ns(e){var t,n,r,o=tM(),a=o.styles,i=o.classNames,l=o.showWeekNumber,u=o.components,s=null!==(t=null==u?void 0:u.Day)&&void 0!==t?t:nl,d=null!==(n=null==u?void 0:u.WeekNumber)&&void 0!==n?n:nu;return l&&(r=tv.jsx("td",{className:i.cell,style:a.cell,children:tv.jsx(d,{number:e.weekNumber,dates:e.dates})})),tv.jsxs("tr",{className:i.row,style:a.row,children:[r,e.dates.map(function(t){return tv.jsx("td",{className:i.cell,style:a.cell,role:"presentation",children:tv.jsx(s,{displayMonth:e.displayMonth,date:t})},function(e){return(0,ea.Z)(1,arguments),Math.floor(function(e){return(0,ea.Z)(1,arguments),(0,eo.Z)(e).getTime()}(e)/1e3)}(t))})]})}function nd(e,t,n){for(var r=(null==n?void 0:n.ISOWeek)?ts(t):tu(t,n),o=(null==n?void 0:n.ISOWeek)?tn(e):tt(e,n),a=ta(r,o),i=[],l=0;l<=a;l++)i.push((0,ev.Z)(o,l));return i.reduce(function(e,t){var r=(null==n?void 0:n.ISOWeek)?function(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e);return Math.round((tn(t).getTime()-(function(e){(0,ea.Z)(1,arguments);var t=function(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=tn(r),a=new Date(0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);var i=tn(a);return t.getTime()>=o.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}(e),n=new Date(0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),tn(n)})(t).getTime())/6048e5)+1}(t):function(e,t){(0,ea.Z)(1,arguments);var n=(0,eo.Z)(e);return Math.round((tt(n,t).getTime()-(function(e,t){(0,ea.Z)(1,arguments);var n,r,o,a,i,l,u,s,d=(0,eh.Z)(null!==(n=null!==(r=null!==(o=null!==(a=null==t?void 0:t.firstWeekContainsDate)&&void 0!==a?a:null==t?void 0:null===(i=t.locale)||void 0===i?void 0:null===(l=i.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==o?o:eM.firstWeekContainsDate)&&void 0!==r?r:null===(u=eM.locale)||void 0===u?void 0:null===(s=u.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==n?n:1),c=function(e,t){(0,ea.Z)(1,arguments);var n,r,o,a,i,l,u,s,d=(0,eo.Z)(e),c=d.getFullYear(),f=(0,eh.Z)(null!==(n=null!==(r=null!==(o=null!==(a=null==t?void 0:t.firstWeekContainsDate)&&void 0!==a?a:null==t?void 0:null===(i=t.locale)||void 0===i?void 0:null===(l=i.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==o?o:eM.firstWeekContainsDate)&&void 0!==r?r:null===(u=eM.locale)||void 0===u?void 0:null===(s=u.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==n?n:1);if(!(f>=1&&f<=7))throw RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setFullYear(c+1,0,f),m.setHours(0,0,0,0);var v=tt(m,t),h=new Date(0);h.setFullYear(c,0,f),h.setHours(0,0,0,0);var p=tt(h,t);return d.getTime()>=v.getTime()?c+1:d.getTime()>=p.getTime()?c:c-1}(e,t),f=new Date(0);return f.setFullYear(c,0,d),f.setHours(0,0,0,0),tt(f,t)})(n,t).getTime())/6048e5)+1}(t,n),o=e.find(function(e){return e.weekNumber===r});return o?o.dates.push(t):e.push({weekNumber:r,dates:[t]}),e},[])}function nc(e){var t,n,r,o=tM(),a=o.locale,i=o.classNames,l=o.styles,u=o.hideHead,s=o.fixedWeeks,d=o.components,c=o.weekStartsOn,f=o.firstWeekContainsDate,m=o.ISOWeek,v=function(e,t){var n=nd(eu(e),e8(e),t);if(null==t?void 0:t.useFixedWeeks){var r=function(e,t){return(0,ea.Z)(1,arguments),function(e,t,n){(0,ea.Z)(2,arguments);var r=tt(e,n),o=tt(t,n);return Math.round((r.getTime()-eY(r)-(o.getTime()-eY(o)))/6048e5)}(function(e){(0,ea.Z)(1,arguments);var t=(0,eo.Z)(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}(e),eu(e),t)+1}(e,t);if(r<6){var o=n[n.length-1],a=o.dates[o.dates.length-1],i=ti(a,6-r),l=nd(ti(a,1),i,t);n.push.apply(n,l)}}return n}(e.displayMonth,{useFixedWeeks:!!s,ISOWeek:m,locale:a,weekStartsOn:c,firstWeekContainsDate:f}),h=null!==(t=null==d?void 0:d.Head)&&void 0!==t?t:tU,p=null!==(n=null==d?void 0:d.Row)&&void 0!==n?n:ns,g=null!==(r=null==d?void 0:d.Footer)&&void 0!==r?r:tR;return tv.jsxs("table",{id:e.id,className:i.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!u&&tv.jsx(h,{}),tv.jsx("tbody",{className:i.tbody,style:l.tbody,children:v.map(function(t){return tv.jsx(p,{displayMonth:e.displayMonth,dates:t.dates,weekNumber:t.weekNumber},t.weekNumber)})}),tv.jsx(g,{displayMonth:e.displayMonth})]})}var nf="undefined"!=typeof window&&window.document&&window.document.createElement?c.useLayoutEffect:c.useEffect,nm=!1,nv=0;function nh(){return"react-day-picker-".concat(++nv)}function np(e){var t,n,r,o,a,i,l,u,s=tM(),d=s.dir,f=s.classNames,m=s.styles,v=s.components,h=t_().displayMonths,p=(r=null!=(t=s.id?"".concat(s.id,"-").concat(e.displayIndex):void 0)?t:nm?nh():null,a=(o=(0,c.useState)(r))[0],i=o[1],nf(function(){null===a&&i(nh())},[]),(0,c.useEffect)(function(){!1===nm&&(nm=!0)},[]),null!==(n=null!=t?t:a)&&void 0!==n?n:void 0),g=s.id?"".concat(s.id,"-grid-").concat(e.displayIndex):void 0,b=[f.month],y=m.month,w=0===e.displayIndex,x=e.displayIndex===h.length-1,k=!w&&!x;"rtl"===d&&(x=(l=[w,x])[0],w=l[1]),w&&(b.push(f.caption_start),y=td(td({},y),m.caption_start)),x&&(b.push(f.caption_end),y=td(td({},y),m.caption_end)),k&&(b.push(f.caption_between),y=td(td({},y),m.caption_between));var M=null!==(u=null==v?void 0:v.Caption)&&void 0!==u?u:tW;return tv.jsxs("div",{className:b.join(" "),style:y,children:[tv.jsx(M,{id:p,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),tv.jsx(nc,{id:g,"aria-labelledby":p,displayMonth:e.displayMonth})]},e.displayIndex)}function ng(e){var t=tM(),n=t.classNames,r=t.styles;return tv.jsx("div",{className:n.months,style:r.months,children:e.children})}function nb(e){var t,n,r=e.initialProps,o=tM(),a=nn(),i=t_(),l=(0,c.useState)(!1),u=l[0],s=l[1];(0,c.useEffect)(function(){o.initialFocus&&a.focusTarget&&(u||(a.focus(a.focusTarget),s(!0)))},[o.initialFocus,u,a.focus,a.focusTarget,a]);var d=[o.classNames.root,o.className];o.numberOfMonths>1&&d.push(o.classNames.multiple_months),o.showWeekNumber&&d.push(o.classNames.with_weeknumber);var f=td(td({},o.styles.root),o.style),m=Object.keys(r).filter(function(e){return e.startsWith("data-")}).reduce(function(e,t){var n;return td(td({},e),((n={})[t]=r[t],n))},{}),v=null!==(n=null===(t=r.components)||void 0===t?void 0:t.Months)&&void 0!==n?n:ng;return tv.jsx("div",td({className:d.join(" "),style:f,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},m,{children:tv.jsx(v,{children:i.displayMonths.map(function(e,t){return tv.jsx(np,{displayIndex:t,displayMonth:e},t)})})}))}function ny(e){var t=e.children,n=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}(e,["children"]);return tv.jsx(tk,{initialProps:n,children:tv.jsx(tS,{children:tv.jsx(no,{initialProps:n,children:tv.jsx(tz,{initialProps:n,children:tv.jsx(tG,{initialProps:n,children:tv.jsx(t5,{children:tv.jsx(nt,{children:t})})})})})})})}function nw(e){return tv.jsx(ny,td({},e,{children:tv.jsx(nb,{initialProps:e})}))}let nx=e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),c.createElement("path",{d:"M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z"}))},nk=e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),c.createElement("path",{d:"M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"}))},nM=e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),c.createElement("path",{d:"M4.83582 12L11.0429 18.2071L12.4571 16.7929L7.66424 12L12.4571 7.20712L11.0429 5.79291L4.83582 12ZM10.4857 12L16.6928 18.2071L18.107 16.7929L13.3141 12L18.107 7.20712L16.6928 5.79291L10.4857 12Z"}))},nC=e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),c.createElement("path",{d:"M19.1642 12L12.9571 5.79291L11.5429 7.20712L16.3358 12L11.5429 16.7929L12.9571 18.2071L19.1642 12ZM13.5143 12L7.30722 5.79291L5.89301 7.20712L10.6859 12L5.89301 16.7929L7.30722 18.2071L13.5143 12Z"}))};var nD=n(84264);n(41649);var nT=n(1526),nN=n(7084),nP=n(26898);let nE={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-1",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-1.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-lg"},xl:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-xl"}},nS={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"}},n_={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"}},nj={[nN.wu.Increase]:{bgColor:(0,e$.bM)(nN.fr.Emerald,nP.K.background).bgColor,textColor:(0,e$.bM)(nN.fr.Emerald,nP.K.text).textColor},[nN.wu.ModerateIncrease]:{bgColor:(0,e$.bM)(nN.fr.Emerald,nP.K.background).bgColor,textColor:(0,e$.bM)(nN.fr.Emerald,nP.K.text).textColor},[nN.wu.Decrease]:{bgColor:(0,e$.bM)(nN.fr.Rose,nP.K.background).bgColor,textColor:(0,e$.bM)(nN.fr.Rose,nP.K.text).textColor},[nN.wu.ModerateDecrease]:{bgColor:(0,e$.bM)(nN.fr.Rose,nP.K.background).bgColor,textColor:(0,e$.bM)(nN.fr.Rose,nP.K.text).textColor},[nN.wu.Unchanged]:{bgColor:(0,e$.bM)(nN.fr.Orange,nP.K.background).bgColor,textColor:(0,e$.bM)(nN.fr.Orange,nP.K.text).textColor}},nO={[nN.wu.Increase]:e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),c.createElement("path",{d:"M13.0001 7.82843V20H11.0001V7.82843L5.63614 13.1924L4.22192 11.7782L12.0001 4L19.7783 11.7782L18.3641 13.1924L13.0001 7.82843Z"}))},[nN.wu.ModerateIncrease]:e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),c.createElement("path",{d:"M16.0037 9.41421L7.39712 18.0208L5.98291 16.6066L14.5895 8H7.00373V6H18.0037V17H16.0037V9.41421Z"}))},[nN.wu.Decrease]:e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),c.createElement("path",{d:"M13.0001 16.1716L18.3641 10.8076L19.7783 12.2218L12.0001 20L4.22192 12.2218L5.63614 10.8076L11.0001 16.1716V4H13.0001V16.1716Z"}))},[nN.wu.ModerateDecrease]:e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),c.createElement("path",{d:"M14.5895 16.0032L5.98291 7.39664L7.39712 5.98242L16.0037 14.589V7.00324H18.0037V18.0032H7.00373V16.0032H14.5895Z"}))},[nN.wu.Unchanged]:e=>{var t=(0,d._T)(e,[]);return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),c.createElement("path",{d:"M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"}))}},nZ=(0,e$.fn)("BadgeDelta");c.forwardRef((e,t)=>{let{deltaType:n=nN.wu.Increase,isIncreasePositive:r=!0,size:o=nN.u8.SM,tooltip:a,children:i,className:l}=e,u=(0,d._T)(e,["deltaType","isIncreasePositive","size","tooltip","children","className"]),s=nO[n],f=(0,e$.Fo)(n,r),m=i?nS:nE,{tooltipProps:v,getReferenceProps:h}=(0,nT.l)();return c.createElement("span",Object.assign({ref:(0,e$.lq)([t,v.refs.setReference]),className:(0,es.q)(nZ("root"),"w-max flex-shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-full bg-opacity-20 dark:bg-opacity-25",nj[f].bgColor,nj[f].textColor,m[o].paddingX,m[o].paddingY,m[o].fontSize,l)},h,u),c.createElement(nT.Z,Object.assign({text:a},v)),c.createElement(s,{className:(0,es.q)(nZ("icon"),"shrink-0",i?(0,es.q)("-ml-1 mr-1.5"):n_[o].height,n_[o].width)}),i?c.createElement("p",{className:(0,es.q)(nZ("text"),"text-sm whitespace-nowrap")},i):null)}).displayName="BadgeDelta";var nL=n(47323);let nY=e=>{var{onClick:t,icon:n}=e,r=(0,d._T)(e,["onClick","icon"]);return c.createElement("button",Object.assign({type:"button",className:(0,es.q)("flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle select-none dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content")},r),c.createElement(nL.Z,{onClick:t,icon:n,variant:"simple",color:"slate",size:"sm"}))};function nF(e){var{mode:t,defaultMonth:n,selected:r,onSelect:o,locale:a,disabled:i,enableYearNavigation:l,classNames:u,weekStartsOn:s=0}=e,f=(0,d._T)(e,["mode","defaultMonth","selected","onSelect","locale","disabled","enableYearNavigation","classNames","weekStartsOn"]);return c.createElement(nw,Object.assign({showOutsideDays:!0,mode:t,defaultMonth:n,selected:r,onSelect:o,locale:a,disabled:i,weekStartsOn:s,classNames:Object.assign({months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-2 relative items-center",caption_label:"text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium",nav:"space-x-1 flex items-center",nav_button:"flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content",nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"w-9 font-normal text-center text-tremor-content-subtle dark:text-dark-tremor-content-subtle",row:"flex w-full mt-0.5",cell:"text-center p-0 relative focus-within:relative text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",day:"h-9 w-9 p-0 hover:bg-tremor-background-subtle dark:hover:bg-dark-tremor-background-subtle outline-tremor-brand dark:outline-dark-tremor-brand rounded-tremor-default",day_today:"font-bold",day_selected:"aria-selected:bg-tremor-background-emphasis aria-selected:text-tremor-content-inverted dark:aria-selected:bg-dark-tremor-background-emphasis dark:aria-selected:text-dark-tremor-content-inverted ",day_disabled:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle disabled:hover:bg-transparent",day_outside:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle"},u),components:{IconLeft:e=>{var t=(0,d._T)(e,[]);return c.createElement(nx,Object.assign({className:"h-4 w-4"},t))},IconRight:e=>{var t=(0,d._T)(e,[]);return c.createElement(nk,Object.assign({className:"h-4 w-4"},t))},Caption:e=>{var t=(0,d._T)(e,[]);let{goToMonth:n,nextMonth:r,previousMonth:o,currentMonth:i}=t_();return c.createElement("div",{className:"flex justify-between items-center"},c.createElement("div",{className:"flex items-center space-x-1"},l&&c.createElement(nY,{onClick:()=>i&&n(tl(i,-1)),icon:nM}),c.createElement(nY,{onClick:()=>o&&n(o),icon:nx})),c.createElement(nD.Z,{className:"text-tremor-default tabular-nums capitalize text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium"},eJ(t.displayMonth,"LLLL yyy",{locale:a})),c.createElement("div",{className:"flex items-center space-x-1"},c.createElement(nY,{onClick:()=>r&&n(r),icon:nk}),l&&c.createElement(nY,{onClick:()=>i&&n(tl(i,1)),icon:nC})))}}},f))}nF.displayName="DateRangePicker",n(27281);var nW=n(43227),nR=n(44140);let nI=el(),nU=c.forwardRef((e,t)=>{var n,r;let{value:o,defaultValue:a,onValueChange:i,enableSelect:l=!0,minDate:u,maxDate:s,placeholder:f="Select range",selectPlaceholder:m="Select range",disabled:v=!1,locale:h=eq,enableClear:p=!0,displayFormat:g,children:b,className:y,enableYearNavigation:w=!1,weekStartsOn:x=0,disabledDates:k}=e,M=(0,d._T)(e,["value","defaultValue","onValueChange","enableSelect","minDate","maxDate","placeholder","selectPlaceholder","disabled","locale","enableClear","displayFormat","children","className","enableYearNavigation","weekStartsOn","disabledDates"]),[C,D]=(0,nR.Z)(a,o),[T,N]=(0,c.useState)(!1),[P,E]=(0,c.useState)(!1),S=(0,c.useMemo)(()=>{let e=[];return u&&e.push({before:u}),s&&e.push({after:s}),[...e,...null!=k?k:[]]},[u,s,k]),_=(0,c.useMemo)(()=>{let e=new Map;return b?c.Children.forEach(b,t=>{var n;e.set(t.props.value,{text:null!==(n=(0,ed.qg)(t))&&void 0!==n?n:t.props.value,from:t.props.from,to:t.props.to})}):e4.forEach(t=>{e.set(t.value,{text:t.text,from:t.from,to:nI})}),e},[b]),j=(0,c.useMemo)(()=>{if(b)return(0,ed.sl)(b);let e=new Map;return e4.forEach(t=>e.set(t.value,t.text)),e},[b]),O=(null==C?void 0:C.selectValue)||"",Z=e1(null==C?void 0:C.from,u,O,_),L=e2(null==C?void 0:C.to,s,O,_),Y=Z||L?e3(Z,L,h,g):f,F=eu(null!==(r=null!==(n=null!=L?L:Z)&&void 0!==n?n:s)&&void 0!==r?r:nI),W=p&&!v;return c.createElement("div",Object.assign({ref:t,className:(0,es.q)("w-full min-w-[10rem] relative flex justify-between text-tremor-default max-w-sm shadow-tremor-input dark:shadow-dark-tremor-input rounded-tremor-default",y)},M),c.createElement($,{as:"div",className:(0,es.q)("w-full",l?"rounded-l-tremor-default":"rounded-tremor-default",T&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10")},c.createElement("div",{className:"relative w-full"},c.createElement($.Button,{onFocus:()=>N(!0),onBlur:()=>N(!1),disabled:v,className:(0,es.q)("w-full outline-none text-left whitespace-nowrap truncate focus:ring-2 transition duration-100 rounded-l-tremor-default flex flex-nowrap border pl-3 py-2","rounded-l-tremor-default border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",l?"rounded-l-tremor-default":"rounded-tremor-default",W?"pr-8":"pr-4",(0,ed.um)((0,ed.Uh)(Z||L),v))},c.createElement(en,{className:(0,es.q)(e0("calendarIcon"),"flex-none shrink-0 h-5 w-5 -ml-0.5 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle"),"aria-hidden":"true"}),c.createElement("p",{className:"truncate"},Y)),W&&Z?c.createElement("button",{type:"button",className:(0,es.q)("absolute outline-none inset-y-0 right-0 flex items-center transition duration-100 mr-4"),onClick:e=>{e.preventDefault(),null==i||i({}),D({})}},c.createElement(er.Z,{className:(0,es.q)(e0("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null),c.createElement(ee.u,{className:"absolute z-10 min-w-min left-0",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"},c.createElement($.Panel,{focus:!0,className:(0,es.q)("divide-y overflow-y-auto outline-none rounded-tremor-default p-3 border my-1","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")},c.createElement(nF,Object.assign({mode:"range",showOutsideDays:!0,defaultMonth:F,selected:{from:Z,to:L},onSelect:e=>{null==i||i({from:null==e?void 0:e.from,to:null==e?void 0:e.to}),D({from:null==e?void 0:e.from,to:null==e?void 0:e.to})},locale:h,disabled:S,enableYearNavigation:w,classNames:{day_range_middle:(0,es.q)("!rounded-none aria-selected:!bg-tremor-background-subtle aria-selected:dark:!bg-dark-tremor-background-subtle aria-selected:!text-tremor-content aria-selected:dark:!bg-dark-tremor-background-subtle"),day_range_start:"rounded-r-none rounded-l-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted",day_range_end:"rounded-l-none rounded-r-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted"},weekStartsOn:x},e))))),l&&c.createElement(et.R,{as:"div",className:(0,es.q)("w-48 -ml-px rounded-r-tremor-default",P&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10"),value:O,onChange:e=>{let{from:t,to:n}=_.get(e),r=null!=n?n:nI;null==i||i({from:t,to:r,selectValue:e}),D({from:t,to:r,selectValue:e})},disabled:v},e=>{var t;let{value:n}=e;return c.createElement(c.Fragment,null,c.createElement(et.R.Button,{onFocus:()=>E(!0),onBlur:()=>E(!1),className:(0,es.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-r-tremor-default transition duration-100 border px-4 py-2","border-tremor-border shadow-tremor-input text-tremor-content-emphasis focus:border-tremor-brand-subtle","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle",(0,ed.um)((0,ed.Uh)(n),v))},n&&null!==(t=j.get(n))&&void 0!==t?t:m),c.createElement(ee.u,{className:"absolute z-10 w-full inset-x-0 right-0",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"},c.createElement(et.R.Options,{className:(0,es.q)("divide-y overflow-y-auto outline-none border my-1","shadow-tremor-dropdown bg-tremor-background border-tremor-border divide-tremor-border rounded-tremor-default","dark:shadow-dark-tremor-dropdown dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border")},null!=b?b:e4.map(e=>c.createElement(nW.Z,{key:e.value,value:e.value},e.text)))))}))});nU.displayName="DateRangePicker"},40048:function(e,t,n){n.d(t,{i:function(){return a}});var r=n(2265),o=n(40293);function a(){for(var e=arguments.length,t=Array(e),n=0;n(0,o.r)(...t),[...t])}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1491-8280340b5391aa11.js b/litellm/proxy/_experimental/out/_next/static/chunks/1491-8280340b5391aa11.js new file mode 100644 index 00000000000..f2f6a5f9bde --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1491-8280340b5391aa11.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1491],{31373:function(e,t,n){"use strict";n.d(t,{iN:function(){return h},R_:function(){return d},EV:function(){return g},ez:function(){return f}});var r=n(82082),o=n(96021),a=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function i(e){var t=e.r,n=e.g,o=e.b,a=(0,r.py)(t,n,o);return{h:360*a.h,s:a.s,v:a.v}}function c(e){var t=e.r,n=e.g,o=e.b;return"#".concat((0,r.vq)(t,n,o,!1))}function l(e,t,n){var r;return(r=Math.round(e.h)>=60&&240>=Math.round(e.h)?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function s(e,t,n){var r;return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2)))}function u(e,t,n){var r;return(r=n?e.v+.05*t:e.v-.15*t)>1&&(r=1),Number(r.toFixed(2))}function d(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=(0,o.uA)(e),d=5;d>0;d-=1){var f=i(r),p=c((0,o.uA)({h:l(f,d,!0),s:s(f,d,!0),v:u(f,d,!0)}));n.push(p)}n.push(c(r));for(var m=1;m<=4;m+=1){var g=i(r),h=c((0,o.uA)({h:l(g,m),s:s(g,m),v:u(g,m)}));n.push(h)}return"dark"===t.theme?a.map(function(e){var r,a,i,l=e.index,s=e.opacity;return c((r=(0,o.uA)(t.backgroundColor||"#141414"),a=(0,o.uA)(n[l]),i=100*s/100,{r:(a.r-r.r)*i+r.r,g:(a.g-r.g)*i+r.g,b:(a.b-r.b)*i+r.b}))}):n}var f={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},p={},m={};Object.keys(f).forEach(function(e){p[e]=d(f[e]),p[e].primary=p[e][5],m[e]=d(f[e],{theme:"dark",backgroundColor:"#141414"}),m[e].primary=m[e][5]}),p.red,p.volcano;var g=p.gold;p.orange,p.yellow,p.lime,p.green,p.cyan;var h=p.blue;p.geekblue,p.purple,p.magenta,p.grey,p.grey},352:function(e,t,n){"use strict";n.d(t,{E4:function(){return eL},jG:function(){return M},ks:function(){return H},bf:function(){return z},CI:function(){return eA},fp:function(){return Y},xy:function(){return eF}});var r,o,a=n(11993),i=n(26365),c=n(83145),l=n(31686),s=function(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))*1540483477+((t>>>16)*59797<<16),t^=t>>>24,n=(65535&t)*1540483477+((t>>>16)*59797<<16)^(65535&n)*1540483477+((n>>>16)*59797<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n^=255&e.charCodeAt(r),n=(65535&n)*1540483477+((n>>>16)*59797<<16)}return n^=n>>>13,(((n=(65535&n)*1540483477+((n>>>16)*59797<<16))^n>>>15)>>>0).toString(36)},u=n(21717),d=n(2265),f=n.t(d,2);n(6397),n(16671);var p=n(76405),m=n(25049);function g(e){return e.join("%")}var h=function(){function e(t){(0,p.Z)(this,e),(0,a.Z)(this,"instanceId",void 0),(0,a.Z)(this,"cache",new Map),this.instanceId=t}return(0,m.Z)(e,[{key:"get",value:function(e){return this.opGet(g(e))}},{key:"opGet",value:function(e){return this.cache.get(e)||null}},{key:"update",value:function(e,t){return this.opUpdate(g(e),t)}},{key:"opUpdate",value:function(e,t){var n=t(this.cache.get(e));null===n?this.cache.delete(e):this.cache.set(e,n)}}]),e}(),v="data-token-hash",b="data-css-hash",y="__cssinjs_instance__",w=d.createContext({hashPriority:"low",cache:function(){var e=Math.random().toString(12).slice(2);if("undefined"!=typeof document&&document.head&&document.body){var t=document.body.querySelectorAll("style[".concat(b,"]"))||[],n=document.head.firstChild;Array.from(t).forEach(function(t){t[y]=t[y]||e,t[y]===e&&document.head.insertBefore(t,n)});var r={};Array.from(document.querySelectorAll("style[".concat(b,"]"))).forEach(function(t){var n,o=t.getAttribute(b);r[o]?t[y]===e&&(null===(n=t.parentNode)||void 0===n||n.removeChild(t)):r[o]=!0})}return new h(e)}(),defaultCache:!0}),x=n(41154),E=n(94981),S=function(){function e(){(0,p.Z)(this,e),(0,a.Z)(this,"cache",void 0),(0,a.Z)(this,"keys",void 0),(0,a.Z)(this,"cacheCallTimes",void 0),this.cache=new Map,this.keys=[],this.cacheCallTimes=0}return(0,m.Z)(e,[{key:"size",value:function(){return this.keys.length}},{key:"internalGet",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o={map:this.cache};return e.forEach(function(e){if(o){var t;o=null===(t=o)||void 0===t||null===(t=t.map)||void 0===t?void 0:t.get(e)}else o=void 0}),null!==(t=o)&&void 0!==t&&t.value&&r&&(o.value[1]=this.cacheCallTimes++),null===(n=o)||void 0===n?void 0:n.value}},{key:"get",value:function(e){var t;return null===(t=this.internalGet(e,!0))||void 0===t?void 0:t[0]}},{key:"has",value:function(e){return!!this.internalGet(e)}},{key:"set",value:function(t,n){var r=this;if(!this.has(t)){if(this.size()+1>e.MAX_CACHE_SIZE+e.MAX_CACHE_OFFSET){var o=this.keys.reduce(function(e,t){var n=(0,i.Z)(e,2)[1];return r.internalGet(t)[1]0,"[Ant Design CSS-in-JS] Theme should have at least one derivative function."),Z+=1}return(0,m.Z)(e,[{key:"getDerivativeToken",value:function(e){return this.derivatives.reduce(function(t,n){return n(e,t)},void 0)}}]),e}(),k=new S;function M(e){var t=Array.isArray(e)?e:[e];return k.has(t)||k.set(t,new O(t)),k.get(t)}var j=new WeakMap,I={},R=new WeakMap;function N(e){var t=R.get(e)||"";return t||(Object.keys(e).forEach(function(n){var r=e[n];t+=n,r instanceof O?t+=r.id:r&&"object"===(0,x.Z)(r)?t+=N(r):t+=r}),R.set(e,t)),t}function P(e,t){return s("".concat(t,"_").concat(N(e)))}var F="random-".concat(Date.now(),"-").concat(Math.random()).replace(/\./g,""),T="_bAmBoO_",A=void 0,L=(0,E.Z)();function z(e){return"number"==typeof e?"".concat(e,"px"):e}function _(e,t,n){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i)return e;var c=(0,l.Z)((0,l.Z)({},o),{},(r={},(0,a.Z)(r,v,t),(0,a.Z)(r,b,n),r)),s=Object.keys(c).map(function(e){var t=c[e];return t?"".concat(e,'="').concat(t,'"'):null}).filter(function(e){return e}).join(" ");return"")}var H=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"--".concat(t?"".concat(t,"-"):"").concat(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g,"$1-$2").replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase()},B=function(e,t,n){var r,o={},a={};return Object.entries(e).forEach(function(e){var t=(0,i.Z)(e,2),r=t[0],c=t[1];if(null!=n&&null!==(l=n.preserve)&&void 0!==l&&l[r])a[r]=c;else if(("string"==typeof c||"number"==typeof c)&&!(null!=n&&null!==(s=n.ignore)&&void 0!==s&&s[r])){var l,s,u,d=H(r,null==n?void 0:n.prefix);o[d]="number"!=typeof c||null!=n&&null!==(u=n.unitless)&&void 0!==u&&u[r]?String(c):"".concat(c,"px"),a[r]="var(".concat(d,")")}}),[a,(r={scope:null==n?void 0:n.scope},Object.keys(o).length?".".concat(t).concat(null!=r&&r.scope?".".concat(r.scope):"","{").concat(Object.entries(o).map(function(e){var t=(0,i.Z)(e,2),n=t[0],r=t[1];return"".concat(n,":").concat(r,";")}).join(""),"}"):"")]},D=n(27380),W=(0,l.Z)({},f).useInsertionEffect,V=W?function(e,t,n){return W(function(){return e(),t()},n)}:function(e,t,n){d.useMemo(e,n),(0,D.Z)(function(){return t(!0)},n)},q=void 0!==(0,l.Z)({},f).useInsertionEffect?function(e){var t=[],n=!1;return d.useEffect(function(){return n=!1,function(){n=!0,t.length&&t.forEach(function(e){return e()})}},e),function(e){n||t.push(e)}}:function(){return function(e){e()}};function G(e,t,n,r,o){var a=d.useContext(w).cache,l=g([e].concat((0,c.Z)(t))),s=q([l]),u=function(e){a.opUpdate(l,function(t){var r=(0,i.Z)(t||[void 0,void 0],2),o=r[0],a=[void 0===o?0:o,r[1]||n()];return e?e(a):a})};d.useMemo(function(){u()},[l]);var f=a.opGet(l)[1];return V(function(){null==o||o(f)},function(e){return u(function(t){var n=(0,i.Z)(t,2),r=n[0],a=n[1];return e&&0===r&&(null==o||o(f)),[r+1,a]}),function(){a.opUpdate(l,function(t){var n=(0,i.Z)(t||[],2),o=n[0],c=void 0===o?0:o,u=n[1];return 0==c-1?(s(function(){(e||!a.opGet(l))&&(null==r||r(u,!1))}),null):[c-1,u]})}},[l]),f}var X={},U=new Map,$=function(e,t,n,r){var o=n.getDerivativeToken(e),a=(0,l.Z)((0,l.Z)({},o),t);return r&&(a=r(a)),a},K="token";function Y(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(0,d.useContext)(w),o=r.cache.instanceId,a=r.container,f=n.salt,p=void 0===f?"":f,m=n.override,g=void 0===m?X:m,h=n.formatToken,x=n.getComputedToken,E=n.cssVar,S=function(e,t){for(var n=j,r=0;r=(U.get(e)||0)}),n.length-r.length>0&&r.forEach(function(e){"undefined"!=typeof document&&document.querySelectorAll("style[".concat(v,'="').concat(e,'"]')).forEach(function(e){if(e[y]===o){var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)}}),U.delete(e)})},function(e){var t=(0,i.Z)(e,4),n=t[0],r=t[3];if(E&&r){var c=(0,u.hq)(r,s("css-variables-".concat(n._themeKey)),{mark:b,prepend:"queue",attachTo:a,priority:-999});c[y]=o,c.setAttribute(v,n._themeKey)}})}var Q=n(1119),J={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ee="comm",et="rule",en="decl",er=Math.abs,eo=String.fromCharCode;function ea(e,t,n){return e.replace(t,n)}function ei(e,t){return 0|e.charCodeAt(t)}function ec(e,t,n){return e.slice(t,n)}function el(e){return e.length}function es(e,t){return t.push(e),e}function eu(e,t){for(var n="",r=0;r0?p[b]+" "+y:ea(y,/&\f/g,p[b])).trim())&&(l[v++]=w);return eb(e,t,n,0===o?et:c,l,s,u,d)}function eC(e,t,n,r,o){return eb(e,t,n,en,ec(e,0,r),ec(e,r+1,-1),r,o)}var eZ="data-ant-cssinjs-cache-path",eO="_FILE_STYLE__",ek=!0,eM="_multi_value_";function ej(e){var t,n,r;return eu((r=function e(t,n,r,o,a,i,c,l,s){for(var u,d,f,p=0,m=0,g=c,h=0,v=0,b=0,y=1,w=1,x=1,E=0,S="",C=a,Z=i,O=o,k=S;w;)switch(b=E,E=ey()){case 40:if(108!=b&&58==ei(k,g-1)){-1!=(d=k+=ea(eE(E),"&","&\f"),f=er(p?l[p-1]:0),d.indexOf("&\f",f))&&(x=-1);break}case 34:case 39:case 91:k+=eE(E);break;case 9:case 10:case 13:case 32:k+=function(e){for(;eh=ew();)if(eh<33)ey();else break;return ex(e)>2||ex(eh)>3?"":" "}(b);break;case 92:k+=function(e,t){for(var n;--t&&ey()&&!(eh<48)&&!(eh>102)&&(!(eh>57)||!(eh<65))&&(!(eh>70)||!(eh<97)););return n=eg+(t<6&&32==ew()&&32==ey()),ec(ev,e,n)}(eg-1,7);continue;case 47:switch(ew()){case 42:case 47:es(eb(u=function(e,t){for(;ey();)if(e+eh===57)break;else if(e+eh===84&&47===ew())break;return"/*"+ec(ev,t,eg-1)+"*"+eo(47===e?e:ey())}(ey(),eg),n,r,ee,eo(eh),ec(u,2,-2),0,s),s),(5==ex(b||1)||5==ex(ew()||1))&&el(k)&&" "!==ec(k,-1,void 0)&&(k+=" ");break;default:k+="/"}break;case 123*y:l[p++]=el(k)*x;case 125*y:case 59:case 0:switch(E){case 0:case 125:w=0;case 59+m:-1==x&&(k=ea(k,/\f/g,"")),v>0&&(el(k)-g||0===y&&47===b)&&es(v>32?eC(k+";",o,r,g-1,s):eC(ea(k," ","")+";",o,r,g-2,s),s);break;case 59:k+=";";default:if(es(O=eS(k,n,r,p,m,a,l,S,C=[],Z=[],g,i),i),123===E){if(0===m)e(k,n,O,O,C,i,g,l,Z);else{switch(h){case 99:if(110===ei(k,3))break;case 108:if(97===ei(k,2))break;default:m=0;case 100:case 109:case 115:}m?e(t,O,O,o&&es(eS(t,O,O,0,0,a,l,S,a,C=[],g,Z),Z),a,Z,g,l,o?C:Z):e(k,O,O,O,[""],Z,0,l,Z)}}}p=m=v=0,y=x=1,S=k="",g=c;break;case 58:g=1+el(k),v=b;default:if(y<1){if(123==E)--y;else if(125==E&&0==y++&&125==(eh=eg>0?ei(ev,--eg):0,ep--,10===eh&&(ep=1,ef--),eh))continue}switch(k+=eo(E),E*y){case 38:x=m>0?1:(k+="\f",-1);break;case 44:l[p++]=(el(k)-1)*x,x=1;break;case 64:45===ew()&&(k+=eE(ey())),h=ew(),m=g=el(S=k+=function(e){for(;!ex(ew());)ey();return ec(ev,e,eg)}(eg)),E++;break;case 45:45===b&&2==el(k)&&(y=0)}}return i}("",null,null,null,[""],(n=t=e,ef=ep=1,em=el(ev=n),eg=0,t=[]),0,[0],t),ev="",r),ed).replace(/\{%%%\:[^;];}/g,";")}var eI=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{root:!0,parentSelectors:[]},o=r.root,a=r.injectHash,s=r.parentSelectors,d=n.hashId,f=n.layer,p=(n.path,n.hashPriority),m=n.transformers,g=void 0===m?[]:m;n.linters;var h="",v={};function b(t){var r=t.getName(d);if(!v[r]){var o=e(t.style,n,{root:!1,parentSelectors:s}),a=(0,i.Z)(o,1)[0];v[r]="@keyframes ".concat(t.getName(d)).concat(a)}}if((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t.forEach(function(t){Array.isArray(t)?e(t,n):t&&n.push(t)}),n})(Array.isArray(t)?t:[t]).forEach(function(t){var r="string"!=typeof t||o?t:{};if("string"==typeof r)h+="".concat(r,"\n");else if(r._keyframe)b(r);else{var u=g.reduce(function(e,t){var n;return(null==t||null===(n=t.visit)||void 0===n?void 0:n.call(t,e))||e},r);Object.keys(u).forEach(function(t){var r=u[t];if("object"!==(0,x.Z)(r)||!r||"animationName"===t&&r._keyframe||"object"===(0,x.Z)(r)&&r&&("_skip_check_"in r||eM in r)){function f(e,t){var n=e.replace(/[A-Z]/g,function(e){return"-".concat(e.toLowerCase())}),r=t;J[e]||"number"!=typeof r||0===r||(r="".concat(r,"px")),"animationName"===e&&null!=t&&t._keyframe&&(b(t),r=t.getName(d)),h+="".concat(n,":").concat(r,";")}var m,g=null!==(m=null==r?void 0:r.value)&&void 0!==m?m:r;"object"===(0,x.Z)(r)&&null!=r&&r[eM]&&Array.isArray(g)?g.forEach(function(e){f(t,e)}):f(t,g)}else{var y=!1,w=t.trim(),E=!1;(o||a)&&d?w.startsWith("@")?y=!0:w=function(e,t,n){if(!t)return e;var r=".".concat(t),o="low"===n?":where(".concat(r,")"):r;return e.split(",").map(function(e){var t,n=e.trim().split(/\s+/),r=n[0]||"",a=(null===(t=r.match(/^\w+/))||void 0===t?void 0:t[0])||"";return[r="".concat(a).concat(o).concat(r.slice(a.length))].concat((0,c.Z)(n.slice(1))).join(" ")}).join(",")}(t,d,p):o&&!d&&("&"===w||""===w)&&(w="",E=!0);var S=e(r,n,{root:E,injectHash:y,parentSelectors:[].concat((0,c.Z)(s),[w])}),C=(0,i.Z)(S,2),Z=C[0],O=C[1];v=(0,l.Z)((0,l.Z)({},v),O),h+="".concat(w).concat(Z)}})}}),o){if(f&&(void 0===A&&(A=function(e,t,n){if((0,E.Z)()){(0,u.hq)(e,F);var r,o,a=document.createElement("div");a.style.position="fixed",a.style.left="0",a.style.top="0",null==t||t(a),document.body.appendChild(a);var i=null===(r=getComputedStyle(a).content)||void 0===r?void 0:r.includes(T);return null===(o=a.parentNode)||void 0===o||o.removeChild(a),(0,u.jL)(F),i}return!1}("@layer ".concat(F," { .").concat(F,' { content: "').concat(T,'"!important; } }'),function(e){e.className=F})),A)){var y=f.split(","),w=y[y.length-1].trim();h="@layer ".concat(w," {").concat(h,"}"),y.length>1&&(h="@layer ".concat(f,"{%%%:%}").concat(h))}}else h="{".concat(h,"}");return[h,v]};function eR(e,t){return s("".concat(e.join("%")).concat(t))}function eN(){return null}var eP="style";function eF(e,t){var n=e.token,o=e.path,l=e.hashId,s=e.layer,f=e.nonce,p=e.clientOnly,m=e.order,g=void 0===m?0:m,h=d.useContext(w),x=h.autoClear,S=(h.mock,h.defaultCache),C=h.hashPriority,Z=h.container,O=h.ssrInline,k=h.transformers,M=h.linters,j=h.cache,I=n._tokenKey,R=[I].concat((0,c.Z)(o)),N=G(eP,R,function(){var e=R.join("|");if(!function(){if(!r&&(r={},(0,E.Z)())){var e,t=document.createElement("div");t.className=eZ,t.style.position="fixed",t.style.visibility="hidden",t.style.top="-9999px",document.body.appendChild(t);var n=getComputedStyle(t).content||"";(n=n.replace(/^"/,"").replace(/"$/,"")).split(";").forEach(function(e){var t=e.split(":"),n=(0,i.Z)(t,2),o=n[0],a=n[1];r[o]=a});var o=document.querySelector("style[".concat(eZ,"]"));o&&(ek=!1,null===(e=o.parentNode)||void 0===e||e.removeChild(o)),document.body.removeChild(t)}}(),r[e]){var n=function(e){var t=r[e],n=null;if(t&&(0,E.Z)()){if(ek)n=eO;else{var o=document.querySelector("style[".concat(b,'="').concat(r[e],'"]'));o?n=o.innerHTML:delete r[e]}}return[n,t]}(e),a=(0,i.Z)(n,2),c=a[0],u=a[1];if(c)return[c,I,u,{},p,g]}var d=eI(t(),{hashId:l,hashPriority:C,layer:s,path:o.join("-"),transformers:k,linters:M}),f=(0,i.Z)(d,2),m=f[0],h=f[1],v=ej(m),y=eR(R,v);return[v,I,y,h,p,g]},function(e,t){var n=(0,i.Z)(e,3)[2];(t||x)&&L&&(0,u.jL)(n,{mark:b})},function(e){var t=(0,i.Z)(e,4),n=t[0],r=(t[1],t[2]),o=t[3];if(L&&n!==eO){var a={mark:b,prepend:"queue",attachTo:Z,priority:g},c="function"==typeof f?f():f;c&&(a.csp={nonce:c});var l=(0,u.hq)(n,r,a);l[y]=j.instanceId,l.setAttribute(v,I),Object.keys(o).forEach(function(e){(0,u.hq)(ej(o[e]),"_effect-".concat(e),a)})}}),P=(0,i.Z)(N,3),F=P[0],T=P[1],A=P[2];return function(e){var t,n;return t=O&&!L&&S?d.createElement("style",(0,Q.Z)({},(n={},(0,a.Z)(n,v,T),(0,a.Z)(n,b,A),n),{dangerouslySetInnerHTML:{__html:F}})):d.createElement(eN,null),d.createElement(d.Fragment,null,t,e)}}var eT="cssVar",eA=function(e,t){var n=e.key,r=e.prefix,o=e.unitless,a=e.ignore,l=e.token,s=e.scope,f=void 0===s?"":s,p=(0,d.useContext)(w),m=p.cache.instanceId,g=p.container,h=l._tokenKey,x=[].concat((0,c.Z)(e.path),[n,f,h]);return G(eT,x,function(){var e=B(t(),n,{prefix:r,unitless:o,ignore:a,scope:f}),c=(0,i.Z)(e,2),l=c[0],s=c[1],u=eR(x,s);return[l,s,u,n]},function(e){var t=(0,i.Z)(e,3)[2];L&&(0,u.jL)(t,{mark:b})},function(e){var t=(0,i.Z)(e,3),r=t[1],o=t[2];if(r){var a=(0,u.hq)(r,o,{mark:b,prepend:"queue",attachTo:g,priority:-999});a[y]=m,a.setAttribute(v,n)}})};o={},(0,a.Z)(o,eP,function(e,t,n){var r=(0,i.Z)(e,6),o=r[0],a=r[1],c=r[2],l=r[3],s=r[4],u=r[5],d=(n||{}).plain;if(s)return null;var f=o,p={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)};return f=_(o,a,c,p,d),l&&Object.keys(l).forEach(function(e){if(!t[e]){t[e]=!0;var n=ej(l[e]);f+=_(n,a,"_effect-".concat(e),p,d)}}),[u,c,f]}),(0,a.Z)(o,K,function(e,t,n){var r=(0,i.Z)(e,5),o=r[2],a=r[3],c=r[4],l=(n||{}).plain;if(!a)return null;var s=o._tokenKey,u=_(a,c,s,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},l);return[-999,s,u]}),(0,a.Z)(o,eT,function(e,t,n){var r=(0,i.Z)(e,4),o=r[1],a=r[2],c=r[3],l=(n||{}).plain;if(!o)return null;var s=_(o,c,a,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},l);return[-999,a,s]});var eL=function(){function e(t,n){(0,p.Z)(this,e),(0,a.Z)(this,"name",void 0),(0,a.Z)(this,"style",void 0),(0,a.Z)(this,"_keyframe",!0),this.name=t,this.style=n}return(0,m.Z)(e,[{key:"getName",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?"".concat(e,"-").concat(this.name):this.name}}]),e}();function ez(e){return e.notSplit=!0,e}ez(["borderTop","borderBottom"]),ez(["borderTop"]),ez(["borderBottom"]),ez(["borderLeft","borderRight"]),ez(["borderLeft"]),ez(["borderRight"])},55015:function(e,t,n){"use strict";n.d(t,{Z:function(){return M}});var r=n(1119),o=n(26365),a=n(11993),i=n(6989),c=n(2265),l=n(36760),s=n.n(l),u=n(31373),d=n(20902),f=n(31686),p=n(41154),m=n(21717),g=n(13211),h=n(32559);function v(e){return"object"===(0,p.Z)(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===(0,p.Z)(e.icon)||"function"==typeof e.icon)}function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r=e[n];return"class"===n?(t.className=r,delete t.class):(delete t[n],t[n.replace(/-(.)/g,function(e,t){return t.toUpperCase()})]=r),t},{})}function y(e){return(0,u.R_)(e)[0]}function w(e){return e?Array.isArray(e)?e:[e]:[]}var x=function(e){var t=(0,c.useContext)(d.Z),n=t.csp,r=t.prefixCls,o="\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";r&&(o=o.replace(/anticon/g,r)),(0,c.useEffect)(function(){var t=e.current,r=(0,g.A)(t);(0,m.hq)(o,"@ant-design-icons",{prepend:!0,csp:n,attachTo:r})},[])},E=["icon","className","onClick","style","primaryColor","secondaryColor"],S={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1},C=function(e){var t,n,r=e.icon,o=e.className,a=e.onClick,l=e.style,s=e.primaryColor,u=e.secondaryColor,d=(0,i.Z)(e,E),p=c.useRef(),m=S;if(s&&(m={primaryColor:s,secondaryColor:u||y(s)}),x(p),t=v(r),n="icon should be icon definiton, but got ".concat(r),(0,h.ZP)(t,"[@ant-design/icons] ".concat(n)),!v(r))return null;var g=r;return g&&"function"==typeof g.icon&&(g=(0,f.Z)((0,f.Z)({},g),{},{icon:g.icon(m.primaryColor,m.secondaryColor)})),function e(t,n,r){return r?c.createElement(t.tag,(0,f.Z)((0,f.Z)({key:n},b(t.attrs)),r),(t.children||[]).map(function(r,o){return e(r,"".concat(n,"-").concat(t.tag,"-").concat(o))})):c.createElement(t.tag,(0,f.Z)({key:n},b(t.attrs)),(t.children||[]).map(function(r,o){return e(r,"".concat(n,"-").concat(t.tag,"-").concat(o))}))}(g.icon,"svg-".concat(g.name),(0,f.Z)((0,f.Z)({className:o,onClick:a,style:l,"data-icon":g.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},d),{},{ref:p}))};function Z(e){var t=w(e),n=(0,o.Z)(t,2),r=n[0],a=n[1];return C.setTwoToneColors({primaryColor:r,secondaryColor:a})}C.displayName="IconReact",C.getTwoToneColors=function(){return(0,f.Z)({},S)},C.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;S.primaryColor=t,S.secondaryColor=n||y(t),S.calculated=!!n};var O=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];Z(u.iN.primary);var k=c.forwardRef(function(e,t){var n,l=e.className,u=e.icon,f=e.spin,p=e.rotate,m=e.tabIndex,g=e.onClick,h=e.twoToneColor,v=(0,i.Z)(e,O),b=c.useContext(d.Z),y=b.prefixCls,x=void 0===y?"anticon":y,E=b.rootClassName,S=s()(E,x,(n={},(0,a.Z)(n,"".concat(x,"-").concat(u.name),!!u.name),(0,a.Z)(n,"".concat(x,"-spin"),!!f||"loading"===u.name),n),l),Z=m;void 0===Z&&g&&(Z=-1);var k=w(h),M=(0,o.Z)(k,2),j=M[0],I=M[1];return c.createElement("span",(0,r.Z)({role:"img","aria-label":u.name},v,{ref:t,tabIndex:Z,onClick:g,className:S}),c.createElement(C,{icon:u,primaryColor:j,secondaryColor:I,style:p?{msTransform:"rotate(".concat(p,"deg)"),transform:"rotate(".concat(p,"deg)")}:void 0}))});k.displayName="AntdIcon",k.getTwoToneColor=function(){var e=C.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},k.setTwoToneColor=Z;var M=k},20902:function(e,t,n){"use strict";var r=(0,n(2265).createContext)({});t.Z=r},8900:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(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 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"}}]},name:"check-circle",theme:"filled"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},9738:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},39725:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"}}]},name:"close-circle",theme:"filled"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},49638:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},70464:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},54537:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(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 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"exclamation-circle",theme:"filled"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},97416:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}},{tag:"path",attrs:{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"}}]},name:"eye-invisible",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},6520:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},55726:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(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 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"info-circle",theme:"filled"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},15424:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(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:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},61935:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},67187:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(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:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},29436:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},i=n(55015),c=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:a}))})},82082:function(e,t,n){"use strict";n.d(t,{T6:function(){return f},VD:function(){return p},WE:function(){return s},Yt:function(){return m},lC:function(){return a},py:function(){return l},rW:function(){return o},s:function(){return d},ve:function(){return c},vq:function(){return u}});var r=n(58317);function o(e,t,n){return{r:255*(0,r.sh)(e,255),g:255*(0,r.sh)(t,255),b:255*(0,r.sh)(n,255)}}function a(e,t,n){var o=Math.max(e=(0,r.sh)(e,255),t=(0,r.sh)(t,255),n=(0,r.sh)(n,255)),a=Math.min(e,t,n),i=0,c=0,l=(o+a)/2;if(o===a)c=0,i=0;else{var s=o-a;switch(c=l>.5?s/(2-o-a):s/(o+a),o){case e:i=(t-n)/s+(t1&&(n-=1),n<1/6)?e+6*n*(t-e):n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function c(e,t,n){if(e=(0,r.sh)(e,360),t=(0,r.sh)(t,100),n=(0,r.sh)(n,100),0===t)a=n,c=n,o=n;else{var o,a,c,l=n<.5?n*(1+t):n+t-n*t,s=2*n-l;o=i(s,l,e+1/3),a=i(s,l,e),c=i(s,l,e-1/3)}return{r:255*o,g:255*a,b:255*c}}function l(e,t,n){var o=Math.max(e=(0,r.sh)(e,255),t=(0,r.sh)(t,255),n=(0,r.sh)(n,255)),a=Math.min(e,t,n),i=0,c=o-a;if(o===a)i=0;else{switch(o){case e:i=(t-n)/c+(t>16,g:(65280&e)>>8,b:255&e}}},28052:function(e,t,n){"use strict";n.d(t,{R:function(){return r}});var r={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}},96021:function(e,t,n){"use strict";n.d(t,{uA:function(){return i}});var r=n(82082),o=n(28052),a=n(58317);function i(e){var t={r:0,g:0,b:0},n=1,i=null,c=null,l=null,s=!1,f=!1;return"string"==typeof e&&(e=function(e){if(0===(e=e.trim().toLowerCase()).length)return!1;var t=!1;if(o.R[e])e=o.R[e],t=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var n=u.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=u.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=u.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=u.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=u.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=u.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=u.hex8.exec(e))?{r:(0,r.VD)(n[1]),g:(0,r.VD)(n[2]),b:(0,r.VD)(n[3]),a:(0,r.T6)(n[4]),format:t?"name":"hex8"}:(n=u.hex6.exec(e))?{r:(0,r.VD)(n[1]),g:(0,r.VD)(n[2]),b:(0,r.VD)(n[3]),format:t?"name":"hex"}:(n=u.hex4.exec(e))?{r:(0,r.VD)(n[1]+n[1]),g:(0,r.VD)(n[2]+n[2]),b:(0,r.VD)(n[3]+n[3]),a:(0,r.T6)(n[4]+n[4]),format:t?"name":"hex8"}:!!(n=u.hex3.exec(e))&&{r:(0,r.VD)(n[1]+n[1]),g:(0,r.VD)(n[2]+n[2]),b:(0,r.VD)(n[3]+n[3]),format:t?"name":"hex"}}(e)),"object"==typeof e&&(d(e.r)&&d(e.g)&&d(e.b)?(t=(0,r.rW)(e.r,e.g,e.b),s=!0,f="%"===String(e.r).substr(-1)?"prgb":"rgb"):d(e.h)&&d(e.s)&&d(e.v)?(i=(0,a.JX)(e.s),c=(0,a.JX)(e.v),t=(0,r.WE)(e.h,i,c),s=!0,f="hsv"):d(e.h)&&d(e.s)&&d(e.l)&&(i=(0,a.JX)(e.s),l=(0,a.JX)(e.l),t=(0,r.ve)(e.h,i,l),s=!0,f="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(n=e.a)),n=(0,a.Yq)(n),{ok:s,format:e.format||f,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var c="(?:".concat("[-\\+]?\\d*\\.\\d+%?",")|(?:").concat("[-\\+]?\\d+%?",")"),l="[\\s|\\(]+(".concat(c,")[,|\\s]+(").concat(c,")[,|\\s]+(").concat(c,")\\s*\\)?"),s="[\\s|\\(]+(".concat(c,")[,|\\s]+(").concat(c,")[,|\\s]+(").concat(c,")[,|\\s]+(").concat(c,")\\s*\\)?"),u={CSS_UNIT:new RegExp(c),rgb:RegExp("rgb"+l),rgba:RegExp("rgba"+s),hsl:RegExp("hsl"+l),hsla:RegExp("hsla"+s),hsv:RegExp("hsv"+l),hsva:RegExp("hsva"+s),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function d(e){return!!u.CSS_UNIT.exec(String(e))}},36360:function(e,t,n){"use strict";n.d(t,{C:function(){return c}});var r=n(82082),o=n(28052),a=n(96021),i=n(58317),c=function(){function e(t,n){if(void 0===t&&(t=""),void 0===n&&(n={}),t instanceof e)return t;"number"==typeof t&&(t=(0,r.Yt)(t)),this.originalInput=t;var o,i=(0,a.uA)(t);this.originalInput=t,this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this.roundA=Math.round(100*this.a)/100,this.format=null!==(o=n.format)&&void 0!==o?o:i.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=i.ok}return e.prototype.isDark=function(){return 128>this.getBrightness()},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255;return .2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=(0,i.Yq)(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){return 0===this.toHsl().s},e.prototype.toHsv=function(){var e=(0,r.py)(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=(0,r.py)(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),o=Math.round(100*e.v);return 1===this.a?"hsv(".concat(t,", ").concat(n,"%, ").concat(o,"%)"):"hsva(".concat(t,", ").concat(n,"%, ").concat(o,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var e=(0,r.lC)(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=(0,r.lC)(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),o=Math.round(100*e.l);return 1===this.a?"hsl(".concat(t,", ").concat(n,"%, ").concat(o,"%)"):"hsla(".concat(t,", ").concat(n,"%, ").concat(o,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(e){return void 0===e&&(e=!1),(0,r.vq)(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return void 0===e&&(e=!1),"#"+this.toHex(e)},e.prototype.toHex8=function(e){return void 0===e&&(e=!1),(0,r.s)(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return void 0===e&&(e=!1),"#"+this.toHex8(e)},e.prototype.toHexShortString=function(e){return void 0===e&&(e=!1),1===this.a?this.toHexString(e):this.toHex8String(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return 1===this.a?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"rgba(".concat(e,", ").concat(t,", ").concat(n,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var e=function(e){return"".concat(Math.round(100*(0,i.sh)(e,255)),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(100*(0,i.sh)(e,255))};return 1===this.a?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+(0,r.vq)(this.r,this.g,this.b,!1),t=0,n=Object.entries(o.R);t=0;return!t&&r&&(e.startsWith("hex")||"name"===e)?"name"===e&&0===this.a?this.toName():this.toRgbString():("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),("hex"===e||"hex6"===e)&&(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=(0,i.V2)(n.l),new e(n)},e.prototype.brighten=function(t){void 0===t&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(-(t/100*255)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(-(t/100*255)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(-(t/100*255)))),new e(n)},e.prototype.darken=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=(0,i.V2)(n.l),new e(n)},e.prototype.tint=function(e){return void 0===e&&(e=10),this.mix("white",e)},e.prototype.shade=function(e){return void 0===e&&(e=10),this.mix("black",e)},e.prototype.desaturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=(0,i.V2)(n.s),new e(n)},e.prototype.saturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=(0,i.V2)(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,new e(n)},e.prototype.mix=function(t,n){void 0===n&&(n=50);var r=this.toRgb(),o=new e(t).toRgb(),a=n/100;return new e({r:(o.r-r.r)*a+r.r,g:(o.g-r.g)*a+r.g,b:(o.b-r.b)*a+r.b,a:(o.a-r.a)*a+r.a})},e.prototype.analogous=function(t,n){void 0===t&&(t=6),void 0===n&&(n=30);var r=this.toHsl(),o=360/n,a=[this];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,a.push(new e(r));return a},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){void 0===t&&(t=6);for(var n=this.toHsv(),r=n.h,o=n.s,a=n.v,i=[],c=1/t;t--;)i.push(new e({h:r,s:o,v:a})),a=(a+c)%1;return i},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),r=new e(t).toRgb(),o=n.a+r.a*(1-n.a);return new e({r:(n.r*n.a+r.r*r.a*(1-n.a))/o,g:(n.g*n.a+r.g*r.a*(1-n.a))/o,b:(n.b*n.a+r.b*r.a*(1-n.a))/o,a:o})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),r=n.h,o=[this],a=360/t,i=1;iMath.abs(e-t))?1:e=360===t?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t))}function o(e){return Math.min(1,Math.max(0,e))}function a(e){return(isNaN(e=parseFloat(e))||e<0||e>1)&&(e=1),e}function i(e){return e<=1?"".concat(100*Number(e),"%"):e}function c(e){return 1===e.length?"0"+e:String(e)}n.d(t,{FZ:function(){return c},JX:function(){return i},V2:function(){return o},Yq:function(){return a},sh:function(){return r}})},28036:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var r=n(26365),o=n(2265),a=n(54887),i=n(94981);n(32559);var c=n(28791),l=o.createContext(null),s=n(83145),u=n(27380),d=[],f=n(21717),p=n(3208),m="rc-util-locker-".concat(Date.now()),g=0,h=function(e){return!1!==e&&((0,i.Z)()&&e?"string"==typeof e?document.querySelector(e):"function"==typeof e?e():e:null)},v=o.forwardRef(function(e,t){var n,v,b,y=e.open,w=e.autoLock,x=e.getContainer,E=(e.debug,e.autoDestroy),S=void 0===E||E,C=e.children,Z=o.useState(y),O=(0,r.Z)(Z,2),k=O[0],M=O[1],j=k||y;o.useEffect(function(){(S||y)&&M(y)},[y,S]);var I=o.useState(function(){return h(x)}),R=(0,r.Z)(I,2),N=R[0],P=R[1];o.useEffect(function(){var e=h(x);P(null!=e?e:null)});var F=function(e,t){var n=o.useState(function(){return(0,i.Z)()?document.createElement("div"):null}),a=(0,r.Z)(n,1)[0],c=o.useRef(!1),f=o.useContext(l),p=o.useState(d),m=(0,r.Z)(p,2),g=m[0],h=m[1],v=f||(c.current?void 0:function(e){h(function(t){return[e].concat((0,s.Z)(t))})});function b(){a.parentElement||document.body.appendChild(a),c.current=!0}function y(){var e;null===(e=a.parentElement)||void 0===e||e.removeChild(a),c.current=!1}return(0,u.Z)(function(){return e?f?f(b):b():y(),y},[e]),(0,u.Z)(function(){g.length&&(g.forEach(function(e){return e()}),h(d))},[g]),[a,v]}(j&&!N,0),T=(0,r.Z)(F,2),A=T[0],L=T[1],z=null!=N?N:A;n=!!(w&&y&&(0,i.Z)()&&(z===A||z===document.body)),v=o.useState(function(){return g+=1,"".concat(m,"_").concat(g)}),b=(0,r.Z)(v,1)[0],(0,u.Z)(function(){if(n){var e=(0,p.o)(document.body).width,t=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth;(0,f.hq)("\nhtml body {\n overflow-y: hidden;\n ".concat(t?"width: calc(100% - ".concat(e,"px);"):"","\n}"),b)}else(0,f.jL)(b);return function(){(0,f.jL)(b)}},[n,b]);var _=null;C&&(0,c.Yr)(C)&&t&&(_=C.ref);var H=(0,c.x1)(_,t);if(!j||!(0,i.Z)()||void 0===N)return null;var B=!1===z,D=C;return t&&(D=o.cloneElement(C,{ref:H})),o.createElement(l.Provider,{value:L},B?D:(0,a.createPortal)(D,z))})},97821:function(e,t,n){"use strict";n.d(t,{Z:function(){return D}});var r=n(31686),o=n(26365),a=n(6989),i=n(28036),c=n(36760),l=n.n(c),s=n(31474),u=n(2868),d=n(13211),f=n(58525),p=n(92491),m=n(27380),g=n(79267),h=n(2265),v=n(1119),b=n(47970),y=n(28791);function w(e){var t=e.prefixCls,n=e.align,r=e.arrow,o=e.arrowPos,a=r||{},i=a.className,c=a.content,s=o.x,u=o.y,d=h.useRef();if(!n||!n.points)return null;var f={position:"absolute"};if(!1!==n.autoArrow){var p=n.points[0],m=n.points[1],g=p[0],v=p[1],b=m[0],y=m[1];g!==b&&["t","b"].includes(g)?"t"===g?f.top=0:f.bottom=0:f.top=void 0===u?0:u,v!==y&&["l","r"].includes(v)?"l"===v?f.left=0:f.right=0:f.left=void 0===s?0:s}return h.createElement("div",{ref:d,className:l()("".concat(t,"-arrow"),i),style:f},c)}function x(e){var t=e.prefixCls,n=e.open,r=e.zIndex,o=e.mask,a=e.motion;return o?h.createElement(b.ZP,(0,v.Z)({},a,{motionAppear:!0,visible:n,removeOnLeave:!0}),function(e){var n=e.className;return h.createElement("div",{style:{zIndex:r},className:l()("".concat(t,"-mask"),n)})}):null}var E=h.memo(function(e){return e.children},function(e,t){return t.cache}),S=h.forwardRef(function(e,t){var n=e.popup,a=e.className,i=e.prefixCls,c=e.style,u=e.target,d=e.onVisibleChanged,f=e.open,p=e.keepDom,g=e.fresh,S=e.onClick,C=e.mask,Z=e.arrow,O=e.arrowPos,k=e.align,M=e.motion,j=e.maskMotion,I=e.forceRender,R=e.getPopupContainer,N=e.autoDestroy,P=e.portal,F=e.zIndex,T=e.onMouseEnter,A=e.onMouseLeave,L=e.onPointerEnter,z=e.ready,_=e.offsetX,H=e.offsetY,B=e.offsetR,D=e.offsetB,W=e.onAlign,V=e.onPrepare,q=e.stretch,G=e.targetWidth,X=e.targetHeight,U="function"==typeof n?n():n,$=f||p,K=(null==R?void 0:R.length)>0,Y=h.useState(!R||!K),Q=(0,o.Z)(Y,2),J=Q[0],ee=Q[1];if((0,m.Z)(function(){!J&&K&&u&&ee(!0)},[J,K,u]),!J)return null;var et="auto",en={left:"-1000vw",top:"-1000vh",right:et,bottom:et};if(z||!f){var er,eo=k.points,ea=k.dynamicInset||(null===(er=k._experimental)||void 0===er?void 0:er.dynamicInset),ei=ea&&"r"===eo[0][1],ec=ea&&"b"===eo[0][0];ei?(en.right=B,en.left=et):(en.left=_,en.right=et),ec?(en.bottom=D,en.top=et):(en.top=H,en.bottom=et)}var el={};return q&&(q.includes("height")&&X?el.height=X:q.includes("minHeight")&&X&&(el.minHeight=X),q.includes("width")&&G?el.width=G:q.includes("minWidth")&&G&&(el.minWidth=G)),f||(el.pointerEvents="none"),h.createElement(P,{open:I||$,getContainer:R&&function(){return R(u)},autoDestroy:N},h.createElement(x,{prefixCls:i,open:f,zIndex:F,mask:C,motion:j}),h.createElement(s.Z,{onResize:W,disabled:!f},function(e){return h.createElement(b.ZP,(0,v.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:I,leavedClassName:"".concat(i,"-hidden")},M,{onAppearPrepare:V,onEnterPrepare:V,visible:f,onVisibleChanged:function(e){var t;null==M||null===(t=M.onVisibleChanged)||void 0===t||t.call(M,e),d(e)}}),function(n,o){var s=n.className,u=n.style,d=l()(i,s,a);return h.createElement("div",{ref:(0,y.sQ)(e,t,o),className:d,style:(0,r.Z)((0,r.Z)((0,r.Z)((0,r.Z)({"--arrow-x":"".concat(O.x||0,"px"),"--arrow-y":"".concat(O.y||0,"px")},en),el),u),{},{boxSizing:"border-box",zIndex:F},c),onMouseEnter:T,onMouseLeave:A,onPointerEnter:L,onClick:S},Z&&h.createElement(w,{prefixCls:i,arrow:Z,arrowPos:O,align:k}),h.createElement(E,{cache:!f&&!g},U))})}))}),C=h.forwardRef(function(e,t){var n=e.children,r=e.getTriggerDOMNode,o=(0,y.Yr)(n),a=h.useCallback(function(e){(0,y.mH)(t,r?r(e):e)},[r]),i=(0,y.x1)(a,n.ref);return o?h.cloneElement(n,{ref:i}):n}),Z=h.createContext(null);function O(e){return e?Array.isArray(e)?e:[e]:[]}var k=n(2857);function M(e,t,n,r){return t||(n?{motionName:"".concat(e,"-").concat(n)}:r?{motionName:r}:null)}function j(e){return e.ownerDocument.defaultView}function I(e){for(var t=[],n=null==e?void 0:e.parentElement,r=["hidden","scroll","clip","auto"];n;){var o=j(n).getComputedStyle(n);[o.overflowX,o.overflowY,o.overflow].some(function(e){return r.includes(e)})&&t.push(n),n=n.parentElement}return t}function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isNaN(e)?t:e}function N(e){return R(parseFloat(e),0)}function P(e,t){var n=(0,r.Z)({},e);return(t||[]).forEach(function(e){if(!(e instanceof HTMLBodyElement||e instanceof HTMLHtmlElement)){var t=j(e).getComputedStyle(e),r=t.overflow,o=t.overflowClipMargin,a=t.borderTopWidth,i=t.borderBottomWidth,c=t.borderLeftWidth,l=t.borderRightWidth,s=e.getBoundingClientRect(),u=e.offsetHeight,d=e.clientHeight,f=e.offsetWidth,p=e.clientWidth,m=N(a),g=N(i),h=N(c),v=N(l),b=R(Math.round(s.width/f*1e3)/1e3),y=R(Math.round(s.height/u*1e3)/1e3),w=m*y,x=h*b,E=0,S=0;if("clip"===r){var C=N(o);E=C*b,S=C*y}var Z=s.x+x-E,O=s.y+w-S,k=Z+s.width+2*E-x-v*b-(f-p-h-v)*b,M=O+s.height+2*S-w-g*y-(u-d-m-g)*y;n.left=Math.max(n.left,Z),n.top=Math.max(n.top,O),n.right=Math.min(n.right,k),n.bottom=Math.min(n.bottom,M)}}),n}function F(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n="".concat(t),r=n.match(/^(.*)\%$/);return r?parseFloat(r[1])/100*e:parseFloat(n)}function T(e,t){var n=(0,o.Z)(t||[],2),r=n[0],a=n[1];return[F(e.width,r),F(e.height,a)]}function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return[e[0],e[1]]}function L(e,t){var n,r=t[0],o=t[1];return n="t"===r?e.y:"b"===r?e.y+e.height:e.y+e.height/2,{x:"l"===o?e.x:"r"===o?e.x+e.width:e.x+e.width/2,y:n}}function z(e,t){var n={t:"b",b:"t",l:"r",r:"l"};return e.map(function(e,r){return r===t?n[e]||"c":e}).join("")}var _=n(83145);n(32559);var H=n(53346),B=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"],D=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.Z;return h.forwardRef(function(t,n){var i,c,v,b,y,w,x,E,N,F,D,W,V,q,G,X,U,$=t.prefixCls,K=void 0===$?"rc-trigger-popup":$,Y=t.children,Q=t.action,J=t.showAction,ee=t.hideAction,et=t.popupVisible,en=t.defaultPopupVisible,er=t.onPopupVisibleChange,eo=t.afterPopupVisibleChange,ea=t.mouseEnterDelay,ei=t.mouseLeaveDelay,ec=void 0===ei?.1:ei,el=t.focusDelay,es=t.blurDelay,eu=t.mask,ed=t.maskClosable,ef=t.getPopupContainer,ep=t.forceRender,em=t.autoDestroy,eg=t.destroyPopupOnHide,eh=t.popup,ev=t.popupClassName,eb=t.popupStyle,ey=t.popupPlacement,ew=t.builtinPlacements,ex=void 0===ew?{}:ew,eE=t.popupAlign,eS=t.zIndex,eC=t.stretch,eZ=t.getPopupClassNameFromAlign,eO=t.fresh,ek=t.alignPoint,eM=t.onPopupClick,ej=t.onPopupAlign,eI=t.arrow,eR=t.popupMotion,eN=t.maskMotion,eP=t.popupTransitionName,eF=t.popupAnimation,eT=t.maskTransitionName,eA=t.maskAnimation,eL=t.className,ez=t.getTriggerDOMNode,e_=(0,a.Z)(t,B),eH=h.useState(!1),eB=(0,o.Z)(eH,2),eD=eB[0],eW=eB[1];(0,m.Z)(function(){eW((0,g.Z)())},[]);var eV=h.useRef({}),eq=h.useContext(Z),eG=h.useMemo(function(){return{registerSubPopup:function(e,t){eV.current[e]=t,null==eq||eq.registerSubPopup(e,t)}}},[eq]),eX=(0,p.Z)(),eU=h.useState(null),e$=(0,o.Z)(eU,2),eK=e$[0],eY=e$[1],eQ=(0,f.Z)(function(e){(0,u.S)(e)&&eK!==e&&eY(e),null==eq||eq.registerSubPopup(eX,e)}),eJ=h.useState(null),e0=(0,o.Z)(eJ,2),e1=e0[0],e2=e0[1],e6=h.useRef(null),e5=(0,f.Z)(function(e){(0,u.S)(e)&&e1!==e&&(e2(e),e6.current=e)}),e4=h.Children.only(Y),e3=(null==e4?void 0:e4.props)||{},e8={},e9=(0,f.Z)(function(e){var t,n;return(null==e1?void 0:e1.contains(e))||(null===(t=(0,d.A)(e1))||void 0===t?void 0:t.host)===e||e===e1||(null==eK?void 0:eK.contains(e))||(null===(n=(0,d.A)(eK))||void 0===n?void 0:n.host)===e||e===eK||Object.values(eV.current).some(function(t){return(null==t?void 0:t.contains(e))||e===t})}),e7=M(K,eR,eF,eP),te=M(K,eN,eA,eT),tt=h.useState(en||!1),tn=(0,o.Z)(tt,2),tr=tn[0],to=tn[1],ta=null!=et?et:tr,ti=(0,f.Z)(function(e){void 0===et&&to(e)});(0,m.Z)(function(){to(et||!1)},[et]);var tc=h.useRef(ta);tc.current=ta;var tl=h.useRef([]);tl.current=[];var ts=(0,f.Z)(function(e){var t;ti(e),(null!==(t=tl.current[tl.current.length-1])&&void 0!==t?t:ta)!==e&&(tl.current.push(e),null==er||er(e))}),tu=h.useRef(),td=function(){clearTimeout(tu.current)},tf=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;td(),0===t?ts(e):tu.current=setTimeout(function(){ts(e)},1e3*t)};h.useEffect(function(){return td},[]);var tp=h.useState(!1),tm=(0,o.Z)(tp,2),tg=tm[0],th=tm[1];(0,m.Z)(function(e){(!e||ta)&&th(!0)},[ta]);var tv=h.useState(null),tb=(0,o.Z)(tv,2),ty=tb[0],tw=tb[1],tx=h.useState([0,0]),tE=(0,o.Z)(tx,2),tS=tE[0],tC=tE[1],tZ=function(e){tC([e.clientX,e.clientY])},tO=(i=ek?tS:e1,c=h.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:ex[ey]||{}}),b=(v=(0,o.Z)(c,2))[0],y=v[1],w=h.useRef(0),x=h.useMemo(function(){return eK?I(eK):[]},[eK]),E=h.useRef({}),ta||(E.current={}),N=(0,f.Z)(function(){if(eK&&i&&ta){var e,t,n,a,c,l,s,d=eK.ownerDocument,f=j(eK).getComputedStyle(eK),p=f.width,m=f.height,g=f.position,h=eK.style.left,v=eK.style.top,b=eK.style.right,w=eK.style.bottom,S=eK.style.overflow,C=(0,r.Z)((0,r.Z)({},ex[ey]),eE),Z=d.createElement("div");if(null===(e=eK.parentElement)||void 0===e||e.appendChild(Z),Z.style.left="".concat(eK.offsetLeft,"px"),Z.style.top="".concat(eK.offsetTop,"px"),Z.style.position=g,Z.style.height="".concat(eK.offsetHeight,"px"),Z.style.width="".concat(eK.offsetWidth,"px"),eK.style.left="0",eK.style.top="0",eK.style.right="auto",eK.style.bottom="auto",eK.style.overflow="hidden",Array.isArray(i))n={x:i[0],y:i[1],width:0,height:0};else{var O=i.getBoundingClientRect();n={x:O.x,y:O.y,width:O.width,height:O.height}}var M=eK.getBoundingClientRect(),I=d.documentElement,N=I.clientWidth,F=I.clientHeight,_=I.scrollWidth,H=I.scrollHeight,B=I.scrollTop,D=I.scrollLeft,W=M.height,V=M.width,q=n.height,G=n.width,X=C.htmlRegion,U="visible",$="visibleFirst";"scroll"!==X&&X!==$&&(X=U);var K=X===$,Y=P({left:-D,top:-B,right:_-D,bottom:H-B},x),Q=P({left:0,top:0,right:N,bottom:F},x),J=X===U?Q:Y,ee=K?Q:J;eK.style.left="auto",eK.style.top="auto",eK.style.right="0",eK.style.bottom="0";var et=eK.getBoundingClientRect();eK.style.left=h,eK.style.top=v,eK.style.right=b,eK.style.bottom=w,eK.style.overflow=S,null===(t=eK.parentElement)||void 0===t||t.removeChild(Z);var en=R(Math.round(V/parseFloat(p)*1e3)/1e3),er=R(Math.round(W/parseFloat(m)*1e3)/1e3);if(!(0===en||0===er||(0,u.S)(i)&&!(0,k.Z)(i))){var eo=C.offset,ea=C.targetOffset,ei=T(M,eo),ec=(0,o.Z)(ei,2),el=ec[0],es=ec[1],eu=T(n,ea),ed=(0,o.Z)(eu,2),ef=ed[0],ep=ed[1];n.x-=ef,n.y-=ep;var em=C.points||[],eg=(0,o.Z)(em,2),eh=eg[0],ev=A(eg[1]),eb=A(eh),ew=L(n,ev),eS=L(M,eb),eC=(0,r.Z)({},C),eZ=ew.x-eS.x+el,eO=ew.y-eS.y+es,ek=tt(eZ,eO),eM=tt(eZ,eO,Q),eI=L(n,["t","l"]),eR=L(M,["t","l"]),eN=L(n,["b","r"]),eP=L(M,["b","r"]),eF=C.overflow||{},eT=eF.adjustX,eA=eF.adjustY,eL=eF.shiftX,ez=eF.shiftY,e_=function(e){return"boolean"==typeof e?e:e>=0};tn();var eH=e_(eA),eB=eb[0]===ev[0];if(eH&&"t"===eb[0]&&(c>ee.bottom||E.current.bt)){var eD=eO;eB?eD-=W-q:eD=eI.y-eP.y-es;var eW=tt(eZ,eD),eV=tt(eZ,eD,Q);eW>ek||eW===ek&&(!K||eV>=eM)?(E.current.bt=!0,eO=eD,es=-es,eC.points=[z(eb,0),z(ev,0)]):E.current.bt=!1}if(eH&&"b"===eb[0]&&(aek||eG===ek&&(!K||eX>=eM)?(E.current.tb=!0,eO=eq,es=-es,eC.points=[z(eb,0),z(ev,0)]):E.current.tb=!1}var eU=e_(eT),e$=eb[1]===ev[1];if(eU&&"l"===eb[1]&&(s>ee.right||E.current.rl)){var eY=eZ;e$?eY-=V-G:eY=eI.x-eP.x-el;var eQ=tt(eY,eO),eJ=tt(eY,eO,Q);eQ>ek||eQ===ek&&(!K||eJ>=eM)?(E.current.rl=!0,eZ=eY,el=-el,eC.points=[z(eb,1),z(ev,1)]):E.current.rl=!1}if(eU&&"r"===eb[1]&&(lek||e1===ek&&(!K||e2>=eM)?(E.current.lr=!0,eZ=e0,el=-el,eC.points=[z(eb,1),z(ev,1)]):E.current.lr=!1}tn();var e6=!0===eL?0:eL;"number"==typeof e6&&(lQ.right&&(eZ-=s-Q.right-el,n.x>Q.right-e6&&(eZ+=n.x-Q.right+e6)));var e5=!0===ez?0:ez;"number"==typeof e5&&(aQ.bottom&&(eO-=c-Q.bottom-es,n.y>Q.bottom-e5&&(eO+=n.y-Q.bottom+e5)));var e4=M.x+eZ,e3=M.y+eO,e8=n.x,e9=n.y;null==ej||ej(eK,eC);var e7=et.right-M.x-(eZ+M.width),te=et.bottom-M.y-(eO+M.height);y({ready:!0,offsetX:eZ/en,offsetY:eO/er,offsetR:e7/en,offsetB:te/er,arrowX:((Math.max(e4,e8)+Math.min(e4+V,e8+G))/2-e4)/en,arrowY:((Math.max(e3,e9)+Math.min(e3+W,e9+q))/2-e3)/er,scaleX:en,scaleY:er,align:eC})}function tt(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:J,r=M.x+e,o=M.y+t,a=Math.max(r,n.left),i=Math.max(o,n.top);return Math.max(0,(Math.min(r+V,n.right)-a)*(Math.min(o+W,n.bottom)-i))}function tn(){c=(a=M.y+eO)+W,s=(l=M.x+eZ)+V}}}),F=function(){y(function(e){return(0,r.Z)((0,r.Z)({},e),{},{ready:!1})})},(0,m.Z)(F,[ey]),(0,m.Z)(function(){ta||F()},[ta]),[b.ready,b.offsetX,b.offsetY,b.offsetR,b.offsetB,b.arrowX,b.arrowY,b.scaleX,b.scaleY,b.align,function(){w.current+=1;var e=w.current;Promise.resolve().then(function(){w.current===e&&N()})}]),tk=(0,o.Z)(tO,11),tM=tk[0],tj=tk[1],tI=tk[2],tR=tk[3],tN=tk[4],tP=tk[5],tF=tk[6],tT=tk[7],tA=tk[8],tL=tk[9],tz=tk[10],t_=(D=void 0===Q?"hover":Q,h.useMemo(function(){var e=O(null!=J?J:D),t=O(null!=ee?ee:D),n=new Set(e),r=new Set(t);return eD&&(n.has("hover")&&(n.delete("hover"),n.add("click")),r.has("hover")&&(r.delete("hover"),r.add("click"))),[n,r]},[eD,D,J,ee])),tH=(0,o.Z)(t_,2),tB=tH[0],tD=tH[1],tW=tB.has("click"),tV=tD.has("click")||tD.has("contextMenu"),tq=(0,f.Z)(function(){tg||tz()});W=function(){tc.current&&ek&&tV&&tf(!1)},(0,m.Z)(function(){if(ta&&e1&&eK){var e=I(e1),t=I(eK),n=j(eK),r=new Set([n].concat((0,_.Z)(e),(0,_.Z)(t)));function o(){tq(),W()}return r.forEach(function(e){e.addEventListener("scroll",o,{passive:!0})}),n.addEventListener("resize",o,{passive:!0}),tq(),function(){r.forEach(function(e){e.removeEventListener("scroll",o),n.removeEventListener("resize",o)})}}},[ta,e1,eK]),(0,m.Z)(function(){tq()},[tS,ey]),(0,m.Z)(function(){ta&&!(null!=ex&&ex[ey])&&tq()},[JSON.stringify(eE)]);var tG=h.useMemo(function(){var e=function(e,t,n,r){for(var o=n.points,a=Object.keys(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}(null===(c=e[l])||void 0===c?void 0:c.points,o,r))return"".concat(t,"-placement-").concat(l)}return""}(ex,K,tL,ek);return l()(e,null==eZ?void 0:eZ(tL))},[tL,eZ,ex,K,ek]);h.useImperativeHandle(n,function(){return{nativeElement:e6.current,forceAlign:tq}});var tX=h.useState(0),tU=(0,o.Z)(tX,2),t$=tU[0],tK=tU[1],tY=h.useState(0),tQ=(0,o.Z)(tY,2),tJ=tQ[0],t0=tQ[1],t1=function(){if(eC&&e1){var e=e1.getBoundingClientRect();tK(e.width),t0(e.height)}};function t2(e,t,n,r){e8[e]=function(o){var a;null==r||r(o),tf(t,n);for(var i=arguments.length,c=Array(i>1?i-1:0),l=1;l1?n-1:0),o=1;o1?n-1:0),o=1;o{var t=(0,r._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 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"}))},i=e=>{var t=(0,r._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:"M1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12ZM12.0003 17C14.7617 17 17.0003 14.7614 17.0003 12C17.0003 9.23858 14.7617 7 12.0003 7C9.23884 7 7.00026 9.23858 7.00026 12C7.00026 14.7614 9.23884 17 12.0003 17ZM12.0003 15C10.3434 15 9.00026 13.6569 9.00026 12C9.00026 10.3431 10.3434 9 12.0003 9C13.6571 9 15.0003 10.3431 15.0003 12C15.0003 13.6569 13.6571 15 12.0003 15Z"}))},c=e=>{var t=(0,r._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:"M4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457ZM14.7577 16.1718L13.2937 14.7078C12.902 14.8952 12.4634 15.0002 12.0003 15.0002C10.3434 15.0002 9.00026 13.657 9.00026 12.0002C9.00026 11.537 9.10522 11.0984 9.29263 10.7067L7.82866 9.24277C7.30514 10.0332 7.00026 10.9811 7.00026 12.0002C7.00026 14.7616 9.23884 17.0002 12.0003 17.0002C13.0193 17.0002 13.9672 16.6953 14.7577 16.1718ZM7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925L16.947 12.7327C16.9821 12.4936 17.0003 12.249 17.0003 12.0002C17.0003 9.23873 14.7617 7.00016 12.0003 7.00016C11.7514 7.00016 11.5068 7.01833 11.2677 7.05343L7.97446 3.76015Z"}))};var l=n(96398),s=n(97324),u=n(1153);let d=o.forwardRef((e,t)=>{let{value:n,defaultValue:d,type:f,placeholder:p="Type...",icon:m,error:g=!1,errorMessage:h,disabled:v=!1,stepper:b,makeInputClassName:y,className:w,onChange:x,onValueChange:E,autoFocus:S}=e,C=(0,r._T)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus"]),[Z,O]=(0,o.useState)(S||!1),[k,M]=(0,o.useState)(!1),j=(0,o.useCallback)(()=>M(!k),[k,M]),I=(0,o.useRef)(null),R=(0,l.Uh)(n||d);return o.useEffect(()=>{let e=()=>O(!0),t=()=>O(!1),n=I.current;return n&&(n.addEventListener("focus",e),n.addEventListener("blur",t),S&&n.focus()),()=>{n&&(n.removeEventListener("focus",e),n.removeEventListener("blur",t))}},[S]),o.createElement(o.Fragment,null,o.createElement("div",{className:(0,s.q)(y("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",(0,l.um)(R,v,g),Z&&(0,s.q)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),w)},m?o.createElement(m,{className:(0,s.q)(y("icon"),"shrink-0 h-5 w-5 ml-2.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,o.createElement("input",Object.assign({ref:(0,u.lq)([I,t]),defaultValue:d,value:n,type:k?"text":f,className:(0,s.q)(y("input"),"w-full focus:outline-none focus:ring-0 border-none bg-transparent text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",m?"pl-2":"pl-3",g?"pr-3":"pr-4",v?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:p,disabled:v,"data-testid":"base-input",onChange:e=>{null==x||x(e),null==E||E(e.target.value)}},C)),"password"!==f||v?null:o.createElement("button",{className:(0,s.q)(y("toggleButton"),"mr-2"),type:"button",onClick:()=>j(),"aria-label":k?"Hide password":"Show Password"},k?o.createElement(c,{className:(0,s.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):o.createElement(i,{className:(0,s.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),g?o.createElement(a,{className:(0,s.q)(y("errorIcon"),"text-red-500 shrink-0 w-5 h-5 mr-2.5")}):null,null!=b?b:null),g&&h?o.createElement("p",{className:(0,s.q)(y("errorMessage"),"text-sm text-red-500 mt-1")},h):null)});d.displayName="BaseInput"},49566:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(5853),o=n(2265);n(97324);var a=n(1153),i=n(69262);let c=(0,a.fn)("TextInput"),l=o.forwardRef((e,t)=>{let{type:n="text"}=e,a=(0,r._T)(e,["type"]);return o.createElement(i.Z,Object.assign({ref:t,type:n,makeInputClassName:c},a))});l.displayName="TextInput"},96398:function(e,t,n){"use strict";n.d(t,{Uh:function(){return s},n0:function(){return c},qg:function(){return a},sl:function(){return i},um:function(){return l}});var r=n(97324),o=n(2265);let a=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(a).join(""):"object"==typeof e&&e?a(e.props.children):void 0;function i(e){let t=new Map;return o.Children.map(e,e=>{var n;t.set(e.props.value,null!==(n=a(e))&&void 0!==n?n:e.props.value)}),t}function c(e,t){return o.Children.map(t,t=>{var n;if((null!==(n=a(t))&&void 0!==n?n:t.props.value).toLowerCase().includes(e.toLowerCase()))return t})}let l=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,r.q)(t?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!t&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",t&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",n&&"text-red-500",n?"border-red-500":"border-tremor-border dark:border-dark-tremor-border")};function s(e){return null!=e&&""!==e}},93942:function(e,t,n){"use strict";n.d(t,{i:function(){return c}});var r=n(2265),o=n(50506),a=n(13959),i=n(71744);function c(e){return t=>r.createElement(a.ZP,{theme:{token:{motion:!1,zIndexPopupBase:0}}},r.createElement(e,Object.assign({},t)))}t.Z=(e,t,n,a)=>c(c=>{let{prefixCls:l,style:s}=c,u=r.useRef(null),[d,f]=r.useState(0),[p,m]=r.useState(0),[g,h]=(0,o.Z)(!1,{value:c.open}),{getPrefixCls:v}=r.useContext(i.E_),b=v(t||"select",l);r.useEffect(()=>{if(h(!0),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{let t=e[0].target;f(t.offsetHeight+8),m(t.offsetWidth)}),t=setInterval(()=>{var r;let o=n?".".concat(n(b)):".".concat(b,"-dropdown"),a=null===(r=u.current)||void 0===r?void 0:r.querySelector(o);a&&(clearInterval(t),e.observe(a))},10);return()=>{clearInterval(t),e.disconnect()}}},[]);let y=Object.assign(Object.assign({},c),{style:Object.assign(Object.assign({},s),{margin:0}),open:g,visible:g,getPopupContainer:()=>u.current});return a&&(y=a(y)),r.createElement("div",{ref:u,style:{paddingBottom:d,position:"relative",minWidth:p}},r.createElement(e,Object.assign({},y)))})},93350:function(e,t,n){"use strict";n.d(t,{o2:function(){return c},yT:function(){return l}});var r=n(83145),o=n(53454);let a=o.i.map(e=>"".concat(e,"-inverse")),i=["success","processing","error","default","warning"];function c(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return t?[].concat((0,r.Z)(a),(0,r.Z)(o.i)).includes(e):o.i.includes(e)}function l(e){return i.includes(e)}},62236:function(e,t,n){"use strict";n.d(t,{Cn:function(){return s},u6:function(){return i}});var r=n(2265),o=n(29961),a=n(95140);let i=1e3,c={Modal:100,Drawer:100,Popover:100,Popconfirm:100,Tooltip:100,Tour:100},l={SelectLike:50,Dropdown:50,DatePicker:50,Menu:50,ImagePreview:1};function s(e,t){let[,n]=(0,o.ZP)(),s=r.useContext(a.Z);if(void 0!==t)return[t,t];let u=null!=s?s:0;return e in c?(u+=(s?0:n.zIndexPopupBase)+c[e],u=Math.min(u,n.zIndexPopupBase+i)):u+=l[e],[void 0===s?t:u,u]}},68710:function(e,t,n){"use strict";n.d(t,{m:function(){return c}});let r=()=>({height:0,opacity:0}),o=e=>{let{scrollHeight:t}=e;return{height:t,opacity:1}},a=e=>({height:e?e.offsetHeight:0}),i=(e,t)=>(null==t?void 0:t.deadline)===!0||"height"===t.propertyName,c=(e,t,n)=>void 0!==n?n:"".concat(e,"-").concat(t);t.Z=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ant";return{motionName:"".concat(e,"-motion-collapse"),onAppearStart:r,onEnterStart:r,onAppearActive:o,onEnterActive:o,onLeaveStart:a,onLeaveActive:r,onAppearEnd:i,onEnterEnd:i,onLeaveEnd:i,motionDeadline:500}}},92736:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(88260);let o={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},a={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},i=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function c(e){let{arrowWidth:t,autoAdjustOverflow:n,arrowPointAtCenter:c,offset:l,borderRadius:s,visibleFirst:u}=e,d=t/2,f={};return Object.keys(o).forEach(e=>{let p=Object.assign(Object.assign({},c&&a[e]||o[e]),{offset:[0,0],dynamicInset:!0});switch(f[e]=p,i.has(e)&&(p.autoArrow=!1),e){case"top":case"topLeft":case"topRight":p.offset[1]=-d-l;break;case"bottom":case"bottomLeft":case"bottomRight":p.offset[1]=d+l;break;case"left":case"leftTop":case"leftBottom":p.offset[0]=-d-l;break;case"right":case"rightTop":case"rightBottom":p.offset[0]=d+l}let m=(0,r.wZ)({contentRadius:s,limitVerticalRadius:!0});if(c)switch(e){case"topLeft":case"bottomLeft":p.offset[0]=-m.arrowOffsetHorizontal-d;break;case"topRight":case"bottomRight":p.offset[0]=m.arrowOffsetHorizontal+d;break;case"leftTop":case"rightTop":p.offset[1]=-m.arrowOffsetHorizontal-d;break;case"leftBottom":case"rightBottom":p.offset[1]=m.arrowOffsetHorizontal+d}p.overflow=function(e,t,n,r){if(!1===r)return{adjustX:!1,adjustY:!1};let o={};switch(e){case"top":case"bottom":o.shiftX=2*t.arrowOffsetHorizontal+n,o.shiftY=!0,o.adjustY=!0;break;case"left":case"right":o.shiftY=2*t.arrowOffsetVertical+n,o.shiftX=!0,o.adjustX=!0}let a=Object.assign(Object.assign({},o),r&&"object"==typeof r?r:{});return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}(e,m,t,n),u&&(p.htmlRegion="visibleFirst")}),f}},19722:function(e,t,n){"use strict";n.d(t,{M2:function(){return i},Tm:function(){return l},l$:function(){return a},wm:function(){return c}});var r,o=n(2265);let{isValidElement:a}=r||(r=n.t(o,2));function i(e){return e&&a(e)&&e.type===o.Fragment}function c(e,t,n){return a(e)?o.cloneElement(e,"function"==typeof n?n(e.props||{}):n):t}function l(e,t){return c(e,e,t)}},6543:function(e,t,n){"use strict";n.d(t,{ZP:function(){return l},c4:function(){return a}});var r=n(2265),o=n(29961);let a=["xxl","xl","lg","md","sm","xs"],i=e=>({xs:"(max-width: ".concat(e.screenXSMax,"px)"),sm:"(min-width: ".concat(e.screenSM,"px)"),md:"(min-width: ".concat(e.screenMD,"px)"),lg:"(min-width: ".concat(e.screenLG,"px)"),xl:"(min-width: ".concat(e.screenXL,"px)"),xxl:"(min-width: ".concat(e.screenXXL,"px)")}),c=e=>{let t=[].concat(a).reverse();return t.forEach((n,r)=>{let o=n.toUpperCase(),a="screen".concat(o,"Min"),i="screen".concat(o);if(!(e[a]<=e[i]))throw Error("".concat(a,"<=").concat(i," fails : !(").concat(e[a],"<=").concat(e[i],")"));if(r{let e=new Map,n=-1,r={};return{matchHandlers:{},dispatch:t=>(r=t,e.forEach(e=>e(r)),e.size>=1),subscribe(t){return e.size||this.register(),n+=1,e.set(n,t),t(r),n},unsubscribe(t){e.delete(t),e.size||this.unregister()},unregister(){Object.keys(t).forEach(e=>{let n=t[e],r=this.matchHandlers[n];null==r||r.mql.removeListener(null==r?void 0:r.listener)}),e.clear()},register(){Object.keys(t).forEach(e=>{let n=t[e],o=t=>{let{matches:n}=t;this.dispatch(Object.assign(Object.assign({},r),{[e]:n}))},a=window.matchMedia(n);a.addListener(o),this.matchHandlers[n]={mql:a,listener:o},o(a)})},responsiveMap:t}},[e])}},12757:function(e,t,n){"use strict";n.d(t,{F:function(){return i},Z:function(){return a}});var r=n(36760),o=n.n(r);function a(e,t,n){return o()({["".concat(e,"-status-success")]:"success"===t,["".concat(e,"-status-warning")]:"warning"===t,["".concat(e,"-status-error")]:"error"===t,["".concat(e,"-status-validating")]:"validating"===t,["".concat(e,"-has-feedback")]:n})}let i=(e,t)=>t||e},13613:function(e,t,n){"use strict";n.d(t,{G8:function(){return a},ln:function(){return i}});var r=n(2265);function o(){}n(32559);let a=r.createContext({}),i=()=>{let e=()=>{};return e.deprecated=o,e}},6694:function(e,t,n){"use strict";n.d(t,{Z:function(){return S}});var r=n(36760),o=n.n(r),a=n(28791),i=n(2857),c=n(2265),l=n(71744),s=n(19722),u=n(80669);let d=e=>{let{componentCls:t,colorPrimary:n}=e;return{[t]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:"var(--wave-color, ".concat(n,")"),boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:["box-shadow 0.4s ".concat(e.motionEaseOutCirc),"opacity 2s ".concat(e.motionEaseOutCirc)].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:["box-shadow 0.3s ".concat(e.motionEaseInOut),"opacity 0.35s ".concat(e.motionEaseInOut)].join(",")}}}}};var f=(0,u.ZP)("Wave",e=>[d(e)]),p=n(74126),m=n(53346),g=n(47970),h=n(18404);function v(e){return e&&"#fff"!==e&&"#ffffff"!==e&&"rgb(255, 255, 255)"!==e&&"rgba(255, 255, 255, 1)"!==e&&function(e){let t=(e||"").match(/rgba?\((\d*), (\d*), (\d*)(, [\d.]*)?\)/);return!t||!t[1]||!t[2]||!t[3]||!(t[1]===t[2]&&t[2]===t[3])}(e)&&!/rgba\((?:\d*, ){3}0\)/.test(e)&&"transparent"!==e}var b=n(34709);function y(e){return Number.isNaN(e)?0:e}let w=e=>{let{className:t,target:n,component:r}=e,a=c.useRef(null),[i,l]=c.useState(null),[s,u]=c.useState([]),[d,f]=c.useState(0),[p,w]=c.useState(0),[x,E]=c.useState(0),[S,C]=c.useState(0),[Z,O]=c.useState(!1),k={left:d,top:p,width:x,height:S,borderRadius:s.map(e=>"".concat(e,"px")).join(" ")};function M(){let e=getComputedStyle(n);l(function(e){let{borderTopColor:t,borderColor:n,backgroundColor:r}=getComputedStyle(e);return v(t)?t:v(n)?n:v(r)?r:null}(n));let t="static"===e.position,{borderLeftWidth:r,borderTopWidth:o}=e;f(t?n.offsetLeft:y(-parseFloat(r))),w(t?n.offsetTop:y(-parseFloat(o))),E(n.offsetWidth),C(n.offsetHeight);let{borderTopLeftRadius:a,borderTopRightRadius:i,borderBottomLeftRadius:c,borderBottomRightRadius:s}=e;u([a,i,s,c].map(e=>y(parseFloat(e))))}if(i&&(k["--wave-color"]=i),c.useEffect(()=>{if(n){let e;let t=(0,m.Z)(()=>{M(),O(!0)});return"undefined"!=typeof ResizeObserver&&(e=new ResizeObserver(M)).observe(n),()=>{m.Z.cancel(t),null==e||e.disconnect()}}},[]),!Z)return null;let j=("Checkbox"===r||"Radio"===r)&&(null==n?void 0:n.classList.contains(b.A));return c.createElement(g.ZP,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(e,t)=>{var n;if(t.deadline||"opacity"===t.propertyName){let e=null===(n=a.current)||void 0===n?void 0:n.parentElement;(0,h.v)(e).then(()=>{null==e||e.remove()})}return!1}},e=>{let{className:n}=e;return c.createElement("div",{ref:a,className:o()(t,{"wave-quick":j},n),style:k})})};var x=(e,t)=>{var n;let{component:r}=t;if("Checkbox"===r&&!(null===(n=e.querySelector("input"))||void 0===n?void 0:n.checked))return;let o=document.createElement("div");o.style.position="absolute",o.style.left="0px",o.style.top="0px",null==e||e.insertBefore(o,null==e?void 0:e.firstChild),(0,h.s)(c.createElement(w,Object.assign({},t,{target:e})),o)},E=n(29961),S=e=>{let{children:t,disabled:n,component:r}=e,{getPrefixCls:u}=(0,c.useContext)(l.E_),d=(0,c.useRef)(null),g=u("wave"),[,h]=f(g),v=function(e,t,n){let{wave:r}=c.useContext(l.E_),[,o,a]=(0,E.ZP)(),i=(0,p.zX)(i=>{let c=e.current;if((null==r?void 0:r.disabled)||!c)return;let l=c.querySelector(".".concat(b.A))||c,{showEffect:s}=r||{};(s||x)(l,{className:t,token:o,component:n,event:i,hashId:a})}),s=c.useRef();return e=>{m.Z.cancel(s.current),s.current=(0,m.Z)(()=>{i(e)})}}(d,o()(g,h),r);if(c.useEffect(()=>{let e=d.current;if(!e||1!==e.nodeType||n)return;let t=t=>{!(0,i.Z)(t.target)||!e.getAttribute||e.getAttribute("disabled")||e.disabled||e.className.includes("disabled")||e.className.includes("-leave")||v(t)};return e.addEventListener("click",t,!0),()=>{e.removeEventListener("click",t,!0)}},[n]),!c.isValidElement(t))return null!=t?t:null;let y=(0,a.Yr)(t)?(0,a.sQ)(t.ref,d):d;return(0,s.Tm)(t,{ref:y})}},34709:function(e,t,n){"use strict";n.d(t,{A:function(){return r}});let r="ant-wave-target"},95140:function(e,t,n){"use strict";let r=n(2265).createContext(void 0);t.Z=r},52402:function(e,t,n){"use strict";n.d(t,{J:function(){return r}});let r=n(2265).createContext({})},51248:function(e,t,n){"use strict";n.d(t,{Te:function(){return s},aG:function(){return i},hU:function(){return u},nx:function(){return c}});var r=n(2265),o=n(19722);let a=/^[\u4e00-\u9fa5]{2}$/,i=a.test.bind(a);function c(e){return"danger"===e?{danger:!0}:{type:e}}function l(e){return"string"==typeof e}function s(e){return"text"===e||"link"===e}function u(e,t){let n=!1,a=[];return r.Children.forEach(e,e=>{let t=typeof e,r="string"===t||"number"===t;if(n&&r){let t=a.length-1,n=a[t];a[t]="".concat(n).concat(e)}else a.push(e);n=r}),r.Children.map(a,e=>(function(e,t){if(null==e)return;let n=t?" ":"";return"string"!=typeof e&&"number"!=typeof e&&l(e.type)&&i(e.props.children)?(0,o.Tm)(e,{children:e.props.children.split("").join(n)}):l(e)?i(e)?r.createElement("span",null,e.split("").join(n)):r.createElement("span",null,e):(0,o.M2)(e)?r.createElement("span",null,e):e})(e,t))}},73002:function(e,t,n){"use strict";n.d(t,{ZP:function(){return ea}});var r=n(2265),o=n(36760),a=n.n(o),i=n(18694),c=n(28791),l=n(6694),s=n(71744),u=n(86586),d=n(33759),f=n(65658),p=n(29961),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};let g=r.createContext(void 0);var h=n(51248);let v=(0,r.forwardRef)((e,t)=>{let{className:n,style:o,children:i,prefixCls:c}=e,l=a()("".concat(c,"-icon"),n);return r.createElement("span",{ref:t,className:l,style:o},i)});var b=n(61935),y=n(47970);let w=(0,r.forwardRef)((e,t)=>{let{prefixCls:n,className:o,style:i,iconClassName:c}=e,l=a()("".concat(n,"-loading-icon"),o);return r.createElement(v,{prefixCls:n,className:l,style:i,ref:t},r.createElement(b.Z,{className:c}))}),x=()=>({width:0,opacity:0,transform:"scale(0)"}),E=e=>({width:e.scrollWidth,opacity:1,transform:"scale(1)"});var S=e=>{let{prefixCls:t,loading:n,existIcon:o,className:a,style:i}=e,c=!!n;return o?r.createElement(w,{prefixCls:t,className:a,style:i}):r.createElement(y.ZP,{visible:c,motionName:"".concat(t,"-loading-icon-motion"),motionLeave:c,removeOnLeave:!0,onAppearStart:x,onAppearActive:E,onEnterStart:x,onEnterActive:E,onLeaveStart:E,onLeaveActive:x},(e,n)=>{let{className:o,style:c}=e;return r.createElement(w,{prefixCls:t,className:a,style:Object.assign(Object.assign({},i),c),ref:n,iconClassName:o})})},C=n(352),Z=n(12918),O=n(3104),k=n(80669);let M=(e,t)=>({["> span, > ".concat(e)]:{"&:not(:last-child)":{["&, & > ".concat(e)]:{"&:not(:disabled)":{borderInlineEndColor:t}}},"&:not(:first-child)":{["&, & > ".concat(e)]:{"&:not(:disabled)":{borderInlineStartColor:t}}}}});var j=e=>{let{componentCls:t,fontSize:n,lineWidth:r,groupBorderColor:o,colorErrorHover:a}=e;return{["".concat(t,"-group")]:[{position:"relative",display:"inline-flex",["> span, > ".concat(t)]:{"&:not(:last-child)":{["&, & > ".concat(t)]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:e.calc(r).mul(-1).equal(),["&, & > ".concat(t)]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[t]:{position:"relative",zIndex:1,"&:hover,\n &:focus,\n &:active":{zIndex:2},"&[disabled]":{zIndex:0}},["".concat(t,"-icon-only")]:{fontSize:n}},M("".concat(t,"-primary"),o),M("".concat(t,"-danger"),a)]}},I=n(1319);let R=e=>{let{paddingInline:t,onlyIconSize:n,paddingBlock:r}=e;return(0,O.TS)(e,{buttonPaddingHorizontal:t,buttonPaddingVertical:r,buttonIconOnlyFontSize:n})},N=e=>{var t,n,r,o,a,i;let c=null!==(t=e.contentFontSize)&&void 0!==t?t:e.fontSize,l=null!==(n=e.contentFontSizeSM)&&void 0!==n?n:e.fontSize,s=null!==(r=e.contentFontSizeLG)&&void 0!==r?r:e.fontSizeLG,u=null!==(o=e.contentLineHeight)&&void 0!==o?o:(0,I.D)(c),d=null!==(a=e.contentLineHeightSM)&&void 0!==a?a:(0,I.D)(l),f=null!==(i=e.contentLineHeightLG)&&void 0!==i?i:(0,I.D)(s);return{fontWeight:400,defaultShadow:"0 ".concat(e.controlOutlineWidth,"px 0 ").concat(e.controlTmpOutline),primaryShadow:"0 ".concat(e.controlOutlineWidth,"px 0 ").concat(e.controlOutline),dangerShadow:"0 ".concat(e.controlOutlineWidth,"px 0 ").concat(e.colorErrorOutline),primaryColor:e.colorTextLightSolid,dangerColor:e.colorTextLightSolid,borderColorDisabled:e.colorBorder,defaultGhostColor:e.colorBgContainer,ghostBg:"transparent",defaultGhostBorderColor:e.colorBgContainer,paddingInline:e.paddingContentHorizontal-e.lineWidth,paddingInlineLG:e.paddingContentHorizontal-e.lineWidth,paddingInlineSM:8-e.lineWidth,onlyIconSize:e.fontSizeLG,onlyIconSizeSM:e.fontSizeLG-2,onlyIconSizeLG:e.fontSizeLG+2,groupBorderColor:e.colorPrimaryHover,linkHoverBg:"transparent",textHoverBg:e.colorBgTextHover,defaultColor:e.colorText,defaultBg:e.colorBgContainer,defaultBorderColor:e.colorBorder,defaultBorderColorDisabled:e.colorBorder,contentFontSize:c,contentFontSizeSM:l,contentFontSizeLG:s,contentLineHeight:u,contentLineHeightSM:d,contentLineHeightLG:f,paddingBlock:Math.max((e.controlHeight-c*u)/2-e.lineWidth,0),paddingBlockSM:Math.max((e.controlHeightSM-l*d)/2-e.lineWidth,0),paddingBlockLG:Math.max((e.controlHeightLG-s*f)/2-e.lineWidth,0)}},P=e=>{let{componentCls:t,iconCls:n,fontWeight:r}=e;return{[t]:{outline:"none",position:"relative",display:"inline-block",fontWeight:r,whiteSpace:"nowrap",textAlign:"center",backgroundImage:"none",background:"transparent",border:"".concat((0,C.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),cursor:"pointer",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut),userSelect:"none",touchAction:"manipulation",color:e.colorText,"&:disabled > *":{pointerEvents:"none"},"> span":{display:"inline-block"},["".concat(t,"-icon")]:{lineHeight:0},["> ".concat(n," + span, > span + ").concat(n)]:{marginInlineStart:e.marginXS},["&:not(".concat(t,"-icon-only) > ").concat(t,"-icon")]:{["&".concat(t,"-loading-icon, &:not(:last-child)")]:{marginInlineEnd:e.marginXS}},"> a":{color:"currentColor"},"&:not(:disabled)":Object.assign({},(0,Z.Qy)(e)),["&".concat(t,"-two-chinese-chars::first-letter")]:{letterSpacing:"0.34em"},["&".concat(t,"-two-chinese-chars > *:not(").concat(n,")")]:{marginInlineEnd:"-0.34em",letterSpacing:"0.34em"},["&-icon-only".concat(t,"-compact-item")]:{flex:"none"}}}},F=(e,t,n)=>({["&:not(:disabled):not(".concat(e,"-disabled)")]:{"&:hover":t,"&:active":n}}),T=e=>({minWidth:e.controlHeight,paddingInlineStart:0,paddingInlineEnd:0,borderRadius:"50%"}),A=e=>({borderRadius:e.controlHeight,paddingInlineStart:e.calc(e.controlHeight).div(2).equal(),paddingInlineEnd:e.calc(e.controlHeight).div(2).equal()}),L=e=>({cursor:"not-allowed",borderColor:e.borderColorDisabled,color:e.colorTextDisabled,background:e.colorBgContainerDisabled,boxShadow:"none"}),z=(e,t,n,r,o,a,i,c)=>({["&".concat(e,"-background-ghost")]:Object.assign(Object.assign({color:n||void 0,background:t,borderColor:r||void 0,boxShadow:"none"},F(e,Object.assign({background:t},i),Object.assign({background:t},c))),{"&:disabled":{cursor:"not-allowed",color:o||void 0,borderColor:a||void 0}})}),_=e=>({["&:disabled, &".concat(e.componentCls,"-disabled")]:Object.assign({},L(e))}),H=e=>Object.assign({},_(e)),B=e=>({["&:disabled, &".concat(e.componentCls,"-disabled")]:{cursor:"not-allowed",color:e.colorTextDisabled}}),D=e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},H(e)),{background:e.defaultBg,borderColor:e.defaultBorderColor,color:e.defaultColor,boxShadow:e.defaultShadow}),F(e.componentCls,{color:e.colorPrimaryHover,borderColor:e.colorPrimaryHover},{color:e.colorPrimaryActive,borderColor:e.colorPrimaryActive})),z(e.componentCls,e.ghostBg,e.defaultGhostColor,e.defaultGhostBorderColor,e.colorTextDisabled,e.colorBorder)),{["&".concat(e.componentCls,"-dangerous")]:Object.assign(Object.assign(Object.assign({color:e.colorError,borderColor:e.colorError},F(e.componentCls,{color:e.colorErrorHover,borderColor:e.colorErrorBorderHover},{color:e.colorErrorActive,borderColor:e.colorErrorActive})),z(e.componentCls,e.ghostBg,e.colorError,e.colorError,e.colorTextDisabled,e.colorBorder)),_(e))}),W=e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},H(e)),{color:e.primaryColor,background:e.colorPrimary,boxShadow:e.primaryShadow}),F(e.componentCls,{color:e.colorTextLightSolid,background:e.colorPrimaryHover},{color:e.colorTextLightSolid,background:e.colorPrimaryActive})),z(e.componentCls,e.ghostBg,e.colorPrimary,e.colorPrimary,e.colorTextDisabled,e.colorBorder,{color:e.colorPrimaryHover,borderColor:e.colorPrimaryHover},{color:e.colorPrimaryActive,borderColor:e.colorPrimaryActive})),{["&".concat(e.componentCls,"-dangerous")]:Object.assign(Object.assign(Object.assign({background:e.colorError,boxShadow:e.dangerShadow,color:e.dangerColor},F(e.componentCls,{background:e.colorErrorHover},{background:e.colorErrorActive})),z(e.componentCls,e.ghostBg,e.colorError,e.colorError,e.colorTextDisabled,e.colorBorder,{color:e.colorErrorHover,borderColor:e.colorErrorHover},{color:e.colorErrorActive,borderColor:e.colorErrorActive})),_(e))}),V=e=>Object.assign(Object.assign({},D(e)),{borderStyle:"dashed"}),q=e=>Object.assign(Object.assign(Object.assign({color:e.colorLink},F(e.componentCls,{color:e.colorLinkHover,background:e.linkHoverBg},{color:e.colorLinkActive})),B(e)),{["&".concat(e.componentCls,"-dangerous")]:Object.assign(Object.assign({color:e.colorError},F(e.componentCls,{color:e.colorErrorHover},{color:e.colorErrorActive})),B(e))}),G=e=>Object.assign(Object.assign(Object.assign({},F(e.componentCls,{color:e.colorText,background:e.textHoverBg},{color:e.colorText,background:e.colorBgTextActive})),B(e)),{["&".concat(e.componentCls,"-dangerous")]:Object.assign(Object.assign({color:e.colorError},B(e)),F(e.componentCls,{color:e.colorErrorHover,background:e.colorErrorBg},{color:e.colorErrorHover,background:e.colorErrorBg}))}),X=e=>{let{componentCls:t}=e;return{["".concat(t,"-default")]:D(e),["".concat(t,"-primary")]:W(e),["".concat(t,"-dashed")]:V(e),["".concat(t,"-link")]:q(e),["".concat(t,"-text")]:G(e),["".concat(t,"-ghost")]:z(e.componentCls,e.ghostBg,e.colorBgContainer,e.colorBgContainer,e.colorTextDisabled,e.colorBorder)}},U=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",{componentCls:n,controlHeight:r,fontSize:o,lineHeight:a,borderRadius:i,buttonPaddingHorizontal:c,iconCls:l,buttonPaddingVertical:s}=e,u="".concat(n,"-icon-only");return[{["".concat(n).concat(t)]:{fontSize:o,lineHeight:a,height:r,padding:"".concat((0,C.bf)(s)," ").concat((0,C.bf)(c)),borderRadius:i,["&".concat(u)]:{width:r,paddingInlineStart:0,paddingInlineEnd:0,["&".concat(n,"-round")]:{width:"auto"},[l]:{fontSize:e.buttonIconOnlyFontSize}},["&".concat(n,"-loading")]:{opacity:e.opacityLoading,cursor:"default"},["".concat(n,"-loading-icon")]:{transition:"width ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,", opacity ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut)}}},{["".concat(n).concat(n,"-circle").concat(t)]:T(e)},{["".concat(n).concat(n,"-round").concat(t)]:A(e)}]},$=e=>U((0,O.TS)(e,{fontSize:e.contentFontSize,lineHeight:e.contentLineHeight})),K=e=>U((0,O.TS)(e,{controlHeight:e.controlHeightSM,fontSize:e.contentFontSizeSM,lineHeight:e.contentLineHeightSM,padding:e.paddingXS,buttonPaddingHorizontal:e.paddingInlineSM,buttonPaddingVertical:e.paddingBlockSM,borderRadius:e.borderRadiusSM,buttonIconOnlyFontSize:e.onlyIconSizeSM}),"".concat(e.componentCls,"-sm")),Y=e=>U((0,O.TS)(e,{controlHeight:e.controlHeightLG,fontSize:e.contentFontSizeLG,lineHeight:e.contentLineHeightLG,buttonPaddingHorizontal:e.paddingInlineLG,buttonPaddingVertical:e.paddingBlockLG,borderRadius:e.borderRadiusLG,buttonIconOnlyFontSize:e.onlyIconSizeLG}),"".concat(e.componentCls,"-lg")),Q=e=>{let{componentCls:t}=e;return{[t]:{["&".concat(t,"-block")]:{width:"100%"}}}};var J=(0,k.I$)("Button",e=>{let t=R(e);return[P(t),K(t),$(t),Y(t),Q(t),X(t),j(t)]},N,{unitless:{fontWeight:!0,contentLineHeight:!0,contentLineHeightSM:!0,contentLineHeightLG:!0}}),ee=n(17691);let et=e=>{let{componentCls:t,calc:n}=e;return{[t]:{["&-compact-item".concat(t,"-primary")]:{["&:not([disabled]) + ".concat(t,"-compact-item").concat(t,"-primary:not([disabled])")]:{position:"relative","&:before":{position:"absolute",top:n(e.lineWidth).mul(-1).equal(),insetInlineStart:n(e.lineWidth).mul(-1).equal(),display:"inline-block",width:e.lineWidth,height:"calc(100% + ".concat((0,C.bf)(e.lineWidth)," * 2)"),backgroundColor:e.colorPrimaryHover,content:'""'}}},"&-compact-vertical-item":{["&".concat(t,"-primary")]:{["&:not([disabled]) + ".concat(t,"-compact-vertical-item").concat(t,"-primary:not([disabled])")]:{position:"relative","&:before":{position:"absolute",top:n(e.lineWidth).mul(-1).equal(),insetInlineStart:n(e.lineWidth).mul(-1).equal(),display:"inline-block",width:"calc(100% + ".concat((0,C.bf)(e.lineWidth)," * 2)"),height:e.lineWidth,backgroundColor:e.colorPrimaryHover,content:'""'}}}}}}};var en=(0,k.bk)(["Button","compact"],e=>{let t=R(e);return[(0,ee.c)(t),function(e){var t;let n="".concat(e.componentCls,"-compact-vertical");return{[n]:Object.assign(Object.assign({},{["&-item:not(".concat(n,"-last-item)")]:{marginBottom:e.calc(e.lineWidth).mul(-1).equal()},"&-item":{"&:hover,&:focus,&:active":{zIndex:2},"&[disabled]":{zIndex:0}}}),(t=e.componentCls,{["&-item:not(".concat(n,"-first-item):not(").concat(n,"-last-item)")]:{borderRadius:0},["&-item".concat(n,"-first-item:not(").concat(n,"-last-item)")]:{["&, &".concat(t,"-sm, &").concat(t,"-lg")]:{borderEndEndRadius:0,borderEndStartRadius:0}},["&-item".concat(n,"-last-item:not(").concat(n,"-first-item)")]:{["&, &".concat(t,"-sm, &").concat(t,"-lg")]:{borderStartStartRadius:0,borderStartEndRadius:0}}}))}}(t),et(t)]},N),er=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};let eo=(0,r.forwardRef)((e,t)=>{var n,o;let{loading:p=!1,prefixCls:m,type:b="default",danger:y,shape:w="default",size:x,styles:E,disabled:C,className:Z,rootClassName:O,children:k,icon:M,ghost:j=!1,block:I=!1,htmlType:R="button",classNames:N,style:P={}}=e,F=er(e,["loading","prefixCls","type","danger","shape","size","styles","disabled","className","rootClassName","children","icon","ghost","block","htmlType","classNames","style"]),{getPrefixCls:T,autoInsertSpaceInButton:A,direction:L,button:z}=(0,r.useContext)(s.E_),_=T("btn",m),[H,B,D]=J(_),W=(0,r.useContext)(u.Z),V=null!=C?C:W,q=(0,r.useContext)(g),G=(0,r.useMemo)(()=>(function(e){if("object"==typeof e&&e){let t=null==e?void 0:e.delay;return{loading:(t=Number.isNaN(t)||"number"!=typeof t?0:t)<=0,delay:t}}return{loading:!!e,delay:0}})(p),[p]),[X,U]=(0,r.useState)(G.loading),[$,K]=(0,r.useState)(!1),Y=(0,r.createRef)(),Q=(0,c.sQ)(t,Y),ee=1===r.Children.count(k)&&!M&&!(0,h.Te)(b);(0,r.useEffect)(()=>{let e=null;return G.delay>0?e=setTimeout(()=>{e=null,U(!0)},G.delay):U(G.loading),function(){e&&(clearTimeout(e),e=null)}},[G]),(0,r.useEffect)(()=>{if(!Q||!Q.current||!1===A)return;let e=Q.current.textContent;ee&&(0,h.aG)(e)?$||K(!0):$&&K(!1)},[Q]);let et=t=>{let{onClick:n}=e;if(X||V){t.preventDefault();return}null==n||n(t)},eo=!1!==A,{compactSize:ea,compactItemClassnames:ei}=(0,f.ri)(_,L),ec=(0,d.Z)(e=>{var t,n;return null!==(n=null!==(t=null!=x?x:ea)&&void 0!==t?t:q)&&void 0!==n?n:e}),el=ec&&({large:"lg",small:"sm",middle:void 0})[ec]||"",es=X?"loading":M,eu=(0,i.Z)(F,["navigate"]),ed=a()(_,B,D,{["".concat(_,"-").concat(w)]:"default"!==w&&w,["".concat(_,"-").concat(b)]:b,["".concat(_,"-").concat(el)]:el,["".concat(_,"-icon-only")]:!k&&0!==k&&!!es,["".concat(_,"-background-ghost")]:j&&!(0,h.Te)(b),["".concat(_,"-loading")]:X,["".concat(_,"-two-chinese-chars")]:$&&eo&&!X,["".concat(_,"-block")]:I,["".concat(_,"-dangerous")]:!!y,["".concat(_,"-rtl")]:"rtl"===L},ei,Z,O,null==z?void 0:z.className),ef=Object.assign(Object.assign({},null==z?void 0:z.style),P),ep=a()(null==N?void 0:N.icon,null===(n=null==z?void 0:z.classNames)||void 0===n?void 0:n.icon),em=Object.assign(Object.assign({},(null==E?void 0:E.icon)||{}),(null===(o=null==z?void 0:z.styles)||void 0===o?void 0:o.icon)||{}),eg=M&&!X?r.createElement(v,{prefixCls:_,className:ep,style:em},M):r.createElement(S,{existIcon:!!M,prefixCls:_,loading:!!X}),eh=k||0===k?(0,h.hU)(k,ee&&eo):null;if(void 0!==eu.href)return H(r.createElement("a",Object.assign({},eu,{className:a()(ed,{["".concat(_,"-disabled")]:V}),href:V?void 0:eu.href,style:ef,onClick:et,ref:Q,tabIndex:V?-1:0}),eg,eh));let ev=r.createElement("button",Object.assign({},F,{type:R,className:ed,style:ef,onClick:et,disabled:V,ref:Q}),eg,eh,!!ei&&r.createElement(en,{key:"compact",prefixCls:_}));return(0,h.Te)(b)||(ev=r.createElement(l.Z,{component:"Button",disabled:!!X},ev)),H(ev)});eo.Group=e=>{let{getPrefixCls:t,direction:n}=r.useContext(s.E_),{prefixCls:o,size:i,className:c}=e,l=m(e,["prefixCls","size","className"]),u=t("btn-group",o),[,,d]=(0,p.ZP)(),f="";switch(i){case"large":f="lg";break;case"small":f="sm"}let h=a()(u,{["".concat(u,"-").concat(f)]:f,["".concat(u,"-rtl")]:"rtl"===n},c,d);return r.createElement(g.Provider,{value:i},r.createElement("div",Object.assign({},l,{className:h})))},eo.__ANT_BUTTON=!0;var ea=eo},86586:function(e,t,n){"use strict";n.d(t,{n:function(){return a}});var r=n(2265);let o=r.createContext(!1),a=e=>{let{children:t,disabled:n}=e,a=r.useContext(o);return r.createElement(o.Provider,{value:null!=n?n:a},t)};t.Z=o},59189:function(e,t,n){"use strict";n.d(t,{q:function(){return a}});var r=n(2265);let o=r.createContext(void 0),a=e=>{let{children:t,size:n}=e,a=r.useContext(o);return r.createElement(o.Provider,{value:n||a},t)};t.Z=o},71744:function(e,t,n){"use strict";n.d(t,{E_:function(){return a},oR:function(){return o}});var r=n(2265);let o="anticon",a=r.createContext({getPrefixCls:(e,t)=>t||(e?"ant-".concat(e):"ant"),iconPrefixCls:o}),{Consumer:i}=a},91086:function(e,t,n){"use strict";var r=n(2265),o=n(71744),a=n(85180);t.Z=e=>{let{componentName:t}=e,{getPrefixCls:n}=(0,r.useContext)(o.E_),i=n("empty");switch(t){case"Table":case"List":return r.createElement(a.Z,{image:a.Z.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return r.createElement(a.Z,{image:a.Z.PRESENTED_IMAGE_SIMPLE,className:"".concat(i,"-small")});default:return r.createElement(a.Z,null)}}},64024:function(e,t,n){"use strict";var r=n(29961);t.Z=e=>{let[,,,,t]=(0,r.ZP)();return t?"".concat(e,"-css-var"):""}},33759:function(e,t,n){"use strict";var r=n(2265),o=n(59189);t.Z=e=>{let t=r.useContext(o.Z);return r.useMemo(()=>e?"string"==typeof e?null!=e?e:t:e instanceof Function?e(t):t:t,[e,t])}},13959:function(e,t,n){"use strict";let r,o,a,i;n.d(t,{ZP:function(){return V},w6:function(){return B}});var c=n(2265),l=n.t(c,2),s=n(352),u=n(20902),d=n(6397),f=n(23789),p=n(13613),m=n(77360),g=n(92246),h=n(91325),v=e=>{let{locale:t={},children:n,_ANT_MARK__:r}=e;c.useEffect(()=>(0,g.f)(t&&t.Modal),[t]);let o=c.useMemo(()=>Object.assign(Object.assign({},t),{exist:!0}),[t]);return c.createElement(h.Z.Provider,{value:o},n)},b=n(13823),y=n(37516),w=n(70774),x=n(71744),E=n(31373),S=n(36360),C=n(94981),Z=n(21717);let O="-ant-".concat(Date.now(),"-").concat(Math.random());var k=n(86586),M=n(59189),j=n(16671);let{useId:I}=Object.assign({},l);var R=void 0===I?()=>"":I,N=n(47970),P=n(29961);function F(e){let{children:t}=e,[,n]=(0,P.ZP)(),{motion:r}=n,o=c.useRef(!1);return(o.current=o.current||!1===r,o.current)?c.createElement(N.zt,{motion:r},t):t}var T=()=>null,A=n(36198),L=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};let z=["getTargetContainer","getPopupContainer","renderEmpty","pageHeader","input","pagination","form","select","button"];function _(){return r||"ant"}function H(){return o||x.oR}let B=()=>({getPrefixCls:(e,t)=>t||(e?"".concat(_(),"-").concat(e):_()),getIconPrefixCls:H,getRootPrefixCls:()=>r||_(),getTheme:()=>a,holderRender:i}),D=e=>{let{children:t,csp:n,autoInsertSpaceInButton:r,alert:o,anchor:a,form:i,locale:l,componentSize:g,direction:h,space:E,virtual:S,dropdownMatchSelectWidth:C,popupMatchSelectWidth:Z,popupOverflow:O,legacyLocale:I,parentContext:N,iconPrefixCls:P,theme:_,componentDisabled:H,segmented:B,statistic:D,spin:W,calendar:V,carousel:q,cascader:G,collapse:X,typography:U,checkbox:$,descriptions:K,divider:Y,drawer:Q,skeleton:J,steps:ee,image:et,layout:en,list:er,mentions:eo,modal:ea,progress:ei,result:ec,slider:el,breadcrumb:es,menu:eu,pagination:ed,input:ef,empty:ep,badge:em,radio:eg,rate:eh,switch:ev,transfer:eb,avatar:ey,message:ew,tag:ex,table:eE,card:eS,tabs:eC,timeline:eZ,timePicker:eO,upload:ek,notification:eM,tree:ej,colorPicker:eI,datePicker:eR,rangePicker:eN,flex:eP,wave:eF,dropdown:eT,warning:eA}=e,eL=c.useCallback((t,n)=>{let{prefixCls:r}=e;if(n)return n;let o=r||N.getPrefixCls("");return t?"".concat(o,"-").concat(t):o},[N.getPrefixCls,e.prefixCls]),ez=P||N.iconPrefixCls||x.oR,e_=n||N.csp;(0,A.Z)(ez,e_);let eH=function(e,t){(0,p.ln)("ConfigProvider");let n=e||{},r=!1!==n.inherit&&t?t:y.u_,o=R();return(0,d.Z)(()=>{var a,i;if(!e)return t;let c=Object.assign({},r.components);Object.keys(e.components||{}).forEach(t=>{c[t]=Object.assign(Object.assign({},c[t]),e.components[t])});let l="css-var-".concat(o.replace(/:/g,"")),s=(null!==(a=n.cssVar)&&void 0!==a?a:r.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:"ant"},"object"==typeof r.cssVar?r.cssVar:{}),"object"==typeof n.cssVar?n.cssVar:{}),{key:"object"==typeof n.cssVar&&(null===(i=n.cssVar)||void 0===i?void 0:i.key)||l});return Object.assign(Object.assign(Object.assign({},r),n),{token:Object.assign(Object.assign({},r.token),n.token),components:c,cssVar:s})},[n,r],(e,t)=>e.some((e,n)=>{let r=t[n];return!(0,j.Z)(e,r,!0)}))}(_,N.theme),eB={csp:e_,autoInsertSpaceInButton:r,alert:o,anchor:a,locale:l||I,direction:h,space:E,virtual:S,popupMatchSelectWidth:null!=Z?Z:C,popupOverflow:O,getPrefixCls:eL,iconPrefixCls:ez,theme:eH,segmented:B,statistic:D,spin:W,calendar:V,carousel:q,cascader:G,collapse:X,typography:U,checkbox:$,descriptions:K,divider:Y,drawer:Q,skeleton:J,steps:ee,image:et,input:ef,layout:en,list:er,mentions:eo,modal:ea,progress:ei,result:ec,slider:el,breadcrumb:es,menu:eu,pagination:ed,empty:ep,badge:em,radio:eg,rate:eh,switch:ev,transfer:eb,avatar:ey,message:ew,tag:ex,table:eE,card:eS,tabs:eC,timeline:eZ,timePicker:eO,upload:ek,notification:eM,tree:ej,colorPicker:eI,datePicker:eR,rangePicker:eN,flex:eP,wave:eF,dropdown:eT,warning:eA},eD=Object.assign({},N);Object.keys(eB).forEach(e=>{void 0!==eB[e]&&(eD[e]=eB[e])}),z.forEach(t=>{let n=e[t];n&&(eD[t]=n)});let eW=(0,d.Z)(()=>eD,eD,(e,t)=>{let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length||n.some(n=>e[n]!==t[n])}),eV=c.useMemo(()=>({prefixCls:ez,csp:e_}),[ez,e_]),eq=c.createElement(c.Fragment,null,c.createElement(T,{dropdownMatchSelectWidth:C}),t),eG=c.useMemo(()=>{var e,t,n,r;return(0,f.T)((null===(e=b.Z.Form)||void 0===e?void 0:e.defaultValidateMessages)||{},(null===(n=null===(t=eW.locale)||void 0===t?void 0:t.Form)||void 0===n?void 0:n.defaultValidateMessages)||{},(null===(r=eW.form)||void 0===r?void 0:r.validateMessages)||{},(null==i?void 0:i.validateMessages)||{})},[eW,null==i?void 0:i.validateMessages]);Object.keys(eG).length>0&&(eq=c.createElement(m.Z.Provider,{value:eG},eq)),l&&(eq=c.createElement(v,{locale:l,_ANT_MARK__:"internalMark"},eq)),(ez||e_)&&(eq=c.createElement(u.Z.Provider,{value:eV},eq)),g&&(eq=c.createElement(M.q,{size:g},eq)),eq=c.createElement(F,null,eq);let eX=c.useMemo(()=>{let e=eH||{},{algorithm:t,token:n,components:r,cssVar:o}=e,a=L(e,["algorithm","token","components","cssVar"]),i=t&&(!Array.isArray(t)||t.length>0)?(0,s.jG)(t):y.uH,c={};Object.entries(r||{}).forEach(e=>{let[t,n]=e,r=Object.assign({},n);"algorithm"in r&&(!0===r.algorithm?r.theme=i:(Array.isArray(r.algorithm)||"function"==typeof r.algorithm)&&(r.theme=(0,s.jG)(r.algorithm)),delete r.algorithm),c[t]=r});let l=Object.assign(Object.assign({},w.Z),n);return Object.assign(Object.assign({},a),{theme:i,token:l,components:c,override:Object.assign({override:l},c),cssVar:o})},[eH]);return _&&(eq=c.createElement(y.Mj.Provider,{value:eX},eq)),eW.warning&&(eq=c.createElement(p.G8.Provider,{value:eW.warning},eq)),void 0!==H&&(eq=c.createElement(k.n,{disabled:H},eq)),c.createElement(x.E_.Provider,{value:eW},eq)},W=e=>{let t=c.useContext(x.E_),n=c.useContext(h.Z);return c.createElement(D,Object.assign({parentContext:t,legacyLocale:n},e))};W.ConfigContext=x.E_,W.SizeContext=M.Z,W.config=e=>{let{prefixCls:t,iconPrefixCls:n,theme:c,holderRender:l}=e;void 0!==t&&(r=t),void 0!==n&&(o=n),"holderRender"in e&&(i=l),c&&(Object.keys(c).some(e=>e.endsWith("Color"))?function(e,t){let n=function(e,t){let n={},r=(e,t)=>{let n=e.clone();return(n=(null==t?void 0:t(n))||n).toRgbString()},o=(e,t)=>{let o=new S.C(e),a=(0,E.R_)(o.toRgbString());n["".concat(t,"-color")]=r(o),n["".concat(t,"-color-disabled")]=a[1],n["".concat(t,"-color-hover")]=a[4],n["".concat(t,"-color-active")]=a[6],n["".concat(t,"-color-outline")]=o.clone().setAlpha(.2).toRgbString(),n["".concat(t,"-color-deprecated-bg")]=a[0],n["".concat(t,"-color-deprecated-border")]=a[2]};if(t.primaryColor){o(t.primaryColor,"primary");let e=new S.C(t.primaryColor),a=(0,E.R_)(e.toRgbString());a.forEach((e,t)=>{n["primary-".concat(t+1)]=e}),n["primary-color-deprecated-l-35"]=r(e,e=>e.lighten(35)),n["primary-color-deprecated-l-20"]=r(e,e=>e.lighten(20)),n["primary-color-deprecated-t-20"]=r(e,e=>e.tint(20)),n["primary-color-deprecated-t-50"]=r(e,e=>e.tint(50)),n["primary-color-deprecated-f-12"]=r(e,e=>e.setAlpha(.12*e.getAlpha()));let i=new S.C(a[0]);n["primary-color-active-deprecated-f-30"]=r(i,e=>e.setAlpha(.3*e.getAlpha())),n["primary-color-active-deprecated-d-02"]=r(i,e=>e.darken(2))}t.successColor&&o(t.successColor,"success"),t.warningColor&&o(t.warningColor,"warning"),t.errorColor&&o(t.errorColor,"error"),t.infoColor&&o(t.infoColor,"info");let a=Object.keys(n).map(t=>"--".concat(e,"-").concat(t,": ").concat(n[t],";"));return"\n :root {\n ".concat(a.join("\n"),"\n }\n ").trim()}(e,t);(0,C.Z)()&&(0,Z.hq)(n,"".concat(O,"-dynamic-theme"))}(_(),c):a=c)},W.useConfig=function(){return{componentDisabled:(0,c.useContext)(k.Z),componentSize:(0,c.useContext)(M.Z)}},Object.defineProperty(W,"SizeContext",{get:()=>M.Z});var V=W},85180:function(e,t,n){"use strict";n.d(t,{Z:function(){return b}});var r=n(36760),o=n.n(r),a=n(2265),i=n(71744),c=n(55274),l=n(36360),s=n(29961),u=n(80669),d=n(3104);let f=e=>{let{componentCls:t,margin:n,marginXS:r,marginXL:o,fontSize:a,lineHeight:i}=e;return{[t]:{marginInline:r,fontSize:a,lineHeight:i,textAlign:"center",["".concat(t,"-image")]:{height:e.emptyImgHeight,marginBottom:r,opacity:e.opacityImage,img:{height:"100%"},svg:{maxWidth:"100%",height:"100%",margin:"auto"}},["".concat(t,"-description")]:{color:e.colorText},["".concat(t,"-footer")]:{marginTop:n},"&-normal":{marginBlock:o,color:e.colorTextDisabled,["".concat(t,"-description")]:{color:e.colorTextDisabled},["".concat(t,"-image")]:{height:e.emptyImgHeightMD}},"&-small":{marginBlock:r,color:e.colorTextDisabled,["".concat(t,"-image")]:{height:e.emptyImgHeightSM}}}}};var p=(0,u.I$)("Empty",e=>{let{componentCls:t,controlHeightLG:n,calc:r}=e;return[f((0,d.TS)(e,{emptyImgCls:"".concat(t,"-img"),emptyImgHeight:r(n).mul(2.5).equal(),emptyImgHeightMD:n,emptyImgHeightSM:r(n).mul(.875).equal()}))]}),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};let g=a.createElement(()=>{let[,e]=(0,s.ZP)(),t=new l.C(e.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return a.createElement("svg",{style:t,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},a.createElement("g",{fill:"none",fillRule:"evenodd"},a.createElement("g",{transform:"translate(24 31.67)"},a.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),a.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),a.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),a.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),a.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),a.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),a.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},a.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),a.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))},null),h=a.createElement(()=>{let[,e]=(0,s.ZP)(),{colorFill:t,colorFillTertiary:n,colorFillQuaternary:r,colorBgContainer:o}=e,{borderColor:i,shadowColor:c,contentColor:u}=(0,a.useMemo)(()=>({borderColor:new l.C(t).onBackground(o).toHexShortString(),shadowColor:new l.C(n).onBackground(o).toHexShortString(),contentColor:new l.C(r).onBackground(o).toHexShortString()}),[t,n,r,o]);return a.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},a.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},a.createElement("ellipse",{fill:c,cx:"32",cy:"33",rx:"32",ry:"7"}),a.createElement("g",{fillRule:"nonzero",stroke:i},a.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),a.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:u}))))},null),v=e=>{var{className:t,rootClassName:n,prefixCls:r,image:l=g,description:s,children:u,imageStyle:d,style:f}=e,v=m(e,["className","rootClassName","prefixCls","image","description","children","imageStyle","style"]);let{getPrefixCls:b,direction:y,empty:w}=a.useContext(i.E_),x=b("empty",r),[E,S,C]=p(x),[Z]=(0,c.Z)("Empty"),O=void 0!==s?s:null==Z?void 0:Z.description,k=null;return k="string"==typeof l?a.createElement("img",{alt:"string"==typeof O?O:"empty",src:l}):l,E(a.createElement("div",Object.assign({className:o()(S,C,x,null==w?void 0:w.className,{["".concat(x,"-normal")]:l===h,["".concat(x,"-rtl")]:"rtl"===y},t,n),style:Object.assign(Object.assign({},null==w?void 0:w.style),f)},v),a.createElement("div",{className:"".concat(x,"-image"),style:d},k),O&&a.createElement("div",{className:"".concat(x,"-description")},O),u&&a.createElement("div",{className:"".concat(x,"-footer")},u)))};v.PRESENTED_IMAGE_DEFAULT=g,v.PRESENTED_IMAGE_SIMPLE=h;var b=v},14605:function(e,t,n){"use strict";var r=n(83145),o=n(36760),a=n.n(o),i=n(47970),c=n(2265),l=n(68710),s=n(39109),u=n(4064),d=n(47713),f=n(64024);let p=[];function m(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return{key:"string"==typeof e?e:"".concat(t,"-").concat(r),error:e,errorStatus:n}}t.Z=e=>{let{help:t,helpStatus:n,errors:o=p,warnings:g=p,className:h,fieldId:v,onVisibleChanged:b}=e,{prefixCls:y}=c.useContext(s.Rk),w="".concat(y,"-item-explain"),x=(0,f.Z)(y),[E,S,C]=(0,d.ZP)(y,x),Z=(0,c.useMemo)(()=>(0,l.Z)(y),[y]),O=(0,u.Z)(o),k=(0,u.Z)(g),M=c.useMemo(()=>null!=t?[m(t,"help",n)]:[].concat((0,r.Z)(O.map((e,t)=>m(e,"error","error",t))),(0,r.Z)(k.map((e,t)=>m(e,"warning","warning",t)))),[t,n,O,k]),j={};return v&&(j.id="".concat(v,"_help")),E(c.createElement(i.ZP,{motionDeadline:Z.motionDeadline,motionName:"".concat(y,"-show-help"),visible:!!M.length,onVisibleChanged:b},e=>{let{className:t,style:n}=e;return c.createElement("div",Object.assign({},j,{className:a()(w,t,C,x,h,S),style:n,role:"alert"}),c.createElement(i.V4,Object.assign({keys:M},(0,l.Z)(y),{motionName:"".concat(y,"-show-help-item"),component:!1}),e=>{let{key:t,error:n,errorStatus:r,className:o,style:i}=e;return c.createElement("div",{key:t,className:a()(o,{["".concat(w,"-").concat(r)]:r}),style:i},n)}))}))}},38994:function(e,t,n){"use strict";n.d(t,{Z:function(){return U}});var r=n(83145),o=n(2265),a=n(36760),i=n.n(a),c=n(64834),l=n(69819),s=n(28791),u=n(19722),d=n(13613),f=n(71744),p=n(64024),m=n(39109),g=n(45287);let h=()=>{let{status:e,errors:t=[],warnings:n=[]}=(0,o.useContext)(m.aM);return{status:e,errors:t,warnings:n}};h.Context=m.aM;var v=n(53346),b=n(47713),y=n(13861),w=n(2857),x=n(27380),E=n(18694),S=n(10295),C=n(54998),Z=n(14605),O=n(80669);let k=e=>{let{formItemCls:t}=e;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{["".concat(t,"-control")]:{display:"flex"}}}};var M=(0,O.bk)(["Form","item-item"],(e,t)=>{let{rootPrefixCls:n}=t;return[k((0,b.B4)(e,n))]}),j=e=>{let{prefixCls:t,status:n,wrapperCol:r,children:a,errors:c,warnings:l,_internalItemRender:s,extra:u,help:d,fieldId:f,marginBottom:p,onErrorVisibleChanged:g}=e,h="".concat(t,"-item"),v=o.useContext(m.q3),b=r||v.wrapperCol||{},y=i()("".concat(h,"-control"),b.className),w=o.useMemo(()=>Object.assign({},v),[v]);delete w.labelCol,delete w.wrapperCol;let x=o.createElement("div",{className:"".concat(h,"-control-input")},o.createElement("div",{className:"".concat(h,"-control-input-content")},a)),E=o.useMemo(()=>({prefixCls:t,status:n}),[t,n]),S=null!==p||c.length||l.length?o.createElement("div",{style:{display:"flex",flexWrap:"nowrap"}},o.createElement(m.Rk.Provider,{value:E},o.createElement(Z.Z,{fieldId:f,errors:c,warnings:l,help:d,helpStatus:n,className:"".concat(h,"-explain-connected"),onVisibleChanged:g})),!!p&&o.createElement("div",{style:{width:0,height:p}})):null,O={};f&&(O.id="".concat(f,"_extra"));let k=u?o.createElement("div",Object.assign({},O,{className:"".concat(h,"-extra")}),u):null,j=s&&"pro_table_render"===s.mark&&s.render?s.render(e,{input:x,errorList:S,extra:k}):o.createElement(o.Fragment,null,x,S,k);return o.createElement(m.q3.Provider,{value:w},o.createElement(C.Z,Object.assign({},b,{className:y}),j),o.createElement(M,{prefixCls:t}))},I=n(67187),R=n(13823),N=n(55274),P=n(89970),F=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},T=e=>{var t;let{prefixCls:n,label:r,htmlFor:a,labelCol:c,labelAlign:l,colon:s,required:u,requiredMark:d,tooltip:f}=e,[p]=(0,N.Z)("Form"),{vertical:g,labelAlign:h,labelCol:v,labelWrap:b,colon:y}=o.useContext(m.q3);if(!r)return null;let w=c||v||{},x="".concat(n,"-item-label"),E=i()(x,"left"===(l||h)&&"".concat(x,"-left"),w.className,{["".concat(x,"-wrap")]:!!b}),S=r,Z=!0===s||!1!==y&&!1!==s;Z&&!g&&"string"==typeof r&&""!==r.trim()&&(S=r.replace(/[:|:]\s*$/,""));let O=f?"object"!=typeof f||o.isValidElement(f)?{title:f}:f:null;if(O){let{icon:e=o.createElement(I.Z,null)}=O,t=F(O,["icon"]),r=o.createElement(P.Z,Object.assign({},t),o.cloneElement(e,{className:"".concat(n,"-item-tooltip"),title:"",onClick:e=>{e.preventDefault()},tabIndex:null}));S=o.createElement(o.Fragment,null,S,r)}let k="optional"===d,M="function"==typeof d;M?S=d(S,{required:!!u}):k&&!u&&(S=o.createElement(o.Fragment,null,S,o.createElement("span",{className:"".concat(n,"-item-optional"),title:""},(null==p?void 0:p.optional)||(null===(t=R.Z.Form)||void 0===t?void 0:t.optional))));let j=i()({["".concat(n,"-item-required")]:u,["".concat(n,"-item-required-mark-optional")]:k||M,["".concat(n,"-item-no-colon")]:!Z});return o.createElement(C.Z,Object.assign({},w,{className:E}),o.createElement("label",{htmlFor:a,className:j,title:"string"==typeof r?r:""},S))},A=n(4064),L=n(8900),z=n(39725),_=n(54537),H=n(61935);let B={success:L.Z,warning:_.Z,error:z.Z,validating:H.Z};function D(e){let{children:t,errors:n,warnings:r,hasFeedback:a,validateStatus:c,prefixCls:l,meta:s,noStyle:u}=e,d="".concat(l,"-item"),{feedbackIcons:f}=o.useContext(m.q3),p=(0,y.lR)(n,r,s,null,!!a,c),{isFormItemInput:g,status:h,hasFeedback:v,feedbackIcon:b}=o.useContext(m.aM),w=o.useMemo(()=>{var e;let t;if(a){let c=!0!==a&&a.icons||f,l=p&&(null===(e=null==c?void 0:c({status:p,errors:n,warnings:r}))||void 0===e?void 0:e[p]),s=p&&B[p];t=!1!==l&&s?o.createElement("span",{className:i()("".concat(d,"-feedback-icon"),"".concat(d,"-feedback-icon-").concat(p))},l||o.createElement(s,null)):null}let c={status:p||"",errors:n,warnings:r,hasFeedback:!!a,feedbackIcon:t,isFormItemInput:!0};return u&&(c.status=(null!=p?p:h)||"",c.isFormItemInput=g,c.hasFeedback=!!(null!=a?a:v),c.feedbackIcon=void 0!==a?c.feedbackIcon:b),c},[p,a,u,g,h]);return o.createElement(m.aM.Provider,{value:w},t)}var W=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};function V(e){let{prefixCls:t,className:n,rootClassName:r,style:a,help:c,errors:l,warnings:s,validateStatus:u,meta:d,hasFeedback:f,hidden:p,children:g,fieldId:h,required:v,isRequired:b,onSubItemMetaChange:C}=e,Z=W(e,["prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange"]),O="".concat(t,"-item"),{requiredMark:k}=o.useContext(m.q3),M=o.useRef(null),I=(0,A.Z)(l),R=(0,A.Z)(s),N=null!=c,P=!!(N||l.length||s.length),F=!!M.current&&(0,w.Z)(M.current),[L,z]=o.useState(null);(0,x.Z)(()=>{P&&M.current&&z(parseInt(getComputedStyle(M.current).marginBottom,10))},[P,F]);let _=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=e?I:d.errors,n=e?R:d.warnings;return(0,y.lR)(t,n,d,"",!!f,u)}(),H=i()(O,n,r,{["".concat(O,"-with-help")]:N||I.length||R.length,["".concat(O,"-has-feedback")]:_&&f,["".concat(O,"-has-success")]:"success"===_,["".concat(O,"-has-warning")]:"warning"===_,["".concat(O,"-has-error")]:"error"===_,["".concat(O,"-is-validating")]:"validating"===_,["".concat(O,"-hidden")]:p});return o.createElement("div",{className:H,style:a,ref:M},o.createElement(S.Z,Object.assign({className:"".concat(O,"-row")},(0,E.Z)(Z,["_internalItemRender","colon","dependencies","extra","fieldKey","getValueFromEvent","getValueProps","htmlFor","id","initialValue","isListField","label","labelAlign","labelCol","labelWrap","messageVariables","name","normalize","noStyle","preserve","requiredMark","rules","shouldUpdate","trigger","tooltip","validateFirst","validateTrigger","valuePropName","wrapperCol","validateDebounce"])),o.createElement(T,Object.assign({htmlFor:h},e,{requiredMark:k,required:null!=v?v:b,prefixCls:t})),o.createElement(j,Object.assign({},e,d,{errors:I,warnings:R,prefixCls:t,status:_,help:c,marginBottom:L,onErrorVisibleChanged:e=>{e||z(null)}}),o.createElement(m.qI.Provider,{value:C},o.createElement(D,{prefixCls:t,meta:d,errors:d.errors,warnings:d.warnings,hasFeedback:f,validateStatus:_},g)))),!!L&&o.createElement("div",{className:"".concat(O,"-margin-offset"),style:{marginBottom:-L}}))}let q=o.memo(e=>{let{children:t}=e;return t},(e,t)=>(function(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>{let r=e[n],o=t[n];return r===o||"function"==typeof r||"function"==typeof o})})(e.control,t.control)&&e.update===t.update&&e.childProps.length===t.childProps.length&&e.childProps.every((e,n)=>e===t.childProps[n]));function G(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}let X=function(e){let{name:t,noStyle:n,className:a,dependencies:h,prefixCls:w,shouldUpdate:x,rules:E,children:S,required:C,label:Z,messageVariables:O,trigger:k="onChange",validateTrigger:M,hidden:j,help:I}=e,{getPrefixCls:R}=o.useContext(f.E_),{name:N}=o.useContext(m.q3),P=function(e){if("function"==typeof e)return e;let t=(0,g.Z)(e);return t.length<=1?t[0]:t}(S),F="function"==typeof P,T=o.useContext(m.qI),{validateTrigger:A}=o.useContext(c.zb),L=void 0!==M?M:A,z=null!=t,_=R("form",w),H=(0,p.Z)(_),[B,W,X]=(0,b.ZP)(_,H);(0,d.ln)("Form.Item");let U=o.useContext(c.ZM),$=o.useRef(),[K,Y]=function(e){let[t,n]=o.useState(e),r=(0,o.useRef)(null),a=(0,o.useRef)([]),i=(0,o.useRef)(!1);return o.useEffect(()=>(i.current=!1,()=>{i.current=!0,v.Z.cancel(r.current),r.current=null}),[]),[t,function(e){i.current||(null===r.current&&(a.current=[],r.current=(0,v.Z)(()=>{r.current=null,n(e=>{let t=e;return a.current.forEach(e=>{t=e(t)}),t})})),a.current.push(e))}]}({}),[Q,J]=(0,l.Z)(()=>G()),ee=(e,t)=>{Y(n=>{let o=Object.assign({},n),a=[].concat((0,r.Z)(e.name.slice(0,-1)),(0,r.Z)(t)).join("__SPLIT__");return e.destroy?delete o[a]:o[a]=e,o})},[et,en]=o.useMemo(()=>{let e=(0,r.Z)(Q.errors),t=(0,r.Z)(Q.warnings);return Object.values(K).forEach(n=>{e.push.apply(e,(0,r.Z)(n.errors||[])),t.push.apply(t,(0,r.Z)(n.warnings||[]))}),[e,t]},[K,Q.errors,Q.warnings]),er=function(){let{itemRef:e}=o.useContext(m.q3),t=o.useRef({});return function(n,r){let o=r&&"object"==typeof r&&r.ref,a=n.join("_");return(t.current.name!==a||t.current.originRef!==o)&&(t.current.name=a,t.current.originRef=o,t.current.ref=(0,s.sQ)(e(n),o)),t.current.ref}}();function eo(t,r,c){return n&&!j?o.createElement(D,{prefixCls:_,hasFeedback:e.hasFeedback,validateStatus:e.validateStatus,meta:Q,errors:et,warnings:en,noStyle:!0},t):o.createElement(V,Object.assign({key:"row"},e,{className:i()(a,X,H,W),prefixCls:_,fieldId:r,isRequired:c,errors:et,warnings:en,meta:Q,onSubItemMetaChange:ee}),t)}if(!z&&!F&&!h)return B(eo(P));let ea={};return"string"==typeof Z?ea.label=Z:t&&(ea.label=String(t)),O&&(ea=Object.assign(Object.assign({},ea),O)),B(o.createElement(c.gN,Object.assign({},e,{messageVariables:ea,trigger:k,validateTrigger:L,onMetaChange:e=>{let t=null==U?void 0:U.getKey(e.name);if(J(e.destroy?G():e,!0),n&&!1!==I&&T){let n=e.name;if(e.destroy)n=$.current||n;else if(void 0!==t){let[e,o]=t;n=[e].concat((0,r.Z)(o)),$.current=n}T(e,n)}}}),(n,a,i)=>{let c=(0,y.qo)(t).length&&a?a.name:[],l=(0,y.dD)(c,N),d=void 0!==C?C:!!(E&&E.some(e=>{if(e&&"object"==typeof e&&e.required&&!e.warningOnly)return!0;if("function"==typeof e){let t=e(i);return t&&t.required&&!t.warningOnly}return!1})),f=Object.assign({},n),p=null;if(Array.isArray(P)&&z)p=P;else if(F&&(!(x||h)||z));else if(!h||F||z){if((0,u.l$)(P)){let t=Object.assign(Object.assign({},P.props),f);if(t.id||(t.id=l),I||et.length>0||en.length>0||e.extra){let n=[];(I||et.length>0)&&n.push("".concat(l,"_help")),e.extra&&n.push("".concat(l,"_extra")),t["aria-describedby"]=n.join(" ")}et.length>0&&(t["aria-invalid"]="true"),d&&(t["aria-required"]="true"),(0,s.Yr)(P)&&(t.ref=er(c,P)),new Set([].concat((0,r.Z)((0,y.qo)(k)),(0,r.Z)((0,y.qo)(L)))).forEach(e=>{t[e]=function(){for(var t,n,r,o=arguments.length,a=Array(o),i=0;i{}}),c=r.createContext(null),l=e=>{let t=(0,a.Z)(e,["prefixCls"]);return r.createElement(o.RV,Object.assign({},t))},s=r.createContext({prefixCls:""}),u=r.createContext({}),d=e=>{let{children:t,status:n,override:o}=e,a=(0,r.useContext)(u),i=(0,r.useMemo)(()=>{let e=Object.assign({},a);return o&&delete e.isFormItemInput,n&&(delete e.status,delete e.hasFeedback,delete e.feedbackIcon),e},[n,o,a]);return r.createElement(u.Provider,{value:i},t)},f=(0,r.createContext)(void 0)},4064:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);function o(e){let[t,n]=r.useState(e);return r.useEffect(()=>{let t=setTimeout(()=>{n(e)},e.length?0:10);return()=>{clearTimeout(t)}},[e]),t}},56250:function(e,t,n){"use strict";var r=n(2265),o=n(39109);let a=["outlined","borderless","filled"];t.Z=function(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=(0,r.useContext)(o.pg);t=void 0!==e?e:!1===n?"borderless":null!=i?i:"outlined";let c=a.includes(t);return[t,c]}},13634:function(e,t,n){"use strict";n.d(t,{Z:function(){return I}});var r=n(14605),o=n(2265),a=n(36760),i=n.n(a),c=n(64834),l=n(71744),s=n(86586),u=n(64024),d=n(33759),f=n(59189),p=n(39109);let m=e=>"object"==typeof e&&null!=e&&1===e.nodeType,g=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,h=(e,t)=>{if(e.clientHeight{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeightat||a>e&&i=t&&c>=n?a-e-r:i>t&&cn?i-t+o:0,b=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},y=(e,t)=>{var n,r,o,a;if("undefined"==typeof document)return[];let{scrollMode:i,block:c,inline:l,boundary:s,skipOverflowHiddenElements:u}=t,d="function"==typeof s?s:e=>e!==s;if(!m(e))throw TypeError("Invalid target");let f=document.scrollingElement||document.documentElement,p=[],g=e;for(;m(g)&&d(g);){if((g=b(g))===f){p.push(g);break}null!=g&&g===document.body&&h(g)&&!h(document.documentElement)||null!=g&&h(g,u)&&p.push(g)}let y=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,w=null!=(a=null==(o=window.visualViewport)?void 0:o.height)?a:innerHeight,{scrollX:x,scrollY:E}=window,{height:S,width:C,top:Z,right:O,bottom:k,left:M}=e.getBoundingClientRect(),{top:j,right:I,bottom:R,left:N}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),P="start"===c||"nearest"===c?Z-j:"end"===c?k+R:Z+S/2-j+R,F="center"===l?M+C/2-N+I:"end"===l?O+I:M-N,T=[];for(let e=0;e=0&&M>=0&&k<=w&&O<=y&&Z>=o&&k<=s&&M>=u&&O<=a)break;let d=getComputedStyle(t),m=parseInt(d.borderLeftWidth,10),g=parseInt(d.borderTopWidth,10),h=parseInt(d.borderRightWidth,10),b=parseInt(d.borderBottomWidth,10),j=0,I=0,R="offsetWidth"in t?t.offsetWidth-t.clientWidth-m-h:0,N="offsetHeight"in t?t.offsetHeight-t.clientHeight-g-b:0,A="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,L="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(f===t)j="start"===c?P:"end"===c?P-w:"nearest"===c?v(E,E+w,w,g,b,E+P,E+P+S,S):P-w/2,I="start"===l?F:"center"===l?F-y/2:"end"===l?F-y:v(x,x+y,y,m,h,x+F,x+F+C,C),j=Math.max(0,j+E),I=Math.max(0,I+x);else{j="start"===c?P-o-g:"end"===c?P-s+b+N:"nearest"===c?v(o,s,n,g,b+N,P,P+S,S):P-(o+n/2)+N/2,I="start"===l?F-u-m:"center"===l?F-(u+r/2)+R/2:"end"===l?F-a+h+R:v(u,a,r,m,h+R,F,F+C,C);let{scrollLeft:e,scrollTop:i}=t;j=0===L?0:Math.max(0,Math.min(i+j/L,t.scrollHeight-n/L+N)),I=0===A?0:Math.max(0,Math.min(e+I/A,t.scrollWidth-r/A+R)),P+=i-j,F+=e-I}T.push({el:t,top:j,left:I})}return T},w=e=>!1===e?{block:"end",inline:"nearest"}:e===Object(e)&&0!==Object.keys(e).length?e:{block:"start",inline:"nearest"};var x=n(13861);function E(e){return(0,x.qo)(e).join("_")}function S(e){let[t]=(0,c.cI)(),n=o.useRef({}),r=o.useMemo(()=>null!=e?e:Object.assign(Object.assign({},t),{__INTERNAL__:{itemRef:e=>t=>{let r=E(e);t?n.current[r]=t:delete n.current[r]}},scrollToField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,x.qo)(e),o=(0,x.dD)(n,r.__INTERNAL__.name),a=o?document.getElementById(o):null;a&&function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(y(e,t));let r="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:o,top:a,left:i}of y(e,w(t))){let e=a-n.top+n.bottom,t=i-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}(a,Object.assign({scrollMode:"if-needed",block:"nearest"},t))},getFieldInstance:e=>{let t=E(e);return n.current[t]}}),[e,t]);return[r]}var C=n(47713),Z=n(77360),O=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};let k=o.forwardRef((e,t)=>{let n=o.useContext(s.Z),{getPrefixCls:r,direction:a,form:m}=o.useContext(l.E_),{prefixCls:g,className:h,rootClassName:v,size:b,disabled:y=n,form:w,colon:x,labelAlign:E,labelWrap:k,labelCol:M,wrapperCol:j,hideRequiredMark:I,layout:R="horizontal",scrollToFirstError:N,requiredMark:P,onFinishFailed:F,name:T,style:A,feedbackIcons:L,variant:z}=e,_=O(e,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons","variant"]),H=(0,d.Z)(b),B=o.useContext(Z.Z),D=(0,o.useMemo)(()=>void 0!==P?P:!I&&(!m||void 0===m.requiredMark||m.requiredMark),[I,P,m]),W=null!=x?x:null==m?void 0:m.colon,V=r("form",g),q=(0,u.Z)(V),[G,X,U]=(0,C.ZP)(V,q),$=i()(V,"".concat(V,"-").concat(R),{["".concat(V,"-hide-required-mark")]:!1===D,["".concat(V,"-rtl")]:"rtl"===a,["".concat(V,"-").concat(H)]:H},U,q,X,null==m?void 0:m.className,h,v),[K]=S(w),{__INTERNAL__:Y}=K;Y.name=T;let Q=(0,o.useMemo)(()=>({name:T,labelAlign:E,labelCol:M,labelWrap:k,wrapperCol:j,vertical:"vertical"===R,colon:W,requiredMark:D,itemRef:Y.itemRef,form:K,feedbackIcons:L}),[T,E,M,j,R,W,D,K,L]);o.useImperativeHandle(t,()=>K);let J=(e,t)=>{if(e){let n={block:"nearest"};"object"==typeof e&&(n=e),K.scrollToField(t,n)}};return G(o.createElement(p.pg.Provider,{value:z},o.createElement(s.n,{disabled:y},o.createElement(f.Z.Provider,{value:H},o.createElement(p.RV,{validateMessages:B},o.createElement(p.q3.Provider,{value:Q},o.createElement(c.ZP,Object.assign({id:T},_,{name:T,onFinishFailed:e=>{if(null==F||F(e),e.errorFields.length){let t=e.errorFields[0].name;if(void 0!==N){J(N,t);return}m&&void 0!==m.scrollToFirstError&&J(m.scrollToFirstError,t)}},form:K,style:Object.assign(Object.assign({},null==m?void 0:m.style),A),className:$}))))))))});var M=n(38994),j=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};k.Item=M.Z,k.List=e=>{var{prefixCls:t,children:n}=e,r=j(e,["prefixCls","children"]);let{getPrefixCls:a}=o.useContext(l.E_),i=a("form",t),s=o.useMemo(()=>({prefixCls:i,status:"error"}),[i]);return o.createElement(c.aV,Object.assign({},r),(e,t,r)=>o.createElement(p.Rk.Provider,{value:s},n(e.map(e=>Object.assign(Object.assign({},e),{fieldKey:e.key})),t,{errors:r.errors,warnings:r.warnings})))},k.ErrorList=r.Z,k.useForm=S,k.useFormInstance=function(){let{form:e}=(0,o.useContext)(p.q3);return e},k.useWatch=c.qo,k.Provider=p.RV,k.create=()=>{};var I=k},47713:function(e,t,n){"use strict";n.d(t,{ZP:function(){return w},B4:function(){return y}});var r=n(352),o=n(12918),a=n(691),i=n(63074),c=n(3104),l=n(80669),s=e=>{let{componentCls:t}=e,n="".concat(t,"-show-help"),r="".concat(t,"-show-help-item");return{[n]:{transition:"opacity ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut),"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[r]:{overflow:"hidden",transition:"height ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n transform ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut," !important"),["&".concat(r,"-appear, &").concat(r,"-enter")]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},["&".concat(r,"-leave-active")]:{transform:"translateY(-5px)"}}}}};let u=e=>({legend:{display:"block",width:"100%",marginBottom:e.marginLG,padding:0,color:e.colorTextDescription,fontSize:e.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:"0 0 0 ".concat((0,r.bf)(e.controlOutlineWidth)," ").concat(e.controlOutline)},output:{display:"block",paddingTop:15,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight}}),d=(e,t)=>{let{formItemCls:n}=e;return{[n]:{["".concat(n,"-label > label")]:{height:t},["".concat(n,"-control-input")]:{minHeight:t}}}},f=e=>{let{componentCls:t}=e;return{[e.componentCls]:Object.assign(Object.assign(Object.assign({},(0,o.Wf)(e)),u(e)),{["".concat(t,"-text")]:{display:"inline-block",paddingInlineEnd:e.paddingSM},"&-small":Object.assign({},d(e,e.controlHeightSM)),"&-large":Object.assign({},d(e,e.controlHeightLG))})}},p=e=>{let{formItemCls:t,iconCls:n,componentCls:r,rootPrefixCls:i,labelRequiredMarkColor:c,labelColor:l,labelFontSize:s,labelHeight:u,labelColonMarginInlineStart:d,labelColonMarginInlineEnd:f,itemMarginBottom:p}=e;return{[t]:Object.assign(Object.assign({},(0,o.Wf)(e)),{marginBottom:p,verticalAlign:"top","&-with-help":{transition:"none"},["&-hidden,\n &-hidden.".concat(i,"-row")]:{display:"none"},"&-has-warning":{["".concat(t,"-split")]:{color:e.colorError}},"&-has-error":{["".concat(t,"-split")]:{color:e.colorWarning}},["".concat(t,"-label")]:{flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:e.lineHeight,whiteSpace:"unset"},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:u,color:l,fontSize:s,["> ".concat(n)]:{fontSize:e.fontSize,verticalAlign:"top"},["&".concat(t,"-required:not(").concat(t,"-required-mark-optional)::before")]:{display:"inline-block",marginInlineEnd:e.marginXXS,color:c,fontSize:e.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"',["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-optional")]:{display:"inline-block",marginInlineStart:e.marginXXS,color:e.colorTextDescription,["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-tooltip")]:{color:e.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:e.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:d,marginInlineEnd:f},["&".concat(t,"-no-colon::after")]:{content:'"\\a0"'}}},["".concat(t,"-control")]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,["&:first-child:not([class^=\"'".concat(i,"-col-'\"]):not([class*=\"' ").concat(i,"-col-'\"])")]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:e.controlHeight,"&-content":{flex:"auto",maxWidth:"100%"}}},[t]:{"&-explain, &-extra":{clear:"both",color:e.colorTextDescription,fontSize:e.fontSize,lineHeight:e.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:e.controlHeightSM,transition:"color ".concat(e.motionDurationMid," ").concat(e.motionEaseOut)},"&-explain":{"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning}}},["&-with-help ".concat(t,"-explain")]:{height:"auto",opacity:1},["".concat(t,"-feedback-icon")]:{fontSize:e.fontSize,textAlign:"center",visibility:"visible",animationName:a.kr,animationDuration:e.motionDurationMid,animationTimingFunction:e.motionEaseOutBack,pointerEvents:"none","&-success":{color:e.colorSuccess},"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning},"&-validating":{color:e.colorPrimary}}})}},m=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-horizontal")]:{["".concat(n,"-label")]:{flexGrow:0},["".concat(n,"-control")]:{flex:"1 1 0",minWidth:0},["".concat(n,"-label[class$='-24'], ").concat(n,"-label[class*='-24 ']")]:{["& + ".concat(n,"-control")]:{minWidth:"unset"}}}}},g=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-inline")]:{display:"flex",flexWrap:"wrap",[n]:{flex:"none",marginInlineEnd:e.margin,marginBottom:0,"&-row":{flexWrap:"nowrap"},["> ".concat(n,"-label,\n > ").concat(n,"-control")]:{display:"inline-block",verticalAlign:"top"},["> ".concat(n,"-label")]:{flex:"none"},["".concat(t,"-text")]:{display:"inline-block"},["".concat(n,"-has-feedback")]:{display:"inline-block"}}}}},h=e=>({padding:e.verticalLabelPadding,margin:e.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),v=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{["".concat(n," ").concat(n,"-label")]:h(e),["".concat(t,":not(").concat(t,"-inline)")]:{[n]:{flexWrap:"wrap",["".concat(n,"-label, ").concat(n,"-control")]:{['&:not([class*=" '.concat(r,'-col-xs"])')]:{flex:"0 0 100%",maxWidth:"100%"}}}}}},b=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:o}=e;return{["".concat(t,"-vertical")]:{[n]:{"&-row":{flexDirection:"column"},"&-label > label":{height:"auto"},["".concat(t,"-item-control")]:{width:"100%"}}},["".concat(t,"-vertical ").concat(n,"-label,\n .").concat(o,"-col-24").concat(n,"-label,\n .").concat(o,"-col-xl-24").concat(n,"-label")]:h(e),["@media (max-width: ".concat((0,r.bf)(e.screenXSMax),")")]:[v(e),{[t]:{[".".concat(o,"-col-xs-24").concat(n,"-label")]:h(e)}}],["@media (max-width: ".concat((0,r.bf)(e.screenSMMax),")")]:{[t]:{[".".concat(o,"-col-sm-24").concat(n,"-label")]:h(e)}},["@media (max-width: ".concat((0,r.bf)(e.screenMDMax),")")]:{[t]:{[".".concat(o,"-col-md-24").concat(n,"-label")]:h(e)}},["@media (max-width: ".concat((0,r.bf)(e.screenLGMax),")")]:{[t]:{[".".concat(o,"-col-lg-24").concat(n,"-label")]:h(e)}}}},y=(e,t)=>(0,c.TS)(e,{formItemCls:"".concat(e.componentCls,"-item"),rootPrefixCls:t});var w=(0,l.I$)("Form",(e,t)=>{let{rootPrefixCls:n}=t,r=y(e,n);return[f(r),p(r),s(r),m(r),g(r),b(r),(0,i.Z)(r),a.kr]},e=>({labelRequiredMarkColor:e.colorError,labelColor:e.colorTextHeading,labelFontSize:e.fontSize,labelHeight:e.controlHeight,labelColonMarginInlineStart:e.marginXXS/2,labelColonMarginInlineEnd:e.marginXS,itemMarginBottom:e.marginLG,verticalLabelPadding:"0 0 ".concat(e.paddingXS,"px"),verticalLabelMargin:0}),{order:-1e3})},13861:function(e,t,n){"use strict";n.d(t,{dD:function(){return a},lR:function(){return i},qo:function(){return o}});let r=["parentNode"];function o(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function a(e,t){if(!e.length)return;let n=e.join("_");return t?"".concat(t,"_").concat(n):r.includes(n)?"".concat("form_item","_").concat(n):n}function i(e,t,n,r,o,a){let i=r;return void 0!==a?i=a:n.validating?i="validating":e.length?i="error":t.length?i="warning":(n.touched||o&&n.validated)&&(i="success"),i}},77360:function(e,t,n){"use strict";var r=n(2265);t.Z=(0,r.createContext)(void 0)},62807:function(e,t,n){"use strict";let r=(0,n(2265).createContext)({});t.Z=r},54998:function(e,t,n){"use strict";var r=n(2265),o=n(36760),a=n.n(o),i=n(71744),c=n(62807),l=n(96776),s=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};let u=["xs","sm","md","lg","xl","xxl"],d=r.forwardRef((e,t)=>{let{getPrefixCls:n,direction:o}=r.useContext(i.E_),{gutter:d,wrap:f}=r.useContext(c.Z),{prefixCls:p,span:m,order:g,offset:h,push:v,pull:b,className:y,children:w,flex:x,style:E}=e,S=s(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),C=n("col",p),[Z,O,k]=(0,l.cG)(C),M={};u.forEach(t=>{let n={},r=e[t];"number"==typeof r?n.span=r:"object"==typeof r&&(n=r||{}),delete S[t],M=Object.assign(Object.assign({},M),{["".concat(C,"-").concat(t,"-").concat(n.span)]:void 0!==n.span,["".concat(C,"-").concat(t,"-order-").concat(n.order)]:n.order||0===n.order,["".concat(C,"-").concat(t,"-offset-").concat(n.offset)]:n.offset||0===n.offset,["".concat(C,"-").concat(t,"-push-").concat(n.push)]:n.push||0===n.push,["".concat(C,"-").concat(t,"-pull-").concat(n.pull)]:n.pull||0===n.pull,["".concat(C,"-").concat(t,"-flex-").concat(n.flex)]:n.flex||"auto"===n.flex,["".concat(C,"-rtl")]:"rtl"===o})});let j=a()(C,{["".concat(C,"-").concat(m)]:void 0!==m,["".concat(C,"-order-").concat(g)]:g,["".concat(C,"-offset-").concat(h)]:h,["".concat(C,"-push-").concat(v)]:v,["".concat(C,"-pull-").concat(b)]:b},y,M,O,k),I={};if(d&&d[0]>0){let e=d[0]/2;I.paddingLeft=e,I.paddingRight=e}return x&&(I.flex="number"==typeof x?"".concat(x," ").concat(x," auto"):/^\d+(\.\d+)?(px|em|rem|%)$/.test(x)?"0 0 ".concat(x):x,!1!==f||I.minWidth||(I.minWidth=0)),Z(r.createElement("div",Object.assign({},S,{style:Object.assign(Object.assign({},I),E),className:j,ref:t}),w))});t.Z=d},10295:function(e,t,n){"use strict";var r=n(2265),o=n(36760),a=n.n(o),i=n(6543),c=n(71744),l=n(62807),s=n(96776),u=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};function d(e,t){let[n,o]=r.useState("string"==typeof e?e:""),a=()=>{if("string"==typeof e&&o(e),"object"==typeof e)for(let n=0;n{a()},[JSON.stringify(e),t]),n}let f=r.forwardRef((e,t)=>{let{prefixCls:n,justify:o,align:f,className:p,style:m,children:g,gutter:h=0,wrap:v}=e,b=u(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:y,direction:w}=r.useContext(c.E_),[x,E]=r.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),[S,C]=r.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),Z=d(f,S),O=d(o,S),k=r.useRef(h),M=(0,i.ZP)();r.useEffect(()=>{let e=M.subscribe(e=>{C(e);let t=k.current||0;(!Array.isArray(t)&&"object"==typeof t||Array.isArray(t)&&("object"==typeof t[0]||"object"==typeof t[1]))&&E(e)});return()=>M.unsubscribe(e)},[]);let j=y("row",n),[I,R,N]=(0,s.VM)(j),P=(()=>{let e=[void 0,void 0];return(Array.isArray(h)?h:[h,void 0]).forEach((t,n)=>{if("object"==typeof t)for(let r=0;r0?-(P[0]/2):void 0;A&&(T.marginLeft=A,T.marginRight=A),[,T.rowGap]=P;let[L,z]=P,_=r.useMemo(()=>({gutter:[L,z],wrap:v}),[L,z,v]);return I(r.createElement(l.Z.Provider,{value:_},r.createElement("div",Object.assign({},b,{className:F,style:Object.assign(Object.assign({},T),m),ref:t}),g)))});t.Z=f},96776:function(e,t,n){"use strict";n.d(t,{VM:function(){return u},cG:function(){return d}});var r=n(352),o=n(80669),a=n(3104);let i=e=>{let{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},c=(e,t)=>{let{componentCls:n,gridColumns:r}=e,o={};for(let e=r;e>=0;e--)0===e?(o["".concat(n).concat(t,"-").concat(e)]={display:"none"},o["".concat(n,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:0},o["".concat(n).concat(t,"-order-").concat(e)]={order:0}):(o["".concat(n).concat(t,"-").concat(e)]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:"0 0 ".concat(e/r*100,"%"),maxWidth:"".concat(e/r*100,"%")}],o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-order-").concat(e)]={order:e});return o},l=(e,t)=>c(e,t),s=(e,t,n)=>({["@media (min-width: ".concat((0,r.bf)(t),")")]:Object.assign({},l(e,n))}),u=(0,o.I$)("Grid",e=>{let{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},()=>({})),d=(0,o.I$)("Grid",e=>{let t=(0,a.TS)(e,{gridColumns:24}),n={"-sm":t.screenSMMin,"-md":t.screenMDMin,"-lg":t.screenLGMin,"-xl":t.screenXLMin,"-xxl":t.screenXXLMin};return[i(t),l(t,""),l(t,"-xs"),Object.keys(n).map(e=>s(t,n[e],e)).reduce((e,t)=>Object.assign(Object.assign({},e),t),{})]},()=>({}))},20577:function(e,t,n){"use strict";n.d(t,{Z:function(){return eg}});var r=n(2265),o=n(70464),a=n(1119),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},c=n(55015),l=r.forwardRef(function(e,t){return r.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:i}))}),s=n(36760),u=n.n(s),d=n(11993),f=n(41154),p=n(26365),m=n(6989),g=n(76405),h=n(25049);function v(){return"function"==typeof BigInt}function b(e){return!e&&0!==e&&!Number.isNaN(e)||!String(e).trim()}function y(e){var t=e.trim(),n=t.startsWith("-");n&&(t=t.slice(1)),(t=t.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,"")).startsWith(".")&&(t="0".concat(t));var r=t||"0",o=r.split("."),a=o[0]||"0",i=o[1]||"0";"0"===a&&"0"===i&&(n=!1);var c=n?"-":"";return{negative:n,negativeStr:c,trimStr:r,integerStr:a,decimalStr:i,fullStr:"".concat(c).concat(r)}}function w(e){var t=String(e);return!Number.isNaN(Number(t))&&t.includes("e")}function x(e){var t=String(e);if(w(e)){var n=Number(t.slice(t.indexOf("e-")+2)),r=t.match(/\.(\d+)/);return null!=r&&r[1]&&(n+=r[1].length),n}return t.includes(".")&&S(t)?t.length-t.indexOf(".")-1:0}function E(e){var t=String(e);if(w(e)){if(e>Number.MAX_SAFE_INTEGER)return String(v()?BigInt(e).toString():Number.MAX_SAFE_INTEGER);if(e=this.add(e.negate().toString()).toNumber()}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e?this.isInvalidate()?"":y("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),e}(),Z=function(){function e(t){if((0,g.Z)(this,e),(0,d.Z)(this,"origin",""),(0,d.Z)(this,"number",void 0),(0,d.Z)(this,"empty",void 0),b(t)){this.empty=!0;return}this.origin=String(t),this.number=Number(t)}return(0,h.Z)(e,[{key:"negate",value:function(){return new e(-this.toNumber())}},{key:"add",value:function(t){if(this.isInvalidate())return new e(t);var n=Number(t);if(Number.isNaN(n))return this;var r=this.number+n;if(r>Number.MAX_SAFE_INTEGER)return new e(Number.MAX_SAFE_INTEGER);if(rNumber.MAX_SAFE_INTEGER)return new e(Number.MAX_SAFE_INTEGER);if(r=this.add(e.negate().toString()).toNumber()}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e?this.isInvalidate()?"":E(this.number):this.origin}}]),e}();function O(e){return v()?new C(e):new Z(e)}function k(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(""===e)return"";var o=y(e),a=o.negativeStr,i=o.integerStr,c=o.decimalStr,l="".concat(t).concat(c),s="".concat(a).concat(i);if(n>=0){var u=Number(c[n]);return u>=5&&!r?k(O(e).add("".concat(a,"0.").concat("0".repeat(n)).concat(10-u)).toString(),t,n,r):0===n?s:"".concat(s).concat(t).concat(c.padEnd(n,"0").slice(0,n))}return".0"===l?s:"".concat(s).concat(l)}var M=n(2027),j=n(27380),I=n(28791),R=n(32559),N=n(79267),P=function(){var e=(0,r.useState)(!1),t=(0,p.Z)(e,2),n=t[0],o=t[1];return(0,j.Z)(function(){o((0,N.Z)())},[]),n},F=n(53346);function T(e){var t=e.prefixCls,n=e.upNode,o=e.downNode,i=e.upDisabled,c=e.downDisabled,l=e.onStep,s=r.useRef(),f=r.useRef([]),p=r.useRef();p.current=l;var m=function(){clearTimeout(s.current)},g=function(e,t){e.preventDefault(),m(),p.current(t),s.current=setTimeout(function e(){p.current(t),s.current=setTimeout(e,200)},600)};if(r.useEffect(function(){return function(){m(),f.current.forEach(function(e){return F.Z.cancel(e)})}},[]),P())return null;var h="".concat(t,"-handler"),v=u()(h,"".concat(h,"-up"),(0,d.Z)({},"".concat(h,"-up-disabled"),i)),b=u()(h,"".concat(h,"-down"),(0,d.Z)({},"".concat(h,"-down-disabled"),c)),y=function(){return f.current.push((0,F.Z)(m))},w={unselectable:"on",role:"button",onMouseUp:y,onMouseLeave:y};return r.createElement("div",{className:"".concat(h,"-wrap")},r.createElement("span",(0,a.Z)({},w,{onMouseDown:function(e){g(e,!0)},"aria-label":"Increase Value","aria-disabled":i,className:v}),n||r.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-up-inner")})),r.createElement("span",(0,a.Z)({},w,{onMouseDown:function(e){g(e,!1)},"aria-label":"Decrease Value","aria-disabled":c,className:b}),o||r.createElement("span",{unselectable:"on",className:"".concat(t,"-handler-down-inner")})))}function A(e){var t="number"==typeof e?E(e):y(e).fullStr;return t.includes(".")?y(t.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:e+"0"}var L=n(55041),z=function(){var e=(0,r.useRef)(0),t=function(){F.Z.cancel(e.current)};return(0,r.useEffect)(function(){return t},[]),function(n){t(),e.current=(0,F.Z)(function(){n()})}},_=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","wheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur"],H=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],B=function(e,t){return e||t.isEmpty()?t.toString():t.toNumber()},D=function(e){var t=O(e);return t.isInvalidate()?null:t},W=r.forwardRef(function(e,t){var n,o,i,c=e.prefixCls,l=void 0===c?"rc-input-number":c,s=e.className,g=e.style,h=e.min,v=e.max,b=e.step,y=void 0===b?1:b,w=e.defaultValue,C=e.value,Z=e.disabled,M=e.readOnly,N=e.upHandler,P=e.downHandler,F=e.keyboard,L=e.wheel,H=e.controls,W=(e.classNames,e.stringMode),V=e.parser,q=e.formatter,G=e.precision,X=e.decimalSeparator,U=e.onChange,$=e.onInput,K=e.onPressEnter,Y=e.onStep,Q=e.changeOnBlur,J=void 0===Q||Q,ee=(0,m.Z)(e,_),et="".concat(l,"-input"),en=r.useRef(null),er=r.useState(!1),eo=(0,p.Z)(er,2),ea=eo[0],ei=eo[1],ec=r.useRef(!1),el=r.useRef(!1),es=r.useRef(!1),eu=r.useState(function(){return O(null!=C?C:w)}),ed=(0,p.Z)(eu,2),ef=ed[0],ep=ed[1],em=r.useCallback(function(e,t){return t?void 0:G>=0?G:Math.max(x(e),x(y))},[G,y]),eg=r.useCallback(function(e){var t=String(e);if(V)return V(t);var n=t;return X&&(n=n.replace(X,".")),n.replace(/[^\w.-]+/g,"")},[V,X]),eh=r.useRef(""),ev=r.useCallback(function(e,t){if(q)return q(e,{userTyping:t,input:String(eh.current)});var n="number"==typeof e?E(e):e;if(!t){var r=em(n,t);S(n)&&(X||r>=0)&&(n=k(n,X||".",r))}return n},[q,em,X]),eb=r.useState(function(){var e=null!=w?w:C;return ef.isInvalidate()&&["string","number"].includes((0,f.Z)(e))?Number.isNaN(e)?"":e:ev(ef.toString(),!1)}),ey=(0,p.Z)(eb,2),ew=ey[0],ex=ey[1];function eE(e,t){ex(ev(e.isInvalidate()?e.toString(!1):e.toString(!t),t))}eh.current=ew;var eS=r.useMemo(function(){return D(v)},[v,G]),eC=r.useMemo(function(){return D(h)},[h,G]),eZ=r.useMemo(function(){return!(!eS||!ef||ef.isInvalidate())&&eS.lessEquals(ef)},[eS,ef]),eO=r.useMemo(function(){return!(!eC||!ef||ef.isInvalidate())&&ef.lessEquals(eC)},[eC,ef]),ek=(n=en.current,o=(0,r.useRef)(null),[function(){try{var e=n.selectionStart,t=n.selectionEnd,r=n.value,a=r.substring(0,e),i=r.substring(t);o.current={start:e,end:t,value:r,beforeTxt:a,afterTxt:i}}catch(e){}},function(){if(n&&o.current&&ea)try{var e=n.value,t=o.current,r=t.beforeTxt,a=t.afterTxt,i=t.start,c=e.length;if(e.endsWith(a))c=e.length-o.current.afterTxt.length;else if(e.startsWith(r))c=r.length;else{var l=r[i-1],s=e.indexOf(l,i-1);-1!==s&&(c=s+1)}n.setSelectionRange(c,c)}catch(e){(0,R.ZP)(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(e.message))}}]),eM=(0,p.Z)(ek,2),ej=eM[0],eI=eM[1],eR=function(e){return eS&&!e.lessEquals(eS)?eS:eC&&!eC.lessEquals(e)?eC:null},eN=function(e){return!eR(e)},eP=function(e,t){var n=e,r=eN(n)||n.isEmpty();if(n.isEmpty()||t||(n=eR(n)||n,r=!0),!M&&!Z&&r){var o,a=n.toString(),i=em(a,t);return i>=0&&!eN(n=O(k(a,".",i)))&&(n=O(k(a,".",i,!0))),n.equals(ef)||(o=n,void 0===C&&ep(o),null==U||U(n.isEmpty()?null:B(W,n)),void 0===C&&eE(n,t)),n}return ef},eF=z(),eT=function e(t){if(ej(),eh.current=t,ex(t),!el.current){var n=O(eg(t));n.isNaN()||eP(n,!0)}null==$||$(t),eF(function(){var n=t;V||(n=t.replace(/。/g,".")),n!==t&&e(n)})},eA=function(e){if((!e||!eZ)&&(e||!eO)){ec.current=!1;var t,n=O(es.current?A(y):y);e||(n=n.negate());var r=eP((ef||O(0)).add(n.toString()),!1);null==Y||Y(B(W,r),{offset:es.current?A(y):y,type:e?"up":"down"}),null===(t=en.current)||void 0===t||t.focus()}},eL=function(e){var t=O(eg(ew)),n=t;n=t.isNaN()?eP(ef,e):eP(t,e),void 0!==C?eE(ef,!1):n.isNaN()||eE(n,!1)};return r.useEffect(function(){var e=function(e){!1!==L&&(eA(e.deltaY<0),e.preventDefault())},t=en.current;if(t)return t.addEventListener("wheel",e),function(){return t.removeEventListener("wheel",e)}},[eA]),(0,j.o)(function(){ef.isInvalidate()||eE(ef,!1)},[G,q]),(0,j.o)(function(){var e=O(C);ep(e);var t=O(eg(ew));e.equals(t)&&ec.current&&!q||eE(e,ec.current)},[C]),(0,j.o)(function(){q&&eI()},[ew]),r.createElement("div",{className:u()(l,s,(i={},(0,d.Z)(i,"".concat(l,"-focused"),ea),(0,d.Z)(i,"".concat(l,"-disabled"),Z),(0,d.Z)(i,"".concat(l,"-readonly"),M),(0,d.Z)(i,"".concat(l,"-not-a-number"),ef.isNaN()),(0,d.Z)(i,"".concat(l,"-out-of-range"),!ef.isInvalidate()&&!eN(ef)),i)),style:g,onFocus:function(){ei(!0)},onBlur:function(){J&&eL(!1),ei(!1),ec.current=!1},onKeyDown:function(e){var t=e.key,n=e.shiftKey;ec.current=!0,es.current=n,"Enter"===t&&(el.current||(ec.current=!1),eL(!1),null==K||K(e)),!1!==F&&!el.current&&["Up","ArrowUp","Down","ArrowDown"].includes(t)&&(eA("Up"===t||"ArrowUp"===t),e.preventDefault())},onKeyUp:function(){ec.current=!1,es.current=!1},onCompositionStart:function(){el.current=!0},onCompositionEnd:function(){el.current=!1,eT(en.current.value)},onBeforeInput:function(){ec.current=!0}},(void 0===H||H)&&r.createElement(T,{prefixCls:l,upNode:N,downNode:P,upDisabled:eZ,downDisabled:eO,onStep:eA}),r.createElement("div",{className:"".concat(et,"-wrap")},r.createElement("input",(0,a.Z)({autoComplete:"off",role:"spinbutton","aria-valuemin":h,"aria-valuemax":v,"aria-valuenow":ef.isInvalidate()?null:ef.toString(),step:y},ee,{ref:(0,I.sQ)(en,t),className:et,value:ew,onChange:function(e){eT(e.target.value)},disabled:Z,readOnly:M}))))}),V=r.forwardRef(function(e,t){var n=e.disabled,o=e.style,i=e.prefixCls,c=e.value,l=e.prefix,s=e.suffix,u=e.addonBefore,d=e.addonAfter,f=e.className,p=e.classNames,g=(0,m.Z)(e,H),h=r.useRef(null);return r.createElement(M.Q,{className:f,triggerFocus:function(e){h.current&&(0,L.nH)(h.current,e)},prefixCls:i,value:c,disabled:n,style:o,prefix:l,suffix:s,addonAfter:d,addonBefore:u,classNames:p,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"}},r.createElement(W,(0,a.Z)({prefixCls:i,disabled:n,ref:(0,I.sQ)(h,t),className:null==p?void 0:p.input},g)))});V.displayName="InputNumber";var q=n(12757),G=n(71744),X=n(13959),U=n(86586),$=n(64024),K=n(33759),Y=n(39109),Q=n(56250),J=n(65658),ee=n(352),et=n(31282),en=n(37433),er=n(65265),eo=n(12918),ea=n(17691),ei=n(80669),ec=n(3104),el=n(36360);let es=(e,t)=>{let{componentCls:n,borderRadiusSM:r,borderRadiusLG:o}=e,a="lg"===t?o:r;return{["&-".concat(t)]:{["".concat(n,"-handler-wrap")]:{borderStartEndRadius:a,borderEndEndRadius:a},["".concat(n,"-handler-up")]:{borderStartEndRadius:a},["".concat(n,"-handler-down")]:{borderEndEndRadius:a}}}},eu=e=>{let{componentCls:t,lineWidth:n,lineType:r,borderRadius:o,fontSizeLG:a,controlHeightLG:i,controlHeightSM:c,colorError:l,paddingInlineSM:s,paddingBlockSM:u,paddingBlockLG:d,paddingInlineLG:f,colorTextDescription:p,motionDurationMid:m,handleHoverColor:g,paddingInline:h,paddingBlock:v,handleBg:b,handleActiveBg:y,colorTextDisabled:w,borderRadiusSM:x,borderRadiusLG:E,controlWidth:S,handleOpacity:C,handleBorderColor:Z,filledHandleBg:O,lineHeightLG:k,calc:M}=e;return[{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,eo.Wf)(e)),(0,et.ik)(e)),{display:"inline-block",width:S,margin:0,padding:0,borderRadius:o}),(0,er.qG)(e,{["".concat(t,"-handler-wrap")]:{background:b,["".concat(t,"-handler-down")]:{borderBlockStart:"".concat((0,ee.bf)(n)," ").concat(r," ").concat(Z)}}})),(0,er.H8)(e,{["".concat(t,"-handler-wrap")]:{background:O,["".concat(t,"-handler-down")]:{borderBlockStart:"".concat((0,ee.bf)(n)," ").concat(r," ").concat(Z)}},"&:focus-within":{["".concat(t,"-handler-wrap")]:{background:b}}})),(0,er.Mu)(e)),{"&-rtl":{direction:"rtl",["".concat(t,"-input")]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:a,lineHeight:k,borderRadius:E,["input".concat(t,"-input")]:{height:M(i).sub(M(n).mul(2)).equal(),padding:"".concat((0,ee.bf)(d)," ").concat((0,ee.bf)(f))}},"&-sm":{padding:0,borderRadius:x,["input".concat(t,"-input")]:{height:M(c).sub(M(n).mul(2)).equal(),padding:"".concat((0,ee.bf)(u)," ").concat((0,ee.bf)(s))}},"&-out-of-range":{["".concat(t,"-input-wrap")]:{input:{color:l}}},"&-group":Object.assign(Object.assign(Object.assign({},(0,eo.Wf)(e)),(0,et.s7)(e)),{"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",textAlign:"start",verticalAlign:"top",["".concat(t,"-affix-wrapper")]:{width:"100%"},"&-lg":{["".concat(t,"-group-addon")]:{borderRadius:E,fontSize:e.fontSizeLG}},"&-sm":{["".concat(t,"-group-addon")]:{borderRadius:x}}},(0,er.ir)(e)),(0,er.S5)(e)),{["&:not(".concat(t,"-compact-first-item):not(").concat(t,"-compact-last-item)").concat(t,"-compact-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderRadius:0}},["&:not(".concat(t,"-compact-last-item)").concat(t,"-compact-first-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderStartEndRadius:0,borderEndEndRadius:0}},["&:not(".concat(t,"-compact-first-item)").concat(t,"-compact-last-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderStartStartRadius:0,borderEndStartRadius:0}}})}),["&-disabled ".concat(t,"-input")]:{cursor:"not-allowed"},[t]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},(0,eo.Wf)(e)),{width:"100%",padding:"".concat((0,ee.bf)(v)," ").concat((0,ee.bf)(h)),textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:o,outline:0,transition:"all ".concat(m," linear"),appearance:"textfield",fontSize:"inherit"}),(0,et.nz)(e.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,webkitAppearance:"none",appearance:"none"}})}})},{[t]:Object.assign(Object.assign(Object.assign({["&:hover ".concat(t,"-handler-wrap, &-focused ").concat(t,"-handler-wrap")]:{opacity:1},["".concat(t,"-handler-wrap")]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:e.handleWidth,height:"100%",borderStartStartRadius:0,borderStartEndRadius:o,borderEndEndRadius:o,borderEndStartRadius:0,opacity:C,display:"flex",flexDirection:"column",alignItems:"stretch",transition:"opacity ".concat(m," linear ").concat(m),["".concat(t,"-handler")]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",["\n ".concat(t,"-handler-up-inner,\n ").concat(t,"-handler-down-inner\n ")]:{marginInlineEnd:0,fontSize:e.handleFontSize}}},["".concat(t,"-handler")]:{height:"50%",overflow:"hidden",color:p,fontWeight:"bold",lineHeight:0,textAlign:"center",cursor:"pointer",borderInlineStart:"".concat((0,ee.bf)(n)," ").concat(r," ").concat(Z),transition:"all ".concat(m," linear"),"&:active":{background:y},"&:hover":{height:"60%",["\n ".concat(t,"-handler-up-inner,\n ").concat(t,"-handler-down-inner\n ")]:{color:g}},"&-up-inner, &-down-inner":Object.assign(Object.assign({},(0,eo.Ro)()),{color:p,transition:"all ".concat(m," linear"),userSelect:"none"})},["".concat(t,"-handler-up")]:{borderStartEndRadius:o},["".concat(t,"-handler-down")]:{borderEndEndRadius:o}},es(e,"lg")),es(e,"sm")),{"&-disabled, &-readonly":{["".concat(t,"-handler-wrap")]:{display:"none"},["".concat(t,"-input")]:{color:"inherit"}},["\n ".concat(t,"-handler-up-disabled,\n ").concat(t,"-handler-down-disabled\n ")]:{cursor:"not-allowed"},["\n ".concat(t,"-handler-up-disabled:hover &-handler-up-inner,\n ").concat(t,"-handler-down-disabled:hover &-handler-down-inner\n ")]:{color:w}})}]},ed=e=>{let{componentCls:t,paddingBlock:n,paddingInline:r,inputAffixPadding:o,controlWidth:a,borderRadiusLG:i,borderRadiusSM:c,paddingInlineLG:l,paddingInlineSM:s,paddingBlockLG:u,paddingBlockSM:d}=e;return{["".concat(t,"-affix-wrapper")]:Object.assign(Object.assign({["input".concat(t,"-input")]:{padding:"".concat((0,ee.bf)(n)," 0")}},(0,et.ik)(e)),{position:"relative",display:"inline-flex",width:a,padding:0,paddingInlineStart:r,"&-lg":{borderRadius:i,paddingInlineStart:l,["input".concat(t,"-input")]:{padding:"".concat((0,ee.bf)(u)," 0")}},"&-sm":{borderRadius:c,paddingInlineStart:s,["input".concat(t,"-input")]:{padding:"".concat((0,ee.bf)(d)," 0")}},["&:not(".concat(t,"-disabled):hover")]:{zIndex:1},"&-focused, &:focus":{zIndex:1},["&-disabled > ".concat(t,"-disabled")]:{background:"transparent"},["> div".concat(t)]:{width:"100%",border:"none",outline:"none",["&".concat(t,"-focused")]:{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},["".concat(t,"-handler-wrap")]:{zIndex:2},[t]:{color:"inherit","&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:o},"&-suffix":{position:"absolute",insetBlockStart:0,insetInlineEnd:0,zIndex:1,height:"100%",marginInlineEnd:r,marginInlineStart:o}}})}};var ef=(0,ei.I$)("InputNumber",e=>{let t=(0,ec.TS)(e,(0,en.e)(e));return[eu(t),ed(t),(0,ea.c)(t)]},e=>{var t;let n=null!==(t=e.handleVisible)&&void 0!==t?t:"auto";return Object.assign(Object.assign({},(0,en.T)(e)),{controlWidth:90,handleWidth:e.controlHeightSM-2*e.lineWidth,handleFontSize:e.fontSize/2,handleVisible:n,handleActiveBg:e.colorFillAlter,handleBg:e.colorBgContainer,filledHandleBg:new el.C(e.colorFillSecondary).onBackground(e.colorBgContainer).toHexString(),handleHoverColor:e.colorPrimary,handleBorderColor:e.colorBorder,handleOpacity:!0===n?1:0})},{unitless:{handleOpacity:!0}}),ep=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};let em=r.forwardRef((e,t)=>{let{getPrefixCls:n,direction:a}=r.useContext(G.E_),i=r.useRef(null);r.useImperativeHandle(t,()=>i.current);let{className:c,rootClassName:s,size:d,disabled:f,prefixCls:p,addonBefore:m,addonAfter:g,prefix:h,bordered:v,readOnly:b,status:y,controls:w,variant:x}=e,E=ep(e,["className","rootClassName","size","disabled","prefixCls","addonBefore","addonAfter","prefix","bordered","readOnly","status","controls","variant"]),S=n("input-number",p),C=(0,$.Z)(S),[Z,O,k]=ef(S,C),{compactSize:M,compactItemClassnames:j}=(0,J.ri)(S,a),I=r.createElement(l,{className:"".concat(S,"-handler-up-inner")}),R=r.createElement(o.Z,{className:"".concat(S,"-handler-down-inner")});"object"==typeof w&&(I=void 0===w.upIcon?I:r.createElement("span",{className:"".concat(S,"-handler-up-inner")},w.upIcon),R=void 0===w.downIcon?R:r.createElement("span",{className:"".concat(S,"-handler-down-inner")},w.downIcon));let{hasFeedback:N,status:P,isFormItemInput:F,feedbackIcon:T}=r.useContext(Y.aM),A=(0,q.F)(P,y),L=(0,K.Z)(e=>{var t;return null!==(t=null!=d?d:M)&&void 0!==t?t:e}),z=r.useContext(U.Z),[_,H]=(0,Q.Z)(x,v),B=N&&r.createElement(r.Fragment,null,T),D=u()({["".concat(S,"-lg")]:"large"===L,["".concat(S,"-sm")]:"small"===L,["".concat(S,"-rtl")]:"rtl"===a,["".concat(S,"-in-form-item")]:F},O),W="".concat(S,"-group");return Z(r.createElement(V,Object.assign({ref:i,disabled:null!=f?f:z,className:u()(k,C,c,s,j),upHandler:I,downHandler:R,prefixCls:S,readOnly:b,controls:"boolean"==typeof w?w:void 0,prefix:h,suffix:B,addonAfter:g&&r.createElement(J.BR,null,r.createElement(Y.Ux,{override:!0,status:!0},g)),addonBefore:m&&r.createElement(J.BR,null,r.createElement(Y.Ux,{override:!0,status:!0},m)),classNames:{input:D,variant:u()({["".concat(S,"-").concat(_)]:H},(0,q.Z)(S,A,N)),affixWrapper:u()({["".concat(S,"-affix-wrapper-sm")]:"small"===L,["".concat(S,"-affix-wrapper-lg")]:"large"===L,["".concat(S,"-affix-wrapper-rtl")]:"rtl"===a},O),wrapper:u()({["".concat(W,"-rtl")]:"rtl"===a},O),groupWrapper:u()({["".concat(S,"-group-wrapper-sm")]:"small"===L,["".concat(S,"-group-wrapper-lg")]:"large"===L,["".concat(S,"-group-wrapper-rtl")]:"rtl"===a,["".concat(S,"-group-wrapper-").concat(_)]:H},(0,q.Z)("".concat(S,"-group-wrapper"),A,N),O)}},E)))});em._InternalPanelDoNotUseOrYouWillBeFired=e=>r.createElement(X.ZP,{theme:{components:{InputNumber:{handleVisible:!0}}}},r.createElement(em,Object.assign({},e)));var eg=em},65863:function(e,t,n){"use strict";n.d(t,{Z:function(){return E},n:function(){return x}});var r=n(2265),o=n(36760),a=n.n(o),i=n(2027),c=n(28791),l=n(12757),s=n(71744),u=n(86586),d=n(33759),f=n(39109),p=n(65658),m=n(39164),g=n(31282),h=n(64024),v=n(56250),b=n(39725),y=e=>{let t;return"object"==typeof e&&(null==e?void 0:e.clearIcon)?t=e:e&&(t={clearIcon:r.createElement(b.Z,null)}),t},w=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};function x(e,t){if(!e)return;e.focus(t);let{cursor:n}=t||{};if(n){let t=e.value.length;switch(n){case"start":e.setSelectionRange(0,0);break;case"end":e.setSelectionRange(t,t);break;default:e.setSelectionRange(0,t)}}}var E=(0,r.forwardRef)((e,t)=>{var n;let{prefixCls:o,bordered:b=!0,status:x,size:E,disabled:S,onBlur:C,onFocus:Z,suffix:O,allowClear:k,addonAfter:M,addonBefore:j,className:I,style:R,styles:N,rootClassName:P,onChange:F,classNames:T,variant:A}=e,L=w(e,["prefixCls","bordered","status","size","disabled","onBlur","onFocus","suffix","allowClear","addonAfter","addonBefore","className","style","styles","rootClassName","onChange","classNames","variant"]),{getPrefixCls:z,direction:_,input:H}=r.useContext(s.E_),B=z("input",o),D=(0,r.useRef)(null),W=(0,h.Z)(B),[V,q,G]=(0,g.ZP)(B,W),{compactSize:X,compactItemClassnames:U}=(0,p.ri)(B,_),$=(0,d.Z)(e=>{var t;return null!==(t=null!=E?E:X)&&void 0!==t?t:e}),K=r.useContext(u.Z),{status:Y,hasFeedback:Q,feedbackIcon:J}=(0,r.useContext)(f.aM),ee=(0,l.F)(Y,x),et=!!(e.prefix||e.suffix||e.allowClear||e.showCount)||!!Q;(0,r.useRef)(et);let en=(0,m.Z)(D,!0),er=(Q||O)&&r.createElement(r.Fragment,null,O,Q&&J),eo=y(k),[ea,ei]=(0,v.Z)(A,b);return V(r.createElement(i.Z,Object.assign({ref:(0,c.sQ)(t,D),prefixCls:B,autoComplete:null==H?void 0:H.autoComplete},L,{disabled:null!=S?S:K,onBlur:e=>{en(),null==C||C(e)},onFocus:e=>{en(),null==Z||Z(e)},style:Object.assign(Object.assign({},null==H?void 0:H.style),R),styles:Object.assign(Object.assign({},null==H?void 0:H.styles),N),suffix:er,allowClear:eo,className:a()(I,P,G,W,U,null==H?void 0:H.className),onChange:e=>{en(),null==F||F(e)},addonAfter:M&&r.createElement(p.BR,null,r.createElement(f.Ux,{override:!0,status:!0},M)),addonBefore:j&&r.createElement(p.BR,null,r.createElement(f.Ux,{override:!0,status:!0},j)),classNames:Object.assign(Object.assign(Object.assign({},T),null==H?void 0:H.classNames),{input:a()({["".concat(B,"-sm")]:"small"===$,["".concat(B,"-lg")]:"large"===$,["".concat(B,"-rtl")]:"rtl"===_},null==T?void 0:T.input,null===(n=null==H?void 0:H.classNames)||void 0===n?void 0:n.input,q),variant:a()({["".concat(B,"-").concat(ea)]:ei},(0,l.Z)(B,ee)),affixWrapper:a()({["".concat(B,"-affix-wrapper-sm")]:"small"===$,["".concat(B,"-affix-wrapper-lg")]:"large"===$,["".concat(B,"-affix-wrapper-rtl")]:"rtl"===_},q),wrapper:a()({["".concat(B,"-group-rtl")]:"rtl"===_},q),groupWrapper:a()({["".concat(B,"-group-wrapper-sm")]:"small"===$,["".concat(B,"-group-wrapper-lg")]:"large"===$,["".concat(B,"-group-wrapper-rtl")]:"rtl"===_,["".concat(B,"-group-wrapper-").concat(ea)]:ei},(0,l.Z)("".concat(B,"-group-wrapper"),ee,Q),q)})})))})},90464:function(e,t,n){"use strict";n.d(t,{Z:function(){return z}});var r,o=n(2265),a=n(39725),i=n(36760),c=n.n(i),l=n(1119),s=n(11993),u=n(31686),d=n(83145),f=n(26365),p=n(6989),m=n(2027),g=n(96032),h=n(55041),v=n(50506),b=n(41154),y=n(31474),w=n(27380),x=n(53346),E=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],S={},C=["prefixCls","onPressEnter","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],Z=o.forwardRef(function(e,t){var n=e.prefixCls,a=(e.onPressEnter,e.defaultValue),i=e.value,d=e.autoSize,m=e.onResize,g=e.className,h=e.style,Z=e.disabled,O=e.onChange,k=(e.onInternalAutoSize,(0,p.Z)(e,C)),M=(0,v.Z)(a,{value:i,postState:function(e){return null!=e?e:""}}),j=(0,f.Z)(M,2),I=j[0],R=j[1],N=o.useRef();o.useImperativeHandle(t,function(){return{textArea:N.current}});var P=o.useMemo(function(){return d&&"object"===(0,b.Z)(d)?[d.minRows,d.maxRows]:[]},[d]),F=(0,f.Z)(P,2),T=F[0],A=F[1],L=!!d,z=function(){try{if(document.activeElement===N.current){var e=N.current,t=e.selectionStart,n=e.selectionEnd,r=e.scrollTop;N.current.setSelectionRange(t,n),N.current.scrollTop=r}}catch(e){}},_=o.useState(2),H=(0,f.Z)(_,2),B=H[0],D=H[1],W=o.useState(),V=(0,f.Z)(W,2),q=V[0],G=V[1],X=function(){D(0)};(0,w.Z)(function(){L&&X()},[i,T,A,L]),(0,w.Z)(function(){if(0===B)D(1);else if(1===B){var e=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r||((r=document.createElement("textarea")).setAttribute("tab-index","-1"),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),e.getAttribute("wrap")?r.setAttribute("wrap",e.getAttribute("wrap")):r.removeAttribute("wrap");var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&S[n])return S[n];var r=window.getComputedStyle(e),o=r.getPropertyValue("box-sizing")||r.getPropertyValue("-moz-box-sizing")||r.getPropertyValue("-webkit-box-sizing"),a=parseFloat(r.getPropertyValue("padding-bottom"))+parseFloat(r.getPropertyValue("padding-top")),i=parseFloat(r.getPropertyValue("border-bottom-width"))+parseFloat(r.getPropertyValue("border-top-width")),c={sizingStyle:E.map(function(e){return"".concat(e,":").concat(r.getPropertyValue(e))}).join(";"),paddingSize:a,borderSize:i,boxSizing:o};return t&&n&&(S[n]=c),c}(e,n),c=i.paddingSize,l=i.borderSize,s=i.boxSizing,u=i.sizingStyle;r.setAttribute("style","".concat(u,";").concat("\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important;\n pointer-events: none !important;\n")),r.value=e.value||e.placeholder||"";var d=void 0,f=void 0,p=r.scrollHeight;if("border-box"===s?p+=l:"content-box"===s&&(p-=c),null!==o||null!==a){r.value=" ";var m=r.scrollHeight-c;null!==o&&(d=m*o,"border-box"===s&&(d=d+c+l),p=Math.max(d,p)),null!==a&&(f=m*a,"border-box"===s&&(f=f+c+l),t=p>f?"":"hidden",p=Math.min(f,p))}var g={height:p,overflowY:t,resize:"none"};return d&&(g.minHeight=d),f&&(g.maxHeight=f),g}(N.current,!1,T,A);D(2),G(e)}else z()},[B]);var U=o.useRef(),$=function(){x.Z.cancel(U.current)};o.useEffect(function(){return $},[]);var K=(0,u.Z)((0,u.Z)({},h),L?q:null);return(0===B||1===B)&&(K.overflowY="hidden",K.overflowX="hidden"),o.createElement(y.Z,{onResize:function(e){2===B&&(null==m||m(e),d&&($(),U.current=(0,x.Z)(function(){X()})))},disabled:!(d||m)},o.createElement("textarea",(0,l.Z)({},k,{ref:N,style:K,className:c()(n,g,(0,s.Z)({},"".concat(n,"-disabled"),Z)),disabled:Z,value:I,onChange:function(e){R(e.target.value),null==O||O(e)}})))}),O=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize"],k=o.forwardRef(function(e,t){var n,r,a,i=e.defaultValue,b=e.value,y=e.onFocus,w=e.onBlur,x=e.onChange,E=e.allowClear,S=e.maxLength,C=e.onCompositionStart,k=e.onCompositionEnd,M=e.suffix,j=e.prefixCls,I=void 0===j?"rc-textarea":j,R=e.showCount,N=e.count,P=e.className,F=e.style,T=e.disabled,A=e.hidden,L=e.classNames,z=e.styles,_=e.onResize,H=(0,p.Z)(e,O),B=(0,v.Z)(i,{value:b,defaultValue:i}),D=(0,f.Z)(B,2),W=D[0],V=D[1],q=null==W?"":String(W),G=o.useState(!1),X=(0,f.Z)(G,2),U=X[0],$=X[1],K=o.useRef(!1),Y=o.useState(null),Q=(0,f.Z)(Y,2),J=Q[0],ee=Q[1],et=(0,o.useRef)(null),en=function(){var e;return null===(e=et.current)||void 0===e?void 0:e.textArea},er=function(){en().focus()};(0,o.useImperativeHandle)(t,function(){return{resizableTextArea:et.current,focus:er,blur:function(){en().blur()}}}),(0,o.useEffect)(function(){$(function(e){return!T&&e})},[T]);var eo=o.useState(null),ea=(0,f.Z)(eo,2),ei=ea[0],ec=ea[1];o.useEffect(function(){if(ei){var e;(e=en()).setSelectionRange.apply(e,(0,d.Z)(ei))}},[ei]);var el=(0,g.Z)(N,R),es=null!==(n=el.max)&&void 0!==n?n:S,eu=Number(es)>0,ed=el.strategy(q),ef=!!es&&ed>es,ep=function(e,t){var n=t;!K.current&&el.exceedFormatter&&el.max&&el.strategy(t)>el.max&&(n=el.exceedFormatter(t,{max:el.max}),t!==n&&ec([en().selectionStart||0,en().selectionEnd||0])),V(n),(0,h.rJ)(e.currentTarget,e,x,n)},em=M;el.show&&(a=el.showFormatter?el.showFormatter({value:q,count:ed,maxLength:es}):"".concat(ed).concat(eu?" / ".concat(es):""),em=o.createElement(o.Fragment,null,em,o.createElement("span",{className:c()("".concat(I,"-data-count"),null==L?void 0:L.count),style:null==z?void 0:z.count},a)));var eg=!H.autoSize&&!R&&!E;return o.createElement(m.Q,{value:q,allowClear:E,handleReset:function(e){V(""),er(),(0,h.rJ)(en(),e,x)},suffix:em,prefixCls:I,classNames:(0,u.Z)((0,u.Z)({},L),{},{affixWrapper:c()(null==L?void 0:L.affixWrapper,(r={},(0,s.Z)(r,"".concat(I,"-show-count"),R),(0,s.Z)(r,"".concat(I,"-textarea-allow-clear"),E),r))}),disabled:T,focused:U,className:c()(P,ef&&"".concat(I,"-out-of-range")),style:(0,u.Z)((0,u.Z)({},F),J&&!eg?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":"string"==typeof a?a:void 0}},hidden:A},o.createElement(Z,(0,l.Z)({},H,{maxLength:S,onKeyDown:function(e){var t=H.onPressEnter,n=H.onKeyDown;"Enter"===e.key&&t&&t(e),null==n||n(e)},onChange:function(e){ep(e,e.target.value)},onFocus:function(e){$(!0),null==y||y(e)},onBlur:function(e){$(!1),null==w||w(e)},onCompositionStart:function(e){K.current=!0,null==C||C(e)},onCompositionEnd:function(e){K.current=!1,ep(e,e.currentTarget.value),null==k||k(e)},className:c()(null==L?void 0:L.textarea),style:(0,u.Z)((0,u.Z)({},null==z?void 0:z.textarea),{},{resize:null==F?void 0:F.resize}),disabled:T,prefixCls:I,onResize:function(e){var t;null==_||_(e),null!==(t=en())&&void 0!==t&&t.style.height&&ee(!0)},ref:et})))}),M=n(12757),j=n(71744),I=n(86586),R=n(33759),N=n(39109),P=n(65863),F=n(31282),T=n(64024),A=n(56250),L=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},z=(0,o.forwardRef)((e,t)=>{var n;let r;let{prefixCls:i,bordered:l=!0,size:s,disabled:u,status:d,allowClear:f,classNames:p,rootClassName:m,className:g,variant:h}=e,v=L(e,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","variant"]),{getPrefixCls:b,direction:y}=o.useContext(j.E_),w=(0,R.Z)(s),x=o.useContext(I.Z),{status:E,hasFeedback:S,feedbackIcon:C}=o.useContext(N.aM),Z=(0,M.F)(E,d),O=o.useRef(null);o.useImperativeHandle(t,()=>{var e;return{resizableTextArea:null===(e=O.current)||void 0===e?void 0:e.resizableTextArea,focus:e=>{var t,n;(0,P.n)(null===(n=null===(t=O.current)||void 0===t?void 0:t.resizableTextArea)||void 0===n?void 0:n.textArea,e)},blur:()=>{var e;return null===(e=O.current)||void 0===e?void 0:e.blur()}}});let z=b("input",i);"object"==typeof f&&(null==f?void 0:f.clearIcon)?r=f:f&&(r={clearIcon:o.createElement(a.Z,null)});let _=(0,T.Z)(z),[H,B,D]=(0,F.ZP)(z,_),[W,V]=(0,A.Z)(h,l);return H(o.createElement(k,Object.assign({},v,{disabled:null!=u?u:x,allowClear:r,className:c()(D,_,g,m),classNames:Object.assign(Object.assign({},p),{textarea:c()({["".concat(z,"-sm")]:"small"===w,["".concat(z,"-lg")]:"large"===w},B,null==p?void 0:p.textarea),variant:c()({["".concat(z,"-").concat(W)]:V},(0,M.Z)(z,Z)),affixWrapper:c()("".concat(z,"-textarea-affix-wrapper"),{["".concat(z,"-affix-wrapper-rtl")]:"rtl"===y,["".concat(z,"-affix-wrapper-sm")]:"small"===w,["".concat(z,"-affix-wrapper-lg")]:"large"===w,["".concat(z,"-textarea-show-count")]:e.showCount||(null===(n=e.count)||void 0===n?void 0:n.show)},B)}),prefixCls:z,suffix:S&&o.createElement("span",{className:"".concat(z,"-textarea-suffix")},C),ref:O})))})},39164:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);function o(e,t){let n=(0,r.useRef)([]),o=()=>{n.current.push(setTimeout(()=>{var t,n,r,o;(null===(t=e.current)||void 0===t?void 0:t.input)&&(null===(n=e.current)||void 0===n?void 0:n.input.getAttribute("type"))==="password"&&(null===(r=e.current)||void 0===r?void 0:r.input.hasAttribute("value"))&&(null===(o=e.current)||void 0===o||o.input.removeAttribute("value"))}))};return(0,r.useEffect)(()=>(t&&o(),()=>n.current.forEach(e=>{e&&clearTimeout(e)})),[]),o}},64482:function(e,t,n){"use strict";n.d(t,{default:function(){return M}});var r=n(2265),o=n(36760),a=n.n(o),i=n(71744),c=n(39109),l=n(31282),s=n(65863),u=n(97416),d=n(6520),f=n(18694),p=n(28791),m=n(39164),g=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};let h=e=>e?r.createElement(d.Z,null):r.createElement(u.Z,null),v={click:"onClick",hover:"onMouseOver"},b=r.forwardRef((e,t)=>{let{visibilityToggle:n=!0}=e,o="object"==typeof n&&void 0!==n.visible,[c,l]=(0,r.useState)(()=>!!o&&n.visible),u=(0,r.useRef)(null);r.useEffect(()=>{o&&l(n.visible)},[o,n]);let d=(0,m.Z)(u),b=()=>{let{disabled:t}=e;t||(c&&d(),l(e=>{var t;let r=!e;return"object"==typeof n&&(null===(t=n.onVisibleChange)||void 0===t||t.call(n,r)),r}))},{className:y,prefixCls:w,inputPrefixCls:x,size:E}=e,S=g(e,["className","prefixCls","inputPrefixCls","size"]),{getPrefixCls:C}=r.useContext(i.E_),Z=C("input",x),O=C("input-password",w),k=n&&(t=>{let{action:n="click",iconRender:o=h}=e,a=v[n]||"",i=o(c);return r.cloneElement(r.isValidElement(i)?i:r.createElement("span",null,i),{[a]:b,className:"".concat(t,"-icon"),key:"passwordIcon",onMouseDown:e=>{e.preventDefault()},onMouseUp:e=>{e.preventDefault()}})})(O),M=a()(O,y,{["".concat(O,"-").concat(E)]:!!E}),j=Object.assign(Object.assign({},(0,f.Z)(S,["suffix","iconRender","visibilityToggle"])),{type:c?"text":"password",className:M,prefixCls:Z,suffix:k});return E&&(j.size=E),r.createElement(s.Z,Object.assign({ref:(0,p.sQ)(t,u)},j))});var y=n(29436),w=n(19722),x=n(73002),E=n(33759),S=n(65658),C=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};let Z=r.forwardRef((e,t)=>{let n;let{prefixCls:o,inputPrefixCls:c,className:l,size:u,suffix:d,enterButton:f=!1,addonAfter:m,loading:g,disabled:h,onSearch:v,onChange:b,onCompositionStart:Z,onCompositionEnd:O}=e,k=C(e,["prefixCls","inputPrefixCls","className","size","suffix","enterButton","addonAfter","loading","disabled","onSearch","onChange","onCompositionStart","onCompositionEnd"]),{getPrefixCls:M,direction:j}=r.useContext(i.E_),I=r.useRef(!1),R=M("input-search",o),N=M("input",c),{compactSize:P}=(0,S.ri)(R,j),F=(0,E.Z)(e=>{var t;return null!==(t=null!=u?u:P)&&void 0!==t?t:e}),T=r.useRef(null),A=e=>{var t;document.activeElement===(null===(t=T.current)||void 0===t?void 0:t.input)&&e.preventDefault()},L=e=>{var t,n;v&&v(null===(n=null===(t=T.current)||void 0===t?void 0:t.input)||void 0===n?void 0:n.value,e,{source:"input"})},z="boolean"==typeof f?r.createElement(y.Z,null):null,_="".concat(R,"-button"),H=f||{},B=H.type&&!0===H.type.__ANT_BUTTON;n=B||"button"===H.type?(0,w.Tm)(H,Object.assign({onMouseDown:A,onClick:e=>{var t,n;null===(n=null===(t=null==H?void 0:H.props)||void 0===t?void 0:t.onClick)||void 0===n||n.call(t,e),L(e)},key:"enterButton"},B?{className:_,size:F}:{})):r.createElement(x.ZP,{className:_,type:f?"primary":void 0,size:F,disabled:h,key:"enterButton",onMouseDown:A,onClick:L,loading:g,icon:z},f),m&&(n=[n,(0,w.Tm)(m,{key:"addonAfter"})]);let D=a()(R,{["".concat(R,"-rtl")]:"rtl"===j,["".concat(R,"-").concat(F)]:!!F,["".concat(R,"-with-button")]:!!f},l);return r.createElement(s.Z,Object.assign({ref:(0,p.sQ)(T,t),onPressEnter:e=>{I.current||g||L(e)}},k,{size:F,onCompositionStart:e=>{I.current=!0,null==Z||Z(e)},onCompositionEnd:e=>{I.current=!1,null==O||O(e)},prefixCls:N,addonAfter:n,suffix:d,onChange:e=>{e&&e.target&&"click"===e.type&&v&&v(e.target.value,e,{source:"clear"}),b&&b(e)},className:D,disabled:h}))});var O=n(90464);let k=s.Z;k.Group=e=>{let{getPrefixCls:t,direction:n}=(0,r.useContext)(i.E_),{prefixCls:o,className:s}=e,u=t("input-group",o),d=t("input"),[f,p]=(0,l.ZP)(d),m=a()(u,{["".concat(u,"-lg")]:"large"===e.size,["".concat(u,"-sm")]:"small"===e.size,["".concat(u,"-compact")]:e.compact,["".concat(u,"-rtl")]:"rtl"===n},p,s),g=(0,r.useContext)(c.aM),h=(0,r.useMemo)(()=>Object.assign(Object.assign({},g),{isFormItemInput:!1}),[g]);return f(r.createElement("span",{className:m,style:e.style,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onFocus:e.onFocus,onBlur:e.onBlur},r.createElement(c.aM.Provider,{value:h},e.children)))},k.Search=Z,k.TextArea=O.Z,k.Password=b;var M=k},31282:function(e,t,n){"use strict";n.d(t,{ik:function(){return p},nz:function(){return u},s7:function(){return m},x0:function(){return f}});var r=n(352),o=n(12918),a=n(17691),i=n(80669),c=n(3104),l=n(37433),s=n(65265);let u=e=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:e,userSelect:"none"},"&:placeholder-shown":{textOverflow:"ellipsis"}}),d=e=>{let{paddingBlockLG:t,lineHeightLG:n,borderRadiusLG:o,paddingInlineLG:a}=e;return{padding:"".concat((0,r.bf)(t)," ").concat((0,r.bf)(a)),fontSize:e.inputFontSizeLG,lineHeight:n,borderRadius:o}},f=e=>({padding:"".concat((0,r.bf)(e.paddingBlockSM)," ").concat((0,r.bf)(e.paddingInlineSM)),fontSize:e.inputFontSizeSM,borderRadius:e.borderRadiusSM}),p=e=>Object.assign(Object.assign({position:"relative",display:"inline-block",width:"100%",minWidth:0,padding:"".concat((0,r.bf)(e.paddingBlock)," ").concat((0,r.bf)(e.paddingInline)),color:e.colorText,fontSize:e.inputFontSize,lineHeight:e.lineHeight,borderRadius:e.borderRadius,transition:"all ".concat(e.motionDurationMid)},u(e.colorTextPlaceholder)),{"textarea&":{maxWidth:"100%",height:"auto",minHeight:e.controlHeight,lineHeight:e.lineHeight,verticalAlign:"bottom",transition:"all ".concat(e.motionDurationSlow,", height 0s"),resize:"vertical"},"&-lg":Object.assign({},d(e)),"&-sm":Object.assign({},f(e)),"&-rtl":{direction:"rtl"},"&-textarea-rtl":{direction:"rtl"}}),m=e=>{let{componentCls:t,antCls:n}=e;return{position:"relative",display:"table",width:"100%",borderCollapse:"separate",borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:e.paddingXS,"&:last-child":{paddingInlineEnd:0}},["&-lg ".concat(t,", &-lg > ").concat(t,"-group-addon")]:Object.assign({},d(e)),["&-sm ".concat(t,", &-sm > ").concat(t,"-group-addon")]:Object.assign({},f(e)),["&-lg ".concat(n,"-select-single ").concat(n,"-select-selector")]:{height:e.controlHeightLG},["&-sm ".concat(n,"-select-single ").concat(n,"-select-selector")]:{height:e.controlHeightSM},["> ".concat(t)]:{display:"table-cell","&:not(:first-child):not(:last-child)":{borderRadius:0}},["".concat(t,"-group")]:{"&-addon, &-wrap":{display:"table-cell",width:1,whiteSpace:"nowrap",verticalAlign:"middle","&:not(:first-child):not(:last-child)":{borderRadius:0}},"&-wrap > *":{display:"block !important"},"&-addon":{position:"relative",padding:"0 ".concat((0,r.bf)(e.paddingInline)),color:e.colorText,fontWeight:"normal",fontSize:e.inputFontSize,textAlign:"center",borderRadius:e.borderRadius,transition:"all ".concat(e.motionDurationSlow),lineHeight:1,["".concat(n,"-select")]:{margin:"".concat((0,r.bf)(e.calc(e.paddingBlock).add(1).mul(-1).equal())," ").concat((0,r.bf)(e.calc(e.paddingInline).mul(-1).equal())),["&".concat(n,"-select-single:not(").concat(n,"-select-customize-input):not(").concat(n,"-pagination-size-changer)")]:{["".concat(n,"-select-selector")]:{backgroundColor:"inherit",border:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),boxShadow:"none"}},"&-open, &-focused":{["".concat(n,"-select-selector")]:{color:e.colorPrimary}}},["".concat(n,"-cascader-picker")]:{margin:"-9px ".concat((0,r.bf)(e.calc(e.paddingInline).mul(-1).equal())),backgroundColor:"transparent",["".concat(n,"-cascader-input")]:{textAlign:"start",border:0,boxShadow:"none"}}}},["".concat(t)]:{width:"100%",marginBottom:0,textAlign:"inherit","&:focus":{zIndex:1,borderInlineEndWidth:1},"&:hover":{zIndex:1,borderInlineEndWidth:1,["".concat(t,"-search-with-button &")]:{zIndex:0}}},["> ".concat(t,":first-child, ").concat(t,"-group-addon:first-child")]:{borderStartEndRadius:0,borderEndEndRadius:0,["".concat(n,"-select ").concat(n,"-select-selector")]:{borderStartEndRadius:0,borderEndEndRadius:0}},["> ".concat(t,"-affix-wrapper")]:{["&:not(:first-child) ".concat(t)]:{borderStartStartRadius:0,borderEndStartRadius:0},["&:not(:last-child) ".concat(t)]:{borderStartEndRadius:0,borderEndEndRadius:0}},["> ".concat(t,":last-child, ").concat(t,"-group-addon:last-child")]:{borderStartStartRadius:0,borderEndStartRadius:0,["".concat(n,"-select ").concat(n,"-select-selector")]:{borderStartStartRadius:0,borderEndStartRadius:0}},["".concat(t,"-affix-wrapper")]:{"&:not(:last-child)":{borderStartEndRadius:0,borderEndEndRadius:0,["".concat(t,"-search &")]:{borderStartStartRadius:e.borderRadius,borderEndStartRadius:e.borderRadius}},["&:not(:first-child), ".concat(t,"-search &:not(:first-child)")]:{borderStartStartRadius:0,borderEndStartRadius:0}},["&".concat(t,"-group-compact")]:Object.assign(Object.assign({display:"block"},(0,o.dF)()),{["".concat(t,"-group-addon, ").concat(t,"-group-wrap, > ").concat(t)]:{"&:not(:first-child):not(:last-child)":{borderInlineEndWidth:e.lineWidth,"&:hover":{zIndex:1},"&:focus":{zIndex:1}}},"& > *":{display:"inline-block",float:"none",verticalAlign:"top",borderRadius:0},["\n & > ".concat(t,"-affix-wrapper,\n & > ").concat(t,"-number-affix-wrapper,\n & > ").concat(n,"-picker-range\n ")]:{display:"inline-flex"},"& > *:not(:last-child)":{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal(),borderInlineEndWidth:e.lineWidth},["".concat(t)]:{float:"none"},["& > ".concat(n,"-select > ").concat(n,"-select-selector,\n & > ").concat(n,"-select-auto-complete ").concat(t,",\n & > ").concat(n,"-cascader-picker ").concat(t,",\n & > ").concat(t,"-group-wrapper ").concat(t)]:{borderInlineEndWidth:e.lineWidth,borderRadius:0,"&:hover":{zIndex:1},"&:focus":{zIndex:1}},["& > ".concat(n,"-select-focused")]:{zIndex:1},["& > ".concat(n,"-select > ").concat(n,"-select-arrow")]:{zIndex:1},["& > *:first-child,\n & > ".concat(n,"-select:first-child > ").concat(n,"-select-selector,\n & > ").concat(n,"-select-auto-complete:first-child ").concat(t,",\n & > ").concat(n,"-cascader-picker:first-child ").concat(t)]:{borderStartStartRadius:e.borderRadius,borderEndStartRadius:e.borderRadius},["& > *:last-child,\n & > ".concat(n,"-select:last-child > ").concat(n,"-select-selector,\n & > ").concat(n,"-cascader-picker:last-child ").concat(t,",\n & > ").concat(n,"-cascader-picker-focused:last-child ").concat(t)]:{borderInlineEndWidth:e.lineWidth,borderStartEndRadius:e.borderRadius,borderEndEndRadius:e.borderRadius},["& > ".concat(n,"-select-auto-complete ").concat(t)]:{verticalAlign:"top"},["".concat(t,"-group-wrapper + ").concat(t,"-group-wrapper")]:{marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),["".concat(t,"-affix-wrapper")]:{borderRadius:0}},["".concat(t,"-group-wrapper:not(:last-child)")]:{["&".concat(t,"-search > ").concat(t,"-group")]:{["& > ".concat(t,"-group-addon > ").concat(t,"-search-button")]:{borderRadius:0},["& > ".concat(t)]:{borderStartStartRadius:e.borderRadius,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:e.borderRadius}}}})}},g=e=>{let{componentCls:t,controlHeightSM:n,lineWidth:r,calc:a}=e,i=a(n).sub(a(r).mul(2)).sub(16).div(2).equal();return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,o.Wf)(e)),p(e)),(0,s.qG)(e)),(0,s.H8)(e)),(0,s.Mu)(e)),{'&[type="color"]':{height:e.controlHeight,["&".concat(t,"-lg")]:{height:e.controlHeightLG},["&".concat(t,"-sm")]:{height:n,paddingTop:i,paddingBottom:i}},'&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration':{"-webkit-appearance":"none"}})}},h=e=>{let{componentCls:t}=e;return{["".concat(t,"-clear-icon")]:{margin:0,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,verticalAlign:-1,cursor:"pointer",transition:"color ".concat(e.motionDurationSlow),"&:hover":{color:e.colorTextTertiary},"&:active":{color:e.colorText},"&-hidden":{visibility:"hidden"},"&-has-suffix":{margin:"0 ".concat((0,r.bf)(e.inputAffixPadding))}}}},v=e=>{let{componentCls:t,inputAffixPadding:n,colorTextDescription:r,motionDurationSlow:o,colorIcon:a,colorIconHover:i,iconCls:c}=e;return{["".concat(t,"-affix-wrapper")]:Object.assign(Object.assign(Object.assign(Object.assign({},p(e)),{display:"inline-flex",["&:not(".concat(t,"-disabled):hover")]:{zIndex:1,["".concat(t,"-search-with-button &")]:{zIndex:0}},"&-focused, &:focus":{zIndex:1},["> input".concat(t)]:{padding:0,fontSize:"inherit",border:"none",borderRadius:0,outline:"none",background:"transparent",color:"inherit","&::-ms-reveal":{display:"none"},"&:focus":{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},["".concat(t)]:{"&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center","> *:not(:last-child)":{marginInlineEnd:e.paddingXS}},"&-show-count-suffix":{color:r},"&-show-count-has-suffix":{marginInlineEnd:e.paddingXXS},"&-prefix":{marginInlineEnd:n},"&-suffix":{marginInlineStart:n}}}),h(e)),{["".concat(c).concat(t,"-password-icon")]:{color:a,cursor:"pointer",transition:"all ".concat(o),"&:hover":{color:i}}})}},b=e=>{let{componentCls:t,borderRadiusLG:n,borderRadiusSM:r}=e;return{["".concat(t,"-group")]:Object.assign(Object.assign(Object.assign({},(0,o.Wf)(e)),m(e)),{"&-rtl":{direction:"rtl"},"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",width:"100%",textAlign:"start",verticalAlign:"top","&-rtl":{direction:"rtl"},"&-lg":{["".concat(t,"-group-addon")]:{borderRadius:n,fontSize:e.inputFontSizeLG}},"&-sm":{["".concat(t,"-group-addon")]:{borderRadius:r}}},(0,s.ir)(e)),(0,s.S5)(e)),{["&:not(".concat(t,"-compact-first-item):not(").concat(t,"-compact-last-item)").concat(t,"-compact-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderRadius:0}},["&:not(".concat(t,"-compact-last-item)").concat(t,"-compact-first-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderStartEndRadius:0,borderEndEndRadius:0}},["&:not(".concat(t,"-compact-first-item)").concat(t,"-compact-last-item")]:{["".concat(t,", ").concat(t,"-group-addon")]:{borderStartStartRadius:0,borderEndStartRadius:0}}})})}},y=e=>{let{componentCls:t,antCls:n}=e,r="".concat(t,"-search");return{[r]:{["".concat(t)]:{"&:hover, &:focus":{borderColor:e.colorPrimaryHover,["+ ".concat(t,"-group-addon ").concat(r,"-button:not(").concat(n,"-btn-primary)")]:{borderInlineStartColor:e.colorPrimaryHover}}},["".concat(t,"-affix-wrapper")]:{borderRadius:0},["".concat(t,"-lg")]:{lineHeight:e.calc(e.lineHeightLG).sub(2e-4).equal({unit:!1})},["> ".concat(t,"-group")]:{["> ".concat(t,"-group-addon:last-child")]:{insetInlineStart:-1,padding:0,border:0,["".concat(r,"-button")]:{paddingTop:0,paddingBottom:0,borderStartStartRadius:0,borderStartEndRadius:e.borderRadius,borderEndEndRadius:e.borderRadius,borderEndStartRadius:0,boxShadow:"none"},["".concat(r,"-button:not(").concat(n,"-btn-primary)")]:{color:e.colorTextDescription,"&:hover":{color:e.colorPrimaryHover},"&:active":{color:e.colorPrimaryActive},["&".concat(n,"-btn-loading::before")]:{insetInlineStart:0,insetInlineEnd:0,insetBlockStart:0,insetBlockEnd:0}}}},["".concat(r,"-button")]:{height:e.controlHeight,"&:hover, &:focus":{zIndex:1}},["&-large ".concat(r,"-button")]:{height:e.controlHeightLG},["&-small ".concat(r,"-button")]:{height:e.controlHeightSM},"&-rtl":{direction:"rtl"},["&".concat(t,"-compact-item")]:{["&:not(".concat(t,"-compact-last-item)")]:{["".concat(t,"-group-addon")]:{["".concat(t,"-search-button")]:{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal(),borderRadius:0}}},["&:not(".concat(t,"-compact-first-item)")]:{["".concat(t,",").concat(t,"-affix-wrapper")]:{borderRadius:0}},["> ".concat(t,"-group-addon ").concat(t,"-search-button,\n > ").concat(t,",\n ").concat(t,"-affix-wrapper")]:{"&:hover,&:focus,&:active":{zIndex:2}},["> ".concat(t,"-affix-wrapper-focused")]:{zIndex:2}}}}},w=e=>{let{componentCls:t,paddingLG:n}=e,r="".concat(t,"-textarea");return{[r]:{position:"relative","&-show-count":{["> ".concat(t)]:{height:"100%"},["".concat(t,"-data-count")]:{position:"absolute",bottom:e.calc(e.fontSize).mul(e.lineHeight).mul(-1).equal(),insetInlineEnd:0,color:e.colorTextDescription,whiteSpace:"nowrap",pointerEvents:"none"}},"&-allow-clear":{["> ".concat(t)]:{paddingInlineEnd:n}},["&-affix-wrapper".concat(r,"-has-feedback")]:{["".concat(t)]:{paddingInlineEnd:n}},["&-affix-wrapper".concat(t,"-affix-wrapper")]:{padding:0,["> textarea".concat(t)]:{fontSize:"inherit",border:"none",outline:"none",background:"transparent","&:focus":{boxShadow:"none !important"}},["".concat(t,"-suffix")]:{margin:0,"> *:not(:last-child)":{marginInline:0},["".concat(t,"-clear-icon")]:{position:"absolute",insetInlineEnd:e.paddingXS,insetBlockStart:e.paddingXS},["".concat(r,"-suffix")]:{position:"absolute",top:0,insetInlineEnd:e.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}}}}},x=e=>{let{componentCls:t}=e;return{["".concat(t,"-out-of-range")]:{["&, & input, & textarea, ".concat(t,"-show-count-suffix, ").concat(t,"-data-count")]:{color:e.colorError}}}};t.ZP=(0,i.I$)("Input",e=>{let t=(0,c.TS)(e,(0,l.e)(e));return[g(t),w(t),v(t),b(t),y(t),x(t),(0,a.c)(t)]},l.T)},37433:function(e,t,n){"use strict";n.d(t,{T:function(){return a},e:function(){return o}});var r=n(3104);function o(e){return(0,r.TS)(e,{inputAffixPadding:e.paddingXXS})}let a=e=>{let{controlHeight:t,fontSize:n,lineHeight:r,lineWidth:o,controlHeightSM:a,controlHeightLG:i,fontSizeLG:c,lineHeightLG:l,paddingSM:s,controlPaddingHorizontalSM:u,controlPaddingHorizontal:d,colorFillAlter:f,colorPrimaryHover:p,colorPrimary:m,controlOutlineWidth:g,controlOutline:h,colorErrorOutline:v,colorWarningOutline:b,colorBgContainer:y}=e;return{paddingBlock:Math.max(Math.round((t-n*r)/2*10)/10-o,0),paddingBlockSM:Math.max(Math.round((a-n*r)/2*10)/10-o,0),paddingBlockLG:Math.ceil((i-c*l)/2*10)/10-o,paddingInline:s-o,paddingInlineSM:u-o,paddingInlineLG:d-o,addonBg:f,activeBorderColor:m,hoverBorderColor:p,activeShadow:"0 0 0 ".concat(g,"px ").concat(h),errorActiveShadow:"0 0 0 ".concat(g,"px ").concat(v),warningActiveShadow:"0 0 0 ".concat(g,"px ").concat(b),hoverBg:y,activeBg:y,inputFontSize:n,inputFontSizeLG:c,inputFontSizeSM:n}}},65265:function(e,t,n){"use strict";n.d(t,{$U:function(){return c},H8:function(){return g},Mu:function(){return f},S5:function(){return v},Xy:function(){return i},ir:function(){return d},qG:function(){return s}});var r=n(352),o=n(3104);let a=e=>({borderColor:e.hoverBorderColor,backgroundColor:e.hoverBg}),i=e=>({color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled,borderColor:e.colorBorder,boxShadow:"none",cursor:"not-allowed",opacity:1,"&:hover:not([disabled])":Object.assign({},a((0,o.TS)(e,{hoverBorderColor:e.colorBorder,hoverBg:e.colorBgContainerDisabled})))}),c=(e,t)=>({background:e.colorBgContainer,borderWidth:e.lineWidth,borderStyle:e.lineType,borderColor:t.borderColor,"&:hover":{borderColor:t.hoverBorderColor,backgroundColor:e.hoverBg},"&:focus, &:focus-within":{borderColor:t.activeBorderColor,boxShadow:t.activeShadow,outline:0,backgroundColor:e.activeBg}}),l=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status,":not(").concat(e.componentCls,"-disabled)")]:Object.assign(Object.assign({},c(e,t)),{["".concat(e.componentCls,"-prefix, ").concat(e.componentCls,"-suffix")]:{color:t.affixColor}})}),s=(e,t)=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c(e,{borderColor:e.colorBorder,hoverBorderColor:e.colorPrimaryHover,activeBorderColor:e.colorPrimary,activeShadow:e.activeShadow})),{["&".concat(e.componentCls,"-disabled, &[disabled]")]:Object.assign({},i(e))}),l(e,{status:"error",borderColor:e.colorError,hoverBorderColor:e.colorErrorBorderHover,activeBorderColor:e.colorError,activeShadow:e.errorActiveShadow,affixColor:e.colorError})),l(e,{status:"warning",borderColor:e.colorWarning,hoverBorderColor:e.colorWarningBorderHover,activeBorderColor:e.colorWarning,activeShadow:e.warningActiveShadow,affixColor:e.colorWarning})),t)}),u=(e,t)=>({["&".concat(e.componentCls,"-group-wrapper-status-").concat(t.status)]:{["".concat(e.componentCls,"-group-addon")]:{borderColor:t.addonBorderColor,color:t.addonColor}}}),d=e=>({"&-outlined":Object.assign(Object.assign(Object.assign({["".concat(e.componentCls,"-group")]:{"&-addon":{background:e.addonBg,border:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)},"&-addon:first-child":{borderInlineEnd:0},"&-addon:last-child":{borderInlineStart:0}}},u(e,{status:"error",addonBorderColor:e.colorError,addonColor:e.colorErrorText})),u(e,{status:"warning",addonBorderColor:e.colorWarning,addonColor:e.colorWarningText})),{["&".concat(e.componentCls,"-group-wrapper-disabled")]:{["".concat(e.componentCls,"-group-addon")]:Object.assign({},i(e))}})}),f=(e,t)=>({"&-borderless":Object.assign({background:"transparent",border:"none","&:focus, &:focus-within":{outline:"none"},["&".concat(e.componentCls,"-disabled, &[disabled]")]:{color:e.colorTextDisabled}},t)}),p=(e,t)=>({background:t.bg,borderWidth:e.lineWidth,borderStyle:e.lineType,borderColor:"transparent","input&, & input, textarea&, & textarea":{color:null==t?void 0:t.inputColor},"&:hover":{background:t.hoverBg},"&:focus, &:focus-within":{outline:0,borderColor:t.activeBorderColor,backgroundColor:e.activeBg}}),m=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status,":not(").concat(e.componentCls,"-disabled)")]:Object.assign(Object.assign({},p(e,t)),{["".concat(e.componentCls,"-prefix, ").concat(e.componentCls,"-suffix")]:{color:t.affixColor}})}),g=(e,t)=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},p(e,{bg:e.colorFillTertiary,hoverBg:e.colorFillSecondary,activeBorderColor:e.colorPrimary})),{["&".concat(e.componentCls,"-disabled, &[disabled]")]:Object.assign({},i(e))}),m(e,{status:"error",bg:e.colorErrorBg,hoverBg:e.colorErrorBgHover,activeBorderColor:e.colorError,inputColor:e.colorErrorText,affixColor:e.colorError})),m(e,{status:"warning",bg:e.colorWarningBg,hoverBg:e.colorWarningBgHover,activeBorderColor:e.colorWarning,inputColor:e.colorWarningText,affixColor:e.colorWarning})),t)}),h=(e,t)=>({["&".concat(e.componentCls,"-group-wrapper-status-").concat(t.status)]:{["".concat(e.componentCls,"-group-addon")]:{background:t.addonBg,color:t.addonColor}}}),v=e=>({"&-filled":Object.assign(Object.assign(Object.assign({["".concat(e.componentCls,"-group")]:{"&-addon":{background:e.colorFillTertiary},["".concat(e.componentCls,"-filled:not(:focus):not(:focus-within)")]:{"&:not(:first-child)":{borderInlineStart:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},"&:not(:last-child)":{borderInlineEnd:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)}}}},h(e,{status:"error",addonBg:e.colorErrorBg,addonColor:e.colorErrorText})),h(e,{status:"warning",addonBg:e.colorWarningBg,addonColor:e.colorWarningText})),{["&".concat(e.componentCls,"-group-wrapper-disabled")]:{["".concat(e.componentCls,"-group")]:{"&-addon":{background:e.colorFillTertiary,color:e.colorTextDisabled},"&-addon:first-child":{borderInlineStart:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderTop:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderBottom:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)},"&-addon:last-child":{borderInlineEnd:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderTop:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderBottom:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)}}}})})},91325:function(e,t,n){"use strict";let r=(0,n(2265).createContext)(void 0);t.Z=r},13823:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(96257),o={placeholder:"Select time",rangePlaceholder:["Start time","End time"]};let a={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",yearFormat:"YYYY",dateFormat:"M/D/YYYY",dayFormat:"D",dateTimeFormat:"M/D/YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"}),timePickerLocale:Object.assign({},o)},i="${label} is not a valid ${type}";var c={locale:"en",Pagination:r.Z,DatePicker:a,TimePicker:o,Calendar:a,global:{placeholder:"Please select"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckall:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand"},PageHeader:{back:"Back"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty"}}},55274:function(e,t,n){"use strict";var r=n(2265),o=n(91325),a=n(13823);t.Z=(e,t)=>{let n=r.useContext(o.Z);return[r.useMemo(()=>{var r;let o=t||a.Z[e],i=null!==(r=null==n?void 0:n[e])&&void 0!==r?r:{};return Object.assign(Object.assign({},"function"==typeof o?o():o),i||{})},[e,t,n]),r.useMemo(()=>{let e=null==n?void 0:n.locale;return(null==n?void 0:n.exist)&&!e?a.Z.locale:e},[n])]}},42264:function(e,t,n){"use strict";n.d(t,{ZP:function(){return G}});var r=n(83145),o=n(2265),a=n(18404),i=n(52402),c=n(71744),l=n(13959),s=n(8900),u=n(39725),d=n(54537),f=n(55726),p=n(61935),m=n(36760),g=n.n(m),h=n(49283),v=n(352),b=n(62236),y=n(12918),w=n(80669),x=n(3104);let E=e=>{let{componentCls:t,iconCls:n,boxShadow:r,colorText:o,colorSuccess:a,colorError:i,colorWarning:c,colorInfo:l,fontSizeLG:s,motionEaseInOutCirc:u,motionDurationSlow:d,marginXS:f,paddingXS:p,borderRadiusLG:m,zIndexPopup:g,contentPadding:h,contentBg:b}=e,w="".concat(t,"-notice"),x=new v.E4("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:p,transform:"translateY(0)",opacity:1}}),E=new v.E4("MessageMoveOut",{"0%":{maxHeight:e.height,padding:p,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}}),S={padding:p,textAlign:"center",["".concat(t,"-custom-content > ").concat(n)]:{verticalAlign:"text-bottom",marginInlineEnd:f,fontSize:s},["".concat(w,"-content")]:{display:"inline-block",padding:h,background:b,borderRadius:m,boxShadow:r,pointerEvents:"all"},["".concat(t,"-success > ").concat(n)]:{color:a},["".concat(t,"-error > ").concat(n)]:{color:i},["".concat(t,"-warning > ").concat(n)]:{color:c},["".concat(t,"-info > ").concat(n,",\n ").concat(t,"-loading > ").concat(n)]:{color:l}};return[{[t]:Object.assign(Object.assign({},(0,y.Wf)(e)),{color:o,position:"fixed",top:f,width:"100%",pointerEvents:"none",zIndex:g,["".concat(t,"-move-up")]:{animationFillMode:"forwards"},["\n ".concat(t,"-move-up-appear,\n ").concat(t,"-move-up-enter\n ")]:{animationName:x,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},["\n ".concat(t,"-move-up-appear").concat(t,"-move-up-appear-active,\n ").concat(t,"-move-up-enter").concat(t,"-move-up-enter-active\n ")]:{animationPlayState:"running"},["".concat(t,"-move-up-leave")]:{animationName:E,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},["".concat(t,"-move-up-leave").concat(t,"-move-up-leave-active")]:{animationPlayState:"running"},"&-rtl":{direction:"rtl",span:{direction:"rtl"}}})},{[t]:{["".concat(w,"-wrapper")]:Object.assign({},S)}},{["".concat(t,"-notice-pure-panel")]:Object.assign(Object.assign({},S),{padding:0,textAlign:"start"})}]};var S=(0,w.I$)("Message",e=>[E((0,x.TS)(e,{height:150}))],e=>({zIndexPopup:e.zIndexPopupBase+b.u6+10,contentBg:e.colorBgElevated,contentPadding:"".concat((e.controlHeightLG-e.fontSize*e.lineHeight)/2,"px ").concat(e.paddingSM,"px")})),C=n(64024),Z=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};let O={info:o.createElement(f.Z,null),success:o.createElement(s.Z,null),error:o.createElement(u.Z,null),warning:o.createElement(d.Z,null),loading:o.createElement(p.Z,null)},k=e=>{let{prefixCls:t,type:n,icon:r,children:a}=e;return o.createElement("div",{className:g()("".concat(t,"-custom-content"),"".concat(t,"-").concat(n))},r||O[n],o.createElement("span",null,a))};var M=n(49638),j=n(13613);function I(e){let t;let n=new Promise(n=>{t=e(()=>{n(!0)})}),r=()=>{null==t||t()};return r.then=(e,t)=>n.then(e,t),r.promise=n,r}var R=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};let N=e=>{let{children:t,prefixCls:n}=e,r=(0,C.Z)(n),[a,i,c]=S(n,r);return a(o.createElement(h.JB,{classNames:{list:g()(i,c,r)}},t))},P=(e,t)=>{let{prefixCls:n,key:r}=t;return o.createElement(N,{prefixCls:n,key:r},e)},F=o.forwardRef((e,t)=>{let{top:n,prefixCls:r,getContainer:a,maxCount:i,duration:l=3,rtl:s,transitionName:u,onAllRemoved:d}=e,{getPrefixCls:f,getPopupContainer:p,message:m,direction:v}=o.useContext(c.E_),b=r||f("message"),y=o.createElement("span",{className:"".concat(b,"-close-x")},o.createElement(M.Z,{className:"".concat(b,"-close-icon")})),[w,x]=(0,h.lm)({prefixCls:b,style:()=>({left:"50%",transform:"translateX(-50%)",top:null!=n?n:8}),className:()=>g()({["".concat(b,"-rtl")]:null!=s?s:"rtl"===v}),motion:()=>({motionName:null!=u?u:"".concat(b,"-move-up")}),closable:!1,closeIcon:y,duration:l,getContainer:()=>(null==a?void 0:a())||(null==p?void 0:p())||document.body,maxCount:i,onAllRemoved:d,renderNotifications:P});return o.useImperativeHandle(t,()=>Object.assign(Object.assign({},w),{prefixCls:b,message:m})),x}),T=0;function A(e){let t=o.useRef(null);return(0,j.ln)("Message"),[o.useMemo(()=>{let e=e=>{var n;null===(n=t.current)||void 0===n||n.close(e)},n=n=>{if(!t.current){let e=()=>{};return e.then=()=>{},e}let{open:r,prefixCls:a,message:i}=t.current,c="".concat(a,"-notice"),{content:l,icon:s,type:u,key:d,className:f,style:p,onClose:m}=n,h=R(n,["content","icon","type","key","className","style","onClose"]),v=d;return null==v&&(T+=1,v="antd-message-".concat(T)),I(t=>(r(Object.assign(Object.assign({},h),{key:v,content:o.createElement(k,{prefixCls:a,type:u,icon:s},l),placement:"top",className:g()(u&&"".concat(c,"-").concat(u),f,null==i?void 0:i.className),style:Object.assign(Object.assign({},null==i?void 0:i.style),p),onClose:()=>{null==m||m(),t()}})),()=>{e(v)}))},r={open:n,destroy:n=>{var r;void 0!==n?e(n):null===(r=t.current)||void 0===r||r.destroy()}};return["info","success","warning","error","loading"].forEach(e=>{r[e]=(t,r,o)=>{let a,i,c;return a=t&&"object"==typeof t&&"content"in t?t:{content:t},"function"==typeof r?c=r:(i=r,c=o),n(Object.assign(Object.assign({onClose:c,duration:i},a),{type:e}))}}),r},[]),o.createElement(F,Object.assign({key:"message-holder"},e,{ref:t}))]}let L=null,z=e=>e(),_=[],H={};function B(){let{getContainer:e,duration:t,rtl:n,maxCount:r,top:o}=H,a=(null==e?void 0:e())||document.body;return{getContainer:()=>a,duration:t,rtl:n,maxCount:r,top:o}}let D=o.forwardRef((e,t)=>{let{messageConfig:n,sync:r}=e,{getPrefixCls:a}=(0,o.useContext)(c.E_),l=H.prefixCls||a("message"),s=(0,o.useContext)(i.J),[u,d]=A(Object.assign(Object.assign(Object.assign({},n),{prefixCls:l}),s.message));return o.useImperativeHandle(t,()=>{let e=Object.assign({},u);return Object.keys(e).forEach(t=>{e[t]=function(){return r(),u[t].apply(u,arguments)}}),{instance:e,sync:r}}),d}),W=o.forwardRef((e,t)=>{let[n,r]=o.useState(B),a=()=>{r(B)};o.useEffect(a,[]);let i=(0,l.w6)(),c=i.getRootPrefixCls(),s=i.getIconPrefixCls(),u=i.getTheme(),d=o.createElement(D,{ref:t,sync:a,messageConfig:n});return o.createElement(l.ZP,{prefixCls:c,iconPrefixCls:s,theme:u},i.holderRender?i.holderRender(d):d)});function V(){if(!L){let e=document.createDocumentFragment(),t={fragment:e};L=t,z(()=>{(0,a.s)(o.createElement(W,{ref:e=>{let{instance:n,sync:r}=e||{};Promise.resolve().then(()=>{!t.instance&&n&&(t.instance=n,t.sync=r,V())})}}),e)});return}L.instance&&(_.forEach(e=>{let{type:t,skipped:n}=e;if(!n)switch(t){case"open":z(()=>{let t=L.instance.open(Object.assign(Object.assign({},H),e.config));null==t||t.then(e.resolve),e.setCloseFn(t)});break;case"destroy":z(()=>{null==L||L.instance.destroy(e.key)});break;default:z(()=>{var n;let o=(n=L.instance)[t].apply(n,(0,r.Z)(e.args));null==o||o.then(e.resolve),e.setCloseFn(o)})}}),_=[])}let q={open:function(e){let t=I(t=>{let n;let r={type:"open",config:e,resolve:t,setCloseFn:e=>{n=e}};return _.push(r),()=>{n?z(()=>{n()}):r.skipped=!0}});return V(),t},destroy:function(e){_.push({type:"destroy",key:e}),V()},config:function(e){H=Object.assign(Object.assign({},H),e),z(()=>{var e;null===(e=null==L?void 0:L.sync)||void 0===e||e.call(L)})},useMessage:function(e){return A(e)},_InternalPanelDoNotUseOrYouWillBeFired:e=>{let{prefixCls:t,className:n,type:r,icon:a,content:i}=e,l=Z(e,["prefixCls","className","type","icon","content"]),{getPrefixCls:s}=o.useContext(c.E_),u=t||s("message"),d=(0,C.Z)(u),[f,p,m]=S(u,d);return f(o.createElement(h.qX,Object.assign({},l,{prefixCls:u,className:g()(n,p,"".concat(u,"-notice-pure-panel"),m,d),eventKey:"pure",duration:null,content:o.createElement(k,{prefixCls:u,type:r,icon:a},i)})))}};["success","info","warning","error","loading"].forEach(e=>{q[e]=function(){for(var t=arguments.length,n=Array(t),r=0;r{let r;let o={type:e,args:t,resolve:n,setCloseFn:e=>{r=e}};return _.push(o),()=>{r?z(()=>{r()}):o.skipped=!0}});return V(),n}(e,n)}});var G=q},92246:function(e,t,n){"use strict";n.d(t,{A:function(){return l},f:function(){return c}});var r=n(13823);let o=Object.assign({},r.Z.Modal),a=[],i=()=>a.reduce((e,t)=>Object.assign(Object.assign({},e),t),r.Z.Modal);function c(e){if(e){let t=Object.assign({},e);return a.push(t),o=i(),()=>{a=a.filter(e=>e!==t),o=i()}}o=Object.assign({},r.Z.Modal)}function l(){return o}},57271:function(e,t,n){"use strict";n.d(t,{ZP:function(){return er}});var r=n(2265),o=n(18404),a=n(52402),i=n(71744),c=n(13959),l=n(8900),s=n(39725),u=n(49638),d=n(54537),f=n(55726),p=n(61935),m=n(36760),g=n.n(m),h=n(49283),v=n(64024),b=n(352),y=n(62236),w=n(12918),x=n(3104),E=n(80669),S=e=>{let{componentCls:t,notificationMarginEdge:n,animationMaxHeight:r}=e,o="".concat(t,"-notice"),a=new b.E4("antNotificationFadeIn",{"0%":{transform:"translate3d(100%, 0, 0)",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",opacity:1}}),i=new b.E4("antNotificationTopFadeIn",{"0%":{top:-r,opacity:0},"100%":{top:0,opacity:1}}),c=new b.E4("antNotificationBottomFadeIn",{"0%":{bottom:e.calc(r).mul(-1).equal(),opacity:0},"100%":{bottom:0,opacity:1}}),l=new b.E4("antNotificationLeftFadeIn",{"0%":{transform:"translate3d(-100%, 0, 0)",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",opacity:1}});return{[t]:{["&".concat(t,"-top, &").concat(t,"-bottom")]:{marginInline:0,[o]:{marginInline:"auto auto"}},["&".concat(t,"-top")]:{["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationName:i}},["&".concat(t,"-bottom")]:{["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationName:c}},["&".concat(t,"-topRight, &").concat(t,"-bottomRight")]:{["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationName:a}},["&".concat(t,"-topLeft, &").concat(t,"-bottomLeft")]:{marginRight:{value:0,_skip_check_:!0},marginLeft:{value:n,_skip_check_:!0},[o]:{marginInlineEnd:"auto",marginInlineStart:0},["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationName:l}}}}};let C=["top","topLeft","topRight","bottom","bottomLeft","bottomRight"],Z={topLeft:"left",topRight:"right",bottomLeft:"left",bottomRight:"right",top:"left",bottom:"left"},O=(e,t)=>{let{componentCls:n}=e;return{["".concat(n,"-").concat(t)]:{["&".concat(n,"-stack > ").concat(n,"-notice-wrapper")]:{[t.startsWith("top")?"top":"bottom"]:0,[Z[t]]:{value:0,_skip_check_:!0}}}}},k=e=>{let t={};for(let n=1;n ".concat(e.componentCls,"-notice")]:{opacity:0,transition:"opacity ".concat(e.motionDurationMid)}};return Object.assign({["&:not(:nth-last-child(-n+".concat(e.notificationStackLayer,"))")]:{opacity:0,overflow:"hidden",color:"transparent",pointerEvents:"none"}},t)},M=e=>{let t={};for(let n=1;n{let{componentCls:t}=e;return Object.assign({["".concat(t,"-stack")]:{["& > ".concat(t,"-notice-wrapper")]:Object.assign({transition:"all ".concat(e.motionDurationSlow,", backdrop-filter 0s"),position:"absolute"},k(e))},["".concat(t,"-stack:not(").concat(t,"-stack-expanded)")]:{["& > ".concat(t,"-notice-wrapper")]:Object.assign({},M(e))},["".concat(t,"-stack").concat(t,"-stack-expanded")]:{["& > ".concat(t,"-notice-wrapper")]:{"&:not(:nth-last-child(-n + 1))":{opacity:1,overflow:"unset",color:"inherit",pointerEvents:"auto",["& > ".concat(e.componentCls,"-notice")]:{opacity:1}},"&:after":{content:'""',position:"absolute",height:e.margin,width:"100%",insetInline:0,bottom:e.calc(e.margin).mul(-1).equal(),background:"transparent",pointerEvents:"auto"}}}},C.map(t=>O(e,t)).reduce((e,t)=>Object.assign(Object.assign({},e),t),{}))};let I=e=>{let{iconCls:t,componentCls:n,boxShadow:r,fontSizeLG:o,notificationMarginBottom:a,borderRadiusLG:i,colorSuccess:c,colorInfo:l,colorWarning:s,colorError:u,colorTextHeading:d,notificationBg:f,notificationPadding:p,notificationMarginEdge:m,fontSize:g,lineHeight:h,width:v,notificationIconSize:y,colorText:w}=e,x="".concat(n,"-notice");return{position:"relative",marginBottom:a,marginInlineStart:"auto",background:f,borderRadius:i,boxShadow:r,[x]:{padding:p,width:v,maxWidth:"calc(100vw - ".concat((0,b.bf)(e.calc(m).mul(2).equal()),")"),overflow:"hidden",lineHeight:h,wordWrap:"break-word"},["".concat(n,"-close-icon")]:{fontSize:g,cursor:"pointer"},["".concat(x,"-message")]:{marginBottom:e.marginXS,color:d,fontSize:o,lineHeight:e.lineHeightLG},["".concat(x,"-description")]:{fontSize:g,color:w},["".concat(x,"-closable ").concat(x,"-message")]:{paddingInlineEnd:e.paddingLG},["".concat(x,"-with-icon ").concat(x,"-message")]:{marginBottom:e.marginXS,marginInlineStart:e.calc(e.marginSM).add(y).equal(),fontSize:o},["".concat(x,"-with-icon ").concat(x,"-description")]:{marginInlineStart:e.calc(e.marginSM).add(y).equal(),fontSize:g},["".concat(x,"-icon")]:{position:"absolute",fontSize:y,lineHeight:1,["&-success".concat(t)]:{color:c},["&-info".concat(t)]:{color:l},["&-warning".concat(t)]:{color:s},["&-error".concat(t)]:{color:u}},["".concat(x,"-close")]:{position:"absolute",top:e.notificationPaddingVertical,insetInlineEnd:e.notificationPaddingHorizontal,color:e.colorIcon,outline:"none",width:e.notificationCloseButtonSize,height:e.notificationCloseButtonSize,borderRadius:e.borderRadiusSM,transition:"background-color ".concat(e.motionDurationMid,", color ").concat(e.motionDurationMid),display:"flex",alignItems:"center",justifyContent:"center","&:hover":{color:e.colorIconHover,backgroundColor:e.closeBtnHoverBg}},["".concat(x,"-btn")]:{float:"right",marginTop:e.marginSM}}},R=e=>{let{componentCls:t,notificationMarginBottom:n,notificationMarginEdge:r,motionDurationMid:o,motionEaseInOut:a}=e,i="".concat(t,"-notice"),c=new b.E4("antNotificationFadeOut",{"0%":{maxHeight:e.animationMaxHeight,marginBottom:n},"100%":{maxHeight:0,marginBottom:0,paddingTop:0,paddingBottom:0,opacity:0}});return[{[t]:Object.assign(Object.assign({},(0,w.Wf)(e)),{position:"fixed",zIndex:e.zIndexPopup,marginRight:{value:r,_skip_check_:!0},["".concat(t,"-hook-holder")]:{position:"relative"},["".concat(t,"-fade-appear-prepare")]:{opacity:"0 !important"},["".concat(t,"-fade-enter, ").concat(t,"-fade-appear")]:{animationDuration:e.motionDurationMid,animationTimingFunction:a,animationFillMode:"both",opacity:0,animationPlayState:"paused"},["".concat(t,"-fade-leave")]:{animationTimingFunction:a,animationFillMode:"both",animationDuration:o,animationPlayState:"paused"},["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationPlayState:"running"},["".concat(t,"-fade-leave").concat(t,"-fade-leave-active")]:{animationName:c,animationPlayState:"running"},"&-rtl":{direction:"rtl",["".concat(i,"-btn")]:{float:"left"}}})},{[t]:{["".concat(i,"-wrapper")]:Object.assign({},I(e))}}]},N=e=>({zIndexPopup:e.zIndexPopupBase+y.u6+50,width:384,closeBtnHoverBg:e.wireframe?"transparent":e.colorFillContent}),P=e=>{let t=e.paddingMD,n=e.paddingLG;return(0,x.TS)(e,{notificationBg:e.colorBgElevated,notificationPaddingVertical:t,notificationPaddingHorizontal:n,notificationIconSize:e.calc(e.fontSizeLG).mul(e.lineHeightLG).equal(),notificationCloseButtonSize:e.calc(e.controlHeightLG).mul(.55).equal(),notificationMarginBottom:e.margin,notificationPadding:"".concat((0,b.bf)(e.paddingMD)," ").concat((0,b.bf)(e.paddingContentHorizontalLG)),notificationMarginEdge:e.marginLG,animationMaxHeight:150,notificationStackLayer:3})};var F=(0,E.I$)("Notification",e=>{let t=P(e);return[R(t),S(t),j(t)]},N),T=(0,E.bk)(["Notification","PurePanel"],e=>{let t="".concat(e.componentCls,"-notice"),n=P(e);return{["".concat(t,"-pure-panel")]:Object.assign(Object.assign({},I(n)),{width:n.width,maxWidth:"calc(100vw - ".concat((0,b.bf)(e.calc(n.notificationMarginEdge).mul(2).equal()),")"),margin:0})}},N),A=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};function L(e,t){return null===t||!1===t?null:t||r.createElement("span",{className:"".concat(e,"-close-x")},r.createElement(u.Z,{className:"".concat(e,"-close-icon")}))}f.Z,l.Z,s.Z,d.Z,p.Z;let z={success:l.Z,info:f.Z,error:s.Z,warning:d.Z},_=e=>{let{prefixCls:t,icon:n,type:o,message:a,description:i,btn:c,role:l="alert"}=e,s=null;return n?s=r.createElement("span",{className:"".concat(t,"-icon")},n):o&&(s=r.createElement(z[o]||null,{className:g()("".concat(t,"-icon"),"".concat(t,"-icon-").concat(o))})),r.createElement("div",{className:g()({["".concat(t,"-with-icon")]:s}),role:l},s,r.createElement("div",{className:"".concat(t,"-message")},a),r.createElement("div",{className:"".concat(t,"-description")},i),c&&r.createElement("div",{className:"".concat(t,"-btn")},c))};var H=n(13613),B=n(29961),D=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};let W=e=>{let{children:t,prefixCls:n}=e,o=(0,v.Z)(n),[a,i,c]=F(n,o);return a(r.createElement(h.JB,{classNames:{list:g()(i,c,o)}},t))},V=(e,t)=>{let{prefixCls:n,key:o}=t;return r.createElement(W,{prefixCls:n,key:o},e)},q=r.forwardRef((e,t)=>{let{top:n,bottom:o,prefixCls:a,getContainer:c,maxCount:l,rtl:s,onAllRemoved:u,stack:d}=e,{getPrefixCls:f,getPopupContainer:p,notification:m,direction:v}=(0,r.useContext)(i.E_),[,b]=(0,B.ZP)(),y=a||f("notification"),[w,x]=(0,h.lm)({prefixCls:y,style:e=>(function(e,t,n){let r;switch(e){case"top":r={left:"50%",transform:"translateX(-50%)",right:"auto",top:t,bottom:"auto"};break;case"topLeft":r={left:0,top:t,bottom:"auto"};break;case"topRight":r={right:0,top:t,bottom:"auto"};break;case"bottom":r={left:"50%",transform:"translateX(-50%)",right:"auto",top:"auto",bottom:n};break;case"bottomLeft":r={left:0,top:"auto",bottom:n};break;default:r={right:0,top:"auto",bottom:n}}return r})(e,null!=n?n:24,null!=o?o:24),className:()=>g()({["".concat(y,"-rtl")]:null!=s?s:"rtl"===v}),motion:()=>({motionName:"".concat(y,"-fade")}),closable:!0,closeIcon:L(y),duration:4.5,getContainer:()=>(null==c?void 0:c())||(null==p?void 0:p())||document.body,maxCount:l,onAllRemoved:u,renderNotifications:V,stack:!1!==d&&{threshold:"object"==typeof d?null==d?void 0:d.threshold:void 0,offset:8,gap:b.margin}});return r.useImperativeHandle(t,()=>Object.assign(Object.assign({},w),{prefixCls:y,notification:m})),x});function G(e){let t=r.useRef(null);return(0,H.ln)("Notification"),[r.useMemo(()=>{let n=n=>{var o;if(!t.current)return;let{open:a,prefixCls:i,notification:c}=t.current,l="".concat(i,"-notice"),{message:s,description:u,icon:d,type:f,btn:p,className:m,style:h,role:v="alert",closeIcon:b}=n,y=D(n,["message","description","icon","type","btn","className","style","role","closeIcon"]),w=L(l,b);return a(Object.assign(Object.assign({placement:null!==(o=null==e?void 0:e.placement)&&void 0!==o?o:"topRight"},y),{content:r.createElement(_,{prefixCls:l,icon:d,type:f,message:s,description:u,btn:p,role:v}),className:g()(f&&"".concat(l,"-").concat(f),m,null==c?void 0:c.className),style:Object.assign(Object.assign({},null==c?void 0:c.style),h),closeIcon:w,closable:!!w}))},o={open:n,destroy:e=>{var n,r;void 0!==e?null===(n=t.current)||void 0===n||n.close(e):null===(r=t.current)||void 0===r||r.destroy()}};return["success","info","warning","error"].forEach(e=>{o[e]=t=>n(Object.assign(Object.assign({},t),{type:e}))}),o},[]),r.createElement(q,Object.assign({key:"notification-holder"},e,{ref:t}))]}let X=null,U=e=>e(),$=[],K={};function Y(){let{getContainer:e,rtl:t,maxCount:n,top:r,bottom:o}=K,a=(null==e?void 0:e())||document.body;return{getContainer:()=>a,rtl:t,maxCount:n,top:r,bottom:o}}let Q=r.forwardRef((e,t)=>{let{notificationConfig:n,sync:o}=e,{getPrefixCls:c}=(0,r.useContext)(i.E_),l=K.prefixCls||c("notification"),s=(0,r.useContext)(a.J),[u,d]=G(Object.assign(Object.assign(Object.assign({},n),{prefixCls:l}),s.notification));return r.useEffect(o,[]),r.useImperativeHandle(t,()=>{let e=Object.assign({},u);return Object.keys(e).forEach(t=>{e[t]=function(){return o(),u[t].apply(u,arguments)}}),{instance:e,sync:o}}),d}),J=r.forwardRef((e,t)=>{let[n,o]=r.useState(Y),a=()=>{o(Y)};r.useEffect(a,[]);let i=(0,c.w6)(),l=i.getRootPrefixCls(),s=i.getIconPrefixCls(),u=i.getTheme(),d=r.createElement(Q,{ref:t,sync:a,notificationConfig:n});return r.createElement(c.ZP,{prefixCls:l,iconPrefixCls:s,theme:u},i.holderRender?i.holderRender(d):d)});function ee(){if(!X){let e=document.createDocumentFragment(),t={fragment:e};X=t,U(()=>{(0,o.s)(r.createElement(J,{ref:e=>{let{instance:n,sync:r}=e||{};Promise.resolve().then(()=>{!t.instance&&n&&(t.instance=n,t.sync=r,ee())})}}),e)});return}X.instance&&($.forEach(e=>{switch(e.type){case"open":U(()=>{X.instance.open(Object.assign(Object.assign({},K),e.config))});break;case"destroy":U(()=>{null==X||X.instance.destroy(e.key)})}}),$=[])}function et(e){(0,c.w6)(),$.push({type:"open",config:e}),ee()}let en={open:et,destroy:function(e){$.push({type:"destroy",key:e}),ee()},config:function(e){K=Object.assign(Object.assign({},K),e),U(()=>{var e;null===(e=null==X?void 0:X.sync)||void 0===e||e.call(X)})},useNotification:function(e){return G(e)},_InternalPanelDoNotUseOrYouWillBeFired:e=>{let{prefixCls:t,className:n,icon:o,type:a,message:c,description:l,btn:s,closable:u=!0,closeIcon:d,className:f}=e,p=A(e,["prefixCls","className","icon","type","message","description","btn","closable","closeIcon","className"]),{getPrefixCls:m}=r.useContext(i.E_),b=t||m("notification"),y="".concat(b,"-notice"),w=(0,v.Z)(b),[x,E,S]=F(b,w);return x(r.createElement("div",{className:g()("".concat(y,"-pure-panel"),E,n,S,w)},r.createElement(T,{prefixCls:b}),r.createElement(h.qX,Object.assign({},p,{prefixCls:b,eventKey:"pure",duration:null,closable:u,className:g()({notificationClassName:f}),closeIcon:L(b,d),content:r.createElement(_,{prefixCls:y,icon:o,type:a,message:c,description:l,btn:s})}))))}};["success","info","warning","error"].forEach(e=>{en[e]=t=>et(Object.assign(Object.assign({},t),{type:e}))});var er=en},52787:function(e,t,n){"use strict";n.d(t,{default:function(){return tt}});var r=n(2265),o=n(36760),a=n.n(o),i=n(1119),c=n(83145),l=n(11993),s=n(31686),u=n(26365),d=n(6989),f=n(41154),p=n(50506),m=n(32559),g=n(27380),h=n(79267),v=n(95814),b=n(28791),y=function(e){var t=e.className,n=e.customizeIcon,o=e.customizeIconProps,i=e.children,c=e.onMouseDown,l=e.onClick,s="function"==typeof n?n(o):n;return r.createElement("span",{className:t,onMouseDown:function(e){e.preventDefault(),null==c||c(e)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:l,"aria-hidden":!0},void 0!==s?s:r.createElement("span",{className:a()(t.split(/\s+/).map(function(e){return"".concat(e,"-icon")}))},i))},w=function(e,t,n,o,a){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,s=r.useMemo(function(){return"object"===(0,f.Z)(o)?o.clearIcon:a||void 0},[o,a]);return{allowClear:r.useMemo(function(){return!i&&!!o&&(!!n.length||!!c)&&!("combobox"===l&&""===c)},[o,i,n.length,c,l]),clearIcon:r.createElement(y,{className:"".concat(e,"-clear"),onMouseDown:t,customizeIcon:s},"\xd7")}},x=r.createContext(null);function E(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:250,t=r.useRef(null),n=r.useRef(null);return r.useEffect(function(){return function(){window.clearTimeout(n.current)}},[]),[function(){return t.current},function(r){(r||null===t.current)&&(t.current=r),window.clearTimeout(n.current),n.current=window.setTimeout(function(){t.current=null},e)}]}var S=n(18242),C=n(1699),Z=r.forwardRef(function(e,t){var n,o=e.prefixCls,i=e.id,c=e.inputElement,l=e.disabled,u=e.tabIndex,d=e.autoFocus,f=e.autoComplete,p=e.editable,g=e.activeDescendantId,h=e.value,v=e.maxLength,y=e.onKeyDown,w=e.onMouseDown,x=e.onChange,E=e.onPaste,S=e.onCompositionStart,C=e.onCompositionEnd,Z=e.open,O=e.attrs,k=c||r.createElement("input",null),M=k,j=M.ref,I=M.props,R=I.onKeyDown,N=I.onChange,P=I.onMouseDown,F=I.onCompositionStart,T=I.onCompositionEnd,A=I.style;return(0,m.Kp)(!("maxLength"in k.props),"Passing 'maxLength' to input element directly may not work because input in BaseSelect is controlled."),k=r.cloneElement(k,(0,s.Z)((0,s.Z)((0,s.Z)({type:"search"},I),{},{id:i,ref:(0,b.sQ)(t,j),disabled:l,tabIndex:u,autoComplete:f||"off",autoFocus:d,className:a()("".concat(o,"-selection-search-input"),null===(n=k)||void 0===n||null===(n=n.props)||void 0===n?void 0:n.className),role:"combobox","aria-expanded":Z||!1,"aria-haspopup":"listbox","aria-owns":"".concat(i,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(i,"_list"),"aria-activedescendant":Z?g:void 0},O),{},{value:p?h:"",maxLength:v,readOnly:!p,unselectable:p?null:"on",style:(0,s.Z)((0,s.Z)({},A),{},{opacity:p?null:0}),onKeyDown:function(e){y(e),R&&R(e)},onMouseDown:function(e){w(e),P&&P(e)},onChange:function(e){x(e),N&&N(e)},onCompositionStart:function(e){S(e),F&&F(e)},onCompositionEnd:function(e){C(e),T&&T(e)},onPaste:E}))});function O(e){return Array.isArray(e)?e:void 0!==e?[e]:[]}var k="undefined"!=typeof window&&window.document&&window.document.documentElement;function M(e){return["string","number"].includes((0,f.Z)(e))}function j(e){var t=void 0;return e&&(M(e.title)?t=e.title.toString():M(e.label)&&(t=e.label.toString())),t}function I(e){var t;return null!==(t=e.key)&&void 0!==t?t:e.value}var R=function(e){e.preventDefault(),e.stopPropagation()},N=function(e){var t,n,o=e.id,i=e.prefixCls,c=e.values,s=e.open,d=e.searchValue,f=e.autoClearSearchValue,p=e.inputRef,m=e.placeholder,g=e.disabled,h=e.mode,v=e.showSearch,b=e.autoFocus,w=e.autoComplete,x=e.activeDescendantId,E=e.tabIndex,O=e.removeIcon,M=e.maxTagCount,N=e.maxTagTextLength,P=e.maxTagPlaceholder,F=void 0===P?function(e){return"+ ".concat(e.length," ...")}:P,T=e.tagRender,A=e.onToggleOpen,L=e.onRemove,z=e.onInputChange,_=e.onInputPaste,H=e.onInputKeyDown,B=e.onInputMouseDown,D=e.onInputCompositionStart,W=e.onInputCompositionEnd,V=r.useRef(null),q=(0,r.useState)(0),G=(0,u.Z)(q,2),X=G[0],U=G[1],$=(0,r.useState)(!1),K=(0,u.Z)($,2),Y=K[0],Q=K[1],J="".concat(i,"-selection"),ee=s||"multiple"===h&&!1===f||"tags"===h?d:"",et="tags"===h||"multiple"===h&&!1===f||v&&(s||Y);t=function(){U(V.current.scrollWidth)},n=[ee],k?r.useLayoutEffect(t,n):r.useEffect(t,n);var en=function(e,t,n,o,i){return r.createElement("span",{title:j(e),className:a()("".concat(J,"-item"),(0,l.Z)({},"".concat(J,"-item-disabled"),n))},r.createElement("span",{className:"".concat(J,"-item-content")},t),o&&r.createElement(y,{className:"".concat(J,"-item-remove"),onMouseDown:R,onClick:i,customizeIcon:O},"\xd7"))},er=r.createElement("div",{className:"".concat(J,"-search"),style:{width:X},onFocus:function(){Q(!0)},onBlur:function(){Q(!1)}},r.createElement(Z,{ref:p,open:s,prefixCls:i,id:o,inputElement:null,disabled:g,autoFocus:b,autoComplete:w,editable:et,activeDescendantId:x,value:ee,onKeyDown:H,onMouseDown:B,onChange:z,onPaste:_,onCompositionStart:D,onCompositionEnd:W,tabIndex:E,attrs:(0,S.Z)(e,!0)}),r.createElement("span",{ref:V,className:"".concat(J,"-search-mirror"),"aria-hidden":!0},ee,"\xa0")),eo=r.createElement(C.Z,{prefixCls:"".concat(J,"-overflow"),data:c,renderItem:function(e){var t,n=e.disabled,o=e.label,a=e.value,i=!g&&!n,c=o;if("number"==typeof N&&("string"==typeof o||"number"==typeof o)){var l=String(c);l.length>N&&(c="".concat(l.slice(0,N),"..."))}var u=function(t){t&&t.stopPropagation(),L(e)};return"function"==typeof T?(t=c,r.createElement("span",{onMouseDown:function(e){R(e),A(!s)}},T({label:t,value:a,disabled:n,closable:i,onClose:u}))):en(e,c,n,i,u)},renderRest:function(e){var t="function"==typeof F?F(e):F;return en({title:t},t,!1)},suffix:er,itemKey:I,maxCount:M});return r.createElement(r.Fragment,null,eo,!c.length&&!ee&&r.createElement("span",{className:"".concat(J,"-placeholder")},m))},P=function(e){var t=e.inputElement,n=e.prefixCls,o=e.id,a=e.inputRef,i=e.disabled,c=e.autoFocus,l=e.autoComplete,s=e.activeDescendantId,d=e.mode,f=e.open,p=e.values,m=e.placeholder,g=e.tabIndex,h=e.showSearch,v=e.searchValue,b=e.activeValue,y=e.maxLength,w=e.onInputKeyDown,x=e.onInputMouseDown,E=e.onInputChange,C=e.onInputPaste,O=e.onInputCompositionStart,k=e.onInputCompositionEnd,M=e.title,I=r.useState(!1),R=(0,u.Z)(I,2),N=R[0],P=R[1],F="combobox"===d,T=F||h,A=p[0],L=v||"";F&&b&&!N&&(L=b),r.useEffect(function(){F&&P(!1)},[F,b]);var z=("combobox"===d||!!f||!!h)&&!!L,_=void 0===M?j(A):M,H=r.useMemo(function(){return A?null:r.createElement("span",{className:"".concat(n,"-selection-placeholder"),style:z?{visibility:"hidden"}:void 0},m)},[A,z,m,n]);return r.createElement(r.Fragment,null,r.createElement("span",{className:"".concat(n,"-selection-search")},r.createElement(Z,{ref:a,prefixCls:n,id:o,open:f,inputElement:t,disabled:i,autoFocus:c,autoComplete:l,editable:T,activeDescendantId:s,value:L,onKeyDown:w,onMouseDown:x,onChange:function(e){P(!0),E(e)},onPaste:C,onCompositionStart:O,onCompositionEnd:k,tabIndex:g,attrs:(0,S.Z)(e,!0),maxLength:F?y:void 0})),!F&&A?r.createElement("span",{className:"".concat(n,"-selection-item"),title:_,style:z?{visibility:"hidden"}:void 0},A.label):null,H)},F=r.forwardRef(function(e,t){var n=(0,r.useRef)(null),o=(0,r.useRef)(!1),a=e.prefixCls,c=e.open,l=e.mode,s=e.showSearch,d=e.tokenWithEnter,f=e.autoClearSearchValue,p=e.onSearch,m=e.onSearchSubmit,g=e.onToggleOpen,h=e.onInputKeyDown,b=e.domRef;r.useImperativeHandle(t,function(){return{focus:function(){n.current.focus()},blur:function(){n.current.blur()}}});var y=E(0),w=(0,u.Z)(y,2),x=w[0],S=w[1],C=(0,r.useRef)(null),Z=function(e){!1!==p(e,!0,o.current)&&g(!0)},O={inputRef:n,onInputKeyDown:function(e){var t=e.which;(t===v.Z.UP||t===v.Z.DOWN)&&e.preventDefault(),h&&h(e),t!==v.Z.ENTER||"tags"!==l||o.current||c||null==m||m(e.target.value),[v.Z.ESC,v.Z.SHIFT,v.Z.BACKSPACE,v.Z.TAB,v.Z.WIN_KEY,v.Z.ALT,v.Z.META,v.Z.WIN_KEY_RIGHT,v.Z.CTRL,v.Z.SEMICOLON,v.Z.EQUALS,v.Z.CAPS_LOCK,v.Z.CONTEXT_MENU,v.Z.F1,v.Z.F2,v.Z.F3,v.Z.F4,v.Z.F5,v.Z.F6,v.Z.F7,v.Z.F8,v.Z.F9,v.Z.F10,v.Z.F11,v.Z.F12].includes(t)||g(!0)},onInputMouseDown:function(){S(!0)},onInputChange:function(e){var t=e.target.value;if(d&&C.current&&/[\r\n]/.test(C.current)){var n=C.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");t=t.replace(n,C.current)}C.current=null,Z(t)},onInputPaste:function(e){var t=e.clipboardData,n=null==t?void 0:t.getData("text");C.current=n||""},onInputCompositionStart:function(){o.current=!0},onInputCompositionEnd:function(e){o.current=!1,"combobox"!==l&&Z(e.target.value)}},k="multiple"===l||"tags"===l?r.createElement(N,(0,i.Z)({},e,O)):r.createElement(P,(0,i.Z)({},e,O));return r.createElement("div",{ref:b,className:"".concat(a,"-selector"),onClick:function(e){e.target!==n.current&&(void 0!==document.body.style.msTouchAction?setTimeout(function(){n.current.focus()}):n.current.focus())},onMouseDown:function(e){var t=x();e.target===n.current||t||"combobox"===l||e.preventDefault(),("combobox"===l||s&&t)&&c||(c&&!1!==f&&p("",!0,!1),g())}},k)}),T=n(97821),A=["prefixCls","disabled","visible","children","popupElement","animation","transitionName","dropdownStyle","dropdownClassName","direction","placement","builtinPlacements","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","getPopupContainer","empty","getTriggerDOMNode","onPopupVisibleChange","onPopupMouseEnter"],L=function(e){var t=!0===e?0:1;return{bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:t,adjustY:1},htmlRegion:"scroll"},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:t,adjustY:1},htmlRegion:"scroll"},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:t,adjustY:1},htmlRegion:"scroll"},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:t,adjustY:1},htmlRegion:"scroll"}}},z=r.forwardRef(function(e,t){var n=e.prefixCls,o=(e.disabled,e.visible),c=e.children,u=e.popupElement,f=e.animation,p=e.transitionName,m=e.dropdownStyle,g=e.dropdownClassName,h=e.direction,v=e.placement,b=e.builtinPlacements,y=e.dropdownMatchSelectWidth,w=e.dropdownRender,x=e.dropdownAlign,E=e.getPopupContainer,S=e.empty,C=e.getTriggerDOMNode,Z=e.onPopupVisibleChange,O=e.onPopupMouseEnter,k=(0,d.Z)(e,A),M="".concat(n,"-dropdown"),j=u;w&&(j=w(u));var I=r.useMemo(function(){return b||L(y)},[b,y]),R=f?"".concat(M,"-").concat(f):p,N="number"==typeof y,P=r.useMemo(function(){return N?null:!1===y?"minWidth":"width"},[y,N]),F=m;N&&(F=(0,s.Z)((0,s.Z)({},F),{},{width:y}));var z=r.useRef(null);return r.useImperativeHandle(t,function(){return{getPopupElement:function(){return z.current}}}),r.createElement(T.Z,(0,i.Z)({},k,{showAction:Z?["click"]:[],hideAction:Z?["click"]:[],popupPlacement:v||("rtl"===(void 0===h?"ltr":h)?"bottomRight":"bottomLeft"),builtinPlacements:I,prefixCls:M,popupTransitionName:R,popup:r.createElement("div",{ref:z,onMouseEnter:O},j),stretch:P,popupAlign:x,popupVisible:o,getPopupContainer:E,popupClassName:a()(g,(0,l.Z)({},"".concat(M,"-empty"),S)),popupStyle:F,getTriggerDOMNode:C,onPopupVisibleChange:Z}),c)}),_=n(87099);function H(e,t){var n,r=e.key;return("value"in e&&(n=e.value),null!=r)?r:void 0!==n?n:"rc-index-key-".concat(t)}function B(e,t){var n=e||{},r=n.label,o=n.value,a=n.options,i=n.groupLabel,c=r||(t?"children":"label");return{label:c,value:o||"value",options:a||"options",groupLabel:i||c}}function D(e){var t=(0,s.Z)({},e);return"props"in t||Object.defineProperty(t,"props",{get:function(){return(0,m.ZP)(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),t}}),t}var W=function(e,t,n){if(!t||!t.length)return null;var r=!1,o=function e(t,n){var o=(0,_.Z)(n),a=o[0],i=o.slice(1);if(!a)return[t];var l=t.split(a);return r=r||l.length>1,l.reduce(function(t,n){return[].concat((0,c.Z)(t),(0,c.Z)(e(n,i)))},[]).filter(Boolean)}(e,t);return r?void 0!==n?o.slice(0,n):o:null},V=r.createContext(null),q=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],G=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],X=function(e){return"tags"===e||"multiple"===e},U=r.forwardRef(function(e,t){var n,o,m,S,C,Z,O,k,M=e.id,j=e.prefixCls,I=e.className,R=e.showSearch,N=e.tagRender,P=e.direction,T=e.omitDomProps,A=e.displayValues,L=e.onDisplayValuesChange,_=e.emptyOptions,H=e.notFoundContent,B=void 0===H?"Not Found":H,D=e.onClear,U=e.mode,$=e.disabled,K=e.loading,Y=e.getInputElement,Q=e.getRawInputElement,J=e.open,ee=e.defaultOpen,et=e.onDropdownVisibleChange,en=e.activeValue,er=e.onActiveValueChange,eo=e.activeDescendantId,ea=e.searchValue,ei=e.autoClearSearchValue,ec=e.onSearch,el=e.onSearchSplit,es=e.tokenSeparators,eu=e.allowClear,ed=e.suffixIcon,ef=e.clearIcon,ep=e.OptionList,em=e.animation,eg=e.transitionName,eh=e.dropdownStyle,ev=e.dropdownClassName,eb=e.dropdownMatchSelectWidth,ey=e.dropdownRender,ew=e.dropdownAlign,ex=e.placement,eE=e.builtinPlacements,eS=e.getPopupContainer,eC=e.showAction,eZ=void 0===eC?[]:eC,eO=e.onFocus,ek=e.onBlur,eM=e.onKeyUp,ej=e.onKeyDown,eI=e.onMouseDown,eR=(0,d.Z)(e,q),eN=X(U),eP=(void 0!==R?R:eN)||"combobox"===U,eF=(0,s.Z)({},eR);G.forEach(function(e){delete eF[e]}),null==T||T.forEach(function(e){delete eF[e]});var eT=r.useState(!1),eA=(0,u.Z)(eT,2),eL=eA[0],ez=eA[1];r.useEffect(function(){ez((0,h.Z)())},[]);var e_=r.useRef(null),eH=r.useRef(null),eB=r.useRef(null),eD=r.useRef(null),eW=r.useRef(null),eV=r.useRef(!1),eq=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=r.useState(!1),n=(0,u.Z)(t,2),o=n[0],a=n[1],i=r.useRef(null),c=function(){window.clearTimeout(i.current)};return r.useEffect(function(){return c},[]),[o,function(t,n){c(),i.current=window.setTimeout(function(){a(t),n&&n()},e)},c]}(),eG=(0,u.Z)(eq,3),eX=eG[0],eU=eG[1],e$=eG[2];r.useImperativeHandle(t,function(){var e,t;return{focus:null===(e=eD.current)||void 0===e?void 0:e.focus,blur:null===(t=eD.current)||void 0===t?void 0:t.blur,scrollTo:function(e){var t;return null===(t=eW.current)||void 0===t?void 0:t.scrollTo(e)}}});var eK=r.useMemo(function(){if("combobox"!==U)return ea;var e,t=null===(e=A[0])||void 0===e?void 0:e.value;return"string"==typeof t||"number"==typeof t?String(t):""},[ea,U,A]),eY="combobox"===U&&"function"==typeof Y&&Y()||null,eQ="function"==typeof Q&&Q(),eJ=(0,b.x1)(eH,null==eQ||null===(S=eQ.props)||void 0===S?void 0:S.ref),e0=r.useState(!1),e1=(0,u.Z)(e0,2),e2=e1[0],e6=e1[1];(0,g.Z)(function(){e6(!0)},[]);var e5=(0,p.Z)(!1,{defaultValue:ee,value:J}),e4=(0,u.Z)(e5,2),e3=e4[0],e8=e4[1],e9=!!e2&&e3,e7=!B&&_;($||e7&&e9&&"combobox"===U)&&(e9=!1);var te=!e7&&e9,tt=r.useCallback(function(e){var t=void 0!==e?e:!e9;$||(e8(t),e9!==t&&(null==et||et(t)))},[$,e9,e8,et]),tn=r.useMemo(function(){return(es||[]).some(function(e){return["\n","\r\n"].includes(e)})},[es]),tr=r.useContext(V)||{},to=tr.maxCount,ta=tr.rawValues,ti=function(e,t,n){if(!((null==ta?void 0:ta.size)>=to)){var r=!0,o=e;null==er||er(null);var a=W(e,es,to&&to-ta.size),i=n?null:a;return"combobox"!==U&&i&&(o="",null==el||el(i),tt(!1),r=!1),ec&&eK!==o&&ec(o,{source:t?"typing":"effect"}),r}};r.useEffect(function(){e9||eN||"combobox"===U||ti("",!1,!1)},[e9]),r.useEffect(function(){e3&&$&&e8(!1),$&&!eV.current&&eU(!1)},[$]);var tc=E(),tl=(0,u.Z)(tc,2),ts=tl[0],tu=tl[1],td=r.useRef(!1),tf=[];r.useEffect(function(){return function(){tf.forEach(function(e){return clearTimeout(e)}),tf.splice(0,tf.length)}},[]);var tp=r.useState({}),tm=(0,u.Z)(tp,2)[1];eQ&&(Z=function(e){tt(e)}),n=function(){var e;return[e_.current,null===(e=eB.current)||void 0===e?void 0:e.getPopupElement()]},o=!!eQ,(m=r.useRef(null)).current={open:te,triggerOpen:tt,customizedTrigger:o},r.useEffect(function(){function e(e){if(null===(t=m.current)||void 0===t||!t.customizedTrigger){var t,r=e.target;r.shadowRoot&&e.composed&&(r=e.composedPath()[0]||r),m.current.open&&n().filter(function(e){return e}).every(function(e){return!e.contains(r)&&e!==r})&&m.current.triggerOpen(!1)}}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}},[]);var tg=r.useMemo(function(){return(0,s.Z)((0,s.Z)({},e),{},{notFoundContent:B,open:e9,triggerOpen:te,id:M,showSearch:eP,multiple:eN,toggleOpen:tt})},[e,B,te,e9,M,eP,eN,tt]),th=!!ed||K;th&&(O=r.createElement(y,{className:a()("".concat(j,"-arrow"),(0,l.Z)({},"".concat(j,"-arrow-loading"),K)),customizeIcon:ed,customizeIconProps:{loading:K,searchValue:eK,open:e9,focused:eX,showSearch:eP}}));var tv=w(j,function(){var e;null==D||D(),null===(e=eD.current)||void 0===e||e.focus(),L([],{type:"clear",values:A}),ti("",!1,!1)},A,eu,ef,$,eK,U),tb=tv.allowClear,ty=tv.clearIcon,tw=r.createElement(ep,{ref:eW}),tx=a()(j,I,(C={},(0,l.Z)(C,"".concat(j,"-focused"),eX),(0,l.Z)(C,"".concat(j,"-multiple"),eN),(0,l.Z)(C,"".concat(j,"-single"),!eN),(0,l.Z)(C,"".concat(j,"-allow-clear"),eu),(0,l.Z)(C,"".concat(j,"-show-arrow"),th),(0,l.Z)(C,"".concat(j,"-disabled"),$),(0,l.Z)(C,"".concat(j,"-loading"),K),(0,l.Z)(C,"".concat(j,"-open"),e9),(0,l.Z)(C,"".concat(j,"-customize-input"),eY),(0,l.Z)(C,"".concat(j,"-show-search"),eP),C)),tE=r.createElement(z,{ref:eB,disabled:$,prefixCls:j,visible:te,popupElement:tw,animation:em,transitionName:eg,dropdownStyle:eh,dropdownClassName:ev,direction:P,dropdownMatchSelectWidth:eb,dropdownRender:ey,dropdownAlign:ew,placement:ex,builtinPlacements:eE,getPopupContainer:eS,empty:_,getTriggerDOMNode:function(){return eH.current},onPopupVisibleChange:Z,onPopupMouseEnter:function(){tm({})}},eQ?r.cloneElement(eQ,{ref:eJ}):r.createElement(F,(0,i.Z)({},e,{domRef:eH,prefixCls:j,inputElement:eY,ref:eD,id:M,showSearch:eP,autoClearSearchValue:ei,mode:U,activeDescendantId:eo,tagRender:N,values:A,open:e9,onToggleOpen:tt,activeValue:en,searchValue:eK,onSearch:ti,onSearchSubmit:function(e){e&&e.trim()&&ec(e,{source:"submit"})},onRemove:function(e){L(A.filter(function(t){return t!==e}),{type:"remove",values:[e]})},tokenWithEnter:tn})));return k=eQ?tE:r.createElement("div",(0,i.Z)({className:tx},eF,{ref:e_,onMouseDown:function(e){var t,n=e.target,r=null===(t=eB.current)||void 0===t?void 0:t.getPopupElement();if(r&&r.contains(n)){var o=setTimeout(function(){var e,t=tf.indexOf(o);-1!==t&&tf.splice(t,1),e$(),eL||r.contains(document.activeElement)||null===(e=eD.current)||void 0===e||e.focus()});tf.push(o)}for(var a=arguments.length,i=Array(a>1?a-1:0),c=1;c=0;i-=1){var l=o[i];if(!l.disabled){o.splice(i,1),a=l;break}}a&&L(o,{type:"remove",values:[a]})}for(var s=arguments.length,u=Array(s>1?s-1:0),d=1;d1?n-1:0),o=1;o=C},[p,C,null==I?void 0:I.size]),B=function(e){e.preventDefault()},D=function(e){var t;null===(t=_.current)||void 0===t||t.scrollTo("number"==typeof e?{index:e}:e)},W=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=z.length,r=0;r1&&void 0!==arguments[1]&&arguments[1];U(e);var n={source:t?"keyboard":"mouse"},r=z[e];if(!r){O(null,-1,n);return}O(r.value,e,n)};(0,r.useEffect)(function(){$(!1!==k?W(0):-1)},[z.length,g]);var K=r.useCallback(function(e){return I.has(e)&&"combobox"!==m},[m,(0,c.Z)(I).toString(),I.size]);(0,r.useEffect)(function(){var e,t=setTimeout(function(){if(!p&&f&&1===I.size){var e=Array.from(I)[0],t=z.findIndex(function(t){return t.data.value===e});-1!==t&&($(t),D(t))}});return f&&(null===(e=_.current)||void 0===e||e.scrollTo(void 0)),function(){return clearTimeout(t)}},[f,g]);var en=function(e){void 0!==e&&M(e,{selected:!I.has(e)}),p||h(!1)};if(r.useImperativeHandle(t,function(){return{onKeyDown:function(e){var t=e.which,n=e.ctrlKey;switch(t){case v.Z.N:case v.Z.P:case v.Z.UP:case v.Z.DOWN:var r=0;if(t===v.Z.UP?r=-1:t===v.Z.DOWN?r=1:/(mac\sos|macintosh)/i.test(navigator.appVersion)&&n&&(t===v.Z.N?r=1:t===v.Z.P&&(r=-1)),0!==r){var o=W(X+r,r);D(o),$(o,!0)}break;case v.Z.ENTER:var a,i=z[X];!i||null!=i&&null!==(a=i.data)&&void 0!==a&&a.disabled||H?en(void 0):en(i.value),f&&e.preventDefault();break;case v.Z.ESC:h(!1),f&&e.stopPropagation()}},onKeyUp:function(){},scrollTo:function(e){D(e)}}}),0===z.length)return r.createElement("div",{role:"listbox",id:"".concat(s,"_list"),className:"".concat(L,"-empty"),onMouseDown:B},b);var er=Object.keys(R).map(function(e){return R[e]}),eo=function(e){return e.label};function ea(e,t){return{role:e.group?"presentation":"option",id:"".concat(s,"_list_").concat(t)}}var ei=function(e){var t=z[e];if(!t)return null;var n=t.data||{},o=n.value,a=t.group,c=(0,S.Z)(n,!0),l=eo(t);return t?r.createElement("div",(0,i.Z)({"aria-label":"string"!=typeof l||a?null:l},c,{key:e},ea(t,e),{"aria-selected":K(o)}),o):null},ec={role:"listbox",id:"".concat(s,"_list")};return r.createElement(r.Fragment,null,N&&r.createElement("div",(0,i.Z)({},ec,{style:{height:0,width:0,overflow:"hidden"}}),ei(X-1),ei(X),ei(X+1)),r.createElement(J.Z,{itemKey:"key",ref:_,data:z,height:F,itemHeight:T,fullHeight:!1,onMouseDown:B,onScroll:w,virtual:N,direction:P,innerProps:N?null:ec},function(e,t){var n=e.group,o=e.groupOption,c=e.data,s=e.label,u=e.value,f=c.key;if(n){var p,m,g=null!==(m=c.title)&&void 0!==m?m:et(s)?s.toString():void 0;return r.createElement("div",{className:a()(L,"".concat(L,"-group")),title:g},void 0!==s?s:f)}var h=c.disabled,v=c.title,b=(c.children,c.style),w=c.className,x=(0,d.Z)(c,ee),E=(0,Q.Z)(x,er),C=K(u),Z=h||!C&&H,O="".concat(L,"-option"),k=a()(L,O,w,(p={},(0,l.Z)(p,"".concat(O,"-grouped"),o),(0,l.Z)(p,"".concat(O,"-active"),X===t&&!Z),(0,l.Z)(p,"".concat(O,"-disabled"),Z),(0,l.Z)(p,"".concat(O,"-selected"),C),p)),M=eo(e),I=!j||"function"==typeof j||C,R="number"==typeof M?M:M||u,P=et(R)?R.toString():void 0;return void 0!==v&&(P=v),r.createElement("div",(0,i.Z)({},(0,S.Z)(E),N?{}:ea(e,t),{"aria-selected":C,className:k,title:P,onMouseMove:function(){X===t||Z||$(t)},onClick:function(){Z||en(u)},style:b}),r.createElement("div",{className:"".concat(O,"-content")},"function"==typeof A?A(e,{index:t}):R),r.isValidElement(j)||C,I&&r.createElement(y,{className:"".concat(L,"-option-state"),customizeIcon:j,customizeIconProps:{value:u,disabled:Z,isSelected:C}},C?"✓":null))}))}),er=function(e,t){var n=r.useRef({values:new Map,options:new Map});return[r.useMemo(function(){var r=n.current,o=r.values,a=r.options,i=e.map(function(e){if(void 0===e.label){var t;return(0,s.Z)((0,s.Z)({},e),{},{label:null===(t=o.get(e.value))||void 0===t?void 0:t.label})}return e}),c=new Map,l=new Map;return i.forEach(function(e){c.set(e.value,e),l.set(e.value,t.get(e.value)||a.get(e.value))}),n.current.values=c,n.current.options=l,i},[e,t]),r.useCallback(function(e){return t.get(e)||n.current.options.get(e)},[t])]};function eo(e,t){return O(e).join("").toUpperCase().includes(t)}var ea=n(94981),ei=0,ec=(0,ea.Z)(),el=n(45287),es=["children","value"],eu=["children"];function ed(e){var t=r.useRef();return t.current=e,r.useCallback(function(){return t.current.apply(t,arguments)},[])}var ef=["id","mode","prefixCls","backfill","fieldNames","inputValue","searchValue","onSearch","autoClearSearchValue","onSelect","onDeselect","dropdownMatchSelectWidth","filterOption","filterSort","optionFilterProp","optionLabelProp","options","optionRender","children","defaultActiveFirstOption","menuItemSelectedIcon","virtual","direction","listHeight","listItemHeight","value","defaultValue","labelInValue","onChange","maxCount"],ep=["inputValue"],em=r.forwardRef(function(e,t){var n,o,a,m,g,h=e.id,v=e.mode,b=e.prefixCls,y=e.backfill,w=e.fieldNames,x=e.inputValue,E=e.searchValue,S=e.onSearch,C=e.autoClearSearchValue,Z=void 0===C||C,k=e.onSelect,M=e.onDeselect,j=e.dropdownMatchSelectWidth,I=void 0===j||j,R=e.filterOption,N=e.filterSort,P=e.optionFilterProp,F=e.optionLabelProp,T=e.options,A=e.optionRender,L=e.children,z=e.defaultActiveFirstOption,_=e.menuItemSelectedIcon,W=e.virtual,q=e.direction,G=e.listHeight,$=void 0===G?200:G,K=e.listItemHeight,Y=void 0===K?20:K,Q=e.value,J=e.defaultValue,ee=e.labelInValue,et=e.onChange,ea=e.maxCount,em=(0,d.Z)(e,ef),eg=(n=r.useState(),a=(o=(0,u.Z)(n,2))[0],m=o[1],r.useEffect(function(){var e;m("rc_select_".concat((ec?(e=ei,ei+=1):e="TEST_OR_SSR",e)))},[]),h||a),eh=X(v),ev=!!(!T&&L),eb=r.useMemo(function(){return(void 0!==R||"combobox"!==v)&&R},[R,v]),ey=r.useMemo(function(){return B(w,ev)},[JSON.stringify(w),ev]),ew=(0,p.Z)("",{value:void 0!==E?E:x,postState:function(e){return e||""}}),ex=(0,u.Z)(ew,2),eE=ex[0],eS=ex[1],eC=r.useMemo(function(){var e=T;T||(e=function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,el.Z)(t).map(function(t,o){if(!r.isValidElement(t)||!t.type)return null;var a,i,c,l,u,f=t.type.isSelectOptGroup,p=t.key,m=t.props,g=m.children,h=(0,d.Z)(m,eu);return n||!f?(a=t.key,c=(i=t.props).children,l=i.value,u=(0,d.Z)(i,es),(0,s.Z)({key:a,value:void 0!==l?l:a,children:c},u)):(0,s.Z)((0,s.Z)({key:"__RC_SELECT_GRP__".concat(null===p?o:p,"__"),label:p},h),{},{options:e(g)})}).filter(function(e){return e})}(L));var t=new Map,n=new Map,o=function(e,t,n){n&&"string"==typeof n&&e.set(t[n],t)};return function e(r){for(var a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=0;i1&&void 0!==arguments[1]?arguments[1]:{},n=t.fieldNames,r=t.childrenAsData,o=[],a=B(n,!1),i=a.label,c=a.value,l=a.options,s=a.groupLabel;return!function e(t,n){Array.isArray(t)&&t.forEach(function(t){if(!n&&l in t){var a=t[s];void 0===a&&r&&(a=t.label),o.push({key:H(t,o.length),group:!0,data:t,label:a}),e(t[l],!0)}else{var u=t[c];o.push({key:H(t,o.length),groupOption:n,data:t,label:t[i],value:u})}})}(e,!1),o}(eD,{fieldNames:ey,childrenAsData:ev})},[eD,ey,ev]),eV=function(e){var t=eM(e);if(eN(t),et&&(t.length!==eT.length||t.some(function(e,t){var n;return(null===(n=eT[t])||void 0===n?void 0:n.value)!==(null==e?void 0:e.value)}))){var n=ee?t:t.map(function(e){return e.value}),r=t.map(function(e){return D(eA(e.value))});et(eh?n:n[0],eh?r:r[0])}},eq=r.useState(null),eG=(0,u.Z)(eq,2),eX=eG[0],eU=eG[1],e$=r.useState(0),eK=(0,u.Z)(e$,2),eY=eK[0],eQ=eK[1],eJ=void 0!==z?z:"combobox"!==v,e0=r.useCallback(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.source;eQ(t),y&&"combobox"===v&&null!==e&&"keyboard"===(void 0===r?"keyboard":r)&&eU(String(e))},[y,v]),e1=function(e,t,n){var r=function(){var t,n=eA(e);return[ee?{label:null==n?void 0:n[ey.label],value:e,key:null!==(t=null==n?void 0:n.key)&&void 0!==t?t:e}:e,D(n)]};if(t&&k){var o=r(),a=(0,u.Z)(o,2);k(a[0],a[1])}else if(!t&&M&&"clear"!==n){var i=r(),c=(0,u.Z)(i,2);M(c[0],c[1])}},e2=ed(function(e,t){var n=!eh||t.selected;eV(n?eh?[].concat((0,c.Z)(eT),[e]):[e]:eT.filter(function(t){return t.value!==e})),e1(e,n),"combobox"===v?eU(""):(!X||Z)&&(eS(""),eU(""))}),e6=r.useMemo(function(){var e=!1!==W&&!1!==I;return(0,s.Z)((0,s.Z)({},eC),{},{flattenOptions:eW,onActiveValue:e0,defaultActiveFirstOption:eJ,onSelect:e2,menuItemSelectedIcon:_,rawValues:ez,fieldNames:ey,virtual:e,direction:q,listHeight:$,listItemHeight:Y,childrenAsData:ev,maxCount:ea,optionRender:A})},[ea,eC,eW,e0,eJ,e2,_,ez,ey,W,I,q,$,Y,ev,A]);return r.createElement(V.Provider,{value:e6},r.createElement(U,(0,i.Z)({},em,{id:eg,prefixCls:void 0===b?"rc-select":b,ref:t,omitDomProps:ep,mode:v,displayValues:eL,onDisplayValuesChange:function(e,t){eV(e);var n=t.type,r=t.values;("remove"===n||"clear"===n)&&r.forEach(function(e){e1(e.value,!1,n)})},direction:q,searchValue:eE,onSearch:function(e,t){if(eS(e),eU(null),"submit"===t.source){var n=(e||"").trim();n&&(eV(Array.from(new Set([].concat((0,c.Z)(ez),[n])))),e1(n,!0),eS(""));return}"blur"!==t.source&&("combobox"===v&&eV(e),null==S||S(e))},autoClearSearchValue:Z,onSearchSplit:function(e){var t=e;"tags"!==v&&(t=e.map(function(e){var t=eO.get(e);return null==t?void 0:t.value}).filter(function(e){return void 0!==e}));var n=Array.from(new Set([].concat((0,c.Z)(ez),(0,c.Z)(t))));eV(n),n.forEach(function(e){e1(e,!0)})},dropdownMatchSelectWidth:I,OptionList:en,emptyOptions:!eW.length,activeValue:eX,activeDescendantId:"".concat(eg,"_list_").concat(eY)})))});em.Option=K,em.OptGroup=$;var eg=n(62236),eh=n(68710),ev=n(93942),eb=n(12757),ey=n(71744),ew=n(91086),ex=n(86586),eE=n(64024),eS=n(33759),eC=n(39109),eZ=n(56250),eO=n(65658),ek=n(29961);let eM=e=>{let t={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:"scroll"===e?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},t),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},t),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},t),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},t),{points:["br","tr"],offset:[0,-4]})}};var ej=n(12918),eI=n(17691),eR=n(80669),eN=n(3104),eP=n(18544),eF=n(29382);let eT=e=>{let{optionHeight:t,optionFontSize:n,optionLineHeight:r,optionPadding:o}=e;return{position:"relative",display:"block",minHeight:t,padding:o,color:e.colorText,fontWeight:"normal",fontSize:n,lineHeight:r,boxSizing:"border-box"}};var eA=e=>{let{antCls:t,componentCls:n}=e,r="".concat(n,"-item"),o="&".concat(t,"-slide-up-enter").concat(t,"-slide-up-enter-active"),a="&".concat(t,"-slide-up-appear").concat(t,"-slide-up-appear-active"),i="&".concat(t,"-slide-up-leave").concat(t,"-slide-up-leave-active"),c="".concat(n,"-dropdown-placement-");return[{["".concat(n,"-dropdown")]:Object.assign(Object.assign({},(0,ej.Wf)(e)),{position:"absolute",top:-9999,zIndex:e.zIndexPopup,boxSizing:"border-box",padding:e.paddingXXS,overflow:"hidden",fontSize:e.fontSize,fontVariant:"initial",backgroundColor:e.colorBgElevated,borderRadius:e.borderRadiusLG,outline:"none",boxShadow:e.boxShadowSecondary,["\n ".concat(o).concat(c,"bottomLeft,\n ").concat(a).concat(c,"bottomLeft\n ")]:{animationName:eP.fJ},["\n ".concat(o).concat(c,"topLeft,\n ").concat(a).concat(c,"topLeft,\n ").concat(o).concat(c,"topRight,\n ").concat(a).concat(c,"topRight\n ")]:{animationName:eP.Qt},["".concat(i).concat(c,"bottomLeft")]:{animationName:eP.Uw},["\n ".concat(i).concat(c,"topLeft,\n ").concat(i).concat(c,"topRight\n ")]:{animationName:eP.ly},"&-hidden":{display:"none"},["".concat(r)]:Object.assign(Object.assign({},eT(e)),{cursor:"pointer",transition:"background ".concat(e.motionDurationSlow," ease"),borderRadius:e.borderRadiusSM,"&-group":{color:e.colorTextDescription,fontSize:e.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":Object.assign({flex:"auto"},ej.vS),"&-state":{flex:"none",display:"flex",alignItems:"center"},["&-active:not(".concat(r,"-option-disabled)")]:{backgroundColor:e.optionActiveBg},["&-selected:not(".concat(r,"-option-disabled)")]:{color:e.optionSelectedColor,fontWeight:e.optionSelectedFontWeight,backgroundColor:e.optionSelectedBg,["".concat(r,"-option-state")]:{color:e.colorPrimary},["&:has(+ ".concat(r,"-option-selected:not(").concat(r,"-option-disabled))")]:{borderEndStartRadius:0,borderEndEndRadius:0,["& + ".concat(r,"-option-selected:not(").concat(r,"-option-disabled)")]:{borderStartStartRadius:0,borderStartEndRadius:0}}},"&-disabled":{["&".concat(r,"-option-selected")]:{backgroundColor:e.colorBgContainerDisabled},color:e.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:e.calc(e.controlPaddingHorizontal).mul(2).equal()}}}),"&-rtl":{direction:"rtl"}})},(0,eP.oN)(e,"slide-up"),(0,eP.oN)(e,"slide-down"),(0,eF.Fm)(e,"move-up"),(0,eF.Fm)(e,"move-down")]},eL=n(352);let ez=e=>{let{multipleSelectItemHeight:t,selectHeight:n,lineWidth:r}=e;return e.calc(n).sub(t).div(2).sub(r).equal()};function e_(e,t){let{componentCls:n,iconCls:r}=e,o="".concat(n,"-selection-overflow"),a=e.multipleSelectItemHeight,i=ez(e),c=t?"".concat(n,"-").concat(t):"";return{["".concat(n,"-multiple").concat(c)]:{fontSize:e.fontSize,[o]:{position:"relative",display:"flex",flex:"auto",flexWrap:"wrap",maxWidth:"100%","&-item":{flex:"none",alignSelf:"center",maxWidth:"100%",display:"inline-flex"}},["".concat(n,"-selector")]:{display:"flex",flexWrap:"wrap",alignItems:"center",height:"100%",paddingInline:e.calc(2).mul(2).equal(),paddingBlock:e.calc(i).sub(2).equal(),borderRadius:e.borderRadius,["".concat(n,"-show-search&")]:{cursor:"text"},["".concat(n,"-disabled&")]:{background:e.multipleSelectorBgDisabled,cursor:"not-allowed"},"&:after":{display:"inline-block",width:0,margin:"".concat((0,eL.bf)(2)," 0"),lineHeight:(0,eL.bf)(a),visibility:"hidden",content:'"\\a0"'}},["\n &".concat(n,"-show-arrow ").concat(n,"-selector,\n &").concat(n,"-allow-clear ").concat(n,"-selector\n ")]:{paddingInlineEnd:e.calc(e.fontSizeIcon).add(e.controlPaddingHorizontal).equal()},["".concat(n,"-selection-item")]:{display:"flex",alignSelf:"center",flex:"none",boxSizing:"border-box",maxWidth:"100%",height:a,marginTop:2,marginBottom:2,lineHeight:(0,eL.bf)(e.calc(a).sub(e.calc(e.lineWidth).mul(2)).equal()),borderRadius:e.borderRadiusSM,cursor:"default",transition:"font-size ".concat(e.motionDurationSlow,", line-height ").concat(e.motionDurationSlow,", height ").concat(e.motionDurationSlow),marginInlineEnd:e.calc(2).mul(2).equal(),paddingInlineStart:e.paddingXS,paddingInlineEnd:e.calc(e.paddingXS).div(2).equal(),["".concat(n,"-disabled&")]:{color:e.multipleItemColorDisabled,borderColor:e.multipleItemBorderColorDisabled,cursor:"not-allowed"},"&-content":{display:"inline-block",marginInlineEnd:e.calc(e.paddingXS).div(2).equal(),overflow:"hidden",whiteSpace:"pre",textOverflow:"ellipsis"},"&-remove":Object.assign(Object.assign({},(0,ej.Ro)()),{display:"inline-flex",alignItems:"center",color:e.colorIcon,fontWeight:"bold",fontSize:10,lineHeight:"inherit",cursor:"pointer",["> ".concat(r)]:{verticalAlign:"-0.2em"},"&:hover":{color:e.colorIconHover}})},["".concat(o,"-item + ").concat(o,"-item")]:{["".concat(n,"-selection-search")]:{marginInlineStart:0}},["".concat(o,"-item-suffix")]:{height:"100%"},["".concat(n,"-selection-search")]:{display:"inline-flex",position:"relative",maxWidth:"100%",marginInlineStart:e.calc(e.inputPaddingHorizontalBase).sub(i).equal(),"\n &-input,\n &-mirror\n ":{height:a,fontFamily:e.fontFamily,lineHeight:(0,eL.bf)(a),transition:"all ".concat(e.motionDurationSlow)},"&-input":{width:"100%",minWidth:4.1},"&-mirror":{position:"absolute",top:0,insetInlineStart:0,insetInlineEnd:"auto",zIndex:999,whiteSpace:"pre",visibility:"hidden"}},["".concat(n,"-selection-placeholder")]:{position:"absolute",top:"50%",insetInlineStart:e.inputPaddingHorizontalBase,insetInlineEnd:e.inputPaddingHorizontalBase,transform:"translateY(-50%)",transition:"all ".concat(e.motionDurationSlow)}}}}var eH=e=>{let{componentCls:t}=e,n=(0,eN.TS)(e,{selectHeight:e.controlHeightSM,multipleSelectItemHeight:e.controlHeightXS,borderRadius:e.borderRadiusSM,borderRadiusSM:e.borderRadiusXS}),r=(0,eN.TS)(e,{fontSize:e.fontSizeLG,selectHeight:e.controlHeightLG,multipleSelectItemHeight:e.multipleItemHeightLG,borderRadius:e.borderRadiusLG,borderRadiusSM:e.borderRadius});return[e_(e),e_(n,"sm"),{["".concat(t,"-multiple").concat(t,"-sm")]:{["".concat(t,"-selection-placeholder")]:{insetInline:e.calc(e.controlPaddingHorizontalSM).sub(e.lineWidth).equal()},["".concat(t,"-selection-search")]:{marginInlineStart:2}}},e_(r,"lg")]};function eB(e,t){let{componentCls:n,inputPaddingHorizontalBase:r,borderRadius:o}=e,a=e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),i=t?"".concat(n,"-").concat(t):"";return{["".concat(n,"-single").concat(i)]:{fontSize:e.fontSize,height:e.controlHeight,["".concat(n,"-selector")]:Object.assign(Object.assign({},(0,ej.Wf)(e,!0)),{display:"flex",borderRadius:o,["".concat(n,"-selection-search")]:{position:"absolute",top:0,insetInlineStart:r,insetInlineEnd:r,bottom:0,"&-input":{width:"100%",WebkitAppearance:"textfield"}},["\n ".concat(n,"-selection-item,\n ").concat(n,"-selection-placeholder\n ")]:{padding:0,lineHeight:(0,eL.bf)(a),transition:"all ".concat(e.motionDurationSlow,", visibility 0s"),alignSelf:"center"},["".concat(n,"-selection-placeholder")]:{transition:"none",pointerEvents:"none"},[["&:after","".concat(n,"-selection-item:empty:after"),"".concat(n,"-selection-placeholder:empty:after")].join(",")]:{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'}}),["\n &".concat(n,"-show-arrow ").concat(n,"-selection-item,\n &").concat(n,"-show-arrow ").concat(n,"-selection-placeholder\n ")]:{paddingInlineEnd:e.showArrowPaddingInlineEnd},["&".concat(n,"-open ").concat(n,"-selection-item")]:{color:e.colorTextPlaceholder},["&:not(".concat(n,"-customize-input)")]:{["".concat(n,"-selector")]:{width:"100%",height:"100%",padding:"0 ".concat((0,eL.bf)(r)),["".concat(n,"-selection-search-input")]:{height:a},"&:after":{lineHeight:(0,eL.bf)(a)}}},["&".concat(n,"-customize-input")]:{["".concat(n,"-selector")]:{"&:after":{display:"none"},["".concat(n,"-selection-search")]:{position:"static",width:"100%"},["".concat(n,"-selection-placeholder")]:{position:"absolute",insetInlineStart:0,insetInlineEnd:0,padding:"0 ".concat((0,eL.bf)(r)),"&:after":{display:"none"}}}}}}}let eD=(e,t)=>{let{componentCls:n,antCls:r,controlOutlineWidth:o}=e;return{["&:not(".concat(n,"-customize-input) ").concat(n,"-selector")]:{border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(t.borderColor),background:e.selectorBg},["&:not(".concat(n,"-disabled):not(").concat(n,"-customize-input):not(").concat(r,"-pagination-size-changer)")]:{["&:hover ".concat(n,"-selector")]:{borderColor:t.hoverBorderHover},["".concat(n,"-focused& ").concat(n,"-selector")]:{borderColor:t.activeBorderColor,boxShadow:"0 0 0 ".concat((0,eL.bf)(o)," ").concat(t.activeShadowColor),outline:0}}}},eW=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status)]:Object.assign({},eD(e,t))}),eV=e=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},eD(e,{borderColor:e.colorBorder,hoverBorderHover:e.colorPrimaryHover,activeBorderColor:e.colorPrimary,activeShadowColor:e.controlOutline})),eW(e,{status:"error",borderColor:e.colorError,hoverBorderHover:e.colorErrorHover,activeBorderColor:e.colorError,activeShadowColor:e.colorErrorOutline})),eW(e,{status:"warning",borderColor:e.colorWarning,hoverBorderHover:e.colorWarningHover,activeBorderColor:e.colorWarning,activeShadowColor:e.colorWarningOutline})),{["&".concat(e.componentCls,"-disabled")]:{["&:not(".concat(e.componentCls,"-customize-input) ").concat(e.componentCls,"-selector")]:{background:e.colorBgContainerDisabled,color:e.colorTextDisabled}},["&".concat(e.componentCls,"-multiple ").concat(e.componentCls,"-selection-item")]:{background:e.multipleItemBg,border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.multipleItemBorderColor)}})}),eq=(e,t)=>{let{componentCls:n,antCls:r}=e;return{["&:not(".concat(n,"-customize-input) ").concat(n,"-selector")]:{background:t.bg,border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," transparent"),color:t.color},["&:not(".concat(n,"-disabled):not(").concat(n,"-customize-input):not(").concat(r,"-pagination-size-changer)")]:{["&:hover ".concat(n,"-selector")]:{background:t.hoverBg},["".concat(n,"-focused& ").concat(n,"-selector")]:{background:e.selectorBg,borderColor:t.activeBorderColor,outline:0}}}},eG=(e,t)=>({["&".concat(e.componentCls,"-status-").concat(t.status)]:Object.assign({},eq(e,t))}),eX=e=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},eq(e,{bg:e.colorFillTertiary,hoverBg:e.colorFillSecondary,activeBorderColor:e.colorPrimary,color:e.colorText})),eG(e,{status:"error",bg:e.colorErrorBg,hoverBg:e.colorErrorBgHover,activeBorderColor:e.colorError,color:e.colorError})),eG(e,{status:"warning",bg:e.colorWarningBg,hoverBg:e.colorWarningBgHover,activeBorderColor:e.colorWarning,color:e.colorWarning})),{["&".concat(e.componentCls,"-disabled")]:{["&:not(".concat(e.componentCls,"-customize-input) ").concat(e.componentCls,"-selector")]:{borderColor:e.colorBorder,background:e.colorBgContainerDisabled,color:e.colorTextDisabled}},["&".concat(e.componentCls,"-multiple ").concat(e.componentCls,"-selection-item")]:{background:e.colorBgContainer,border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)}})}),eU=e=>({"&-borderless":{["".concat(e.componentCls,"-selector")]:{background:"transparent",borderColor:"transparent"},["&".concat(e.componentCls,"-disabled")]:{["&:not(".concat(e.componentCls,"-customize-input) ").concat(e.componentCls,"-selector")]:{color:e.colorTextDisabled}},["&".concat(e.componentCls,"-multiple ").concat(e.componentCls,"-selection-item")]:{background:e.multipleItemBg,border:"".concat((0,eL.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.multipleItemBorderColor)}}});var e$=e=>({[e.componentCls]:Object.assign(Object.assign(Object.assign({},eV(e)),eX(e)),eU(e))});let eK=e=>{let{componentCls:t}=e;return{position:"relative",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut),input:{cursor:"pointer"},["".concat(t,"-show-search&")]:{cursor:"text",input:{cursor:"auto",color:"inherit",height:"100%"}},["".concat(t,"-disabled&")]:{cursor:"not-allowed",input:{cursor:"not-allowed"}}}},eY=e=>{let{componentCls:t}=e;return{["".concat(t,"-selection-search-input")]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none",fontFamily:"inherit","&::-webkit-search-cancel-button":{display:"none","-webkit-appearance":"none"}}}},eQ=e=>{let{antCls:t,componentCls:n,inputPaddingHorizontalBase:r,iconCls:o}=e;return{[n]:Object.assign(Object.assign({},(0,ej.Wf)(e)),{position:"relative",display:"inline-block",cursor:"pointer",["&:not(".concat(n,"-customize-input) ").concat(n,"-selector")]:Object.assign(Object.assign({},eK(e)),eY(e)),["".concat(n,"-selection-item")]:Object.assign(Object.assign({flex:1,fontWeight:"normal",position:"relative",userSelect:"none"},ej.vS),{["> ".concat(t,"-typography")]:{display:"inline"}}),["".concat(n,"-selection-placeholder")]:Object.assign(Object.assign({},ej.vS),{flex:1,color:e.colorTextPlaceholder,pointerEvents:"none"}),["".concat(n,"-arrow")]:Object.assign(Object.assign({},(0,ej.Ro)()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:r,height:e.fontSizeIcon,marginTop:e.calc(e.fontSizeIcon).mul(-1).div(2).equal(),color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",transition:"opacity ".concat(e.motionDurationSlow," ease"),[o]:{verticalAlign:"top",transition:"transform ".concat(e.motionDurationSlow),"> svg":{verticalAlign:"top"},["&:not(".concat(n,"-suffix)")]:{pointerEvents:"auto"}},["".concat(n,"-disabled &")]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),["".concat(n,"-clear")]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:r,zIndex:1,display:"inline-block",width:e.fontSizeIcon,height:e.fontSizeIcon,marginTop:e.calc(e.fontSizeIcon).mul(-1).div(2).equal(),color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",cursor:"pointer",opacity:0,transition:"color ".concat(e.motionDurationMid," ease, opacity ").concat(e.motionDurationSlow," ease"),textRendering:"auto","&:before":{display:"block"},"&:hover":{color:e.colorTextTertiary}},"&:hover":{["".concat(n,"-clear")]:{opacity:1},["".concat(n,"-arrow:not(:last-child)")]:{opacity:0}}}),["".concat(n,"-has-feedback")]:{["".concat(n,"-clear")]:{insetInlineEnd:e.calc(r).add(e.fontSize).add(e.paddingXS).equal()}}}},eJ=e=>{let{componentCls:t}=e;return[{[t]:{["&".concat(t,"-in-form-item")]:{width:"100%"}}},eQ(e),function(e){let{componentCls:t}=e,n=e.calc(e.controlPaddingHorizontalSM).sub(e.lineWidth).equal();return[eB(e),eB((0,eN.TS)(e,{controlHeight:e.controlHeightSM,borderRadius:e.borderRadiusSM}),"sm"),{["".concat(t,"-single").concat(t,"-sm")]:{["&:not(".concat(t,"-customize-input)")]:{["".concat(t,"-selection-search")]:{insetInlineStart:n,insetInlineEnd:n},["".concat(t,"-selector")]:{padding:"0 ".concat((0,eL.bf)(n))},["&".concat(t,"-show-arrow ").concat(t,"-selection-search")]:{insetInlineEnd:e.calc(n).add(e.calc(e.fontSize).mul(1.5)).equal()},["\n &".concat(t,"-show-arrow ").concat(t,"-selection-item,\n &").concat(t,"-show-arrow ").concat(t,"-selection-placeholder\n ")]:{paddingInlineEnd:e.calc(e.fontSize).mul(1.5).equal()}}}},eB((0,eN.TS)(e,{controlHeight:e.singleItemHeightLG,fontSize:e.fontSizeLG,borderRadius:e.borderRadiusLG}),"lg")]}(e),eH(e),eA(e),{["".concat(t,"-rtl")]:{direction:"rtl"}},(0,eI.c)(e,{borderElCls:"".concat(t,"-selector"),focusElCls:"".concat(t,"-focused")})]};var e0=(0,eR.I$)("Select",(e,t)=>{let{rootPrefixCls:n}=t,r=(0,eN.TS)(e,{rootPrefixCls:n,inputPaddingHorizontalBase:e.calc(e.paddingSM).sub(1).equal(),multipleSelectItemHeight:e.multipleItemHeight,selectHeight:e.controlHeight});return[eJ(r),e$(r)]},e=>{let{fontSize:t,lineHeight:n,controlHeight:r,controlPaddingHorizontal:o,zIndexPopupBase:a,colorText:i,fontWeightStrong:c,controlItemBgActive:l,controlItemBgHover:s,colorBgContainer:u,colorFillSecondary:d,controlHeightLG:f,controlHeightSM:p,colorBgContainerDisabled:m,colorTextDisabled:g}=e;return{zIndexPopup:a+50,optionSelectedColor:i,optionSelectedFontWeight:c,optionSelectedBg:l,optionActiveBg:s,optionPadding:"".concat((r-t*n)/2,"px ").concat(o,"px"),optionFontSize:t,optionLineHeight:n,optionHeight:r,selectorBg:u,clearBg:u,singleItemHeightLG:f,multipleItemBg:d,multipleItemBorderColor:"transparent",multipleItemHeight:p,multipleItemHeightLG:r,multipleSelectorBgDisabled:m,multipleItemColorDisabled:g,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(1.25*e.fontSize)}},{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}}),e1=n(9738),e2=n(39725),e6=n(49638),e5=n(70464),e4=n(61935),e3=n(29436),e8=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};let e9="SECRET_COMBOBOX_MODE_DO_NOT_USE",e7=r.forwardRef((e,t)=>{var n,o,i;let c;let{prefixCls:l,bordered:s,className:u,rootClassName:d,getPopupContainer:f,popupClassName:p,dropdownClassName:m,listHeight:g=256,placement:h,listItemHeight:v,size:b,disabled:y,notFoundContent:w,status:x,builtinPlacements:E,dropdownMatchSelectWidth:S,popupMatchSelectWidth:C,direction:Z,style:O,allowClear:k,variant:M,dropdownStyle:j,transitionName:I,tagRender:R,maxCount:N}=e,P=e8(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount"]),{getPopupContainer:F,getPrefixCls:T,renderEmpty:A,direction:L,virtual:z,popupMatchSelectWidth:_,popupOverflow:H,select:B}=r.useContext(ey.E_),[,D]=(0,ek.ZP)(),W=null!=v?v:null==D?void 0:D.controlHeight,V=T("select",l),q=T(),G=null!=Z?Z:L,{compactSize:X,compactItemClassnames:U}=(0,eO.ri)(V,G),[$,K]=(0,eZ.Z)(M,s),Y=(0,eE.Z)(V),[J,ee,et]=e0(V,Y),en=r.useMemo(()=>{let{mode:t}=e;return"combobox"===t?void 0:t===e9?"combobox":t},[e.mode]),er="multiple"===en||"tags"===en,eo=(o=e.suffixIcon,void 0!==(i=e.showArrow)?i:null!==o),ea=null!==(n=null!=C?C:S)&&void 0!==n?n:_,{status:ei,hasFeedback:ec,isFormItemInput:el,feedbackIcon:es}=r.useContext(eC.aM),eu=(0,eb.F)(ei,x);c=void 0!==w?w:"combobox"===en?null:(null==A?void 0:A("Select"))||r.createElement(ew.Z,{componentName:"Select"});let{suffixIcon:ed,itemIcon:ef,removeIcon:ep,clearIcon:ev}=function(e){let{suffixIcon:t,clearIcon:n,menuItemSelectedIcon:o,removeIcon:a,loading:i,multiple:c,hasFeedback:l,prefixCls:s,showSuffixIcon:u,feedbackIcon:d,showArrow:f,componentName:p}=e,m=null!=n?n:r.createElement(e2.Z,null),g=e=>null!==t||l||f?r.createElement(r.Fragment,null,!1!==u&&e,l&&d):null,h=null;if(void 0!==t)h=g(t);else if(i)h=g(r.createElement(e4.Z,{spin:!0}));else{let e="".concat(s,"-suffix");h=t=>{let{open:n,showSearch:o}=t;return n&&o?g(r.createElement(e3.Z,{className:e})):g(r.createElement(e5.Z,{className:e}))}}let v=null;return v=void 0!==o?o:c?r.createElement(e1.Z,null):null,{clearIcon:m,suffixIcon:h,itemIcon:v,removeIcon:void 0!==a?a:r.createElement(e6.Z,null)}}(Object.assign(Object.assign({},P),{multiple:er,hasFeedback:ec,feedbackIcon:es,showSuffixIcon:eo,prefixCls:V,componentName:"Select"})),ej=(0,Q.Z)(P,["suffixIcon","itemIcon"]),eI=a()(p||m,{["".concat(V,"-dropdown-").concat(G)]:"rtl"===G},d,et,Y,ee),eR=(0,eS.Z)(e=>{var t;return null!==(t=null!=b?b:X)&&void 0!==t?t:e}),eN=r.useContext(ex.Z),eP=a()({["".concat(V,"-lg")]:"large"===eR,["".concat(V,"-sm")]:"small"===eR,["".concat(V,"-rtl")]:"rtl"===G,["".concat(V,"-").concat($)]:K,["".concat(V,"-in-form-item")]:el},(0,eb.Z)(V,eu,ec),U,null==B?void 0:B.className,u,d,et,Y,ee),eF=r.useMemo(()=>void 0!==h?h:"rtl"===G?"bottomRight":"bottomLeft",[h,G]),[eT]=(0,eg.Cn)("SelectLike",null==j?void 0:j.zIndex);return J(r.createElement(em,Object.assign({ref:t,virtual:z,showSearch:null==B?void 0:B.showSearch},ej,{style:Object.assign(Object.assign({},null==B?void 0:B.style),O),dropdownMatchSelectWidth:ea,transitionName:(0,eh.m)(q,"slide-up",I),builtinPlacements:E||eM(H),listHeight:g,listItemHeight:W,mode:en,prefixCls:V,placement:eF,direction:G,suffixIcon:ed,menuItemSelectedIcon:ef,removeIcon:ep,allowClear:!0===k?{clearIcon:ev}:k,notFoundContent:c,className:eP,getPopupContainer:f||F,dropdownClassName:eI,disabled:null!=y?y:eN,dropdownStyle:Object.assign(Object.assign({},j),{zIndex:eT}),maxCount:er?N:void 0,tagRender:er?R:void 0})))}),te=(0,ev.Z)(e7);e7.SECRET_COMBOBOX_MODE_DO_NOT_USE=e9,e7.Option=K,e7.OptGroup=$,e7._InternalPanelDoNotUseOrYouWillBeFired=te;var tt=e7},65658:function(e,t,n){"use strict";n.d(t,{BR:function(){return p},ri:function(){return f}});var r=n(36760),o=n.n(r),a=n(45287),i=n(2265),c=n(71744),l=n(33759),s=n(4924),u=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};let d=i.createContext(null),f=(e,t)=>{let n=i.useContext(d),r=i.useMemo(()=>{if(!n)return"";let{compactDirection:r,isFirstItem:a,isLastItem:i}=n,c="vertical"===r?"-vertical-":"-";return o()("".concat(e,"-compact").concat(c,"item"),{["".concat(e,"-compact").concat(c,"first-item")]:a,["".concat(e,"-compact").concat(c,"last-item")]:i,["".concat(e,"-compact").concat(c,"item-rtl")]:"rtl"===t})},[e,t,n]);return{compactSize:null==n?void 0:n.compactSize,compactDirection:null==n?void 0:n.compactDirection,compactItemClassnames:r}},p=e=>{let{children:t}=e;return i.createElement(d.Provider,{value:null},t)},m=e=>{var{children:t}=e,n=u(e,["children"]);return i.createElement(d.Provider,{value:n},t)};t.ZP=e=>{let{getPrefixCls:t,direction:n}=i.useContext(c.E_),{size:r,direction:f,block:p,prefixCls:g,className:h,rootClassName:v,children:b}=e,y=u(e,["size","direction","block","prefixCls","className","rootClassName","children"]),w=(0,l.Z)(e=>null!=r?r:e),x=t("space-compact",g),[E,S]=(0,s.Z)(x),C=o()(x,S,{["".concat(x,"-rtl")]:"rtl"===n,["".concat(x,"-block")]:p,["".concat(x,"-vertical")]:"vertical"===f},h,v),Z=i.useContext(d),O=(0,a.Z)(b),k=i.useMemo(()=>O.map((e,t)=>{let n=e&&e.key||"".concat(x,"-item-").concat(t);return i.createElement(m,{key:n,compactSize:w,compactDirection:f,isFirstItem:0===t&&(!Z||(null==Z?void 0:Z.isFirstItem)),isLastItem:t===O.length-1&&(!Z||(null==Z?void 0:Z.isLastItem))},e)}),[r,O,Z]);return 0===O.length?null:E(i.createElement("div",Object.assign({className:C},y),k))}},4924:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(80669),o=n(3104),a=e=>{let{componentCls:t}=e;return{[t]:{"&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}};let i=e=>{let{componentCls:t}=e;return{[t]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},["".concat(t,"-item:empty")]:{display:"none"}}}},c=e=>{let{componentCls:t}=e;return{[t]:{"&-gap-row-small":{rowGap:e.spaceGapSmallSize},"&-gap-row-middle":{rowGap:e.spaceGapMiddleSize},"&-gap-row-large":{rowGap:e.spaceGapLargeSize},"&-gap-col-small":{columnGap:e.spaceGapSmallSize},"&-gap-col-middle":{columnGap:e.spaceGapMiddleSize},"&-gap-col-large":{columnGap:e.spaceGapLargeSize}}}};var l=(0,r.I$)("Space",e=>{let t=(0,o.TS)(e,{spaceGapSmallSize:e.paddingXS,spaceGapMiddleSize:e.padding,spaceGapLargeSize:e.paddingLG});return[i(t),c(t),a(t)]},()=>({}),{resetStyle:!1})},17691:function(e,t,n){"use strict";function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{focus:!0},{componentCls:n}=e,r="".concat(n,"-compact");return{[r]:Object.assign(Object.assign({},function(e,t,n){let{focusElCls:r,focus:o,borderElCls:a}=n,i=a?"> *":"",c=["hover",o?"focus":null,"active"].filter(Boolean).map(e=>"&:".concat(e," ").concat(i)).join(",");return{["&-item:not(".concat(t,"-last-item)")]:{marginInlineEnd:e.calc(e.lineWidth).mul(-1).equal()},"&-item":Object.assign(Object.assign({[c]:{zIndex:2}},r?{["&".concat(r)]:{zIndex:2}}:{}),{["&[disabled] ".concat(i)]:{zIndex:0}})}}(e,r,t)),function(e,t,n){let{borderElCls:r}=n,o=r?"> ".concat(r):"";return{["&-item:not(".concat(t,"-first-item):not(").concat(t,"-last-item) ").concat(o)]:{borderRadius:0},["&-item:not(".concat(t,"-last-item)").concat(t,"-first-item")]:{["& ".concat(o,", &").concat(e,"-sm ").concat(o,", &").concat(e,"-lg ").concat(o)]:{borderStartEndRadius:0,borderEndEndRadius:0}},["&-item:not(".concat(t,"-first-item)").concat(t,"-last-item")]:{["& ".concat(o,", &").concat(e,"-sm ").concat(o,", &").concat(e,"-lg ").concat(o)]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}(n,r,t))}}n.d(t,{c:function(){return r}})},12918:function(e,t,n){"use strict";n.d(t,{Lx:function(){return l},Qy:function(){return d},Ro:function(){return i},Wf:function(){return a},dF:function(){return c},du:function(){return s},oN:function(){return u},vS:function(){return o}});var r=n(352);let o={overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{boxSizing:"border-box",margin:0,padding:0,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight,listStyle:"none",fontFamily:t?"inherit":e.fontFamily}},i=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),c=()=>({"&::before":{display:"table",content:'""'},"&::after":{display:"table",clear:"both",content:'""'}}),l=e=>({a:{color:e.colorLink,textDecoration:e.linkDecoration,backgroundColor:"transparent",outline:"none",cursor:"pointer",transition:"color ".concat(e.motionDurationSlow),"-webkit-text-decoration-skip":"objects","&:hover":{color:e.colorLinkHover},"&:active":{color:e.colorLinkActive},"&:active,\n &:hover":{textDecoration:e.linkHoverDecoration,outline:0},"&:focus":{textDecoration:e.linkFocusDecoration,outline:0},"&[disabled]":{color:e.colorTextDisabled,cursor:"not-allowed"}}}),s=(e,t)=>{let{fontFamily:n,fontSize:r}=e,o='[class^="'.concat(t,'"], [class*=" ').concat(t,'"]');return{[o]:{fontFamily:n,fontSize:r,boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"},[o]:{boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}}}}},u=e=>({outline:"".concat((0,r.bf)(e.lineWidthFocus)," solid ").concat(e.colorPrimaryBorder),outlineOffset:1,transition:"outline-offset 0s, outline 0s"}),d=e=>({"&:focus-visible":Object.assign({},u(e))})},63074:function(e,t){"use strict";t.Z=e=>({[e.componentCls]:{["".concat(e.antCls,"-motion-collapse-legacy")]:{overflow:"hidden","&-active":{transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}},["".concat(e.antCls,"-motion-collapse")]:{overflow:"hidden",transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}}})},37133:function(e,t,n){"use strict";n.d(t,{R:function(){return a}});let r=e=>({animationDuration:e,animationFillMode:"both"}),o=e=>({animationDuration:e,animationFillMode:"both"}),a=function(e,t,n,a){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],c=i?"&":"";return{["\n ".concat(c).concat(e,"-enter,\n ").concat(c).concat(e,"-appear\n ")]:Object.assign(Object.assign({},r(a)),{animationPlayState:"paused"}),["".concat(c).concat(e,"-leave")]:Object.assign(Object.assign({},o(a)),{animationPlayState:"paused"}),["\n ".concat(c).concat(e,"-enter").concat(e,"-enter-active,\n ").concat(c).concat(e,"-appear").concat(e,"-appear-active\n ")]:{animationName:t,animationPlayState:"running"},["".concat(c).concat(e,"-leave").concat(e,"-leave-active")]:{animationName:n,animationPlayState:"running",pointerEvents:"none"}}}},29382:function(e,t,n){"use strict";n.d(t,{Fm:function(){return f}});var r=n(352),o=n(37133);let a=new r.E4("antMoveDownIn",{"0%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),i=new r.E4("antMoveDownOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0}}),c=new r.E4("antMoveLeftIn",{"0%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),l=new r.E4("antMoveLeftOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),s=new r.E4("antMoveRightIn",{"0%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),u=new r.E4("antMoveRightOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),d={"move-up":{inKeyframes:new r.E4("antMoveUpIn",{"0%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),outKeyframes:new r.E4("antMoveUpOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0}})},"move-down":{inKeyframes:a,outKeyframes:i},"move-left":{inKeyframes:c,outKeyframes:l},"move-right":{inKeyframes:s,outKeyframes:u}},f=(e,t)=>{let{antCls:n}=e,r="".concat(n,"-").concat(t),{inKeyframes:a,outKeyframes:i}=d[t];return[(0,o.R)(r,a,i,e.motionDurationMid),{["\n ".concat(r,"-enter,\n ").concat(r,"-appear\n ")]:{opacity:0,animationTimingFunction:e.motionEaseOutCirc},["".concat(r,"-leave")]:{animationTimingFunction:e.motionEaseInOutCirc}}]}},18544:function(e,t,n){"use strict";n.d(t,{Qt:function(){return c},Uw:function(){return i},fJ:function(){return a},ly:function(){return l},oN:function(){return d}});var r=n(352),o=n(37133);let a=new r.E4("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),i=new r.E4("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),c=new r.E4("antSlideDownIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1}}),l=new r.E4("antSlideDownOut",{"0%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0}}),s=new r.E4("antSlideLeftIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1}}),u={"slide-up":{inKeyframes:a,outKeyframes:i},"slide-down":{inKeyframes:c,outKeyframes:l},"slide-left":{inKeyframes:s,outKeyframes:new r.E4("antSlideLeftOut",{"0%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0}})},"slide-right":{inKeyframes:new r.E4("antSlideRightIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1}}),outKeyframes:new r.E4("antSlideRightOut",{"0%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0}})}},d=(e,t)=>{let{antCls:n}=e,r="".concat(n,"-").concat(t),{inKeyframes:a,outKeyframes:i}=u[t];return[(0,o.R)(r,a,i,e.motionDurationMid),{["\n ".concat(r,"-enter,\n ").concat(r,"-appear\n ")]:{transform:"scale(0)",transformOrigin:"0% 0%",opacity:0,animationTimingFunction:e.motionEaseOutQuint,"&-prepare":{transform:"scale(1)"}},["".concat(r,"-leave")]:{animationTimingFunction:e.motionEaseInQuint}}]}},691:function(e,t,n){"use strict";n.d(t,{_y:function(){return g},kr:function(){return a}});var r=n(352),o=n(37133);let a=new r.E4("antZoomIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),i=new r.E4("antZoomOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),c=new r.E4("antZoomBigIn",{"0%":{transform:"scale(0.8)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),l=new r.E4("antZoomBigOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.8)",opacity:0}}),s=new r.E4("antZoomUpIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 0%"}}),u=new r.E4("antZoomUpOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 0%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0}}),d=new r.E4("antZoomLeftIn",{"0%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"0% 50%"}}),f=new r.E4("antZoomLeftOut",{"0%":{transform:"scale(1)",transformOrigin:"0% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0}}),p=new r.E4("antZoomRightIn",{"0%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"100% 50%"}}),m={zoom:{inKeyframes:a,outKeyframes:i},"zoom-big":{inKeyframes:c,outKeyframes:l},"zoom-big-fast":{inKeyframes:c,outKeyframes:l},"zoom-left":{inKeyframes:d,outKeyframes:f},"zoom-right":{inKeyframes:p,outKeyframes:new r.E4("antZoomRightOut",{"0%":{transform:"scale(1)",transformOrigin:"100% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0}})},"zoom-up":{inKeyframes:s,outKeyframes:u},"zoom-down":{inKeyframes:new r.E4("antZoomDownIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 100%"}}),outKeyframes:new r.E4("antZoomDownOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 100%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0}})}},g=(e,t)=>{let{antCls:n}=e,r="".concat(n,"-").concat(t),{inKeyframes:a,outKeyframes:i}=m[t];return[(0,o.R)(r,a,i,"zoom-big-fast"===t?e.motionDurationFast:e.motionDurationMid),{["\n ".concat(r,"-enter,\n ").concat(r,"-appear\n ")]:{transform:"scale(0)",opacity:0,animationTimingFunction:e.motionEaseOutCirc,"&-prepare":{transform:"none"}},["".concat(r,"-leave")]:{animationTimingFunction:e.motionEaseInOutCirc}}]}},88260:function(e,t,n){"use strict";n.d(t,{ZP:function(){return i},qN:function(){return o},wZ:function(){return a}});var r=n(34442);let o=8;function a(e){let{contentRadius:t,limitVerticalRadius:n}=e,r=t>12?t+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?o:r}}function i(e,t,n){var o,a,i,c,l,s,u,d;let{componentCls:f,boxShadowPopoverArrow:p,arrowOffsetVertical:m,arrowOffsetHorizontal:g}=e,{arrowDistance:h=0,arrowPlacement:v={left:!0,right:!0,top:!0,bottom:!0}}=n||{};return{[f]:Object.assign(Object.assign(Object.assign(Object.assign({["".concat(f,"-arrow")]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},(0,r.W)(e,t,p)),{"&:before":{background:t}})]},(o=!!v.top,a={[["&-placement-top > ".concat(f,"-arrow"),"&-placement-topLeft > ".concat(f,"-arrow"),"&-placement-topRight > ".concat(f,"-arrow")].join(",")]:{bottom:h,transform:"translateY(100%) rotate(180deg)"},["&-placement-top > ".concat(f,"-arrow")]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},["&-placement-topLeft > ".concat(f,"-arrow")]:{left:{_skip_check_:!0,value:g}},["&-placement-topRight > ".concat(f,"-arrow")]:{right:{_skip_check_:!0,value:g}}},o?a:{})),(i=!!v.bottom,c={[["&-placement-bottom > ".concat(f,"-arrow"),"&-placement-bottomLeft > ".concat(f,"-arrow"),"&-placement-bottomRight > ".concat(f,"-arrow")].join(",")]:{top:h,transform:"translateY(-100%)"},["&-placement-bottom > ".concat(f,"-arrow")]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},["&-placement-bottomLeft > ".concat(f,"-arrow")]:{left:{_skip_check_:!0,value:g}},["&-placement-bottomRight > ".concat(f,"-arrow")]:{right:{_skip_check_:!0,value:g}}},i?c:{})),(l=!!v.left,s={[["&-placement-left > ".concat(f,"-arrow"),"&-placement-leftTop > ".concat(f,"-arrow"),"&-placement-leftBottom > ".concat(f,"-arrow")].join(",")]:{right:{_skip_check_:!0,value:h},transform:"translateX(100%) rotate(90deg)"},["&-placement-left > ".concat(f,"-arrow")]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},["&-placement-leftTop > ".concat(f,"-arrow")]:{top:m},["&-placement-leftBottom > ".concat(f,"-arrow")]:{bottom:m}},l?s:{})),(u=!!v.right,d={[["&-placement-right > ".concat(f,"-arrow"),"&-placement-rightTop > ".concat(f,"-arrow"),"&-placement-rightBottom > ".concat(f,"-arrow")].join(",")]:{left:{_skip_check_:!0,value:h},transform:"translateX(-100%) rotate(-90deg)"},["&-placement-right > ".concat(f,"-arrow")]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},["&-placement-rightTop > ".concat(f,"-arrow")]:{top:m},["&-placement-rightBottom > ".concat(f,"-arrow")]:{bottom:m}},u?d:{}))}}},34442:function(e,t,n){"use strict";n.d(t,{W:function(){return a},w:function(){return o}});var r=n(352);function o(e){let{sizePopupArrow:t,borderRadiusXS:n,borderRadiusOuter:r}=e,o=t/2,a=1*r/Math.sqrt(2),i=o-r*(1-1/Math.sqrt(2)),c=o-1/Math.sqrt(2)*n,l=r*(Math.sqrt(2)-1)+1/Math.sqrt(2)*n,s=2*o-c,u=2*o-a,d=2*o-0,f=o*Math.sqrt(2)+r*(Math.sqrt(2)-2),p=r*(Math.sqrt(2)-1),m="polygon(".concat(p,"px 100%, 50% ").concat(p,"px, ").concat(2*o-p,"px 100%, ").concat(p,"px 100%)");return{arrowShadowWidth:f,arrowPath:"path('M ".concat(0," ").concat(o," A ").concat(r," ").concat(r," 0 0 0 ").concat(a," ").concat(i," L ").concat(c," ").concat(l," A ").concat(n," ").concat(n," 0 0 1 ").concat(s," ").concat(l," L ").concat(u," ").concat(i," A ").concat(r," ").concat(r," 0 0 0 ").concat(d," ").concat(o," Z')"),arrowPolygon:m}}let a=(e,t,n)=>{let{sizePopupArrow:o,arrowPolygon:a,arrowPath:i,arrowShadowWidth:c,borderRadiusXS:l,calc:s}=e;return{pointerEvents:"none",width:o,height:o,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:o,height:s(o).div(2).equal(),background:t,clipPath:{_multi_value_:!0,value:[a,i]},content:'""'},"&::after":{content:'""',position:"absolute",width:c,height:c,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:"0 0 ".concat((0,r.bf)(l)," 0")},transform:"translateY(50%) rotate(-135deg)",boxShadow:n,zIndex:0,background:"transparent"}}}},37516:function(e,t,n){"use strict";n.d(t,{Mj:function(){return b},u_:function(){return v},uH:function(){return h}});var r=n(2265),o=n(352),a=n(31373),i=e=>{let{controlHeight:t}=e;return{controlHeightSM:.75*t,controlHeightXS:.5*t,controlHeightLG:1.25*t}},c=n(70774),l=n(36360),s=e=>{let t=e,n=e,r=e,o=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?o=4:e>=8&&(o=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:o}};let u=(e,t)=>new l.C(e).setAlpha(t).toRgbString(),d=(e,t)=>new l.C(e).darken(t).toHexString(),f=e=>{let t=(0,a.R_)(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},p=(e,t)=>{let n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:u(r,.88),colorTextSecondary:u(r,.65),colorTextTertiary:u(r,.45),colorTextQuaternary:u(r,.25),colorFill:u(r,.15),colorFillSecondary:u(r,.06),colorFillTertiary:u(r,.04),colorFillQuaternary:u(r,.02),colorBgLayout:d(n,4),colorBgContainer:d(n,0),colorBgElevated:d(n,0),colorBgSpotlight:u(r,.85),colorBgBlur:"transparent",colorBorder:d(n,15),colorBorderSecondary:d(n,6)}};var m=n(1319),g=e=>{let t=(0,m.Z)(e),n=t.map(e=>e.size),r=t.map(e=>e.lineHeight),o=n[1],a=n[0],i=n[2],c=r[1],l=r[0],s=r[2];return{fontSizeSM:a,fontSize:o,fontSizeLG:i,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:c,lineHeightLG:s,lineHeightSM:l,fontHeight:Math.round(c*o),fontHeightLG:Math.round(s*i),fontHeightSM:Math.round(l*a),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};let h=(0,o.jG)(function(e){let t=Object.keys(c.M).map(t=>{let n=(0,a.R_)(e[t]);return Array(10).fill(1).reduce((e,r,o)=>(e["".concat(t,"-").concat(o+1)]=n[o],e["".concat(t).concat(o+1)]=n[o],e),{})}).reduce((e,t)=>e=Object.assign(Object.assign({},e),t),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),function(e,t){let{generateColorPalettes:n,generateNeutralColorPalettes:r}=t,{colorSuccess:o,colorWarning:a,colorError:i,colorInfo:c,colorPrimary:s,colorBgBase:u,colorTextBase:d}=e,f=n(s),p=n(o),m=n(a),g=n(i),h=n(c),v=r(u,d),b=n(e.colorLink||e.colorInfo);return Object.assign(Object.assign({},v),{colorPrimaryBg:f[1],colorPrimaryBgHover:f[2],colorPrimaryBorder:f[3],colorPrimaryBorderHover:f[4],colorPrimaryHover:f[5],colorPrimary:f[6],colorPrimaryActive:f[7],colorPrimaryTextHover:f[8],colorPrimaryText:f[9],colorPrimaryTextActive:f[10],colorSuccessBg:p[1],colorSuccessBgHover:p[2],colorSuccessBorder:p[3],colorSuccessBorderHover:p[4],colorSuccessHover:p[4],colorSuccess:p[6],colorSuccessActive:p[7],colorSuccessTextHover:p[8],colorSuccessText:p[9],colorSuccessTextActive:p[10],colorErrorBg:g[1],colorErrorBgHover:g[2],colorErrorBorder:g[3],colorErrorBorderHover:g[4],colorErrorHover:g[5],colorError:g[6],colorErrorActive:g[7],colorErrorTextHover:g[8],colorErrorText:g[9],colorErrorTextActive:g[10],colorWarningBg:m[1],colorWarningBgHover:m[2],colorWarningBorder:m[3],colorWarningBorderHover:m[4],colorWarningHover:m[4],colorWarning:m[6],colorWarningActive:m[7],colorWarningTextHover:m[8],colorWarningText:m[9],colorWarningTextActive:m[10],colorInfoBg:h[1],colorInfoBgHover:h[2],colorInfoBorder:h[3],colorInfoBorderHover:h[4],colorInfoHover:h[4],colorInfo:h[6],colorInfoActive:h[7],colorInfoTextHover:h[8],colorInfoText:h[9],colorInfoTextActive:h[10],colorLinkHover:b[4],colorLink:b[6],colorLinkActive:b[7],colorBgMask:new l.C("#000").setAlpha(.45).toRgbString(),colorWhite:"#fff"})}(e,{generateColorPalettes:f,generateNeutralColorPalettes:p})),g(e.fontSize)),function(e){let{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}(e)),i(e)),function(e){let{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:o}=e;return Object.assign({motionDurationFast:"".concat((n+t).toFixed(1),"s"),motionDurationMid:"".concat((n+2*t).toFixed(1),"s"),motionDurationSlow:"".concat((n+3*t).toFixed(1),"s"),lineWidthBold:o+1},s(r))}(e))}),v={token:c.Z,override:{override:c.Z},hashed:!0},b=r.createContext(v)},53454:function(e,t,n){"use strict";n.d(t,{i:function(){return r}});let r=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"]},70774:function(e,t,n){"use strict";n.d(t,{M:function(){return r}});let r={blue:"#1677ff",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#eb2f96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},o=Object.assign(Object.assign({},r),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,\n'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',\n'Noto Color Emoji'",fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0});t.Z=o},1319:function(e,t,n){"use strict";function r(e){return(e+8)/e}function o(e){let t=Array(10).fill(null).map((t,n)=>{let r=e*Math.pow(2.71828,(n-1)/5);return 2*Math.floor((n>1?Math.floor(r):Math.ceil(r))/2)});return t[1]=e,t.map(e=>({size:e,lineHeight:r(e)}))}n.d(t,{D:function(){return r},Z:function(){return o}})},29961:function(e,t,n){"use strict";n.d(t,{ZP:function(){return v},ID:function(){return m},NJ:function(){return p}});var r=n(2265),o=n(352),a=n(37516),i=n(70774),c=n(36360);function l(e){return e>=0&&e<=255}var s=function(e,t){let{r:n,g:r,b:o,a:a}=new c.C(e).toRgb();if(a<1)return e;let{r:i,g:s,b:u}=new c.C(t).toRgb();for(let e=.01;e<=1;e+=.01){let t=Math.round((n-i*(1-e))/e),a=Math.round((r-s*(1-e))/e),d=Math.round((o-u*(1-e))/e);if(l(t)&&l(a)&&l(d))return new c.C({r:t,g:a,b:d,a:Math.round(100*e)/100}).toRgbString()}return new c.C({r:n,g:r,b:o,a:1}).toRgbString()},u=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};function d(e){let{override:t}=e,n=u(e,["override"]),r=Object.assign({},t);Object.keys(i.Z).forEach(e=>{delete r[e]});let o=Object.assign(Object.assign({},n),r);return!1===o.motion&&(o.motionDurationFast="0s",o.motionDurationMid="0s",o.motionDurationSlow="0s"),Object.assign(Object.assign(Object.assign({},o),{colorFillContent:o.colorFillSecondary,colorFillContentHover:o.colorFill,colorFillAlter:o.colorFillQuaternary,colorBgContainerDisabled:o.colorFillTertiary,colorBorderBg:o.colorBgContainer,colorSplit:s(o.colorBorderSecondary,o.colorBgContainer),colorTextPlaceholder:o.colorTextQuaternary,colorTextDisabled:o.colorTextQuaternary,colorTextHeading:o.colorText,colorTextLabel:o.colorTextSecondary,colorTextDescription:o.colorTextTertiary,colorTextLightSolid:o.colorWhite,colorHighlight:o.colorError,colorBgTextHover:o.colorFillSecondary,colorBgTextActive:o.colorFill,colorIcon:o.colorTextTertiary,colorIconHover:o.colorText,colorErrorOutline:s(o.colorErrorBg,o.colorBgContainer),colorWarningOutline:s(o.colorWarningBg,o.colorBgContainer),fontSizeIcon:o.fontSizeSM,lineWidthFocus:4*o.lineWidth,lineWidth:o.lineWidth,controlOutlineWidth:2*o.lineWidth,controlInteractiveSize:o.controlHeight/2,controlItemBgHover:o.colorFillTertiary,controlItemBgActive:o.colorPrimaryBg,controlItemBgActiveHover:o.colorPrimaryBgHover,controlItemBgActiveDisabled:o.colorFill,controlTmpOutline:o.colorFillQuaternary,controlOutline:s(o.colorPrimaryBg,o.colorBgContainer),lineType:o.lineType,borderRadius:o.borderRadius,borderRadiusXS:o.borderRadiusXS,borderRadiusSM:o.borderRadiusSM,borderRadiusLG:o.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:o.sizeXXS,paddingXS:o.sizeXS,paddingSM:o.sizeSM,padding:o.size,paddingMD:o.sizeMD,paddingLG:o.sizeLG,paddingXL:o.sizeXL,paddingContentHorizontalLG:o.sizeLG,paddingContentVerticalLG:o.sizeMS,paddingContentHorizontal:o.sizeMS,paddingContentVertical:o.sizeSM,paddingContentHorizontalSM:o.size,paddingContentVerticalSM:o.sizeXS,marginXXS:o.sizeXXS,marginXS:o.sizeXS,marginSM:o.sizeSM,margin:o.size,marginMD:o.sizeMD,marginLG:o.sizeLG,marginXL:o.sizeXL,marginXXL:o.sizeXXL,boxShadow:"\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowSecondary:"\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowTertiary:"\n 0 1px 2px 0 rgba(0, 0, 0, 0.03),\n 0 1px 6px -1px rgba(0, 0, 0, 0.02),\n 0 2px 4px 0 rgba(0, 0, 0, 0.02)\n ",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600,boxShadowPopoverArrow:"2px 2px 5px rgba(0, 0, 0, 0.05)",boxShadowCard:"\n 0 1px 2px -2px ".concat(new c.C("rgba(0, 0, 0, 0.16)").toRgbString(),",\n 0 3px 6px 0 ").concat(new c.C("rgba(0, 0, 0, 0.12)").toRgbString(),",\n 0 5px 12px 4px ").concat(new c.C("rgba(0, 0, 0, 0.09)").toRgbString(),"\n "),boxShadowDrawerRight:"\n -6px 0 16px 0 rgba(0, 0, 0, 0.08),\n -3px 0 6px -4px rgba(0, 0, 0, 0.12),\n -9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowDrawerLeft:"\n 6px 0 16px 0 rgba(0, 0, 0, 0.08),\n 3px 0 6px -4px rgba(0, 0, 0, 0.12),\n 9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowDrawerUp:"\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowDrawerDown:"\n 0 -6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 -3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 -9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var f=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};let p={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0},m={size:!0,sizeSM:!0,sizeLG:!0,sizeMD:!0,sizeXS:!0,sizeXXS:!0,sizeMS:!0,sizeXL:!0,sizeXXL:!0,sizeUnit:!0,sizeStep:!0,motionBase:!0,motionUnit:!0},g={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},h=(e,t,n)=>{let r=n.getDerivativeToken(e),{override:o}=t,a=f(t,["override"]),i=Object.assign(Object.assign({},r),{override:o});return i=d(i),a&&Object.entries(a).forEach(e=>{let[t,n]=e,{theme:r}=n,o=f(n,["theme"]),a=o;r&&(a=h(Object.assign(Object.assign({},i),o),{override:o},r)),i[t]=a}),i};function v(){let{token:e,hashed:t,theme:n,override:c,cssVar:l}=r.useContext(a.Mj),s="".concat("5.13.2","-").concat(t||""),u=n||a.uH,[f,v,b]=(0,o.fp)(u,[i.Z,e],{salt:s,override:c,getComputedToken:h,formatToken:d,cssVar:l&&{prefix:l.prefix,key:l.key,unitless:p,ignore:m,preserve:g}});return[u,b,t?v:"",f,l]}},80669:function(e,t,n){"use strict";n.d(t,{ZP:function(){return Z},I$:function(){return M},bk:function(){return O}});var r=n(2265),o=n(352);n(74126);var a=n(71744),i=n(12918),c=n(29961),l=n(76405),s=n(25049),u=n(37977),d=n(63929),f=n(24995),p=n(15354);let m=(0,s.Z)(function e(){(0,l.Z)(this,e)}),g=function(e){function t(e){var n,r,o;return(0,l.Z)(this,t),r=t,r=(0,f.Z)(r),(n=(0,u.Z)(this,(0,d.Z)()?Reflect.construct(r,[],(0,f.Z)(this).constructor):r.apply(this,o))).result=0,e instanceof t?n.result=e.result:"number"==typeof e&&(n.result=e),n}return(0,p.Z)(t,e),(0,s.Z)(t,[{key:"add",value:function(e){return e instanceof t?this.result+=e.result:"number"==typeof e&&(this.result+=e),this}},{key:"sub",value:function(e){return e instanceof t?this.result-=e.result:"number"==typeof e&&(this.result-=e),this}},{key:"mul",value:function(e){return e instanceof t?this.result*=e.result:"number"==typeof e&&(this.result*=e),this}},{key:"div",value:function(e){return e instanceof t?this.result/=e.result:"number"==typeof e&&(this.result/=e),this}},{key:"equal",value:function(){return this.result}}]),t}(m),h="CALC_UNIT";function v(e){return"number"==typeof e?"".concat(e).concat(h):e}let b=function(e){function t(e){var n,r,o;return(0,l.Z)(this,t),r=t,r=(0,f.Z)(r),(n=(0,u.Z)(this,(0,d.Z)()?Reflect.construct(r,[],(0,f.Z)(this).constructor):r.apply(this,o))).result="",e instanceof t?n.result="(".concat(e.result,")"):"number"==typeof e?n.result=v(e):"string"==typeof e&&(n.result=e),n}return(0,p.Z)(t,e),(0,s.Z)(t,[{key:"add",value:function(e){return e instanceof t?this.result="".concat(this.result," + ").concat(e.getResult()):("number"==typeof e||"string"==typeof e)&&(this.result="".concat(this.result," + ").concat(v(e))),this.lowPriority=!0,this}},{key:"sub",value:function(e){return e instanceof t?this.result="".concat(this.result," - ").concat(e.getResult()):("number"==typeof e||"string"==typeof e)&&(this.result="".concat(this.result," - ").concat(v(e))),this.lowPriority=!0,this}},{key:"mul",value:function(e){return this.lowPriority&&(this.result="(".concat(this.result,")")),e instanceof t?this.result="".concat(this.result," * ").concat(e.getResult(!0)):("number"==typeof e||"string"==typeof e)&&(this.result="".concat(this.result," * ").concat(e)),this.lowPriority=!1,this}},{key:"div",value:function(e){return this.lowPriority&&(this.result="(".concat(this.result,")")),e instanceof t?this.result="".concat(this.result," / ").concat(e.getResult(!0)):("number"==typeof e||"string"==typeof e)&&(this.result="".concat(this.result," / ").concat(e)),this.lowPriority=!1,this}},{key:"getResult",value:function(e){return this.lowPriority||e?"(".concat(this.result,")"):this.result}},{key:"equal",value:function(e){let{unit:t=!0}=e||{},n=RegExp("".concat(h),"g");return(this.result=this.result.replace(n,t?"px":""),void 0!==this.lowPriority)?"calc(".concat(this.result,")"):this.result}}]),t}(m);var y=e=>{let t="css"===e?b:g;return e=>new t(e)},w=n(3104),x=n(36198);let E=(e,t,n)=>{var r;return"function"==typeof n?n((0,w.TS)(t,null!==(r=t[e])&&void 0!==r?r:{})):null!=n?n:{}},S=(e,t,n,r)=>{let o=Object.assign({},t[e]);if(null==r?void 0:r.deprecatedTokens){let{deprecatedTokens:e}=r;e.forEach(e=>{var t;let[n,r]=e;((null==o?void 0:o[n])||(null==o?void 0:o[r]))&&(null!==(t=o[r])&&void 0!==t||(o[r]=null==o?void 0:o[n]))})}let a=Object.assign(Object.assign({},n),o);return Object.keys(a).forEach(e=>{a[e]===t[e]&&delete a[e]}),a},C=(e,t)=>"".concat([t,e.replace(/([A-Z]+)([A-Z][a-z]+)/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2")].filter(Boolean).join("-"));function Z(e,t,n){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=Array.isArray(e)?e:[e,e],[u]=s,d=s.join("-");return e=>{let[s,f,p,m,g]=(0,c.ZP)(),{getPrefixCls:h,iconPrefixCls:v,csp:b}=(0,r.useContext)(a.E_),Z=h(),O=g?"css":"js",k=y(O),{max:M,min:j}="js"===O?{max:Math.max,min:Math.min}:{max:function(){for(var e=arguments.length,t=Array(e),n=0;n(0,o.bf)(e)).join(","),")")},min:function(){for(var e=arguments.length,t=Array(e),n=0;n(0,o.bf)(e)).join(","),")")}},I={theme:s,token:m,hashId:p,nonce:()=>null==b?void 0:b.nonce,clientOnly:l.clientOnly,order:l.order||-999};return(0,o.xy)(Object.assign(Object.assign({},I),{clientOnly:!1,path:["Shared",Z]}),()=>[{"&":(0,i.Lx)(m)}]),(0,x.Z)(v,b),[(0,o.xy)(Object.assign(Object.assign({},I),{path:[d,e,v]}),()=>{if(!1===l.injectStyle)return[];let{token:r,flush:a}=(0,w.ZP)(m),c=E(u,f,n),s=".".concat(e),d=S(u,f,c,{deprecatedTokens:l.deprecatedTokens});g&&Object.keys(c).forEach(e=>{c[e]="var(".concat((0,o.ks)(e,C(u,g.prefix)),")")});let h=(0,w.TS)(r,{componentCls:s,prefixCls:e,iconCls:".".concat(v),antCls:".".concat(Z),calc:k,max:M,min:j},g?c:d),b=t(h,{hashId:p,prefixCls:e,rootPrefixCls:Z,iconPrefixCls:v});return a(u,d),[!1===l.resetStyle?null:(0,i.du)(h,e),b]}),p]}}let O=(e,t,n,r)=>{let o=Z(e,t,n,Object.assign({resetStyle:!1,order:-998},r));return e=>{let{prefixCls:t}=e;return o(t),null}},k=(e,t,n)=>{function a(t){return"".concat(e).concat(t.slice(0,1).toUpperCase()).concat(t.slice(1))}let{unitless:i={},injectStyle:l=!0}=null!=n?n:{},s={[a("zIndexPopup")]:!0};Object.keys(i).forEach(e=>{s[a(e)]=i[e]});let u=r=>{let{rootCls:i,cssVar:l}=r,[,u]=(0,c.ZP)();return(0,o.CI)({path:[e],prefix:l.prefix,key:null==l?void 0:l.key,unitless:Object.assign(Object.assign({},c.NJ),s),ignore:c.ID,token:u,scope:i},()=>{let r=E(e,u,t),o=S(e,u,r,{deprecatedTokens:null==n?void 0:n.deprecatedTokens});return Object.keys(r).forEach(e=>{o[a(e)]=o[e],delete o[e]}),o}),null};return t=>{let[,,,,n]=(0,c.ZP)();return[o=>l&&n?r.createElement(r.Fragment,null,r.createElement(u,{rootCls:t,cssVar:n,component:e}),o):o,null==n?void 0:n.key]}},M=(e,t,n,r)=>{let o=Z(e,t,n,r),a=k(Array.isArray(e)?e[0]:e,n,r);return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,[,n]=o(e),[r,i]=a(t);return[r,n,i]}}},18536:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(53454);function o(e,t){return r.i.reduce((n,r)=>{let o=e["".concat(r,"1")],a=e["".concat(r,"3")],i=e["".concat(r,"6")],c=e["".concat(r,"7")];return Object.assign(Object.assign({},n),t(r,{lightColor:o,lightBorderColor:a,darkColor:i,textColor:c}))},{})}},3104:function(e,t,n){"use strict";n.d(t,{TS:function(){return a}});let r="undefined"!=typeof CSSINJS_STATISTIC,o=!0;function a(){for(var e=arguments.length,t=Array(e),n=0;n{Object.keys(e).forEach(t=>{Object.defineProperty(a,t,{configurable:!0,enumerable:!0,get:()=>e[t]})})}),o=!0,a}let i={};function c(){}t.ZP=e=>{let t;let n=e,a=c;return r&&"undefined"!=typeof Proxy&&(t=new Set,n=new Proxy(e,{get:(e,n)=>(o&&t.add(n),e[n])}),a=(e,n)=>{var r;i[e]={global:Array.from(t),component:Object.assign(Object.assign({},null===(r=i[e])||void 0===r?void 0:r.component),n)}}),{token:n,keys:t,flush:a}}},36198:function(e,t,n){"use strict";var r=n(352),o=n(12918),a=n(29961);t.Z=(e,t)=>{let[n,i]=(0,a.ZP)();return(0,r.xy)({theme:n,token:i,hashId:"",path:["ant-design-icons",e],nonce:()=>null==t?void 0:t.nonce},()=>[{[".".concat(e)]:Object.assign(Object.assign({},(0,o.Ro)()),{[".".concat(e," .").concat(e,"-icon")]:{display:"block"}})}])}},89970:function(e,t,n){"use strict";n.d(t,{Z:function(){return N}});var r=n(2265),o=n(36760),a=n.n(o),i=n(5769),c=n(50506),l=n(62236),s=n(68710),u=n(92736),d=n(19722),f=n(13613),p=n(95140),m=n(71744),g=n(65658),h=n(29961),v=n(12918),b=n(691),y=n(88260),w=n(18536),x=n(3104),E=n(80669),S=n(352),C=n(34442);let Z=e=>{let{componentCls:t,tooltipMaxWidth:n,tooltipColor:r,tooltipBg:o,tooltipBorderRadius:a,zIndexPopup:i,controlHeight:c,boxShadowSecondary:l,paddingSM:s,paddingXS:u}=e;return[{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,v.Wf)(e)),{position:"absolute",zIndex:i,display:"block",width:"max-content",maxWidth:n,visibility:"visible",transformOrigin:"var(--arrow-x, 50%) var(--arrow-y, 50%)","&-hidden":{display:"none"},"--antd-arrow-background-color":o,["".concat(t,"-inner")]:{minWidth:c,minHeight:c,padding:"".concat((0,S.bf)(e.calc(s).div(2).equal())," ").concat((0,S.bf)(u)),color:r,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:o,borderRadius:a,boxShadow:l,boxSizing:"border-box"},"&-placement-left,&-placement-leftTop,&-placement-leftBottom,&-placement-right,&-placement-rightTop,&-placement-rightBottom":{["".concat(t,"-inner")]:{borderRadius:e.min(a,y.qN)}},["".concat(t,"-content")]:{position:"relative"}}),(0,w.Z)(e,(e,n)=>{let{darkColor:r}=n;return{["&".concat(t,"-").concat(e)]:{["".concat(t,"-inner")]:{backgroundColor:r},["".concat(t,"-arrow")]:{"--antd-arrow-background-color":r}}}})),{"&-rtl":{direction:"rtl"}})},(0,y.ZP)(e,"var(--antd-arrow-background-color)"),{["".concat(t,"-pure")]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow}}]},O=e=>Object.assign(Object.assign({zIndexPopup:e.zIndexPopupBase+70},(0,y.wZ)({contentRadius:e.borderRadius,limitVerticalRadius:!0})),(0,C.w)((0,x.TS)(e,{borderRadiusOuter:Math.min(e.borderRadiusOuter,4)})));function k(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return(0,E.I$)("Tooltip",e=>{let{borderRadius:t,colorTextLightSolid:n,colorBgSpotlight:r}=e;return[Z((0,x.TS)(e,{tooltipMaxWidth:250,tooltipColor:n,tooltipBorderRadius:t,tooltipBg:r})),(0,b._y)(e,"zoom-big-fast")]},O,{resetStyle:!1,injectStyle:t})(e)}var M=n(93350);function j(e,t){let n=(0,M.o2)(t),r=a()({["".concat(e,"-").concat(t)]:t&&n}),o={},i={};return t&&!n&&(o.background=t,i["--antd-arrow-background-color"]=t),{className:r,overlayStyle:o,arrowStyle:i}}var I=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};let R=r.forwardRef((e,t)=>{var n,o;let{prefixCls:v,openClassName:b,getTooltipContainer:y,overlayClassName:w,color:x,overlayInnerStyle:E,children:S,afterOpenChange:C,afterVisibleChange:Z,destroyTooltipOnHide:O,arrow:M=!0,title:R,overlay:N,builtinPlacements:P,arrowPointAtCenter:F=!1,autoAdjustOverflow:T=!0}=e,A=!!M,[,L]=(0,h.ZP)(),{getPopupContainer:z,getPrefixCls:_,direction:H}=r.useContext(m.E_),B=(0,f.ln)("Tooltip"),D=r.useRef(null),W=()=>{var e;null===(e=D.current)||void 0===e||e.forceAlign()};r.useImperativeHandle(t,()=>({forceAlign:W,forcePopupAlign:()=>{B.deprecated(!1,"forcePopupAlign","forceAlign"),W()}}));let[V,q]=(0,c.Z)(!1,{value:null!==(n=e.open)&&void 0!==n?n:e.visible,defaultValue:null!==(o=e.defaultOpen)&&void 0!==o?o:e.defaultVisible}),G=!R&&!N&&0!==R,X=r.useMemo(()=>{var e,t;let n=F;return"object"==typeof M&&(n=null!==(t=null!==(e=M.pointAtCenter)&&void 0!==e?e:M.arrowPointAtCenter)&&void 0!==t?t:F),P||(0,u.Z)({arrowPointAtCenter:n,autoAdjustOverflow:T,arrowWidth:A?L.sizePopupArrow:0,borderRadius:L.borderRadius,offset:L.marginXXS,visibleFirst:!0})},[F,M,P,L]),U=r.useMemo(()=>0===R?R:N||R||"",[N,R]),$=r.createElement(g.BR,null,"function"==typeof U?U():U),{getPopupContainer:K,placement:Y="top",mouseEnterDelay:Q=.1,mouseLeaveDelay:J=.1,overlayStyle:ee,rootClassName:et}=e,en=I(e,["getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName"]),er=_("tooltip",v),eo=_(),ea=e["data-popover-inject"],ei=V;"open"in e||"visible"in e||!G||(ei=!1);let ec=(0,d.l$)(S)&&!(0,d.M2)(S)?S:r.createElement("span",null,S),el=ec.props,es=el.className&&"string"!=typeof el.className?el.className:a()(el.className,b||"".concat(er,"-open")),[eu,ed,ef]=k(er,!ea),ep=j(er,x),em=ep.arrowStyle,eg=Object.assign(Object.assign({},E),ep.overlayStyle),eh=a()(w,{["".concat(er,"-rtl")]:"rtl"===H},ep.className,et,ed,ef),[ev,eb]=(0,l.Cn)("Tooltip",en.zIndex),ey=r.createElement(i.Z,Object.assign({},en,{zIndex:ev,showArrow:A,placement:Y,mouseEnterDelay:Q,mouseLeaveDelay:J,prefixCls:er,overlayClassName:eh,overlayStyle:Object.assign(Object.assign({},em),ee),getTooltipContainer:K||y||z,ref:D,builtinPlacements:X,overlay:$,visible:ei,onVisibleChange:t=>{var n,r;q(!G&&t),G||(null===(n=e.onOpenChange)||void 0===n||n.call(e,t),null===(r=e.onVisibleChange)||void 0===r||r.call(e,t))},afterVisibleChange:null!=C?C:Z,overlayInnerStyle:eg,arrowContent:r.createElement("span",{className:"".concat(er,"-arrow-content")}),motion:{motionName:(0,s.m)(eo,"zoom-big-fast",e.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!O}),ei?(0,d.Tm)(ec,{className:es}):ec);return eu(r.createElement(p.Z.Provider,{value:eb},ey))});R._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:t,className:n,placement:o="top",title:c,color:l,overlayInnerStyle:s}=e,{getPrefixCls:u}=r.useContext(m.E_),d=u("tooltip",t),[f,p,g]=k(d),h=j(d,l),v=h.arrowStyle,b=Object.assign(Object.assign({},s),h.overlayStyle),y=a()(p,g,d,"".concat(d,"-pure"),"".concat(d,"-placement-").concat(o),n,h.className);return f(r.createElement("div",{className:y,style:v},r.createElement("div",{className:"".concat(d,"-arrow")}),r.createElement(i.G,Object.assign({},e,{className:p,prefixCls:d,overlayInnerStyle:b}),c)))};var N=R},99376:function(e,t,n){"use strict";var r=n(35475);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},40257:function(e,t,n){"use strict";var r,o;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(o=n.g.process)?void 0:o.env)?n.g.process:n(44227)},44227:function(e){!function(){var t={229:function(e){var t,n,r,o=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var l=[],s=!1,u=-1;function d(){s&&r&&(s=!1,r.length?l=r.concat(l):u=-1,l.length&&f())}function f(){if(!s){var e=c(d);s=!0;for(var t=l.length;t;){for(r=l,l=[];++u1)for(var n=1;n1?t-1:0),r=1;r=a)return e;switch(e){case"%s":return String(n[o++]);case"%d":return Number(n[o++]);case"%j":try{return JSON.stringify(n[o++])}catch(e){return"[Circular]"}break;default:return e}}):e}function F(e,t){return!!(null==e||"array"===t&&Array.isArray(e)&&!e.length)||("string"===t||"url"===t||"hex"===t||"email"===t||"date"===t||"pattern"===t)&&"string"==typeof e&&!e}function T(e,t,n){var r=0,o=e.length;!function a(i){if(i&&i.length){n(i);return}var c=r;r+=1,c()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},D={integer:function(e){return D.number(e)&&parseInt(e,10)===e},float:function(e){return D.number(e)&&!D.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return new RegExp(e),!0}catch(e){return!1}},date:function(e){return"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear&&!isNaN(e.getTime())},number:function(e){return!isNaN(e)&&"number"==typeof e},object:function(e){return"object"==typeof e&&!D.array(e)},method:function(e){return"function"==typeof e},email:function(e){return"string"==typeof e&&e.length<=320&&!!e.match(B.email)},url:function(e){return"string"==typeof e&&e.length<=2048&&!!e.match(H())},hex:function(e){return"string"==typeof e&&!!e.match(B.hex)}},W="enum",V={required:_,whitespace:function(e,t,n,r,o){(/^\s+$/.test(t)||""===t)&&r.push(P(o.messages.whitespace,e.fullField))},type:function(e,t,n,r,o){if(e.required&&void 0===t){_(e,t,n,r,o);return}var a=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(a)>-1?D[a](t)||r.push(P(o.messages.types[a],e.fullField,e.type)):a&&typeof t!==e.type&&r.push(P(o.messages.types[a],e.fullField,e.type))},range:function(e,t,n,r,o){var a="number"==typeof e.len,i="number"==typeof e.min,c="number"==typeof e.max,l=t,s=null,u="number"==typeof t,d="string"==typeof t,f=Array.isArray(t);if(u?s="number":d?s="string":f&&(s="array"),!s)return!1;f&&(l=t.length),d&&(l=t.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length),a?l!==e.len&&r.push(P(o.messages[s].len,e.fullField,e.len)):i&&!c&&le.max?r.push(P(o.messages[s].max,e.fullField,e.max)):i&&c&&(le.max)&&r.push(P(o.messages[s].range,e.fullField,e.min,e.max))},enum:function(e,t,n,r,o){e[W]=Array.isArray(e[W])?e[W]:[],-1===e[W].indexOf(t)&&r.push(P(o.messages[W],e.fullField,e[W].join(", ")))},pattern:function(e,t,n,r,o){!e.pattern||(e.pattern instanceof RegExp?(e.pattern.lastIndex=0,e.pattern.test(t)||r.push(P(o.messages.pattern.mismatch,e.fullField,t,e.pattern))):"string"!=typeof e.pattern||new RegExp(e.pattern).test(t)||r.push(P(o.messages.pattern.mismatch,e.fullField,t,e.pattern)))}},q=function(e,t,n,r,o){var a=e.type,i=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t,a)&&!e.required)return n();V.required(e,t,r,i,o,a),F(t,a)||V.type(e,t,r,i,o)}n(i)},G={string:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t,"string")&&!e.required)return n();V.required(e,t,r,a,o,"string"),F(t,"string")||(V.type(e,t,r,a,o),V.range(e,t,r,a,o),V.pattern(e,t,r,a,o),!0===e.whitespace&&V.whitespace(e,t,r,a,o))}n(a)},method:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t)&&!e.required)return n();V.required(e,t,r,a,o),void 0!==t&&V.type(e,t,r,a,o)}n(a)},number:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(""===t&&(t=void 0),F(t)&&!e.required)return n();V.required(e,t,r,a,o),void 0!==t&&(V.type(e,t,r,a,o),V.range(e,t,r,a,o))}n(a)},boolean:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t)&&!e.required)return n();V.required(e,t,r,a,o),void 0!==t&&V.type(e,t,r,a,o)}n(a)},regexp:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t)&&!e.required)return n();V.required(e,t,r,a,o),F(t)||V.type(e,t,r,a,o)}n(a)},integer:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t)&&!e.required)return n();V.required(e,t,r,a,o),void 0!==t&&(V.type(e,t,r,a,o),V.range(e,t,r,a,o))}n(a)},float:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t)&&!e.required)return n();V.required(e,t,r,a,o),void 0!==t&&(V.type(e,t,r,a,o),V.range(e,t,r,a,o))}n(a)},array:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(null==t&&!e.required)return n();V.required(e,t,r,a,o,"array"),null!=t&&(V.type(e,t,r,a,o),V.range(e,t,r,a,o))}n(a)},object:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t)&&!e.required)return n();V.required(e,t,r,a,o),void 0!==t&&V.type(e,t,r,a,o)}n(a)},enum:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t)&&!e.required)return n();V.required(e,t,r,a,o),void 0!==t&&V.enum(e,t,r,a,o)}n(a)},pattern:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t,"string")&&!e.required)return n();V.required(e,t,r,a,o),F(t,"string")||V.pattern(e,t,r,a,o)}n(a)},date:function(e,t,n,r,o){var a,i=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t,"date")&&!e.required)return n();V.required(e,t,r,i,o),!F(t,"date")&&(a=t instanceof Date?t:new Date(t),V.type(e,a,r,i,o),a&&V.range(e,a.getTime(),r,i,o))}n(i)},url:q,hex:q,email:q,required:function(e,t,n,r,o){var a=[],i=Array.isArray(t)?"array":typeof t;V.required(e,t,r,a,o,i),n(a)},any:function(e,t,n,r,o){var a=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if(F(t)&&!e.required)return n();V.required(e,t,r,a,o)}n(a)}};function X(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var U=X(),$=function(){function e(e){this.rules=null,this._messages=U,this.define(e)}var t=e.prototype;return t.define=function(e){var t=this;if(!e)throw Error("Cannot configure a schema with no rules");if("object"!=typeof e||Array.isArray(e))throw Error("Rules must be an object");this.rules={},Object.keys(e).forEach(function(n){var r=e[n];t.rules[n]=Array.isArray(r)?r:[r]})},t.messages=function(e){return e&&(this._messages=z(X(),e)),this._messages},t.validate=function(t,n,r){var o=this;void 0===n&&(n={}),void 0===r&&(r=function(){});var a=t,i=n,c=r;if("function"==typeof i&&(c=i,i={}),!this.rules||0===Object.keys(this.rules).length)return c&&c(null,a),Promise.resolve(a);if(i.messages){var l=this.messages();l===U&&(l=X()),z(l,i.messages),i.messages=l}else i.messages=this.messages();var s={};(i.keys||Object.keys(this.rules)).forEach(function(e){var n=o.rules[e],r=a[e];n.forEach(function(n){var i=n;"function"==typeof i.transform&&(a===t&&(a=O({},a)),r=a[e]=i.transform(r)),(i="function"==typeof i?{validator:i}:O({},i)).validator=o.getValidationMethod(i),i.validator&&(i.field=e,i.fullField=i.fullField||e,i.type=o.getType(i),s[e]=s[e]||[],s[e].push({rule:i,value:r,source:a,field:e}))})});var u={};return function(e,t,n,r,o){if(t.first){var a=new Promise(function(t,a){var i;T((i=[],Object.keys(e).forEach(function(t){i.push.apply(i,e[t]||[])}),i),n,function(e){return r(e),e.length?a(new A(e,N(e))):t(o)})});return a.catch(function(e){return e}),a}var i=!0===t.firstFields?Object.keys(e):t.firstFields||[],c=Object.keys(e),l=c.length,s=0,u=[],d=new Promise(function(t,a){var d=function(e){if(u.push.apply(u,e),++s===l)return r(u),u.length?a(new A(u,N(u))):t(o)};c.length||(r(u),t(o)),c.forEach(function(t){var r=e[t];-1!==i.indexOf(t)?T(r,n,d):function(e,t,n){var r=[],o=0,a=e.length;function i(e){r.push.apply(r,e||[]),++o===a&&n(r)}e.forEach(function(e){t(e,i)})}(r,n,d)})});return d.catch(function(e){return e}),d}(s,i,function(t,n){var r,o=t.rule,c=("object"===o.type||"array"===o.type)&&("object"==typeof o.fields||"object"==typeof o.defaultField);function l(e,t){return O({},t,{fullField:o.fullField+"."+e,fullFields:o.fullFields?[].concat(o.fullFields,[e]):[e]})}function s(r){void 0===r&&(r=[]);var s=Array.isArray(r)?r:[r];!i.suppressWarning&&s.length&&e.warning("async-validator:",s),s.length&&void 0!==o.message&&(s=[].concat(o.message));var d=s.map(L(o,a));if(i.first&&d.length)return u[o.field]=1,n(d);if(c){if(o.required&&!t.value)return void 0!==o.message?d=[].concat(o.message).map(L(o,a)):i.error&&(d=[i.error(o,P(i.messages.required,o.field))]),n(d);var f={};o.defaultField&&Object.keys(t.value).map(function(e){f[e]=o.defaultField});var p={};Object.keys(f=O({},f,t.rule.fields)).forEach(function(e){var t=f[e],n=Array.isArray(t)?t:[t];p[e]=n.map(l.bind(null,e))});var m=new e(p);m.messages(i.messages),t.rule.options&&(t.rule.options.messages=i.messages,t.rule.options.error=i.error),m.validate(t.value,t.rule.options||i,function(e){var t=[];d&&d.length&&t.push.apply(t,d),e&&e.length&&t.push.apply(t,e),n(t.length?t:null)})}else n(d)}if(c=c&&(o.required||!o.required&&t.value),o.field=t.field,o.asyncValidator)r=o.asyncValidator(o,t.value,s,t.source,i);else if(o.validator){try{r=o.validator(o,t.value,s,t.source,i)}catch(e){null==console.error||console.error(e),i.suppressValidatorError||setTimeout(function(){throw e},0),s(e.message)}!0===r?s():!1===r?s("function"==typeof o.message?o.message(o.fullField||o.field):o.message||(o.fullField||o.field)+" fails"):r instanceof Array?s(r):r instanceof Error&&s(r.message)}r&&r.then&&r.then(function(){return s()},function(e){return s(e)})},function(e){!function(e){for(var t=[],n={},r=0;r2&&void 0!==arguments[2]&&arguments[2];return e&&e.some(function(e){return es(t,e,n)})}function es(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!!e&&!!t&&(!!n||e.length===t.length)&&t.every(function(t,n){return e[n]===t})}function eu(e){var t=arguments.length<=1?void 0:arguments[1];return t&&t.target&&"object"===(0,eo.Z)(t.target)&&e in t.target?t.target[e]:t}function ed(e,t,n){var r=e.length;if(t<0||t>=r||n<0||n>=r)return e;var o=e[t],a=t-n;return a>0?[].concat((0,u.Z)(e.slice(0,n)),[o],(0,u.Z)(e.slice(n,t)),(0,u.Z)(e.slice(t+1,r))):a<0?[].concat((0,u.Z)(e.slice(0,t)),(0,u.Z)(e.slice(t+1,n+1)),[o],(0,u.Z)(e.slice(n+1,r))):e}var ef=["name"],ep=[];function em(e,t,n,r,o,a){return"function"==typeof e?e(t,n,"source"in a?{source:a.source}:{}):r!==o}var eg=function(e){(0,m.Z)(n,e);var t=(0,g.Z)(n);function n(e){var r;return(0,d.Z)(this,n),r=t.call(this,e),(0,h.Z)((0,p.Z)(r),"state",{resetCount:0}),(0,h.Z)((0,p.Z)(r),"cancelRegisterFunc",null),(0,h.Z)((0,p.Z)(r),"mounted",!1),(0,h.Z)((0,p.Z)(r),"touched",!1),(0,h.Z)((0,p.Z)(r),"dirty",!1),(0,h.Z)((0,p.Z)(r),"validatePromise",void 0),(0,h.Z)((0,p.Z)(r),"prevValidating",void 0),(0,h.Z)((0,p.Z)(r),"errors",ep),(0,h.Z)((0,p.Z)(r),"warnings",ep),(0,h.Z)((0,p.Z)(r),"cancelRegister",function(){var e=r.props,t=e.preserve,n=e.isListField,o=e.name;r.cancelRegisterFunc&&r.cancelRegisterFunc(n,t,ei(o)),r.cancelRegisterFunc=null}),(0,h.Z)((0,p.Z)(r),"getNamePath",function(){var e=r.props,t=e.name,n=e.fieldContext.prefixName;return void 0!==t?[].concat((0,u.Z)(void 0===n?[]:n),(0,u.Z)(t)):[]}),(0,h.Z)((0,p.Z)(r),"getRules",function(){var e=r.props,t=e.rules,n=e.fieldContext;return(void 0===t?[]:t).map(function(e){return"function"==typeof e?e(n):e})}),(0,h.Z)((0,p.Z)(r),"refresh",function(){r.mounted&&r.setState(function(e){return{resetCount:e.resetCount+1}})}),(0,h.Z)((0,p.Z)(r),"metaCache",null),(0,h.Z)((0,p.Z)(r),"triggerMetaEvent",function(e){var t=r.props.onMetaChange;if(t){var n=(0,s.Z)((0,s.Z)({},r.getMeta()),{},{destroy:e});(0,b.Z)(r.metaCache,n)||t(n),r.metaCache=n}else r.metaCache=null}),(0,h.Z)((0,p.Z)(r),"onStoreChange",function(e,t,n){var o=r.props,a=o.shouldUpdate,i=o.dependencies,c=void 0===i?[]:i,l=o.onReset,s=n.store,u=r.getNamePath(),d=r.getValue(e),f=r.getValue(s),p=t&&el(t,u);switch("valueUpdate"===n.type&&"external"===n.source&&d!==f&&(r.touched=!0,r.dirty=!0,r.validatePromise=null,r.errors=ep,r.warnings=ep,r.triggerMetaEvent()),n.type){case"reset":if(!t||p){r.touched=!1,r.dirty=!1,r.validatePromise=void 0,r.errors=ep,r.warnings=ep,r.triggerMetaEvent(),null==l||l(),r.refresh();return}break;case"remove":if(a){r.reRender();return}break;case"setField":var m=n.data;if(p){"touched"in m&&(r.touched=m.touched),"validating"in m&&!("originRCField"in m)&&(r.validatePromise=m.validating?Promise.resolve([]):null),"errors"in m&&(r.errors=m.errors||ep),"warnings"in m&&(r.warnings=m.warnings||ep),r.dirty=!0,r.triggerMetaEvent(),r.reRender();return}if("value"in m&&el(t,u,!0)||a&&!u.length&&em(a,e,s,d,f,n)){r.reRender();return}break;case"dependenciesUpdate":if(c.map(ei).some(function(e){return el(n.relatedFields,e)})){r.reRender();return}break;default:if(p||(!c.length||u.length||a)&&em(a,e,s,d,f,n)){r.reRender();return}}!0===a&&r.reRender()}),(0,h.Z)((0,p.Z)(r),"validateRules",function(e){var t=r.getNamePath(),n=r.getValue(),o=e||{},a=o.triggerName,i=o.validateOnly,d=Promise.resolve().then((0,l.Z)((0,c.Z)().mark(function o(){var i,f,p,m,g,h,v;return(0,c.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(r.mounted){o.next=2;break}return o.abrupt("return",[]);case 2:if(p=void 0!==(f=(i=r.props).validateFirst)&&f,m=i.messageVariables,g=i.validateDebounce,h=r.getRules(),a&&(h=h.filter(function(e){return e}).filter(function(e){var t=e.validateTrigger;return!t||C(t).includes(a)})),!(g&&a)){o.next=10;break}return o.next=8,new Promise(function(e){setTimeout(e,g)});case 8:if(!(r.validatePromise!==d)){o.next=10;break}return o.abrupt("return",[]);case 10:return(v=function(e,t,n,r,o,a){var i,u,d=e.join("."),f=n.map(function(e,t){var n=e.validator,r=(0,s.Z)((0,s.Z)({},e),{},{ruleIndex:t});return n&&(r.validator=function(e,t,r){var o=!1,a=n(e,t,function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:ep;if(r.validatePromise===d){r.validatePromise=null;var t,n=[],o=[];null===(t=e.forEach)||void 0===t||t.call(e,function(e){var t=e.rule.warningOnly,r=e.errors,a=void 0===r?ep:r;t?o.push.apply(o,(0,u.Z)(a)):n.push.apply(n,(0,u.Z)(a))}),r.errors=n,r.warnings=o,r.triggerMetaEvent(),r.reRender()}}),o.abrupt("return",v);case 13:case"end":return o.stop()}},o)})));return void 0!==i&&i||(r.validatePromise=d,r.dirty=!0,r.errors=ep,r.warnings=ep,r.triggerMetaEvent(),r.reRender()),d}),(0,h.Z)((0,p.Z)(r),"isFieldValidating",function(){return!!r.validatePromise}),(0,h.Z)((0,p.Z)(r),"isFieldTouched",function(){return r.touched}),(0,h.Z)((0,p.Z)(r),"isFieldDirty",function(){return!!r.dirty||void 0!==r.props.initialValue||void 0!==(0,r.props.fieldContext.getInternalHooks(w).getInitialValue)(r.getNamePath())}),(0,h.Z)((0,p.Z)(r),"getErrors",function(){return r.errors}),(0,h.Z)((0,p.Z)(r),"getWarnings",function(){return r.warnings}),(0,h.Z)((0,p.Z)(r),"isListField",function(){return r.props.isListField}),(0,h.Z)((0,p.Z)(r),"isList",function(){return r.props.isList}),(0,h.Z)((0,p.Z)(r),"isPreserve",function(){return r.props.preserve}),(0,h.Z)((0,p.Z)(r),"getMeta",function(){return r.prevValidating=r.isFieldValidating(),{touched:r.isFieldTouched(),validating:r.prevValidating,errors:r.errors,warnings:r.warnings,name:r.getNamePath(),validated:null===r.validatePromise}}),(0,h.Z)((0,p.Z)(r),"getOnlyChild",function(e){if("function"==typeof e){var t=r.getMeta();return(0,s.Z)((0,s.Z)({},r.getOnlyChild(e(r.getControlled(),t,r.props.fieldContext))),{},{isFunction:!0})}var n=(0,v.Z)(e);return 1===n.length&&o.isValidElement(n[0])?{child:n[0],isFunction:!1}:{child:n,isFunction:!1}}),(0,h.Z)((0,p.Z)(r),"getValue",function(e){var t=r.props.fieldContext.getFieldsValue,n=r.getNamePath();return(0,ea.Z)(e||t(!0),n)}),(0,h.Z)((0,p.Z)(r),"getControlled",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=r.props,n=t.trigger,o=t.validateTrigger,a=t.getValueFromEvent,i=t.normalize,c=t.valuePropName,l=t.getValueProps,u=t.fieldContext,d=void 0!==o?o:u.validateTrigger,f=r.getNamePath(),p=u.getInternalHooks,m=u.getFieldsValue,g=p(w).dispatch,v=r.getValue(),b=l||function(e){return(0,h.Z)({},c,e)},y=e[n],x=(0,s.Z)((0,s.Z)({},e),b(v));return x[n]=function(){r.touched=!0,r.dirty=!0,r.triggerMetaEvent();for(var e,t=arguments.length,n=Array(t),o=0;o=0&&t<=n.length?(f.keys=[].concat((0,u.Z)(f.keys.slice(0,t)),[f.id],(0,u.Z)(f.keys.slice(t))),o([].concat((0,u.Z)(n.slice(0,t)),[e],(0,u.Z)(n.slice(t))))):(f.keys=[].concat((0,u.Z)(f.keys),[f.id]),o([].concat((0,u.Z)(n),[e]))),f.id+=1},remove:function(e){var t=i(),n=new Set(Array.isArray(e)?e:[e]);n.size<=0||(f.keys=f.keys.filter(function(e,t){return!n.has(t)}),o(t.filter(function(e,t){return!n.has(t)})))},move:function(e,t){if(e!==t){var n=i();e<0||e>=n.length||t<0||t>=n.length||(f.keys=ed(f.keys,e,t),o(ed(n,e,t)))}}},t)})))},eb=n(26365),ey="__@field_split__";function ew(e){return e.map(function(e){return"".concat((0,eo.Z)(e),":").concat(e)}).join(ey)}var ex=function(){function e(){(0,d.Z)(this,e),(0,h.Z)(this,"kvs",new Map)}return(0,f.Z)(e,[{key:"set",value:function(e,t){this.kvs.set(ew(e),t)}},{key:"get",value:function(e){return this.kvs.get(ew(e))}},{key:"update",value:function(e,t){var n=t(this.get(e));n?this.set(e,n):this.delete(e)}},{key:"delete",value:function(e){this.kvs.delete(ew(e))}},{key:"map",value:function(e){return(0,u.Z)(this.kvs.entries()).map(function(t){var n=(0,eb.Z)(t,2),r=n[0],o=n[1];return e({key:r.split(ey).map(function(e){var t=e.match(/^([^:]*):(.*)$/),n=(0,eb.Z)(t,3),r=n[1],o=n[2];return"number"===r?Number(o):o}),value:o})})}},{key:"toJSON",value:function(){var e={};return this.map(function(t){var n=t.key,r=t.value;return e[n.join(".")]=r,null}),e}}]),e}(),eE=["name"],eS=(0,f.Z)(function e(t){var n=this;(0,d.Z)(this,e),(0,h.Z)(this,"formHooked",!1),(0,h.Z)(this,"forceRootUpdate",void 0),(0,h.Z)(this,"subscribable",!0),(0,h.Z)(this,"store",{}),(0,h.Z)(this,"fieldEntities",[]),(0,h.Z)(this,"initialValues",{}),(0,h.Z)(this,"callbacks",{}),(0,h.Z)(this,"validateMessages",null),(0,h.Z)(this,"preserve",null),(0,h.Z)(this,"lastValidatePromise",null),(0,h.Z)(this,"getForm",function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}}),(0,h.Z)(this,"getInternalHooks",function(e){return e===w?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):((0,y.ZP)(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),(0,h.Z)(this,"useSubscribe",function(e){n.subscribable=e}),(0,h.Z)(this,"prevWithoutPreserves",null),(0,h.Z)(this,"setInitialValues",function(e,t){if(n.initialValues=e||{},t){var r,o=(0,Q.T)(e,n.store);null===(r=n.prevWithoutPreserves)||void 0===r||r.map(function(t){var n=t.key;o=(0,Q.Z)(o,n,(0,ea.Z)(e,n))}),n.prevWithoutPreserves=null,n.updateStore(o)}}),(0,h.Z)(this,"destroyForm",function(){var e=new ex;n.getFieldEntities(!0).forEach(function(t){n.isMergedPreserve(t.isPreserve())||e.set(t.getNamePath(),!0)}),n.prevWithoutPreserves=e}),(0,h.Z)(this,"getInitialValue",function(e){var t=(0,ea.Z)(n.initialValues,e);return e.length?(0,Q.T)(t):t}),(0,h.Z)(this,"setCallbacks",function(e){n.callbacks=e}),(0,h.Z)(this,"setValidateMessages",function(e){n.validateMessages=e}),(0,h.Z)(this,"setPreserve",function(e){n.preserve=e}),(0,h.Z)(this,"watchList",[]),(0,h.Z)(this,"registerWatch",function(e){return n.watchList.push(e),function(){n.watchList=n.watchList.filter(function(t){return t!==e})}}),(0,h.Z)(this,"notifyWatch",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(n.watchList.length){var t=n.getFieldsValue(),r=n.getFieldsValue(!0);n.watchList.forEach(function(n){n(t,r,e)})}}),(0,h.Z)(this,"timeoutId",null),(0,h.Z)(this,"warningUnhooked",function(){}),(0,h.Z)(this,"updateStore",function(e){n.store=e}),(0,h.Z)(this,"getFieldEntities",function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?n.fieldEntities.filter(function(e){return e.getNamePath().length}):n.fieldEntities}),(0,h.Z)(this,"getFieldsMap",function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=new ex;return n.getFieldEntities(e).forEach(function(e){var n=e.getNamePath();t.set(n,e)}),t}),(0,h.Z)(this,"getFieldEntitiesForNamePathList",function(e){if(!e)return n.getFieldEntities(!0);var t=n.getFieldsMap(!0);return e.map(function(e){var n=ei(e);return t.get(n)||{INVALIDATE_NAME_PATH:ei(e)}})}),(0,h.Z)(this,"getFieldsValue",function(e,t){if(n.warningUnhooked(),!0===e||Array.isArray(e)?(r=e,o=t):e&&"object"===(0,eo.Z)(e)&&(a=e.strict,o=e.filter),!0===r&&!o)return n.store;var r,o,a,i=n.getFieldEntitiesForNamePathList(Array.isArray(r)?r:null),c=[];return i.forEach(function(e){var t,n,i,l="INVALIDATE_NAME_PATH"in e?e.INVALIDATE_NAME_PATH:e.getNamePath();if(a){if(null!==(i=e.isList)&&void 0!==i&&i.call(e))return}else if(!r&&null!==(t=(n=e).isListField)&&void 0!==t&&t.call(n))return;if(o){var s="getMeta"in e?e.getMeta():null;o(s)&&c.push(l)}else c.push(l)}),ec(n.store,c.map(ei))}),(0,h.Z)(this,"getFieldValue",function(e){n.warningUnhooked();var t=ei(e);return(0,ea.Z)(n.store,t)}),(0,h.Z)(this,"getFieldsError",function(e){return n.warningUnhooked(),n.getFieldEntitiesForNamePathList(e).map(function(t,n){return!t||"INVALIDATE_NAME_PATH"in t?{name:ei(e[n]),errors:[],warnings:[]}:{name:t.getNamePath(),errors:t.getErrors(),warnings:t.getWarnings()}})}),(0,h.Z)(this,"getFieldError",function(e){n.warningUnhooked();var t=ei(e);return n.getFieldsError([t])[0].errors}),(0,h.Z)(this,"getFieldWarning",function(e){n.warningUnhooked();var t=ei(e);return n.getFieldsError([t])[0].warnings}),(0,h.Z)(this,"isFieldsTouched",function(){n.warningUnhooked();for(var e,t=arguments.length,r=Array(t),o=0;o0&&void 0!==arguments[0]?arguments[0]:{},r=new ex,o=n.getFieldEntities(!0);o.forEach(function(e){var t=e.props.initialValue,n=e.getNamePath();if(void 0!==t){var o=r.get(n)||new Set;o.add({entity:e,value:t}),r.set(n,o)}}),t.entities?e=t.entities:t.namePathList?(e=[],t.namePathList.forEach(function(t){var n,o=r.get(t);o&&(n=e).push.apply(n,(0,u.Z)((0,u.Z)(o).map(function(e){return e.entity})))})):e=o,function(e){e.forEach(function(e){if(void 0!==e.props.initialValue){var o=e.getNamePath();if(void 0!==n.getInitialValue(o))(0,y.ZP)(!1,"Form already set 'initialValues' with path '".concat(o.join("."),"'. Field can not overwrite it."));else{var a=r.get(o);if(a&&a.size>1)(0,y.ZP)(!1,"Multiple Field with path '".concat(o.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(a){var i=n.getFieldValue(o);e.isListField()||t.skipExist&&void 0!==i||n.updateStore((0,Q.Z)(n.store,o,(0,u.Z)(a)[0].value))}}}})}(e)}),(0,h.Z)(this,"resetFields",function(e){n.warningUnhooked();var t=n.store;if(!e){n.updateStore((0,Q.T)(n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(t,null,{type:"reset"}),n.notifyWatch();return}var r=e.map(ei);r.forEach(function(e){var t=n.getInitialValue(e);n.updateStore((0,Q.Z)(n.store,e,t))}),n.resetWithFieldInitialValue({namePathList:r}),n.notifyObservers(t,r,{type:"reset"}),n.notifyWatch(r)}),(0,h.Z)(this,"setFields",function(e){n.warningUnhooked();var t=n.store,r=[];e.forEach(function(e){var o=e.name,a=(0,i.Z)(e,eE),c=ei(o);r.push(c),"value"in a&&n.updateStore((0,Q.Z)(n.store,c,a.value)),n.notifyObservers(t,[c],{type:"setField",data:e})}),n.notifyWatch(r)}),(0,h.Z)(this,"getFields",function(){return n.getFieldEntities(!0).map(function(e){var t=e.getNamePath(),r=e.getMeta(),o=(0,s.Z)((0,s.Z)({},r),{},{name:t,value:n.getFieldValue(t)});return Object.defineProperty(o,"originRCField",{value:!0}),o})}),(0,h.Z)(this,"initEntityValue",function(e){var t=e.props.initialValue;if(void 0!==t){var r=e.getNamePath();void 0===(0,ea.Z)(n.store,r)&&n.updateStore((0,Q.Z)(n.store,r,t))}}),(0,h.Z)(this,"isMergedPreserve",function(e){var t=void 0!==e?e:n.preserve;return null==t||t}),(0,h.Z)(this,"registerField",function(e){n.fieldEntities.push(e);var t=e.getNamePath();if(n.notifyWatch([t]),void 0!==e.props.initialValue){var r=n.store;n.resetWithFieldInitialValue({entities:[e],skipExist:!0}),n.notifyObservers(r,[e.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(r,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter(function(t){return t!==e}),!n.isMergedPreserve(o)&&(!r||a.length>1)){var i=r?void 0:n.getInitialValue(t);if(t.length&&n.getFieldValue(t)!==i&&n.fieldEntities.every(function(e){return!es(e.getNamePath(),t)})){var c=n.store;n.updateStore((0,Q.Z)(c,t,i,!0)),n.notifyObservers(c,[t],{type:"remove"}),n.triggerDependenciesUpdate(c,t)}}n.notifyWatch([t])}}),(0,h.Z)(this,"dispatch",function(e){switch(e.type){case"updateValue":var t=e.namePath,r=e.value;n.updateValue(t,r);break;case"validateField":var o=e.namePath,a=e.triggerName;n.validateFields([o],{triggerName:a})}}),(0,h.Z)(this,"notifyObservers",function(e,t,r){if(n.subscribable){var o=(0,s.Z)((0,s.Z)({},r),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach(function(n){(0,n.onStoreChange)(e,t,o)})}else n.forceRootUpdate()}),(0,h.Z)(this,"triggerDependenciesUpdate",function(e,t){var r=n.getDependencyChildrenFields(t);return r.length&&n.validateFields(r),n.notifyObservers(e,r,{type:"dependenciesUpdate",relatedFields:[t].concat((0,u.Z)(r))}),r}),(0,h.Z)(this,"updateValue",function(e,t){var r=ei(e),o=n.store;n.updateStore((0,Q.Z)(n.store,r,t)),n.notifyObservers(o,[r],{type:"valueUpdate",source:"internal"}),n.notifyWatch([r]);var a=n.triggerDependenciesUpdate(o,r),i=n.callbacks.onValuesChange;i&&i(ec(n.store,[r]),n.getFieldsValue()),n.triggerOnFieldsChange([r].concat((0,u.Z)(a)))}),(0,h.Z)(this,"setFieldsValue",function(e){n.warningUnhooked();var t=n.store;if(e){var r=(0,Q.T)(n.store,e);n.updateStore(r)}n.notifyObservers(t,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()}),(0,h.Z)(this,"setFieldValue",function(e,t){n.setFields([{name:e,value:t}])}),(0,h.Z)(this,"getDependencyChildrenFields",function(e){var t=new Set,r=[],o=new ex;return n.getFieldEntities().forEach(function(e){(e.props.dependencies||[]).forEach(function(t){var n=ei(t);o.update(n,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;return t.add(e),t})})}),function e(n){(o.get(n)||new Set).forEach(function(n){if(!t.has(n)){t.add(n);var o=n.getNamePath();n.isFieldDirty()&&o.length&&(r.push(o),e(o))}})}(e),r}),(0,h.Z)(this,"triggerOnFieldsChange",function(e,t){var r=n.callbacks.onFieldsChange;if(r){var o=n.getFields();if(t){var a=new ex;t.forEach(function(e){var t=e.name,n=e.errors;a.set(t,n)}),o.forEach(function(e){e.errors=a.get(e.name)||e.errors})}var i=o.filter(function(t){return el(e,t.name)});i.length&&r(i,o)}}),(0,h.Z)(this,"validateFields",function(e,t){n.warningUnhooked(),Array.isArray(e)||"string"==typeof e||"string"==typeof t?(i=e,c=t):c=e;var r,o,a,i,c,l=!!i,d=l?i.map(ei):[],f=[],p=String(Date.now()),m=new Set,g=c||{},h=g.recursive,v=g.dirty;n.getFieldEntities(!0).forEach(function(e){if(l||d.push(e.getNamePath()),e.props.rules&&e.props.rules.length&&(!v||e.isFieldDirty())){var t=e.getNamePath();if(m.add(t.join(p)),!l||el(d,t,h)){var r=e.validateRules((0,s.Z)({validateMessages:(0,s.Z)((0,s.Z)({},Y),n.validateMessages)},c));f.push(r.then(function(){return{name:t,errors:[],warnings:[]}}).catch(function(e){var n,r=[],o=[];return(null===(n=e.forEach)||void 0===n||n.call(e,function(e){var t=e.rule.warningOnly,n=e.errors;t?o.push.apply(o,(0,u.Z)(n)):r.push.apply(r,(0,u.Z)(n))}),r.length)?Promise.reject({name:t,errors:r,warnings:o}):{name:t,errors:r,warnings:o}}))}}});var b=(r=!1,o=f.length,a=[],f.length?new Promise(function(e,t){f.forEach(function(n,i){n.catch(function(e){return r=!0,e}).then(function(n){o-=1,a[i]=n,o>0||(r&&t(a),e(a))})})}):Promise.resolve([]));n.lastValidatePromise=b,b.catch(function(e){return e}).then(function(e){var t=e.map(function(e){return e.name});n.notifyObservers(n.store,t,{type:"validateFinish"}),n.triggerOnFieldsChange(t,e)});var y=b.then(function(){return n.lastValidatePromise===b?Promise.resolve(n.getFieldsValue(d)):Promise.reject([])}).catch(function(e){var t=e.filter(function(e){return e&&e.errors.length});return Promise.reject({values:n.getFieldsValue(d),errorFields:t,outOfDate:n.lastValidatePromise!==b})});y.catch(function(e){return e});var w=d.filter(function(e){return m.has(e.join(p))});return n.triggerOnFieldsChange(w),y}),(0,h.Z)(this,"submit",function(){n.warningUnhooked(),n.validateFields().then(function(e){var t=n.callbacks.onFinish;if(t)try{t(e)}catch(e){console.error(e)}}).catch(function(e){var t=n.callbacks.onFinishFailed;t&&t(e)})}),this.forceRootUpdate=t}),eC=function(e){var t=o.useRef(),n=o.useState({}),r=(0,eb.Z)(n,2)[1];if(!t.current){if(e)t.current=e;else{var a=new eS(function(){r({})});t.current=a.getForm()}}return[t.current]},eZ=o.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),eO=function(e){var t=e.validateMessages,n=e.onFormChange,r=e.onFormFinish,a=e.children,i=o.useContext(eZ),c=o.useRef({});return o.createElement(eZ.Provider,{value:(0,s.Z)((0,s.Z)({},i),{},{validateMessages:(0,s.Z)((0,s.Z)({},i.validateMessages),t),triggerFormChange:function(e,t){n&&n(e,{changedFields:t,forms:c.current}),i.triggerFormChange(e,t)},triggerFormFinish:function(e,t){r&&r(e,{values:t,forms:c.current}),i.triggerFormFinish(e,t)},registerForm:function(e,t){e&&(c.current=(0,s.Z)((0,s.Z)({},c.current),{},(0,h.Z)({},e,t))),i.registerForm(e,t)},unregisterForm:function(e){var t=(0,s.Z)({},c.current);delete t[e],c.current=t,i.unregisterForm(e)}})},a)},ek=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed"];function eM(e){try{return JSON.stringify(e)}catch(e){return Math.random()}}var ej=function(){},eI=function(){for(var e=arguments.length,t=Array(e),n=0;n1?t-1:0),o=1;oen;(0,s.useImperativeHandle)(t,function(){return{focus:q,blur:function(){var e;null===(e=V.current)||void 0===e||e.blur()},setSelectionRange:function(e,t,n){var r;null===(r=V.current)||void 0===r||r.setSelectionRange(e,t,n)},select:function(){var e;null===(e=V.current)||void 0===e||e.select()},input:V.current}}),(0,s.useEffect)(function(){D(function(e){return(!e||!Z)&&e})},[Z]);var ea=function(e,t,n){var r,o,a=t;if(!W.current&&et.exceedFormatter&&et.max&&et.strategy(t)>et.max)a=et.exceedFormatter(t,{max:et.max}),t!==a&&ee([(null===(r=V.current)||void 0===r?void 0:r.selectionStart)||0,(null===(o=V.current)||void 0===o?void 0:o.selectionEnd)||0]);else if("compositionEnd"===n.source)return;$(a),V.current&&(0,u.rJ)(V.current,e,c,a)};(0,s.useEffect)(function(){if(J){var e;null===(e=V.current)||void 0===e||e.setSelectionRange.apply(e,(0,f.Z)(J))}},[J]);var ei=eo&&"".concat(C,"-out-of-range");return s.createElement(d,(0,o.Z)({},z,{prefixCls:C,className:l()(k,ei),handleReset:function(e){$(""),q(),V.current&&(0,u.rJ)(V.current,e,c)},value:K,focused:B,triggerFocus:q,suffix:function(){var e=Number(en)>0;if(j||et.show){var t=et.showFormatter?et.showFormatter({value:K,count:er,maxLength:en}):"".concat(er).concat(e?" / ".concat(en):"");return s.createElement(s.Fragment,null,et.show&&s.createElement("span",{className:l()("".concat(C,"-show-count-suffix"),(0,a.Z)({},"".concat(C,"-show-count-has-suffix"),!!j),null==F?void 0:F.count),style:(0,r.Z)({},null==T?void 0:T.count)},t),j)}return null}(),disabled:Z,classes:P,classNames:F,styles:T}),(n=(0,h.Z)(e,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames"]),s.createElement("input",(0,o.Z)({autoComplete:i},n,{onChange:function(e){ea(e,e.target.value,{source:"change"})},onFocus:function(e){D(!0),null==y||y(e)},onBlur:function(e){D(!1),null==w||w(e)},onKeyDown:function(e){x&&"Enter"===e.key&&x(e),null==E||E(e)},className:l()(C,(0,a.Z)({},"".concat(C,"-disabled"),Z),null==F?void 0:F.input),style:null==T?void 0:T.input,ref:V,size:O,type:void 0===N?"text":N,onCompositionStart:function(e){W.current=!0,null==A||A(e)},onCompositionEnd:function(e){W.current=!1,ea(e,e.currentTarget.value,{source:"compositionEnd"}),null==L||L(e)}}))))})},55041:function(e,t,n){"use strict";function r(e){return!!(e.addonBefore||e.addonAfter)}function o(e){return!!(e.prefix||e.suffix||e.allowClear)}function a(e,t,n,r){if(n){var o=t;if("click"===t.type){var a=e.cloneNode(!0);o=Object.create(t,{target:{value:a},currentTarget:{value:a}}),a.value="",n(o);return}if("file"!==e.type&&void 0!==r){var i=e.cloneNode(!0);o=Object.create(t,{target:{value:i},currentTarget:{value:i}}),i.value=r,n(o);return}n(o)}}function i(e,t){if(e){e.focus(t);var n=(t||{}).cursor;if(n){var r=e.value.length;switch(n){case"start":e.setSelectionRange(0,0);break;case"end":e.setSelectionRange(r,r);break;default:e.setSelectionRange(0,r)}}}}n.d(t,{He:function(){return r},X3:function(){return o},nH:function(){return i},rJ:function(){return a}})},47970:function(e,t,n){"use strict";n.d(t,{V4:function(){return ep},zt:function(){return w},ZP:function(){return em}});var r,o,a,i,c,l=n(11993),s=n(31686),u=n(26365),d=n(41154),f=n(36760),p=n.n(f),m=n(2868),g=n(28791),h=n(2265),v=n(6989),b=["children"],y=h.createContext({});function w(e){var t=e.children,n=(0,v.Z)(e,b);return h.createElement(y.Provider,{value:n},t)}var x=n(76405),E=n(25049),S=n(15354),C=n(15900),Z=function(e){(0,S.Z)(n,e);var t=(0,C.Z)(n);function n(){return(0,x.Z)(this,n),t.apply(this,arguments)}return(0,E.Z)(n,[{key:"render",value:function(){return this.props.children}}]),n}(h.Component),O=n(69819),k="none",M="appear",j="enter",I="leave",R="none",N="prepare",P="start",F="active",T="prepared",A=n(94981);function L(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}var z=(r=(0,A.Z)(),o="undefined"!=typeof window?window:{},a={animationend:L("Animation","AnimationEnd"),transitionend:L("Transition","TransitionEnd")},!r||("AnimationEvent"in o||delete a.animationend.animation,"TransitionEvent"in o||delete a.transitionend.transition),a),_={};(0,A.Z)()&&(_=document.createElement("div").style);var H={};function B(e){if(H[e])return H[e];var t=z[e];if(t)for(var n=Object.keys(t),r=n.length,o=0;o1&&void 0!==arguments[1]?arguments[1]:2;t();var a=(0,K.Z)(function(){o<=1?r({isCanceled:function(){return a!==e.current}}):n(r,o-1)});e.current=a},t]},Q=[N,P,F,"end"],J=[N,T];function ee(e){return e===F||"end"===e}var et=function(e,t,n){var r=(0,O.Z)(R),o=(0,u.Z)(r,2),a=o[0],i=o[1],c=Y(),l=(0,u.Z)(c,2),s=l[0],d=l[1],f=t?J:Q;return $(function(){if(a!==R&&"end"!==a){var e=f.indexOf(a),t=f[e+1],r=n(a);!1===r?i(t,!0):t&&s(function(e){function n(){e.isCanceled()||i(t,!0)}!0===r?n():Promise.resolve(r).then(n)})}},[e,a]),h.useEffect(function(){return function(){d()}},[]),[function(){i(N,!0)},a]},en=(i=V,"object"===(0,d.Z)(V)&&(i=V.transitionSupport),(c=h.forwardRef(function(e,t){var n=e.visible,r=void 0===n||n,o=e.removeOnLeave,a=void 0===o||o,c=e.forceRender,d=e.children,f=e.motionName,v=e.leavedClassName,b=e.eventProps,w=h.useContext(y).motion,x=!!(e.motionName&&i&&!1!==w),E=(0,h.useRef)(),S=(0,h.useRef)(),C=function(e,t,n,r){var o=r.motionEnter,a=void 0===o||o,i=r.motionAppear,c=void 0===i||i,d=r.motionLeave,f=void 0===d||d,p=r.motionDeadline,m=r.motionLeaveImmediately,g=r.onAppearPrepare,v=r.onEnterPrepare,b=r.onLeavePrepare,y=r.onAppearStart,w=r.onEnterStart,x=r.onLeaveStart,E=r.onAppearActive,S=r.onEnterActive,C=r.onLeaveActive,Z=r.onAppearEnd,R=r.onEnterEnd,A=r.onLeaveEnd,L=r.onVisibleChanged,z=(0,O.Z)(),_=(0,u.Z)(z,2),H=_[0],B=_[1],D=(0,O.Z)(k),W=(0,u.Z)(D,2),V=W[0],q=W[1],G=(0,O.Z)(null),X=(0,u.Z)(G,2),K=X[0],Y=X[1],Q=(0,h.useRef)(!1),J=(0,h.useRef)(null),en=(0,h.useRef)(!1);function er(){q(k,!0),Y(null,!0)}function eo(e){var t,r=n();if(!e||e.deadline||e.target===r){var o=en.current;V===M&&o?t=null==Z?void 0:Z(r,e):V===j&&o?t=null==R?void 0:R(r,e):V===I&&o&&(t=null==A?void 0:A(r,e)),V!==k&&o&&!1!==t&&er()}}var ea=U(eo),ei=(0,u.Z)(ea,1)[0],ec=function(e){var t,n,r;switch(e){case M:return t={},(0,l.Z)(t,N,g),(0,l.Z)(t,P,y),(0,l.Z)(t,F,E),t;case j:return n={},(0,l.Z)(n,N,v),(0,l.Z)(n,P,w),(0,l.Z)(n,F,S),n;case I:return r={},(0,l.Z)(r,N,b),(0,l.Z)(r,P,x),(0,l.Z)(r,F,C),r;default:return{}}},el=h.useMemo(function(){return ec(V)},[V]),es=et(V,!e,function(e){if(e===N){var t,r=el[N];return!!r&&r(n())}return ef in el&&Y((null===(t=el[ef])||void 0===t?void 0:t.call(el,n(),null))||null),ef===F&&(ei(n()),p>0&&(clearTimeout(J.current),J.current=setTimeout(function(){eo({deadline:!0})},p))),ef===T&&er(),!0}),eu=(0,u.Z)(es,2),ed=eu[0],ef=eu[1],ep=ee(ef);en.current=ep,$(function(){B(t);var n,r=Q.current;Q.current=!0,!r&&t&&c&&(n=M),r&&t&&a&&(n=j),(r&&!t&&f||!r&&m&&!t&&f)&&(n=I);var o=ec(n);n&&(e||o[N])?(q(n),ed()):q(k)},[t]),(0,h.useEffect)(function(){(V!==M||c)&&(V!==j||a)&&(V!==I||f)||q(k)},[c,a,f]),(0,h.useEffect)(function(){return function(){Q.current=!1,clearTimeout(J.current)}},[]);var em=h.useRef(!1);(0,h.useEffect)(function(){H&&(em.current=!0),void 0!==H&&V===k&&((em.current||H)&&(null==L||L(H)),em.current=!0)},[H,V]);var eg=K;return el[N]&&ef===P&&(eg=(0,s.Z)({transition:"none"},eg)),[V,ef,eg,null!=H?H:t]}(x,r,function(){try{return E.current instanceof HTMLElement?E.current:(0,m.Z)(S.current)}catch(e){return null}},e),R=(0,u.Z)(C,4),A=R[0],L=R[1],z=R[2],_=R[3],H=h.useRef(_);_&&(H.current=!0);var B=h.useCallback(function(e){E.current=e,(0,g.mH)(t,e)},[t]),D=(0,s.Z)((0,s.Z)({},b),{},{visible:r});if(d){if(A===k)W=_?d((0,s.Z)({},D),B):!a&&H.current&&v?d((0,s.Z)((0,s.Z)({},D),{},{className:v}),B):!c&&(a||v)?null:d((0,s.Z)((0,s.Z)({},D),{},{style:{display:"none"}}),B);else{L===N?q="prepare":ee(L)?q="active":L===P&&(q="start");var W,V,q,G=X(f,"".concat(A,"-").concat(q));W=d((0,s.Z)((0,s.Z)({},D),{},{className:p()(X(f,A),(V={},(0,l.Z)(V,G,G&&q),(0,l.Z)(V,f,"string"==typeof f),V)),style:z}),B)}}else W=null;return h.isValidElement(W)&&(0,g.Yr)(W)&&!W.ref&&(W=h.cloneElement(W,{ref:B})),h.createElement(Z,{ref:S},W)})).displayName="CSSMotion",c),er=n(1119),eo=n(63496),ea="keep",ei="remove",ec="removed";function el(e){var t;return t=e&&"object"===(0,d.Z)(e)&&"key"in e?e:{key:e},(0,s.Z)((0,s.Z)({},t),{},{key:String(t.key)})}function es(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(el)}var eu=["component","children","onVisibleChanged","onAllRemoved"],ed=["status"],ef=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"],ep=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:en,n=function(e){(0,S.Z)(r,e);var n=(0,C.Z)(r);function r(){var e;(0,x.Z)(this,r);for(var t=arguments.length,o=Array(t),a=0;a0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0,o=t.length,a=es(e),i=es(t);a.forEach(function(e){for(var t=!1,a=r;a1}).forEach(function(e){(n=n.filter(function(t){var n=t.key,r=t.status;return n!==e||r!==ei})).forEach(function(t){t.key===e&&(t.status=ea)})}),n})(r,es(n)).filter(function(e){var t=r.find(function(t){var n=t.key;return e.key===n});return!t||t.status!==ec||e.status!==ei})}}}]),r}(h.Component);return(0,l.Z)(n,"defaultProps",{component:"div"}),n}(V),em=en},49283:function(e,t,n){"use strict";n.d(t,{qX:function(){return g},JB:function(){return v},lm:function(){return O}});var r=n(83145),o=n(26365),a=n(6989),i=n(2265),c=n(31686),l=n(54887),s=n(1119),u=n(11993),d=n(36760),f=n.n(d),p=n(47970),m=n(95814),g=i.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,a=e.className,c=e.duration,l=void 0===c?4.5:c,d=e.eventKey,p=e.content,g=e.closable,h=e.closeIcon,v=e.props,b=e.onClick,y=e.onNoticeClose,w=e.times,x=e.hovering,E=i.useState(!1),S=(0,o.Z)(E,2),C=S[0],Z=S[1],O=x||C,k=function(){y(d)};i.useEffect(function(){if(!O&&l>0){var e=setTimeout(function(){k()},1e3*l);return function(){clearTimeout(e)}}},[l,O,w]);var M="".concat(n,"-notice");return i.createElement("div",(0,s.Z)({},v,{ref:t,className:f()(M,a,(0,u.Z)({},"".concat(M,"-closable"),g)),style:r,onMouseEnter:function(e){var t;Z(!0),null==v||null===(t=v.onMouseEnter)||void 0===t||t.call(v,e)},onMouseLeave:function(e){var t;Z(!1),null==v||null===(t=v.onMouseLeave)||void 0===t||t.call(v,e)},onClick:b}),i.createElement("div",{className:"".concat(M,"-content")},p),g&&i.createElement("a",{tabIndex:0,className:"".concat(M,"-close"),onKeyDown:function(e){("Enter"===e.key||"Enter"===e.code||e.keyCode===m.Z.ENTER)&&k()},onClick:function(e){e.preventDefault(),e.stopPropagation(),k()}},void 0===h?"x":h))}),h=i.createContext({}),v=function(e){var t=e.children,n=e.classNames;return i.createElement(h.Provider,{value:{classNames:n}},t)},b=n(41154),y=function(e){var t,n,r,o={offset:8,threshold:3,gap:16};return e&&"object"===(0,b.Z)(e)&&(o.offset=null!==(t=e.offset)&&void 0!==t?t:8,o.threshold=null!==(n=e.threshold)&&void 0!==n?n:3,o.gap=null!==(r=e.gap)&&void 0!==r?r:16),[!!e,o]},w=["className","style","classNames","styles"],x=function(e){var t,n=e.configList,l=e.placement,d=e.prefixCls,m=e.className,v=e.style,b=e.motion,x=e.onAllNoticeRemoved,E=e.onNoticeClose,S=e.stack,C=(0,i.useContext)(h).classNames,Z=(0,i.useRef)({}),O=(0,i.useState)(null),k=(0,o.Z)(O,2),M=k[0],j=k[1],I=(0,i.useState)([]),R=(0,o.Z)(I,2),N=R[0],P=R[1],F=n.map(function(e){return{config:e,key:String(e.key)}}),T=y(S),A=(0,o.Z)(T,2),L=A[0],z=A[1],_=z.offset,H=z.threshold,B=z.gap,D=L&&(N.length>0||F.length<=H),W="function"==typeof b?b(l):b;return(0,i.useEffect)(function(){L&&N.length>1&&P(function(e){return e.filter(function(e){return F.some(function(t){return e===t.key})})})},[N,F,L]),(0,i.useEffect)(function(){var e,t;L&&Z.current[null===(e=F[F.length-1])||void 0===e?void 0:e.key]&&j(Z.current[null===(t=F[F.length-1])||void 0===t?void 0:t.key])},[F,L]),i.createElement(p.V4,(0,s.Z)({key:l,className:f()(d,"".concat(d,"-").concat(l),null==C?void 0:C.list,m,(t={},(0,u.Z)(t,"".concat(d,"-stack"),!!L),(0,u.Z)(t,"".concat(d,"-stack-expanded"),D),t)),style:v,keys:F,motionAppear:!0},W,{onAllRemoved:function(){x(l)}}),function(e,t){var n=e.config,o=e.className,u=e.style,p=e.index,m=n.key,h=n.times,v=String(m),b=n.className,y=n.style,x=n.classNames,S=n.styles,O=(0,a.Z)(n,w),k=F.findIndex(function(e){return e.key===v}),j={};if(L){var I=F.length-1-(k>-1?k:p-1),R="top"===l||"bottom"===l?"-50%":"0";if(I>0){j.height=D?null===(T=Z.current[v])||void 0===T?void 0:T.offsetHeight:null==M?void 0:M.offsetHeight;for(var T,A,z,H,W=0,V=0;V-1?Z.current[v]=e:delete Z.current[v]},prefixCls:d,classNames:x,styles:S,className:f()(b,null==C?void 0:C.notice),style:y,times:h,key:m,eventKey:m,onNoticeClose:E,hovering:L&&N.length>0})))})},E=i.forwardRef(function(e,t){var n=e.prefixCls,a=void 0===n?"rc-notification":n,s=e.container,u=e.motion,d=e.maxCount,f=e.className,p=e.style,m=e.onAllRemoved,g=e.stack,h=e.renderNotifications,v=i.useState([]),b=(0,o.Z)(v,2),y=b[0],w=b[1],E=function(e){var t,n=y.find(function(t){return t.key===e});null==n||null===(t=n.onClose)||void 0===t||t.call(n),w(function(t){return t.filter(function(t){return t.key!==e})})};i.useImperativeHandle(t,function(){return{open:function(e){w(function(t){var n,o=(0,r.Z)(t),a=o.findIndex(function(t){return t.key===e.key}),i=(0,c.Z)({},e);return a>=0?(i.times=((null===(n=t[a])||void 0===n?void 0:n.times)||0)+1,o[a]=i):(i.times=0,o.push(i)),d>0&&o.length>d&&(o=o.slice(-d)),o})},close:function(e){E(e)},destroy:function(){w([])}}});var S=i.useState({}),C=(0,o.Z)(S,2),Z=C[0],O=C[1];i.useEffect(function(){var e={};y.forEach(function(t){var n=t.placement,r=void 0===n?"topRight":n;r&&(e[r]=e[r]||[],e[r].push(t))}),Object.keys(Z).forEach(function(t){e[t]=e[t]||[]}),O(e)},[y]);var k=function(e){O(function(t){var n=(0,c.Z)({},t);return(n[e]||[]).length||delete n[e],n})},M=i.useRef(!1);if(i.useEffect(function(){Object.keys(Z).length>0?M.current=!0:M.current&&(null==m||m(),M.current=!1)},[Z]),!s)return null;var j=Object.keys(Z);return(0,l.createPortal)(i.createElement(i.Fragment,null,j.map(function(e){var t=Z[e],n=i.createElement(x,{key:e,configList:t,placement:e,prefixCls:a,className:null==f?void 0:f(e),style:null==p?void 0:p(e),motion:u,onNoticeClose:E,onAllNoticeRemoved:k,stack:g});return h?h(n,{prefixCls:a,key:e}):n})),s)}),S=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],C=function(){return document.body},Z=0;function O(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.getContainer,n=void 0===t?C:t,c=e.motion,l=e.prefixCls,s=e.maxCount,u=e.className,d=e.style,f=e.onAllRemoved,p=e.stack,m=e.renderNotifications,g=(0,a.Z)(e,S),h=i.useState(),v=(0,o.Z)(h,2),b=v[0],y=v[1],w=i.useRef(),x=i.createElement(E,{container:b,ref:w,prefixCls:l,motion:c,maxCount:s,className:u,style:d,onAllRemoved:f,stack:p,renderNotifications:m}),O=i.useState([]),k=(0,o.Z)(O,2),M=k[0],j=k[1],I=i.useMemo(function(){return{open:function(e){var t=function(){for(var e={},t=arguments.length,n=Array(t),r=0;rP,ej=(0,c.useMemo)(function(){var e=w;return eO?e=null===q&&B?w:w.slice(0,Math.min(w.length,X/j)):"number"==typeof P&&(e=w.slice(0,P)),e},[w,j,q,P,eO]),eI=(0,c.useMemo)(function(){return eO?w.slice(eb+1):w.slice(ej.length)},[w,ej,eO,eb]),eR=(0,c.useCallback)(function(e,t){var n;return"function"==typeof S?S(e):null!==(n=S&&(null==e?void 0:e[S]))&&void 0!==n?n:t},[S]),eN=(0,c.useCallback)(x||function(e){return e},[x]);function eP(e,t,n){(eh!==e||void 0!==t&&t!==ef)&&(ev(e),n||(eE(eX){eP(r-1,e-o-el+eo);break}}A&&eT(0)+el>X&&ep(null)}},[X,K,eo,el,eR,ej]);var eA=ex&&!!eI.length,eL={};null!==ef&&eO&&(eL={position:"absolute",left:ef,top:0});var ez={prefixCls:eS,responsive:eO,component:z,invalidate:ek},e_=E?function(e,t){var n=eR(e,t);return c.createElement(y.Provider,{key:n,value:(0,o.Z)((0,o.Z)({},ez),{},{order:t,item:e,itemKey:n,registerSize:eF,display:t<=eb})},E(e,t))}:function(e,t){var n=eR(e,t);return c.createElement(m,(0,r.Z)({},ez,{order:t,key:n,item:e,renderItem:eN,itemKey:n,registerSize:eF,display:t<=eb}))},eH={order:eA?eb:Number.MAX_SAFE_INTEGER,className:"".concat(eS,"-rest"),registerSize:function(e,t){ea(t),et(eo)},display:eA};if(T)T&&(l=c.createElement(y.Provider,{value:(0,o.Z)((0,o.Z)({},ez),eH)},T(eI)));else{var eB=F||k;l=c.createElement(m,(0,r.Z)({},ez,eH),"function"==typeof eB?eB(eI):eB)}var eD=c.createElement(void 0===L?"div":L,(0,r.Z)({className:s()(!ek&&p,N),style:R,ref:t},H),ej.map(e_),eM?l:null,A&&c.createElement(m,(0,r.Z)({},ez,{responsive:eZ,responsiveDisabled:!eO,order:eb,className:"".concat(eS,"-suffix"),registerSize:function(e,t){es(t)},display:!0,style:eL}),A));return eZ&&(eD=c.createElement(u.Z,{onResize:function(e,t){G(t.clientWidth)},disabled:!eO},eD)),eD});M.displayName="Overflow",M.Item=S,M.RESPONSIVE=Z,M.INVALIDATE=O;var j=M},96257:function(e,t){"use strict";t.Z={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"}},31474:function(e,t,n){"use strict";n.d(t,{Z:function(){return H}});var r=n(1119),o=n(2265),a=n(45287);n(32559);var i=n(31686),c=n(41154),l=n(2868),s=n(28791),u=o.createContext(null),d=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some(function(e,r){return e[0]===t&&(n=r,!0)}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,r=this.__entries__;n0},e.prototype.connect_=function(){f&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),h?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){f&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;g.some(function(e){return!!~n.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),b=function(e,t){for(var n=0,r=Object.keys(t);n0},e}(),M="undefined"!=typeof WeakMap?new WeakMap:new d,j=function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var n=new k(t,v.getInstance(),this);M.set(this,n)};["observe","unobserve","disconnect"].forEach(function(e){j.prototype[e]=function(){var t;return(t=M.get(this))[e].apply(t,arguments)}});var I=void 0!==p.ResizeObserver?p.ResizeObserver:j,R=new Map,N=new I(function(e){e.forEach(function(e){var t,n=e.target;null===(t=R.get(n))||void 0===t||t.forEach(function(e){return e(n)})})}),P=n(76405),F=n(25049),T=n(15354),A=n(15900),L=function(e){(0,T.Z)(n,e);var t=(0,A.Z)(n);function n(){return(0,P.Z)(this,n),t.apply(this,arguments)}return(0,F.Z)(n,[{key:"render",value:function(){return this.props.children}}]),n}(o.Component),z=o.forwardRef(function(e,t){var n=e.children,r=e.disabled,a=o.useRef(null),d=o.useRef(null),f=o.useContext(u),p="function"==typeof n,m=p?n(a):n,g=o.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),h=!p&&o.isValidElement(m)&&(0,s.Yr)(m),v=h?m.ref:null,b=(0,s.x1)(v,a),y=function(){var e;return(0,l.Z)(a.current)||(a.current&&"object"===(0,c.Z)(a.current)?(0,l.Z)(null===(e=a.current)||void 0===e?void 0:e.nativeElement):null)||(0,l.Z)(d.current)};o.useImperativeHandle(t,function(){return y()});var w=o.useRef(e);w.current=e;var x=o.useCallback(function(e){var t=w.current,n=t.onResize,r=t.data,o=e.getBoundingClientRect(),a=o.width,c=o.height,l=e.offsetWidth,s=e.offsetHeight,u=Math.floor(a),d=Math.floor(c);if(g.current.width!==u||g.current.height!==d||g.current.offsetWidth!==l||g.current.offsetHeight!==s){var p={width:u,height:d,offsetWidth:l,offsetHeight:s};g.current=p;var m=(0,i.Z)((0,i.Z)({},p),{},{offsetWidth:l===Math.round(a)?a:l,offsetHeight:s===Math.round(c)?c:s});null==f||f(m,e,r),n&&Promise.resolve().then(function(){n(m,e)})}},[]);return o.useEffect(function(){var e=y();return e&&!r&&(R.has(e)||(R.set(e,new Set),N.observe(e)),R.get(e).add(x)),function(){R.has(e)&&(R.get(e).delete(x),R.get(e).size||(N.unobserve(e),R.delete(e)))}},[a.current,r]),o.createElement(L,{ref:d},h?o.cloneElement(m,{ref:b}):m)}),_=o.forwardRef(function(e,t){var n=e.children;return("function"==typeof n?[n]:(0,a.Z)(n)).map(function(n,a){var i=(null==n?void 0:n.key)||"".concat("rc-observer-key","-").concat(a);return o.createElement(z,(0,r.Z)({},e,{key:i,ref:0===a?t:void 0}),n)})});_.Collection=function(e){var t=e.children,n=e.onBatchResize,r=o.useRef(0),a=o.useRef([]),i=o.useContext(u),c=o.useCallback(function(e,t,o){r.current+=1;var c=r.current;a.current.push({size:e,element:t,data:o}),Promise.resolve().then(function(){c===r.current&&(null==n||n(a.current),a.current=[])}),null==i||i(e,t,o)},[n,i]);return o.createElement(u.Provider,{value:c},t)};var H=_},5769:function(e,t,n){"use strict";n.d(t,{G:function(){return i},Z:function(){return h}});var r=n(36760),o=n.n(r),a=n(2265);function i(e){var t=e.children,n=e.prefixCls,r=e.id,i=e.overlayInnerStyle,c=e.className,l=e.style;return a.createElement("div",{className:o()("".concat(n,"-content"),c),style:l},a.createElement("div",{className:"".concat(n,"-inner"),id:r,role:"tooltip",style:i},"function"==typeof t?t():t))}var c=n(1119),l=n(31686),s=n(6989),u=n(97821),d={shiftX:64,adjustY:1},f={adjustX:1,shiftY:!0},p=[0,0],m={left:{points:["cr","cl"],overflow:f,offset:[-4,0],targetOffset:p},right:{points:["cl","cr"],overflow:f,offset:[4,0],targetOffset:p},top:{points:["bc","tc"],overflow:d,offset:[0,-4],targetOffset:p},bottom:{points:["tc","bc"],overflow:d,offset:[0,4],targetOffset:p},topLeft:{points:["bl","tl"],overflow:d,offset:[0,-4],targetOffset:p},leftTop:{points:["tr","tl"],overflow:f,offset:[-4,0],targetOffset:p},topRight:{points:["br","tr"],overflow:d,offset:[0,-4],targetOffset:p},rightTop:{points:["tl","tr"],overflow:f,offset:[4,0],targetOffset:p},bottomRight:{points:["tr","br"],overflow:d,offset:[0,4],targetOffset:p},rightBottom:{points:["bl","br"],overflow:f,offset:[4,0],targetOffset:p},bottomLeft:{points:["tl","bl"],overflow:d,offset:[0,4],targetOffset:p},leftBottom:{points:["br","bl"],overflow:f,offset:[-4,0],targetOffset:p}},g=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow"],h=(0,a.forwardRef)(function(e,t){var n=e.overlayClassName,r=e.trigger,o=e.mouseEnterDelay,d=e.mouseLeaveDelay,f=e.overlayStyle,p=e.prefixCls,h=void 0===p?"rc-tooltip":p,v=e.children,b=e.onVisibleChange,y=e.afterVisibleChange,w=e.transitionName,x=e.animation,E=e.motion,S=e.placement,C=e.align,Z=e.destroyTooltipOnHide,O=e.defaultVisible,k=e.getTooltipContainer,M=e.overlayInnerStyle,j=(e.arrowContent,e.overlay),I=e.id,R=e.showArrow,N=(0,s.Z)(e,g),P=(0,a.useRef)(null);(0,a.useImperativeHandle)(t,function(){return P.current});var F=(0,l.Z)({},N);return"visible"in e&&(F.popupVisible=e.visible),a.createElement(u.Z,(0,c.Z)({popupClassName:n,prefixCls:h,popup:function(){return a.createElement(i,{key:"content",prefixCls:h,id:I,overlayInnerStyle:M},j)},action:void 0===r?["hover"]:r,builtinPlacements:m,popupPlacement:void 0===S?"right":S,ref:P,popupAlign:void 0===C?{}:C,getPopupContainer:k,onPopupVisibleChange:b,afterPopupVisibleChange:y,popupTransitionName:w,popupAnimation:x,popupMotion:E,defaultPopupVisible:O,autoDestroy:void 0!==Z&&Z,mouseLeaveDelay:void 0===d?.1:d,popupStyle:f,mouseEnterDelay:void 0===o?0:o,arrow:void 0===R||R},F),v)})},45287:function(e,t,n){"use strict";n.d(t,{Z:function(){return function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=[];return r.Children.forEach(t,function(t){(null!=t||n.keepEmpty)&&(Array.isArray(t)?a=a.concat(e(t)):(0,o.isFragment)(t)&&t.props?a=a.concat(e(t.props.children,n)):a.push(t))}),a}}});var r=n(2265),o=n(93754)},94981:function(e,t,n){"use strict";function r(){return!!("undefined"!=typeof window&&window.document&&window.document.createElement)}n.d(t,{Z:function(){return r}})},2161:function(e,t,n){"use strict";function r(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}n.d(t,{Z:function(){return r}})},21717:function(e,t,n){"use strict";n.d(t,{hq:function(){return m},jL:function(){return p}});var r=n(94981),o=n(2161),a="data-rc-order",i="data-rc-priority",c=new Map;function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mark;return t?t.startsWith("data-")?t:"data-".concat(t):"rc-util-key"}function s(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function u(e){return Array.from((c.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,r.Z)())return null;var n=t.csp,o=t.prepend,c=t.priority,l=void 0===c?0:c,d="queue"===o?"prependQueue":o?"prepend":"append",f="prependQueue"===d,p=document.createElement("style");p.setAttribute(a,d),f&&l&&p.setAttribute(i,"".concat(l)),null!=n&&n.nonce&&(p.nonce=null==n?void 0:n.nonce),p.innerHTML=e;var m=s(t),g=m.firstChild;if(o){if(f){var h=u(m).filter(function(e){return!!["prepend","prependQueue"].includes(e.getAttribute(a))&&l>=Number(e.getAttribute(i)||0)});if(h.length)return m.insertBefore(p,h[h.length-1].nextSibling),p}m.insertBefore(p,g)}else m.appendChild(p);return p}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u(s(t)).find(function(n){return n.getAttribute(l(t))===e})}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=f(e,t);n&&s(t).removeChild(n)}function m(e,t){var n,r,a,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){var n=c.get(e);if(!n||!(0,o.Z)(document,n)){var r=d("",t),a=r.parentNode;c.set(e,a),e.removeChild(r)}}(s(i),i);var u=f(t,i);if(u)return null!==(n=i.csp)&&void 0!==n&&n.nonce&&u.nonce!==(null===(r=i.csp)||void 0===r?void 0:r.nonce)&&(u.nonce=null===(a=i.csp)||void 0===a?void 0:a.nonce),u.innerHTML!==e&&(u.innerHTML=e),u;var p=d(e,i);return p.setAttribute(l(i),t),p}},2868:function(e,t,n){"use strict";n.d(t,{S:function(){return a},Z:function(){return i}});var r=n(2265),o=n(54887);function a(e){return e instanceof HTMLElement||e instanceof SVGElement}function i(e){return a(e)?e:e instanceof r.Component?o.findDOMNode(e):null}},2857:function(e,t){"use strict";t.Z=function(e){if(!e)return!1;if(e instanceof Element){if(e.offsetParent)return!0;if(e.getBBox){var t=e.getBBox(),n=t.width,r=t.height;if(n||r)return!0}if(e.getBoundingClientRect){var o=e.getBoundingClientRect(),a=o.width,i=o.height;if(a||i)return!0}}return!1}},13211:function(e,t,n){"use strict";function r(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function o(e){return r(e) instanceof ShadowRoot?r(e):null}n.d(t,{A:function(){return o}})},95814:function(e,t){"use strict";var n={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var t=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||t>=n.F1&&t<=n.F12)return!1;switch(t){case n.ALT:case n.CAPS_LOCK:case n.CONTEXT_MENU:case n.CTRL:case n.DOWN:case n.END:case n.ESC:case n.HOME:case n.INSERT:case n.LEFT:case n.MAC_FF_META:case n.META:case n.NUMLOCK:case n.NUM_CENTER:case n.PAGE_DOWN:case n.PAGE_UP:case n.PAUSE:case n.PRINT_SCREEN:case n.RIGHT:case n.SHIFT:case n.UP:case n.WIN_KEY:case n.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=n.ZERO&&e<=n.NINE||e>=n.NUM_ZERO&&e<=n.NUM_MULTIPLY||e>=n.A&&e<=n.Z||-1!==window.navigator.userAgent.indexOf("WebKit")&&0===e)return!0;switch(e){case n.SPACE:case n.QUESTION_MARK:case n.NUM_PLUS:case n.NUM_MINUS:case n.NUM_PERIOD:case n.NUM_DIVISION:case n.SEMICOLON:case n.DASH:case n.EQUALS:case n.COMMA:case n.PERIOD:case n.SLASH:case n.APOSTROPHE:case n.SINGLE_QUOTE:case n.OPEN_SQUARE_BRACKET:case n.BACKSLASH:case n.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};t.Z=n},18404:function(e,t,n){"use strict";n.d(t,{s:function(){return h},v:function(){return b}});var r,o,a=n(73129),i=n(54580),c=n(41154),l=n(31686),s=n(54887),u=(0,l.Z)({},r||(r=n.t(s,2))),d=u.version,f=u.render,p=u.unmountComponentAtNode;try{Number((d||"").split(".")[0])>=18&&(o=u.createRoot)}catch(e){}function m(e){var t=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;t&&"object"===(0,c.Z)(t)&&(t.usingClientEntryPoint=e)}var g="__rc_react_root__";function h(e,t){if(o){var n;m(!0),n=t[g]||o(t),m(!1),n.render(e),t[g]=n;return}f(e,t)}function v(){return(v=(0,i.Z)((0,a.Z)().mark(function e(t){return(0,a.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.resolve().then(function(){var e;null===(e=t[g])||void 0===e||e.unmount(),delete t[g]}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function b(e){return y.apply(this,arguments)}function y(){return(y=(0,i.Z)((0,a.Z)().mark(function e(t){return(0,a.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(void 0!==o)){e.next=2;break}return e.abrupt("return",function(e){return v.apply(this,arguments)}(t));case 2:p(t);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}},3208:function(e,t,n){"use strict";var r;function o(e){if("undefined"==typeof document)return 0;if(e||void 0===r){var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var n=document.createElement("div"),o=n.style;o.position="absolute",o.top="0",o.left="0",o.pointerEvents="none",o.visibility="hidden",o.width="200px",o.height="150px",o.overflow="hidden",n.appendChild(t),document.body.appendChild(n);var a=t.offsetWidth;n.style.overflow="scroll";var i=t.offsetWidth;a===i&&(i=n.clientWidth),document.body.removeChild(n),r=a-i}return r}function a(e){var t=e.match(/^(.*)px$/),n=Number(null==t?void 0:t[1]);return Number.isNaN(n)?o():n}function i(e){if("undefined"==typeof document||!e||!(e instanceof Element))return{width:0,height:0};var t=getComputedStyle(e,"::-webkit-scrollbar"),n=t.width,r=t.height;return{width:a(n),height:a(r)}}n.d(t,{Z:function(){return o},o:function(){return i}})},58525:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);function o(e){var t=r.useRef();return t.current=e,r.useCallback(function(){for(var e,n=arguments.length,r=Array(n),o=0;o2&&void 0!==arguments[2]&&arguments[2],a=new Set;return function e(t,i){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,l=a.has(t);if((0,o.ZP)(!l,"Warning: There may be circular references"),l)return!1;if(t===i)return!0;if(n&&c>1)return!1;a.add(t);var s=c+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(var u=0;u