diff --git a/CHANGELOG.md b/CHANGELOG.md index b6bba269..b61c78b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,74 @@ # Changelog +## [1.6.1](https://github.com/google/adk-python/compare/v1.5.0...v1.6.1) (2025-07-09) + +### Features + +* Add A2A support as experimental features [f0183a9](https://github.com/google/adk-python/commit/f0183a9b98b0bcf8aab4f948f467cef204ddc9d6) + * Install google-adk with a2a extra: pip install google-adk[a2a] + * Users can serve agents as A2A agent with `--a2a` option for `adk web` and + `adk api_server` + * Users can run a remote A2A agent with `RemoteA2AAgent` class + * Three A2A agent samples are added: + * contributing/samples/a2a_basic + * contributing/samples/a2a_auth + * contributing/samples/a2a_human_in_loop + +* Support agent hot reload.[e545e5a](https://github.com/google/adk-python/commit/e545e5a570c1331d2ed8fda31c7244b5e0f71584) + Users can add `--reload_agents` flag to `adk web` and `adk api_server` command + to reload agents automatically when new changes are detected. + +* Eval features + * Implement auto rater-based evaluator for responses [75699fb](https://github.com/google/adk-python/commit/75699fbeca06f99c6f2415938da73bb423ec9b9b) + * Add Safety evaluator metric [0bd05df](https://github.com/google/adk-python/commit/0bd05df471a440159a44b5864be4740b0f1565f9) + * Add BaseEvalService declaration and surrounding data models [b0d88bf](https://github.com/google/adk-python/commit/b0d88bf17242e738bcd409b3d106deed8ce4d407) + +* Minor features + * Add `custom_metadata` to VertexAiSessionService when adding events [a021222](https://github.com/google/adk-python/commit/a02122207734cabb26f7c23e84d2336c4b8b0375) + * Support protected write in BigQuery `execute_sql` tool [dc43d51](https://github.com/google/adk-python/commit/dc43d518c90b44932b3fdedd33fca9e6c87704e2) + * Added clone() method to BaseAgent to allow users to create copies of an agent [d263afd] (https://github.com/google/adk-python/commit/d263afd91ba4a3444e5321c0e1801c499dec4c68) + +### Bug Fixes + +* Support project-based gemini model path to use enterprise_web_search_tool [e33161b](https://github.com/google/adk-python/commit/e33161b4f8650e8bcb36c650c4e2d1fe79ae2526) +* Use inspect.signature() instead of typing.get_type_hints for examining function signatures[4ca77bc](https://github.com/google/adk-python/commit/4ca77bc056daa575621a80d3c8d5014b78209233) +* Replace Event ID generation with UUID4 to prevent SQLite integrity constraint failures [e437c7a](https://github.com/google/adk-python/commit/e437c7aac650ac6a53fcfa71bd740e3e5ec0f230) +* Remove duplicate options from `adk deploy` [3fa2ea7](https://github.com/google/adk-python/commit/3fa2ea7cb923c9f8606d98b45a23bd58a7027436) +* Fix scenario where a user can access another users events given the same session id [362fb3f](https://github.com/google/adk-python/commit/362fb3f2b7ac4ad15852d00ce4f3935249d097f6) +* Handle unexpected 'parameters' argument in FunctionTool.run_async [0959b06](https://github.com/google/adk-python/commit/0959b06dbdf3037fe4121f12b6d25edca8fb9afc) +* Make sure each partial event has different timestamp [17d6042](https://github.com/google/adk-python/commit/17d604299505c448fcb55268f0cbaeb6c4fa314a) +* Avoid pydantic.ValidationError when the model stream returns empty final chunk [9b75e24](https://github.com/google/adk-python/commit/9b75e24d8c01878c153fec26ccfea4490417d23b) +* Fix google_search_tool.py to support updated Gemini LIVE model naming [77b869f](https://github.com/google/adk-python/commit/77b869f5e35a66682cba35563824fd23a9028d7c) +* Adding detailed information on each metric evaluation [04de3e1](https://github.com/google/adk-python/commit/04de3e197d7a57935488eb7bfa647c7ab62cd9d9) +* Converts litellm generate config err [3901fad](https://github.com/google/adk-python/commit/3901fade71486a1e9677fe74a120c3f08efe9d9e) +* Save output in state via output_key only when the event is authored by current agent [20279d9](https://github.com/google/adk-python/commit/20279d9a50ac051359d791dea77865c17c0bbf9e) +* Treat SQLite database update time as UTC for session's last update time [3f621ae](https://github.com/google/adk-python/commit/3f621ae6f2a5fac7f992d3d833a5311b4d4e7091) +* Raise ValueError when sessionId and userId are incorrect combination(#1653) [4e765ae](https://github.com/google/adk-python/commit/4e765ae2f3821318e581c26a52e11d392aaf72a4) +* Support API-Key for MCP Tool authentication [045aea9](https://github.com/google/adk-python/commit/045aea9b15ad0190a960f064d6e1e1fc7f964c69) +* Lock LangGraph version to <= 0.4.10 [9029b8a](https://github.com/google/adk-python/commit/9029b8a66e9d5e0d29d9a6df0e5590cc7c0e9038) +* Update the retry logic of create session polling [3d2f13c](https://github.com/google/adk-python/commit/3d2f13cecd3fef5adfa1c98bf23d7b68ff355f4d) + +### Chores + +* Extract mcp client creation logic to a separate method [45d60a1](https://github.com/google/adk-python/commit/45d60a1906bfe7c43df376a829377e2112ea3d17) +* Add tests for live streaming configs [bf39c00](https://github.com/google/adk-python/commit/bf39c006102ef3f01e762e7bb744596a4589f171) +* Update ResponseEvaluator to use newer version of Eval SDK [62c4a85](https://github.com/google/adk-python/commit/62c4a8591780a9a3fdb03a0de11092d84118a1b9) +* Add util to build our llms.txt and llms-full.txt files [a903c54](https://github.com/google/adk-python/commit/a903c54bacfcb150dc315bec9c67bf7ce9551c07) +* Create an example for multi agent live streaming [a58cc3d](https://github.com/google/adk-python/commit/a58cc3d882e59358553e8ea16d166b1ab6d3aa71) +* Refactor the ADK Triaging Agent to make the code easier to read [b6c7b5b](https://github.com/google/adk-python/commit/b6c7b5b64fcd2e83ed43f7b96ea43791733955d8) + + +### Documentation + +* Update the a2a exmaple link in README.md [d0fdfb8](https://github.com/google/adk-python/commit/d0fdfb8c8e2e32801999c81de8d8ed0be3f88e76) +* Adds AGENTS.md to provide relevant project context for the Gemini CLI [37108be](https://github.com/google/adk-python/commit/37108be8557e011f321de76683835448213f8515) +* Update CONTRIBUTING.md [ffa9b36](https://github.com/google/adk-python/commit/ffa9b361db615ae365ba62c09a8f4226fb761551) +* Add adk project overview and architecture [28d0ea8](https://github.com/google/adk-python/commit/28d0ea876f2f8de952f1eccbc788e98e39f50cf5) +* Add docstring to clarify that inmemory service are not suitable for production [dc414cb](https://github.com/google/adk-python/commit/dc414cb5078326b8c582b3b9072cbda748766286) +* Update agents.md to include versioning strategy [6a39c85](https://github.com/google/adk-python/commit/6a39c854e032bda3bc15f0e4fe159b41cf2f474b) +* Add tenacity into project.toml [df141db](https://github.com/google/adk-python/commit/df141db60c1137a6bcddd6d46aad3dc506868543) +* Updating CONTRIBUTING.md with missing extra [e153d07](https://github.com/google/adk-python/commit/e153d075939fb628a7dc42b12e1b3461842db541) + ## [1.5.0](https://github.com/google/adk-python/compare/v1.4.2...v1.5.0) (2025-06-25) diff --git a/contributing/samples/a2a_basic/agent.py b/contributing/samples/a2a_basic/agent.py index 275511f4..294a9c0d 100755 --- a/contributing/samples/a2a_basic/agent.py +++ b/contributing/samples/a2a_basic/agent.py @@ -93,7 +93,7 @@ prime_agent = RemoteA2aAgent( root_agent = Agent( - model="gemini-1.5-flash", + model="gemini-2.0-flash", name="root_agent", instruction=""" You are a helpful assistant that can roll dice and check if numbers are prime. diff --git a/contributing/samples/a2a_human_in_loop/agent.py b/contributing/samples/a2a_human_in_loop/agent.py index d15b5bb3..3b1313f2 100644 --- a/contributing/samples/a2a_human_in_loop/agent.py +++ b/contributing/samples/a2a_human_in_loop/agent.py @@ -33,7 +33,7 @@ approval_agent = RemoteA2aAgent( root_agent = Agent( - model='gemini-1.5-flash', + model='gemini-2.0-flash', name='reimbursement_agent', instruction=""" You are an agent whose job is to handle the reimbursement process for diff --git a/contributing/samples/a2a_human_in_loop/remote_a2a/human_in_loop/agent.py b/contributing/samples/a2a_human_in_loop/remote_a2a/human_in_loop/agent.py index acf7e456..913fa44c 100644 --- a/contributing/samples/a2a_human_in_loop/remote_a2a/human_in_loop/agent.py +++ b/contributing/samples/a2a_human_in_loop/remote_a2a/human_in_loop/agent.py @@ -39,7 +39,7 @@ def ask_for_approval( root_agent = Agent( - model='gemini-1.5-flash', + model='gemini-2.0-flash', name='reimbursement_agent', instruction=""" You are an agent whose job is to handle the reimbursement process for diff --git a/contributing/samples/adk_answering_agent/README.md b/contributing/samples/adk_answering_agent/README.md new file mode 100644 index 00000000..e2af591d --- /dev/null +++ b/contributing/samples/adk_answering_agent/README.md @@ -0,0 +1,83 @@ +# ADK Answering Agent + +The ADK Answering Agent is a Python-based agent designed to help answer questions in GitHub discussions for the `google/adk-python` repository. It uses a large language model to analyze open discussions, retrieve information from document store, generate response, and post a comment in the github discussion. + +This agent can be operated in three distinct modes: an interactive mode for local use, a batch script mode for oncall use, or as a fully automated GitHub Actions workflow (TBD). + +--- + +## Interactive Mode + +This mode allows you to run the agent locally to review its recommendations in real-time before any changes are made to your repository's issues. + +### Features +* **Web Interface**: The agent's interactive mode can be rendered in a web browser using the ADK's `adk web` command. +* **User Approval**: In interactive mode, the agent is instructed to ask for your confirmation before posting a comment to a GitHub issue. +* **Question & Answer**: You can ask ADK related questions, and the agent will provide answers based on its knowledge on ADK. + +### Running in Interactive Mode +To run the agent in interactive mode, first set the required environment variables. Then, execute the following command in your terminal: + +```bash +adk web +``` +This will start a local server and provide a URL to access the agent's web interface in your browser. + +--- + +## Batch Script Mode + +The `answer_discussions.py` is created for ADK oncall team to batch process discussions. + +### Features +* **Batch Process**: Taken either a number as the count of the recent discussions or a list of discussion numbers, the script will invoke the agent to answer all the specified discussions in one single run. + +### Running in Interactive Mode +To run the agent in batch script mode, first set the required environment variables. Then, execute the following command in your terminal: + +```bash +export PYTHONPATH=contributing/samples +python -m adk_answering_agent.answer_discussions --numbers 27 36 # Answer specified discussions +``` + +Or `python -m adk_answering_agent.answer_discussions --recent 10` to answer the 10 most recent updated discussions. + +--- + +## GitHub Workflow Mode + +The `main.py` is reserved for the Github Workflow. The detailed setup for the automatic workflow is TBD. + +--- + +## Setup and Configuration + +Whether running in interactive or workflow mode, the agent requires the following setup. + +### Dependencies +The agent requires the following Python libraries. + +```bash +pip install --upgrade pip +pip install google-adk requests +``` + +The agent also requires gcloud login: + +```bash +gcloud auth application-default login +``` + +### Environment Variables +The following environment variables are required for the agent to connect to the necessary services. + +* `GITHUB_TOKEN=YOUR_GITHUB_TOKEN`: **(Required)** A GitHub Personal Access Token with `issues:write` permissions. Needed for both interactive and workflow modes. +* `GOOGLE_GENAI_USE_VERTEXAI=TRUE`: **(Required)** Use Google Vertex AI for the authentication. +* `GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID`: **(Required)** The Google Cloud project ID. +* `GOOGLE_CLOUD_LOCATION=LOCATION`: **(Required)** The Google Cloud region. +* `VERTEXAI_DATASTORE_ID=YOUR_DATASTORE_ID`: **(Required)** The Vertex AI datastore ID for the document store (i.e. knowledge base). +* `OWNER`: The GitHub organization or username that owns the repository (e.g., `google`). Needed for both modes. +* `REPO`: The name of the GitHub repository (e.g., `adk-python`). Needed for both modes. +* `INTERACTIVE`: Controls the agent's interaction mode. For the automated workflow, this is set to `0`. For interactive mode, it should be set to `1` or left unset. + +For local execution in interactive mode, you can place these variables in a `.env` file in the project's root directory. For the GitHub workflow, they should be configured as repository secrets. \ No newline at end of file diff --git a/contributing/samples/adk_answering_agent/__init__.py b/contributing/samples/adk_answering_agent/__init__.py new file mode 100644 index 00000000..c48963cd --- /dev/null +++ b/contributing/samples/adk_answering_agent/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from . import agent diff --git a/contributing/samples/adk_answering_agent/agent.py b/contributing/samples/adk_answering_agent/agent.py new file mode 100644 index 00000000..96e30a73 --- /dev/null +++ b/contributing/samples/adk_answering_agent/agent.py @@ -0,0 +1,192 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Any + +from adk_answering_agent.settings import IS_INTERACTIVE +from adk_answering_agent.settings import OWNER +from adk_answering_agent.settings import REPO +from adk_answering_agent.settings import VERTEXAI_DATASTORE_ID +from adk_answering_agent.utils import error_response +from adk_answering_agent.utils import run_graphql_query +from google.adk.agents import Agent +from google.adk.tools import VertexAiSearchTool +import requests + +if IS_INTERACTIVE: + APPROVAL_INSTRUCTION = ( + "Ask for user approval or confirmation for adding the comment." + ) +else: + APPROVAL_INSTRUCTION = ( + "**Do not** wait or ask for user approval or confirmation for adding the" + " comment." + ) + + +def get_discussion_and_comments(discussion_number: int) -> dict[str, Any]: + """Fetches a discussion and its comments using the GitHub GraphQL API. + + Args: + discussion_number: The number of the GitHub discussion. + + Returns: + A dictionary with the request status and the discussion details. + """ + print(f"Attempting to get discussion #{discussion_number} and its comments") + query = """ + query($owner: String!, $repo: String!, $discussionNumber: Int!) { + repository(owner: $owner, name: $repo) { + discussion(number: $discussionNumber) { + id + title + body + createdAt + closed + author { + login + } + # For each comment, fetch the latest 100 comments. + comments(last: 100) { + nodes { + id + body + createdAt + author { + login + } + # For each comment, fetch the latest 50 replies + replies(last: 50) { + nodes { + id + body + createdAt + author { + login + } + } + } + } + } + } + } + } + """ + variables = { + "owner": OWNER, + "repo": REPO, + "discussionNumber": discussion_number, + } + try: + response = run_graphql_query(query, variables) + if "errors" in response: + return error_response(str(response["errors"])) + discussion_data = ( + response.get("data", {}).get("repository", {}).get("discussion") + ) + if not discussion_data: + return error_response(f"Discussion #{discussion_number} not found.") + return {"status": "success", "discussion": discussion_data} + except requests.exceptions.RequestException as e: + return error_response(str(e)) + + +def add_comment_to_discussion( + discussion_id: str, comment_body: str +) -> dict[str, Any]: + """Adds a comment to a specific discussion. + + Args: + discussion_id: The GraphQL node ID of the discussion. + comment_body: The content of the comment in Markdown. + + Returns: + The status of the request and the new comment's details. + """ + print(f"Adding comment to discussion {discussion_id}") + query = """ + mutation($discussionId: ID!, $body: String!) { + addDiscussionComment(input: {discussionId: $discussionId, body: $body}) { + comment { + id + body + createdAt + author { + login + } + } + } + } + """ + variables = {"discussionId": discussion_id, "body": comment_body} + try: + response = run_graphql_query(query, variables) + if "errors" in response: + return error_response(str(response["errors"])) + new_comment = ( + response.get("data", {}).get("addDiscussionComment", {}).get("comment") + ) + return {"status": "success", "comment": new_comment} + except requests.exceptions.RequestException as e: + return error_response(str(e)) + + +root_agent = Agent( + model="gemini-2.5-pro", + name="adk_answering_agent", + description="Answer questions about ADK repo.", + instruction=f""" + You are a helpful assistant that responds to questions from the GitHub repository `{OWNER}/{REPO}` + based on information about Google ADK found in the document store. You can access the document store + using the `VertexAiSearchTool`. + + When user specifies a discussion number, here are the steps: + 1. Use the `get_discussion_and_comments` tool to get the details of the discussion including the comments. + 2. Focus on the latest comment but reference all comments if needed to understand the context. + * If there is no comment at all, just focus on the discussion title and body. + 3. If all the following conditions are met, try to add a comment to the discussion, otherwise, do not respond: + * The discussion is not closed. + * The latest comment is not from you or other agents (marked as "Response from XXX Agent"). + * The latest comment is asking a question or requesting information. + 4. Use the `VertexAiSearchTool` to find relevant information before answering. + + IMPORTANT: + * {APPROVAL_INSTRUCTION} + * Your response should be based on the information you found in the document store. Do not invent + information that is not in the document store. Do not invent citations which are not in the document store. + * If you can't find the answer or information in the document store, **do not** respond. + * Include a bolded note (e.g. "Response from ADK Answering Agent") in your comment + to indicate this comment was added by an ADK Answering Agent. + * Have an empty line between the note and the rest of your response. + * Inlclude a short summary of your response in the comment as a TLDR, e.g. "**TLDR**: ". + * Have a divider line between the TLDR and your detail response. + * Do not respond to any other discussion except the one specified by the user. + * Please include your justification for your decision in your output + to the user who is telling with you. + * If you uses citation from the document store, please provide a footnote + referencing the source document format it as: "[1] URL of the document". + * Replace the "gs://prefix/" part, e.g. "gs://adk-qa-bucket/", to be "https://github.com/google/" + * Add "blob/main/" after the repo name, e.g. "adk-python", "adk-docs", for example: + * If the original URL is "gs://adk-qa-bucket/adk-python/src/google/adk/version.py", + then the citation URL is "https://github.com/google/adk-python/blob/main/src/google/adk/version.py", + * If the original URL is "gs://adk-qa-bucket/adk-docs/docs/index.md", + then the citation URL is "https://github.com/google/adk-docs/blob/main/docs/index.md" + * If the file is a html file, replace the ".html" to be ".md" + """, + tools=[ + VertexAiSearchTool(data_store_id=VERTEXAI_DATASTORE_ID), + get_discussion_and_comments, + add_comment_to_discussion, + ], +) diff --git a/contributing/samples/adk_answering_agent/answer_discussions.py b/contributing/samples/adk_answering_agent/answer_discussions.py new file mode 100644 index 00000000..1aa73758 --- /dev/null +++ b/contributing/samples/adk_answering_agent/answer_discussions.py @@ -0,0 +1,172 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import asyncio +import sys +import time + +from adk_answering_agent import agent +from adk_answering_agent.settings import OWNER +from adk_answering_agent.settings import REPO +from adk_answering_agent.utils import call_agent_async +from adk_answering_agent.utils import run_graphql_query +from google.adk.runners import InMemoryRunner +import requests + +APP_NAME = "adk_discussion_answering_app" +USER_ID = "adk_discussion_answering_assistant" + + +async def list_most_recent_discussions(count: int = 1) -> list[int] | None: + """Fetches a specified number of the most recently updated discussions. + + Args: + count: The number of discussions to retrieve. Defaults to 1. + + Returns: + A list of discussion numbers. + """ + print( + f"Attempting to fetch the {count} most recently updated discussions from" + f" {OWNER}/{REPO}..." + ) + + query = """ + query($owner: String!, $repo: String!, $count: Int!) { + repository(owner: $owner, name: $repo) { + discussions( + first: $count + orderBy: {field: UPDATED_AT, direction: DESC} + ) { + nodes { + title + number + updatedAt + author { + login + } + } + } + } + } + """ + variables = {"owner": OWNER, "repo": REPO, "count": count} + + try: + response = run_graphql_query(query, variables) + + if "errors" in response: + print(f"Error from GitHub API: {response['errors']}", file=sys.stderr) + return None + + discussions = ( + response.get("data", {}) + .get("repository", {}) + .get("discussions", {}) + .get("nodes", []) + ) + return [d["number"] for d in discussions] + + except requests.exceptions.RequestException as e: + print(f"Request failed: {e}", file=sys.stderr) + return None + + +def process_arguments(): + """Parses command-line arguments.""" + parser = argparse.ArgumentParser( + description="A script that answer questions for Github discussions.", + epilog=( + "Example usage: \n" + "\tpython -m adk_answering_agent.answer_discussions --recent 10\n" + "\tpython -m adk_answering_agent.answer_discussions --numbers 21 31\n" + ), + formatter_class=argparse.RawTextHelpFormatter, + ) + + group = parser.add_mutually_exclusive_group(required=True) + + group.add_argument( + "--recent", + type=int, + metavar="COUNT", + help="Answer the N most recently updated discussion numbers.", + ) + + group.add_argument( + "--numbers", + type=int, + nargs="+", + metavar="NUM", + help="Answer a specific list of discussion numbers.", + ) + + if len(sys.argv) == 1: + parser.print_help(sys.stderr) + sys.exit(1) + + return parser.parse_args() + + +async def main(): + args = process_arguments() + discussion_numbers = [] + + if args.recent: + discussion_numbers = await list_most_recent_discussions(count=args.recent) + elif args.numbers: + discussion_numbers = args.numbers + + if not discussion_numbers: + print("No discussions specified. Exiting...", file=sys.stderr) + sys.exit(1) + + print(f"Will try to answer discussions: {discussion_numbers}...") + + runner = InMemoryRunner( + agent=agent.root_agent, + app_name=APP_NAME, + ) + + for discussion_number in discussion_numbers: + print("#" * 80) + print(f"Starting to process discussion #{discussion_number}...") + # Create a new session for each discussion to avoid interference. + session = await runner.session_service.create_session( + app_name=APP_NAME, user_id=USER_ID + ) + prompt = ( + f"Please check discussion #{discussion_number} see if you can help" + " answer the question or provide some information!" + ) + response = await call_agent_async(runner, USER_ID, session.id, prompt) + print(f"<<<< Agent Final Output: {response}\n") + + +if __name__ == "__main__": + start_time = time.time() + print( + f"Start answering discussions for {OWNER}/{REPO} at" + f" {time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(start_time))}" + ) + print("-" * 80) + asyncio.run(main()) + print("-" * 80) + end_time = time.time() + print( + "Discussion answering finished at" + f" {time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(end_time))}", + ) + print("Total script execution time:", f"{end_time - start_time:.2f} seconds") diff --git a/contributing/samples/adk_answering_agent/main.py b/contributing/samples/adk_answering_agent/main.py new file mode 100644 index 00000000..735ebae7 --- /dev/null +++ b/contributing/samples/adk_answering_agent/main.py @@ -0,0 +1,66 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import asyncio +import time + +from adk_answering_agent import agent +from adk_answering_agent.settings import DISCUSSION_NUMBER +from adk_answering_agent.settings import OWNER +from adk_answering_agent.settings import REPO +from adk_answering_agent.utils import call_agent_async +from adk_answering_agent.utils import parse_number_string +from google.adk.runners import InMemoryRunner + +APP_NAME = "adk_answering_app" +USER_ID = "adk_answering_user" + + +async def main(): + runner = InMemoryRunner( + agent=agent.root_agent, + app_name=APP_NAME, + ) + session = await runner.session_service.create_session( + app_name=APP_NAME, user_id=USER_ID + ) + + discussion_number = parse_number_string(DISCUSSION_NUMBER) + if not discussion_number: + print(f"Error: Invalid discussion number received: {DISCUSSION_NUMBER}.") + return + + prompt = ( + f"Please check discussion #{discussion_number} see if you can help answer" + " the question or provide some information!" + ) + response = await call_agent_async(runner, USER_ID, session.id, prompt) + print(f"<<<< Agent Final Output: {response}\n") + + +if __name__ == "__main__": + start_time = time.time() + print( + f"Start Q&A checking on {OWNER}/{REPO} discussion #{DISCUSSION_NUMBER} at" + f" {time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(start_time))}" + ) + print("-" * 80) + asyncio.run(main()) + print("-" * 80) + end_time = time.time() + print( + "Q&A checking finished at" + f" {time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(end_time))}", + ) + print("Total script execution time:", f"{end_time - start_time:.2f} seconds") diff --git a/contributing/samples/adk_answering_agent/settings.py b/contributing/samples/adk_answering_agent/settings.py new file mode 100644 index 00000000..205f9f36 --- /dev/null +++ b/contributing/samples/adk_answering_agent/settings.py @@ -0,0 +1,36 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +from dotenv import load_dotenv + +load_dotenv(override=True) + +GITHUB_BASE_URL = "https://api.github.com" +GITHUB_GRAPHQL_URL = GITHUB_BASE_URL + "/graphql" + +GITHUB_TOKEN = os.getenv("GITHUB_TOKEN") +if not GITHUB_TOKEN: + raise ValueError("GITHUB_TOKEN environment variable not set") + +VERTEXAI_DATASTORE_ID = os.getenv("VERTEXAI_DATASTORE_ID") +if not VERTEXAI_DATASTORE_ID: + raise ValueError("VERTEXAI_DATASTORE_ID environment variable not set") + +OWNER = os.getenv("OWNER", "google") +REPO = os.getenv("REPO", "adk-python") +DISCUSSION_NUMBER = os.getenv("DISCUSSION_NUMBER") + +IS_INTERACTIVE = os.getenv("INTERACTIVE", "1").lower() in ["true", "1"] diff --git a/contributing/samples/adk_answering_agent/utils.py b/contributing/samples/adk_answering_agent/utils.py new file mode 100644 index 00000000..c8321f94 --- /dev/null +++ b/contributing/samples/adk_answering_agent/utils.py @@ -0,0 +1,81 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +from typing import Any + +from adk_answering_agent.settings import GITHUB_GRAPHQL_URL +from adk_answering_agent.settings import GITHUB_TOKEN +from google.adk.agents.run_config import RunConfig +from google.adk.runners import Runner +from google.genai import types +import requests + +headers = { + "Authorization": f"token {GITHUB_TOKEN}", + "Accept": "application/vnd.github.v3+json", +} + + +def error_response(error_message: str) -> dict[str, Any]: + return {"status": "error", "error_message": error_message} + + +def run_graphql_query(query: str, variables: dict[str, Any]) -> dict[str, Any]: + """Executes a GraphQL query.""" + payload = {"query": query, "variables": variables} + response = requests.post( + GITHUB_GRAPHQL_URL, headers=headers, json=payload, timeout=60 + ) + response.raise_for_status() + return response.json() + + +def parse_number_string(number_str: str | None, default_value: int = 0) -> int: + """Parse a number from the given string.""" + if not number_str: + return default_value + + try: + return int(number_str) + except ValueError: + print( + f"Warning: Invalid number string: {number_str}. Defaulting to" + f" {default_value}.", + file=sys.stderr, + ) + return default_value + + +async def call_agent_async( + runner: Runner, user_id: str, session_id: str, prompt: str +) -> str: + """Call the agent asynchronously with the user's prompt.""" + content = types.Content( + role="user", parts=[types.Part.from_text(text=prompt)] + ) + + final_response_text = "" + async for event in runner.run_async( + user_id=user_id, + session_id=session_id, + new_message=content, + run_config=RunConfig(save_input_blobs_as_artifacts=False), + ): + if event.content and event.content.parts: + if text := "".join(part.text or "" for part in event.content.parts): + if event.author != "user": + final_response_text += text + + return final_response_text diff --git a/contributing/samples/adk_issue_formatting_agent/utils.py b/contributing/samples/adk_issue_formatting_agent/utils.py index 2ee735d3..c8c4561b 100644 --- a/contributing/samples/adk_issue_formatting_agent/utils.py +++ b/contributing/samples/adk_issue_formatting_agent/utils.py @@ -20,6 +20,7 @@ import requests headers = { "Authorization": f"token {GITHUB_TOKEN}", "Accept": "application/vnd.github.v3+json", + "X-GitHub-Api-Version": "2022-11-28", } diff --git a/contributing/samples/adk_pr_agent/__init__.py b/contributing/samples/adk_pr_agent/__init__.py new file mode 100755 index 00000000..c48963cd --- /dev/null +++ b/contributing/samples/adk_pr_agent/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from . import agent diff --git a/contributing/samples/adk_pr_agent/agent.py b/contributing/samples/adk_pr_agent/agent.py new file mode 100644 index 00000000..8c398e7e --- /dev/null +++ b/contributing/samples/adk_pr_agent/agent.py @@ -0,0 +1,150 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# pylint: disable=g-importing-member + +import os + +from google.adk import Agent +import requests + +GITHUB_TOKEN = os.getenv("GITHUB_TOKEN", "") +if not GITHUB_TOKEN: + raise ValueError("GITHUB_TOKEN environment variable not set") + +OWNER = os.getenv("OWNER", "google") +REPO = os.getenv("REPO", "adk-python") + + +def get_github_pr_info_http(pr_number: int) -> str | None: + """Fetches information for a GitHub Pull Request by sending direct HTTP requests. + + Args: + pr_number (int): The number of the Pull Request. + + Returns: + pr_message: A string. + """ + base_url = "https://api.github.com" + + headers = { + "Accept": "application/vnd.github+json", + "Authorization": f"Bearer {GITHUB_TOKEN}", + "X-GitHub-Api-Version": "2022-11-28", + } + + pr_message = "" + + # --- 1. Get main PR details --- + pr_url = f"{base_url}/repos/{OWNER}/{REPO}/pulls/{pr_number}" + print(f"Fetching PR details from: {pr_url}") + try: + response = requests.get(pr_url, headers=headers) + response.raise_for_status() + pr_data = response.json() + pr_message += f"The PR title is: {pr_data.get('title')}\n" + except requests.exceptions.HTTPError as e: + print( + f"HTTP Error fetching PR details: {e.response.status_code} - " + f" {e.response.text}" + ) + return None + except requests.exceptions.RequestException as e: + print(f"Network or request error fetching PR details: {e}") + return None + except Exception as e: # pylint: disable=broad-except + print(f"An unexpected error occurred: {e}") + return None + + # --- 2. Fetching associated commits (paginated) --- + commits_url = pr_data.get( + "commits_url" + ) # This URL is provided in the initial PR response + if commits_url: + print("\n--- Associated Commits in this PR: ---") + page = 1 + while True: + # GitHub API often uses 'per_page' and 'page' for pagination + params = { + "per_page": 100, + "page": page, + } # Fetch up to 100 commits per page + try: + response = requests.get(commits_url, headers=headers, params=params) + response.raise_for_status() + commits_data = response.json() + + if not commits_data: # No more commits + break + + pr_message += "The associated commits are:\n" + for commit in commits_data: + message = commit.get("commit", {}).get("message", "").splitlines()[0] + if message: + pr_message += message + "\n" + + # Check for 'Link' header to determine if more pages exist + # This is how GitHub's API indicates pagination + if "Link" in response.headers: + link_header = response.headers["Link"] + if 'rel="next"' in link_header: + page += 1 # Move to the next page + else: + break # No more pages + else: + break # No Link header, so probably only one page + + except requests.exceptions.HTTPError as e: + print( + f"HTTP Error fetching PR commits (page {page}):" + f" {e.response.status_code} - {e.response.text}" + ) + break + except requests.exceptions.RequestException as e: + print( + f"Network or request error fetching PR commits (page {page}): {e}" + ) + break + else: + print("Commits URL not found in PR data.") + + return pr_message + + +system_prompt = """ +You are a helpful assistant to generate reasonable descriptions for pull requests for software engineers. + +The descritions should not be too short (e.g.: less than 3 words), or too long (e.g.: more than 30 words). + +The generated description should start with `chore`, `docs`, `feat`, `fix`, `test`, or `refactor`. +`feat` stands for a new feature. +`fix` stands for a bug fix. +`chore`, `docs`, `test`, and `refactor` stand for improvements. + +Some good descriptions are: +1. feat: Added implementation for `get_eval_case`, `update_eval_case` and `delete_eval_case` for the local eval sets manager. +2. feat: Provide inject_session_state as public util method. + +Some bad descriptions are: +1. fix: This fixes bugs. +2. feat: This is a new feature. + +""" + +root_agent = Agent( + model="gemini-2.0-flash", + name="github_pr_agent", + description="Generate pull request descriptions for ADK.", + instruction=system_prompt, +) diff --git a/contributing/samples/adk_pr_agent/main.py b/contributing/samples/adk_pr_agent/main.py new file mode 100644 index 00000000..6b3bebb5 --- /dev/null +++ b/contributing/samples/adk_pr_agent/main.py @@ -0,0 +1,73 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# pylint: disable=g-importing-member + +import asyncio +import time + +import agent +from google.adk.agents.run_config import RunConfig +from google.adk.runners import InMemoryRunner +from google.adk.sessions import Session +from google.genai import types + + +async def main(): + app_name = "adk_pr_app" + user_id_1 = "adk_pr_user" + runner = InMemoryRunner( + agent=agent.root_agent, + app_name=app_name, + ) + session_11 = await runner.session_service.create_session( + app_name=app_name, user_id=user_id_1 + ) + + async def run_agent_prompt(session: Session, prompt_text: str): + content = types.Content( + role="user", parts=[types.Part.from_text(text=prompt_text)] + ) + final_agent_response_parts = [] + async for event in runner.run_async( + user_id=user_id_1, + session_id=session.id, + new_message=content, + run_config=RunConfig(save_input_blobs_as_artifacts=False), + ): + if event.content.parts and event.content.parts[0].text: + if event.author == agent.root_agent.name: + final_agent_response_parts.append(event.content.parts[0].text) + print(f"<<<< Agent Final Output: {''.join(final_agent_response_parts)}\n") + + pr_message = agent.get_github_pr_info_http(pr_number=1422) + query = "Generate pull request description for " + pr_message + await run_agent_prompt(session_11, query) + + +if __name__ == "__main__": + start_time = time.time() + print( + "Script start time:", + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(start_time)), + ) + print("------------------------------------") + asyncio.run(main()) + end_time = time.time() + print("------------------------------------") + print( + "Script end time:", + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(end_time)), + ) + print("Total script execution time:", f"{end_time - start_time:.2f} seconds") diff --git a/contributing/samples/adk_triaging_agent/agent.py b/contributing/samples/adk_triaging_agent/agent.py index dcd9b958..b5ad1950 100644 --- a/contributing/samples/adk_triaging_agent/agent.py +++ b/contributing/samples/adk_triaging_agent/agent.py @@ -25,18 +25,18 @@ from adk_triaging_agent.utils import post_request from google.adk import Agent import requests -ALLOWED_LABELS = [ - "documentation", - "services", - "question", - "tools", - "eval", - "live", - "models", - "tracing", - "core", - "web", -] +LABEL_TO_OWNER = { + "documentation": "polong", + "services": "DeanChensj", + "question": "", + "tools": "seanzhou1023", + "eval": "ankursharmas", + "live": "hangfei", + "models": "selcukgun", + "tracing": "Jacksunwei", + "core": "Jacksunwei", + "web": "wyf7107", +} APPROVAL_INSTRUCTION = ( "Do not ask for user approval for labeling! If you can't find appropriate" @@ -78,33 +78,61 @@ def list_unlabeled_issues(issue_count: int) -> dict[str, Any]: return {"status": "success", "issues": unlabeled_issues} -def add_label_to_issue(issue_number: int, label: str) -> dict[str, Any]: - """Add the specified label to the given issue number. +def add_label_and_owner_to_issue( + issue_number: int, label: str +) -> dict[str, Any]: + """Add the specified label and owner to the given issue number. Args: issue_number: issue number of the Github issue. label: label to assign Returns: - The the status of this request, with the applied label when successful. + The the status of this request, with the applied label and assigned owner + when successful. """ print(f"Attempting to add label '{label}' to issue #{issue_number}") - if label not in ALLOWED_LABELS: + if label not in LABEL_TO_OWNER: return error_response( f"Error: Label '{label}' is not an allowed label. Will not apply." ) - url = f"{GITHUB_BASE_URL}/repos/{OWNER}/{REPO}/issues/{issue_number}/labels" - payload = [label, BOT_LABEL] + label_url = ( + f"{GITHUB_BASE_URL}/repos/{OWNER}/{REPO}/issues/{issue_number}/labels" + ) + label_payload = [label, BOT_LABEL] try: - response = post_request(url, payload) + response = post_request(label_url, label_payload) except requests.exceptions.RequestException as e: return error_response(f"Error: {e}") + + owner = LABEL_TO_OWNER.get(label, None) + if not owner: + return { + "status": "warning", + "message": ( + f"{response}\n\nLabel '{label}' does not have an owner. Will not" + " assign." + ), + "applied_label": label, + } + + assignee_url = ( + f"{GITHUB_BASE_URL}/repos/{OWNER}/{REPO}/issues/{issue_number}/assignees" + ) + assignee_payload = {"assignees": [owner]} + + try: + response = post_request(assignee_url, assignee_payload) + except requests.exceptions.RequestException as e: + return error_response(f"Error: {e}") + return { "status": "success", "message": response, "applied_label": label, + "assigned_owner": owner, } @@ -128,9 +156,12 @@ root_agent = Agent( - If it's agent orchestration, agent definition, label it with "core". - If you can't find a appropriate labels for the issue, follow the previous instruction that starts with "IMPORTANT:". + Call the `add_label_and_owner_to_issue` tool to label the issue, which will also assign the issue to the owner of the label. + Present the followings in an easy to read format highlighting issue number and your label. - the issue summary in a few sentence - your label recommendation and justification + - the owner of the label if you assign the issue to an owner """, - tools=[list_unlabeled_issues, add_label_to_issue], + tools=[list_unlabeled_issues, add_label_and_owner_to_issue], ) diff --git a/contributing/samples/google_search_agent/agent.py b/contributing/samples/google_search_agent/agent.py index 4056f1ef..cbf69e7b 100644 --- a/contributing/samples/google_search_agent/agent.py +++ b/contributing/samples/google_search_agent/agent.py @@ -14,10 +14,6 @@ from google.adk import Agent from google.adk.tools import google_search -from google.genai import Client - -# Only Vertex AI supports image generation for now. -client = Client() root_agent = Agent( model='gemini-2.0-flash-001', diff --git a/pyproject.toml b/pyproject.toml index 3b4ef0be..a646747c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,7 @@ dependencies = [ "typing-extensions>=4.5, <5", "tzlocal>=5.3", # Time zone utilities "uvicorn>=0.34.0", # ASGI server for FastAPI + "watchdog>=6.0.0", # For file change detection and hot reload "websockets>=15.0.1", # For BaseLlmFlow # go/keep-sorted end ] diff --git a/src/google/adk/agents/agent_config.py b/src/google/adk/agents/agent_config.py new file mode 100644 index 00000000..f32f0f96 --- /dev/null +++ b/src/google/adk/agents/agent_config.py @@ -0,0 +1,46 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +from typing import Union + +from pydantic import RootModel + +from ..utils.feature_decorator import working_in_progress +from .llm_agent import LlmAgentConfig +from .loop_agent import LoopAgentConfig +from .parallel_agent import ParallelAgentConfig +from .sequential_agent import SequentialAgentConfig + +# A discriminated union of all possible agent configurations. +ConfigsUnion = Union[ + LlmAgentConfig, + LoopAgentConfig, + ParallelAgentConfig, + SequentialAgentConfig, +] + + +# Use a RootModel to represent the agent directly at the top level. +# The `discriminator` is applied to the union within the RootModel. +@working_in_progress("AgentConfig is not ready for use.") +class AgentConfig(RootModel[ConfigsUnion]): + """The config for the YAML schema to create an agent.""" + + class Config: + # Pydantic v2 requires this for discriminated unions on RootModel + # This tells the model to look at the 'agent_class' field of the input + # data to decide which model from the `ConfigsUnion` to use. + discriminator = "agent_class" diff --git a/src/google/adk/agents/base_agent.py b/src/google/adk/agents/base_agent.py index bdc10ac3..645256fd 100644 --- a/src/google/adk/agents/base_agent.py +++ b/src/google/adk/agents/base_agent.py @@ -19,9 +19,14 @@ from typing import Any from typing import AsyncGenerator from typing import Awaitable from typing import Callable +from typing import Dict from typing import final +from typing import Literal +from typing import Mapping from typing import Optional +from typing import Type from typing import TYPE_CHECKING +from typing import TypeVar from typing import Union from google.genai import types @@ -34,6 +39,7 @@ from typing_extensions import override from typing_extensions import TypeAlias from ..events.event import Event +from ..utils.feature_decorator import working_in_progress from .callback_context import CallbackContext if TYPE_CHECKING: @@ -56,6 +62,8 @@ AfterAgentCallback: TypeAlias = Union[ list[_SingleAgentCallback], ] +SelfAgent = TypeVar('SelfAgent', bound='BaseAgent') + class BaseAgent(BaseModel): """Base class for all agents in Agent Development Kit.""" @@ -121,6 +129,56 @@ class BaseAgent(BaseModel): response and appended to event history as agent response. """ + def clone( + self: SelfAgent, update: Mapping[str, Any] | None = None + ) -> SelfAgent: + """Creates a copy of this agent instance. + + Args: + update: Optional mapping of new values for the fields of the cloned agent. + The keys of the mapping are the names of the fields to be updated, and + the values are the new values for those fields. + For example: {"name": "cloned_agent"} + + Returns: + A new agent instance with identical configuration as the original + agent except for the fields specified in the update. + """ + if update is not None and 'parent_agent' in update: + raise ValueError( + 'Cannot update `parent_agent` field in clone. Parent agent is set' + ' only when the parent agent is instantiated with the sub-agents.' + ) + + # Only allow updating fields that are defined in the agent class. + allowed_fields = set(self.__class__.model_fields) + if update is not None: + invalid_fields = set(update) - allowed_fields + if invalid_fields: + raise ValueError( + f'Cannot update non-existent fields in {self.__class__.__name__}:' + f' {invalid_fields}' + ) + + cloned_agent = self.model_copy(update=update) + + if update is None or 'sub_agents' not in update: + # If `sub_agents` is not provided in the update, need to recursively clone + # the sub-agents to avoid sharing the sub-agents with the original agent. + cloned_agent.sub_agents = [] + for sub_agent in self.sub_agents: + cloned_sub_agent = sub_agent.clone() + cloned_sub_agent.parent_agent = cloned_agent + cloned_agent.sub_agents.append(cloned_sub_agent) + else: + for sub_agent in cloned_agent.sub_agents: + sub_agent.parent_agent = cloned_agent + + # Remove the parent agent from the cloned agent to avoid sharing the parent + # agent with the cloned agent. + cloned_agent.parent_agent = None + return cloned_agent + @final async def run_async( self, @@ -169,11 +227,18 @@ class BaseAgent(BaseModel): """ with tracer.start_as_current_span(f'agent_run [{self.name}]'): ctx = self._create_invocation_context(parent_context) - # TODO(hangfei): support before/after_agent_callback + + if event := await self.__handle_before_agent_callback(ctx): + yield event + if ctx.end_invocation: + return async for event in self._run_live_impl(ctx): yield event + if event := await self.__handle_after_agent_callback(ctx): + yield event + async def _run_async_impl( self, ctx: InvocationContext ) -> AsyncGenerator[Event, None]: @@ -277,73 +342,99 @@ class BaseAgent(BaseModel): ) -> Optional[Event]: """Runs the before_agent_callback if it exists. + Args: + ctx: InvocationContext, the invocation context for this agent. + Returns: Optional[Event]: an event if callback provides content or changed state. """ - ret_event = None - - if not self.canonical_before_agent_callbacks: - return ret_event - callback_context = CallbackContext(ctx) - for callback in self.canonical_before_agent_callbacks: - before_agent_callback_content = callback( - callback_context=callback_context - ) - if inspect.isawaitable(before_agent_callback_content): - before_agent_callback_content = await before_agent_callback_content - if before_agent_callback_content: - ret_event = Event( - invocation_id=ctx.invocation_id, - author=self.name, - branch=ctx.branch, - content=before_agent_callback_content, - actions=callback_context._event_actions, + # Run callbacks from the plugins. + before_agent_callback_content = ( + await ctx.plugin_manager.run_before_agent_callback( + agent=self, callback_context=callback_context ) - ctx.end_invocation = True - return ret_event + ) + + # If no overrides are provided from the plugins, further run the canonical + # callbacks. + if ( + not before_agent_callback_content + and self.canonical_before_agent_callbacks + ): + for callback in self.canonical_before_agent_callbacks: + before_agent_callback_content = callback( + callback_context=callback_context + ) + if inspect.isawaitable(before_agent_callback_content): + before_agent_callback_content = await before_agent_callback_content + if before_agent_callback_content: + break + + # Process the override content if exists, and further process the state + # change if exists. + if before_agent_callback_content: + ret_event = Event( + invocation_id=ctx.invocation_id, + author=self.name, + branch=ctx.branch, + content=before_agent_callback_content, + actions=callback_context._event_actions, + ) + ctx.end_invocation = True + return ret_event if callback_context.state.has_delta(): - ret_event = Event( + return Event( invocation_id=ctx.invocation_id, author=self.name, branch=ctx.branch, actions=callback_context._event_actions, ) - return ret_event + return None async def __handle_after_agent_callback( self, invocation_context: InvocationContext ) -> Optional[Event]: """Runs the after_agent_callback if it exists. + Args: + invocation_context: InvocationContext, the invocation context for this + agent. + Returns: Optional[Event]: an event if callback provides content or changed state. """ - ret_event = None - - if not self.canonical_after_agent_callbacks: - return ret_event callback_context = CallbackContext(invocation_context) - for callback in self.canonical_after_agent_callbacks: - after_agent_callback_content = callback(callback_context=callback_context) - if inspect.isawaitable(after_agent_callback_content): - after_agent_callback_content = await after_agent_callback_content - if after_agent_callback_content: - ret_event = Event( - invocation_id=invocation_context.invocation_id, - author=self.name, - branch=invocation_context.branch, - content=after_agent_callback_content, - actions=callback_context._event_actions, + # Run callbacks from the plugins. + after_agent_callback_content = ( + await invocation_context.plugin_manager.run_after_agent_callback( + agent=self, callback_context=callback_context ) - return ret_event + ) - if callback_context.state.has_delta(): + # If no overrides are provided from the plugins, further run the canonical + # callbacks. + if ( + not after_agent_callback_content + and self.canonical_after_agent_callbacks + ): + for callback in self.canonical_after_agent_callbacks: + after_agent_callback_content = callback( + callback_context=callback_context + ) + if inspect.isawaitable(after_agent_callback_content): + after_agent_callback_content = await after_agent_callback_content + if after_agent_callback_content: + break + + # Process the override content if exists, and further process the state + # change if exists. + if after_agent_callback_content: ret_event = Event( invocation_id=invocation_context.invocation_id, author=self.name, @@ -351,8 +442,17 @@ class BaseAgent(BaseModel): content=after_agent_callback_content, actions=callback_context._event_actions, ) + return ret_event - return ret_event + if callback_context.state.has_delta(): + return Event( + invocation_id=invocation_context.invocation_id, + author=self.name, + branch=invocation_context.branch, + content=after_agent_callback_content, + actions=callback_context._event_actions, + ) + return None @override def model_post_init(self, __context: Any) -> None: @@ -385,3 +485,49 @@ class BaseAgent(BaseModel): ) sub_agent.parent_agent = self return self + + @classmethod + @working_in_progress('BaseAgent.from_config is not ready for use.') + def from_config( + cls: Type[SelfAgent], + config: BaseAgentConfig, + ) -> SelfAgent: + """Creates an agent from a config. + + This method converts fields in a config to the corresponding + fields in an agent. + + Child classes should re-implement this method to support loading from their + custom config types. + + Args: + config: The config to create the agent from. + + Returns: + The created agent. + """ + kwargs: Dict[str, Any] = { + 'name': config.name, + 'description': config.description, + } + return cls(**kwargs) + + +@working_in_progress('BaseAgentConfig is not ready for use.') +class BaseAgentConfig(BaseModel): + """The config for the YAML schema of a BaseAgent. + + Do not use this class directly. It's the base class for all agent configs. + """ + + model_config = ConfigDict(extra='forbid') + + agent_class: Literal['BaseAgent'] = 'BaseAgent' + """Required. The class of the agent. The value is used to differentiate + among different agent classes.""" + + name: str + """Required. The name of the agent.""" + + description: str = '' + """Optional. The description of the agent.""" diff --git a/src/google/adk/agents/config_agent_utils.py b/src/google/adk/agents/config_agent_utils.py new file mode 100644 index 00000000..a9609b68 --- /dev/null +++ b/src/google/adk/agents/config_agent_utils.py @@ -0,0 +1,88 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import os +from pathlib import Path + +import yaml + +from ..utils.feature_decorator import working_in_progress +from .agent_config import AgentConfig +from .base_agent import BaseAgent +from .llm_agent import LlmAgent +from .llm_agent import LlmAgentConfig +from .loop_agent import LoopAgent +from .loop_agent import LoopAgentConfig +from .parallel_agent import ParallelAgent +from .parallel_agent import ParallelAgentConfig +from .sequential_agent import SequentialAgent +from .sequential_agent import SequentialAgentConfig + + +@working_in_progress("from_config is not ready for use.") +def from_config(config_path: str) -> BaseAgent: + """Build agent from a configfile path. + + Args: + config: the path to a YAML config file. + + Returns: + The created agent instance. + + Raises: + FileNotFoundError: If config file doesn't exist. + ValidationError: If config file's content is invalid YAML. + ValueError: If agent type is unsupported. + """ + abs_path = os.path.abspath(config_path) + config = _load_config_from_path(abs_path) + + if isinstance(config.root, LlmAgentConfig): + return LlmAgent.from_config(config.root) + elif isinstance(config.root, LoopAgentConfig): + return LoopAgent.from_config(config.root) + elif isinstance(config.root, ParallelAgentConfig): + return ParallelAgent.from_config(config.root) + elif isinstance(config.root, SequentialAgentConfig): + return SequentialAgent.from_config(config.root) + else: + raise ValueError("Unsupported config type") + + +@working_in_progress("_load_config_from_path is not ready for use.") +def _load_config_from_path(config_path: str) -> AgentConfig: + """Load an agent's configuration from a YAML file. + + Args: + config_path: Path to the YAML config file. Both relative and absolute + paths are accepted. + + Returns: + The loaded and validated AgentConfig object. + + Raises: + FileNotFoundError: If config file doesn't exist. + ValidationError: If config file's content is invalid YAML. + """ + config_path = Path(config_path) + + if not config_path.exists(): + raise FileNotFoundError(f"Config file not found: {config_path}") + + with open(config_path, "r", encoding="utf-8") as f: + config_data = yaml.safe_load(f) + + return AgentConfig.model_validate(config_data) diff --git a/src/google/adk/agents/config_schemas/AgentConfig.json b/src/google/adk/agents/config_schemas/AgentConfig.json new file mode 100644 index 00000000..b353ba11 --- /dev/null +++ b/src/google/adk/agents/config_schemas/AgentConfig.json @@ -0,0 +1,180 @@ +{ + "$defs": { + "LlmAgentConfig": { + "additionalProperties": false, + "description": "The config for the YAML schema of a LlmAgent.", + "properties": { + "agent_class": { + "default": "LlmAgent", + "enum": [ + "LlmAgent", + "" + ], + "title": "Agent Class", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "default": "", + "title": "Description", + "type": "string" + }, + "model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Model" + }, + "instruction": { + "title": "Instruction", + "type": "string" + }, + "disallow_transfer_to_parent": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Disallow Transfer To Parent" + }, + "disallow_transfer_to_peers": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Disallow Transfer To Peers" + } + }, + "required": [ + "name", + "instruction" + ], + "title": "LlmAgentConfig", + "type": "object" + }, + "LoopAgentConfig": { + "additionalProperties": false, + "description": "The config for the YAML schema of a LoopAgent.", + "properties": { + "agent_class": { + "const": "LoopAgent", + "default": "LoopAgent", + "title": "Agent Class", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "default": "", + "title": "Description", + "type": "string" + }, + "max_iterations": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Max Iterations" + } + }, + "required": [ + "name" + ], + "title": "LoopAgentConfig", + "type": "object" + }, + "ParallelAgentConfig": { + "additionalProperties": false, + "description": "The config for the YAML schema of a ParallelAgent.", + "properties": { + "agent_class": { + "const": "ParallelAgent", + "default": "ParallelAgent", + "title": "Agent Class", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "default": "", + "title": "Description", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "ParallelAgentConfig", + "type": "object" + }, + "SequentialAgentConfig": { + "additionalProperties": false, + "description": "The config for the YAML schema of a SequentialAgent.", + "properties": { + "agent_class": { + "const": "SequentialAgent", + "default": "SequentialAgent", + "title": "Agent Class", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "description": { + "default": "", + "title": "Description", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "SequentialAgentConfig", + "type": "object" + } + }, + "anyOf": [ + { + "$ref": "#/$defs/LlmAgentConfig" + }, + { + "$ref": "#/$defs/LoopAgentConfig" + }, + { + "$ref": "#/$defs/ParallelAgentConfig" + }, + { + "$ref": "#/$defs/SequentialAgentConfig" + } + ], + "description": "The config for the YAML schema to create an agent.", + "title": "AgentConfig" +} \ No newline at end of file diff --git a/src/google/adk/agents/invocation_context.py b/src/google/adk/agents/invocation_context.py index 765f22a2..8af54743 100644 --- a/src/google/adk/agents/invocation_context.py +++ b/src/google/adk/agents/invocation_context.py @@ -24,6 +24,7 @@ from pydantic import ConfigDict from ..artifacts.base_artifact_service import BaseArtifactService from ..auth.credential_service.base_credential_service import BaseCredentialService from ..memory.base_memory_service import BaseMemoryService +from ..plugins.plugin_manager import PluginManager from ..sessions.base_session_service import BaseSessionService from ..sessions.session import Session from .active_streaming_tool import ActiveStreamingTool @@ -153,6 +154,9 @@ class InvocationContext(BaseModel): run_config: Optional[RunConfig] = None """Configurations for live agents under this invocation.""" + plugin_manager: PluginManager = PluginManager() + """The manager for keeping track of plugins in this invocation.""" + _invocation_cost_manager: _InvocationCostManager = _InvocationCostManager() """A container to keep track of different kinds of costs incurred as a part of this invocation. diff --git a/src/google/adk/agents/llm_agent.py b/src/google/adk/agents/llm_agent.py index a5c859e2..6c5e109a 100644 --- a/src/google/adk/agents/llm_agent.py +++ b/src/google/adk/agents/llm_agent.py @@ -20,8 +20,10 @@ from typing import Any from typing import AsyncGenerator from typing import Awaitable from typing import Callable +from typing import Dict from typing import Literal from typing import Optional +from typing import Type from typing import Union from google.genai import types @@ -48,7 +50,9 @@ from ..tools.base_tool import BaseTool from ..tools.base_toolset import BaseToolset from ..tools.function_tool import FunctionTool from ..tools.tool_context import ToolContext +from ..utils.feature_decorator import working_in_progress from .base_agent import BaseAgent +from .base_agent import BaseAgentConfig from .callback_context import CallbackContext from .invocation_context import InvocationContext from .readonly_context import ReadonlyContext @@ -516,5 +520,44 @@ class LlmAgent(BaseAgent): ) return generate_content_config + @classmethod + @override + @working_in_progress('LlmAgent.from_config is not ready for use.') + def from_config( + cls: Type[LlmAgent], + config: LlmAgentConfig, + ) -> LlmAgent: + agent = super().from_config(config) + if config.model: + agent.model = config.model + if config.instruction: + agent.instruction = config.instruction + if config.disallow_transfer_to_parent: + agent.disallow_transfer_to_parent = config.disallow_transfer_to_parent + if config.disallow_transfer_to_peers: + agent.disallow_transfer_to_peers = config.disallow_transfer_to_peers + return agent + Agent: TypeAlias = LlmAgent + + +class LlmAgentConfig(BaseAgentConfig): + """The config for the YAML schema of a LlmAgent.""" + + agent_class: Literal['LlmAgent', ''] = 'LlmAgent' + """The value is used to uniquely identify the LlmAgent class. If it is + empty, it is by default an LlmAgent.""" + + model: Optional[str] = None + """Optional. LlmAgent.model. If not set, the model will be inherited from + the ancestor.""" + + instruction: str + """Required. LlmAgent.instruction.""" + + disallow_transfer_to_parent: Optional[bool] = None + """Optional. LlmAgent.disallow_transfer_to_parent.""" + + disallow_transfer_to_peers: Optional[bool] = None + """Optional. LlmAgent.disallow_transfer_to_peers.""" diff --git a/src/google/adk/agents/loop_agent.py b/src/google/adk/agents/loop_agent.py index 219e0c22..7a2c2230 100644 --- a/src/google/adk/agents/loop_agent.py +++ b/src/google/adk/agents/loop_agent.py @@ -16,14 +16,20 @@ from __future__ import annotations +from typing import Any from typing import AsyncGenerator +from typing import Dict +from typing import Literal from typing import Optional +from typing import Type from typing_extensions import override from ..agents.invocation_context import InvocationContext from ..events.event import Event +from ..utils.feature_decorator import working_in_progress from .base_agent import BaseAgent +from .base_agent import BaseAgentConfig class LoopAgent(BaseAgent): @@ -60,3 +66,25 @@ class LoopAgent(BaseAgent): ) -> AsyncGenerator[Event, None]: raise NotImplementedError('This is not supported yet for LoopAgent.') yield # AsyncGenerator requires having at least one yield statement + + @classmethod + @override + @working_in_progress('LoopAgent.from_config is not ready for use.') + def from_config( + cls: Type[LoopAgent], + config: LoopAgentConfig, + ) -> LoopAgent: + agent = super().from_config(config) + if config.max_iterations: + agent.max_iterations = config.max_iterations + return agent + + +@working_in_progress('LoopAgentConfig is not ready for use.') +class LoopAgentConfig(BaseAgentConfig): + """The config for the YAML schema of a LoopAgent.""" + + agent_class: Literal['LoopAgent'] = 'LoopAgent' + + max_iterations: Optional[int] = None + """Optional. LoopAgent.max_iterations.""" diff --git a/src/google/adk/agents/parallel_agent.py b/src/google/adk/agents/parallel_agent.py index 427128ce..10b573bb 100644 --- a/src/google/adk/agents/parallel_agent.py +++ b/src/google/adk/agents/parallel_agent.py @@ -18,9 +18,13 @@ from __future__ import annotations import asyncio from typing import AsyncGenerator +from typing import Literal +from typing import Type from typing_extensions import override +from ..agents.base_agent import BaseAgentConfig +from ..agents.base_agent import working_in_progress from ..agents.invocation_context import InvocationContext from ..events.event import Event from .base_agent import BaseAgent @@ -33,9 +37,9 @@ def _create_branch_ctx_for_sub_agent( ) -> InvocationContext: """Create isolated branch for every sub-agent.""" invocation_context = invocation_context.model_copy() - branch_suffix = f"{agent.name}.{sub_agent.name}" + branch_suffix = f'{agent.name}.{sub_agent.name}' invocation_context.branch = ( - f"{invocation_context.branch}.{branch_suffix}" + f'{invocation_context.branch}.{branch_suffix}' if invocation_context.branch else branch_suffix ) @@ -109,5 +113,21 @@ class ParallelAgent(BaseAgent): async def _run_live_impl( self, ctx: InvocationContext ) -> AsyncGenerator[Event, None]: - raise NotImplementedError("This is not supported yet for ParallelAgent.") + raise NotImplementedError('This is not supported yet for ParallelAgent.') yield # AsyncGenerator requires having at least one yield statement + + @classmethod + @override + @working_in_progress('ParallelAgent.from_config is not ready for use.') + def from_config( + cls: Type[ParallelAgent], + config: ParallelAgentConfig, + ) -> ParallelAgent: + return super().from_config(config) + + +@working_in_progress('ParallelAgentConfig is not ready for use.') +class ParallelAgentConfig(BaseAgentConfig): + """The config for the YAML schema of a ParallelAgent.""" + + agent_class: Literal['ParallelAgent'] = 'ParallelAgent' diff --git a/src/google/adk/agents/sequential_agent.py b/src/google/adk/agents/sequential_agent.py index 845dd5ac..e094f8ae 100644 --- a/src/google/adk/agents/sequential_agent.py +++ b/src/google/adk/agents/sequential_agent.py @@ -17,9 +17,13 @@ from __future__ import annotations from typing import AsyncGenerator +from typing import Literal +from typing import Type from typing_extensions import override +from ..agents.base_agent import BaseAgentConfig +from ..agents.base_agent import working_in_progress from ..agents.invocation_context import InvocationContext from ..events.event import Event from .base_agent import BaseAgent @@ -60,7 +64,7 @@ class SequentialAgent(BaseAgent): Signals that the model has successfully completed the user's question or task. """ - return "Task completion signaled." + return 'Task completion signaled.' if isinstance(sub_agent, LlmAgent): # Use function name to dedupe. @@ -74,3 +78,19 @@ class SequentialAgent(BaseAgent): for sub_agent in self.sub_agents: async for event in sub_agent.run_live(ctx): yield event + + @classmethod + @override + @working_in_progress('SequentialAgent.from_config is not ready for use.') + def from_config( + cls: Type[SequentialAgent], + config: SequentialAgentConfig, + ) -> SequentialAgent: + return super().from_config(config) + + +@working_in_progress('SequentialAgentConfig is not ready for use.') +class SequentialAgentConfig(BaseAgentConfig): + """The config for the YAML schema of a SequentialAgent.""" + + agent_class: Literal['SequentialAgent'] = 'SequentialAgent' diff --git a/src/google/adk/auth/auth_handler.py b/src/google/adk/auth/auth_handler.py index 473f3141..2e2a9a07 100644 --- a/src/google/adk/auth/auth_handler.py +++ b/src/google/adk/auth/auth_handler.py @@ -30,9 +30,9 @@ if TYPE_CHECKING: try: from authlib.integrations.requests_client import OAuth2Session - AUTHLIB_AVIALABLE = True + AUTHLIB_AVAILABLE = True except ImportError: - AUTHLIB_AVIALABLE = False + AUTHLIB_AVAILABLE = False class AuthHandler: @@ -146,7 +146,7 @@ class AuthHandler: ValueError: If the authorization endpoint is not configured in the auth scheme. """ - if not AUTHLIB_AVIALABLE: + if not AUTHLIB_AVAILABLE: return ( self.auth_config.raw_auth_credential.model_copy(deep=True) if self.auth_config.raw_auth_credential diff --git a/src/google/adk/auth/exchanger/oauth2_credential_exchanger.py b/src/google/adk/auth/exchanger/oauth2_credential_exchanger.py index 768457e1..4231a7c1 100644 --- a/src/google/adk/auth/exchanger/oauth2_credential_exchanger.py +++ b/src/google/adk/auth/exchanger/oauth2_credential_exchanger.py @@ -33,9 +33,9 @@ from .base_credential_exchanger import CredentialExchangError try: from authlib.integrations.requests_client import OAuth2Session - AUTHLIB_AVIALABLE = True + AUTHLIB_AVAILABLE = True except ImportError: - AUTHLIB_AVIALABLE = False + AUTHLIB_AVAILABLE = False logger = logging.getLogger("google_adk." + __name__) @@ -68,7 +68,7 @@ class OAuth2CredentialExchanger(BaseCredentialExchanger): "auth_scheme is required for OAuth2 credential exchange" ) - if not AUTHLIB_AVIALABLE: + if not AUTHLIB_AVAILABLE: # If authlib is not available, we cannot exchange the credential. # We return the original credential without exchange. # The client using this tool can decide to exchange the credential diff --git a/src/google/adk/auth/oauth2_credential_util.py b/src/google/adk/auth/oauth2_credential_util.py index 51ed4d29..cc315bd2 100644 --- a/src/google/adk/auth/oauth2_credential_util.py +++ b/src/google/adk/auth/oauth2_credential_util.py @@ -29,9 +29,9 @@ try: from authlib.integrations.requests_client import OAuth2Session from authlib.oauth2.rfc6749 import OAuth2Token - AUTHLIB_AVIALABLE = True + AUTHLIB_AVAILABLE = True except ImportError: - AUTHLIB_AVIALABLE = False + AUTHLIB_AVAILABLE = False logger = logging.getLogger("google_adk." + __name__) diff --git a/src/google/adk/auth/refresher/oauth2_credential_refresher.py b/src/google/adk/auth/refresher/oauth2_credential_refresher.py index 4c19520c..02d8ebfb 100644 --- a/src/google/adk/auth/refresher/oauth2_credential_refresher.py +++ b/src/google/adk/auth/refresher/oauth2_credential_refresher.py @@ -34,9 +34,9 @@ from .base_credential_refresher import BaseCredentialRefresher try: from authlib.oauth2.rfc6749 import OAuth2Token - AUTHLIB_AVIALABLE = True + AUTHLIB_AVAILABLE = True except ImportError: - AUTHLIB_AVIALABLE = False + AUTHLIB_AVAILABLE = False logger = logging.getLogger("google_adk." + __name__) @@ -63,7 +63,7 @@ class OAuth2CredentialRefresher(BaseCredentialRefresher): # Handle regular OAuth2 credentials if auth_credential.oauth2: - if not AUTHLIB_AVIALABLE: + if not AUTHLIB_AVAILABLE: return False return OAuth2Token({ @@ -93,7 +93,7 @@ class OAuth2CredentialRefresher(BaseCredentialRefresher): # Handle regular OAuth2 credentials if auth_credential.oauth2 and auth_scheme: - if not AUTHLIB_AVIALABLE: + if not AUTHLIB_AVAILABLE: return auth_credential if not auth_credential.oauth2: diff --git a/src/google/adk/cli/agent_graph.py b/src/google/adk/cli/agent_graph.py index 249e5bfb..2df968f8 100644 --- a/src/google/adk/cli/agent_graph.py +++ b/src/google/adk/cli/agent_graph.py @@ -284,7 +284,9 @@ async def build_graph( async def get_agent_graph(root_agent, highlights_pairs, image=False): print('build graph') - graph = graphviz.Digraph(graph_attr={'rankdir': 'LR', 'bgcolor': '#333537'}) + graph = graphviz.Digraph( + graph_attr={'rankdir': 'LR', 'bgcolor': '#333537'}, strict=True + ) await build_graph(graph, root_agent, highlights_pairs) if image: return graph.pipe(format='png') diff --git a/src/google/adk/cli/browser/index.html b/src/google/adk/cli/browser/index.html index ebd088d3..34e22268 100644 --- a/src/google/adk/cli/browser/index.html +++ b/src/google/adk/cli/browser/index.html @@ -23,11 +23,12 @@ - + + - + - + diff --git a/src/google/adk/cli/browser/main-KQCFA2KU.js b/src/google/adk/cli/browser/main-RXDVX3K6.js similarity index 97% rename from src/google/adk/cli/browser/main-KQCFA2KU.js rename to src/google/adk/cli/browser/main-RXDVX3K6.js index 793b49a6..83f7fa72 100644 --- a/src/google/adk/cli/browser/main-KQCFA2KU.js +++ b/src/google/adk/cli/browser/main-RXDVX3K6.js @@ -3847,7 +3847,7 @@ button.jse-context-menu-button.svelte-1idfykj svg { --jse-context-menu-pointer-background: var(--jse-context-menu-pointer-hover-background, #b2b2b2); }`);var GJA=pA('
',1);function UJA(t,e){st(e,!1);var A=X(void 0,!0),i=wr("jsoneditor:JSONEditor"),n={text:""},o=void 0,r=!1,s=tr.tree,a=!0,c=!0,l=!0,I=!0,C=!1,d=!1,B=!0,E=JSON,Q=void 0,u=JSON,v={parse:qGA,stringify:Dl},L=[lGA],x=L[0].id,y=Kc,F=void 0,U=void 0,T=jGA,N=Kc,K=Kc,H=Kc,j=Kc,IA=se=>{console.error(se),alert(se.toString())},lA=Kc,uA=Kc,p=k(e,"content",13,n),V=k(e,"selection",13,o),cA=k(e,"readOnly",13,r),aA=k(e,"indentation",13,2),jA=k(e,"tabSize",13,4),VA=k(e,"truncateTextSize",13,1e3),ce=k(e,"mode",13,s),EA=k(e,"mainMenuBar",13,a),sA=k(e,"navigationBar",13,c),TA=k(e,"statusBar",13,l),Ke=k(e,"askToFormat",13,I),Re=k(e,"escapeControlCharacters",13,C),hA=k(e,"escapeUnicodeCharacters",13,d),eA=k(e,"flattenColumns",13,B),RA=k(e,"parser",13,E),oA=k(e,"validator",13,Q),ne=k(e,"validationParser",13,u),h=k(e,"pathParser",13,v),f=k(e,"queryLanguages",13,L),w=k(e,"queryLanguageId",13,x),D=k(e,"onChangeQueryLanguage",13,y),O=k(e,"onChange",13,F),Z=k(e,"onSelect",13,U),q=k(e,"onRenderValue",13,T),CA=k(e,"onClassName",13,N),kA=k(e,"onRenderMenu",13,K),KA=k(e,"onRenderContextMenu",13,H),Ie=k(e,"onChangeMode",13,j),GA=k(e,"onError",13,IA),oe=k(e,"onFocus",13,lA),M=k(e,"onBlur",13,uA),G=X(TE(),!0),Y=X(!1,!0),AA=X(void 0,!0),dA=X(void 0,!0),WA=X(void 0,!0),Qe=X(void 0,!0),yA=X(RA(),!0);function DA(){return p()}function We(se){i("set");var fi=MN(se);if(fi)throw new Error(fi);b(G,TE()),p(se),go()}function be(se){i("update");var fi=MN(se);if(fi)throw new Error(fi);p(se),go()}function qA(se){var fi=g(AA).patch(se);return go(),fi}function It(se){V(se),go()}function Vi(se,fi){g(AA).expand(se,fi),go()}function on(se){var fi=arguments.length>1&&arguments[1]!==void 0&&arguments[1];g(AA).collapse(se,fi),go()}function Hi(){var se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};g(AA).transform(se),go()}function Ci(){return g(AA).validate()}function Zi(){var se=g(AA).acceptAutoRepair();return go(),se}function Qi(se){return Ft.apply(this,arguments)}function Ft(){return(Ft=yt(function*(se){yield g(AA).scrollTo(se)})).apply(this,arguments)}function Tt(se){return g(AA).findElement(se)}function Ht(){g(AA).focus(),go()}function zi(){return ui.apply(this,arguments)}function ui(){return(ui=yt(function*(){yield g(AA).refresh()})).apply(this,arguments)}function Ye(se){var fi,bA,fe,it,Gt,Xe,Ot,Pi,Jt,Ki,Ct,ti,$e,Nt,Wi,Tn,ii,Ri,dt,zn,QA,_A,Ce,Pt,Li,ai,Fn,Co,Qn,un,jt,Nn=Object.keys(se);for(var ut of Nn)switch(ut){case"content":p((fi=se[ut])!==null&&fi!==void 0?fi:n);break;case"selection":V((bA=se[ut])!==null&&bA!==void 0?bA:o);break;case"readOnly":cA((fe=se[ut])!==null&&fe!==void 0?fe:r);break;case"indentation":aA((it=se[ut])!==null&&it!==void 0?it:2);break;case"tabSize":jA((Gt=se[ut])!==null&&Gt!==void 0?Gt:4);break;case"truncateTextSize":VA((Xe=se[ut])!==null&&Xe!==void 0?Xe:1e3);break;case"mode":ce((Ot=se[ut])!==null&&Ot!==void 0?Ot:s);break;case"mainMenuBar":EA((Pi=se[ut])!==null&&Pi!==void 0?Pi:a);break;case"navigationBar":sA((Jt=se[ut])!==null&&Jt!==void 0?Jt:c);break;case"statusBar":TA((Ki=se[ut])!==null&&Ki!==void 0?Ki:l);break;case"askToFormat":Ke((Ct=se[ut])!==null&&Ct!==void 0?Ct:I);break;case"escapeControlCharacters":Re((ti=se[ut])!==null&&ti!==void 0?ti:C);break;case"escapeUnicodeCharacters":hA(($e=se[ut])!==null&&$e!==void 0?$e:d);break;case"flattenColumns":eA((Nt=se[ut])!==null&&Nt!==void 0?Nt:B);break;case"parser":RA((Wi=se[ut])!==null&&Wi!==void 0?Wi:E);break;case"validator":oA((Tn=se[ut])!==null&&Tn!==void 0?Tn:Q);break;case"validationParser":ne((ii=se[ut])!==null&&ii!==void 0?ii:u);break;case"pathParser":h((Ri=se[ut])!==null&&Ri!==void 0?Ri:v);break;case"queryLanguages":f((dt=se[ut])!==null&&dt!==void 0?dt:L);break;case"queryLanguageId":w((zn=se[ut])!==null&&zn!==void 0?zn:x);break;case"onChangeQueryLanguage":D((QA=se[ut])!==null&&QA!==void 0?QA:y);break;case"onChange":O((_A=se[ut])!==null&&_A!==void 0?_A:F);break;case"onRenderValue":q((Ce=se[ut])!==null&&Ce!==void 0?Ce:T);break;case"onClassName":CA((Pt=se[ut])!==null&&Pt!==void 0?Pt:N);break;case"onRenderMenu":kA((Li=se[ut])!==null&&Li!==void 0?Li:K);break;case"onRenderContextMenu":KA((ai=se[ut])!==null&&ai!==void 0?ai:H);break;case"onChangeMode":Ie((Fn=se[ut])!==null&&Fn!==void 0?Fn:j);break;case"onSelect":Z((Co=se[ut])!==null&&Co!==void 0?Co:U);break;case"onError":GA((Qn=se[ut])!==null&&Qn!==void 0?Qn:IA);break;case"onFocus":oe((un=se[ut])!==null&&un!==void 0?un:lA);break;case"onBlur":M((jt=se[ut])!==null&&jt!==void 0?jt:uA);break;default:Xo(ut)}function Xo(Oe){i('Unknown property "'.concat(Oe,'"'))}f().some(Oe=>Oe.id===w())||w(f()[0].id),go()}function Ai(){return ei.apply(this,arguments)}function ei(){return(ei=yt(function*(){throw new Error("class method destroy() is deprecated. It is replaced with a method destroy() in the vanilla library.")})).apply(this,arguments)}function Oi(se,fi,bA){p(se),O()&&O()(se,fi,bA)}function Yn(se){V(se),Z()&&Z()(Tu(se))}function Dn(){b(Y,!0),oe()&&oe()()}function Ho(){b(Y,!1),M()&&M()()}function Sn(se){return io.apply(this,arguments)}function io(){return(io=yt(function*(se){ce()!==se&&(ce(se),go(),Ht(),Ie()(se))})).apply(this,arguments)}function Wo(se){i("handleChangeQueryLanguage",se),w(se),D()(se)}function No(se){var{id:fi,json:bA,rootPath:fe,onTransform:it,onClose:Gt}=se;cA()||b(Qe,{id:fi,json:bA,rootPath:fe,indentation:aA(),truncateTextSize:VA(),escapeControlCharacters:Re(),escapeUnicodeCharacters:hA(),parser:RA(),parseMemoizeOne:g(A),validationParser:ne(),pathParser:h(),queryLanguages:f(),queryLanguageId:w(),onChangeQueryLanguage:Wo,onRenderValue:q(),onRenderMenu:Xe=>kA()(Xe,{mode:ce(),modal:!0,readOnly:cA()}),onRenderContextMenu:Xe=>KA()(Xe,{mode:ce(),modal:!0,readOnly:cA(),selection:V()}),onClassName:CA(),onTransform:it,onClose:Gt})}function Jn(se){cA()||b(WA,se)}function hn(se){var{content:fi,path:bA,onPatch:fe,onClose:it}=se;i("onJSONEditorModal",{content:fi,path:bA}),b(dA,{content:fi,path:bA,onPatch:fe,readOnly:cA(),indentation:aA(),tabSize:jA(),truncateTextSize:VA(),mainMenuBar:EA(),navigationBar:sA(),statusBar:TA(),askToFormat:Ke(),escapeControlCharacters:Re(),escapeUnicodeCharacters:hA(),flattenColumns:eA(),parser:RA(),validator:void 0,validationParser:ne(),pathParser:h(),onRenderValue:q(),onClassName:CA(),onRenderMenu:kA(),onRenderContextMenu:KA(),onSortModal:Jn,onTransformModal:No,onClose:it})}function wo(se){se.stopPropagation()}return fA(()=>(W(RA()),g(yA),W(p()),TE),()=>{if(!IsA(RA(),g(yA))){if(i("parser changed, recreate editor"),k3(p())){var se=g(yA).stringify(p().json);p({json:se!==void 0?RA().parse(se):void 0})}b(yA,RA()),b(G,TE())}}),fA(()=>W(p()),()=>{var se=MN(p());se&&console.error("Error: "+se)}),fA(()=>W(V()),()=>{V()===null&&console.warn("selection is invalid: it is null but should be undefined")}),fA(()=>W(RA()),()=>{b(A,VB(RA().parse))}),fA(()=>W(ce()),()=>{i("mode changed to",ce())}),nn(),Rt(!0),c_(t,{children:(se,fi)=>{var bA,fe=GJA(),it=Bt(fe);$rA($(it),()=>g(G),Ct=>{to(urA(Ct,{get externalMode(){return ce()},get content(){return p()},get selection(){return V()},get readOnly(){return cA()},get indentation(){return aA()},get tabSize(){return jA()},get truncateTextSize(){return VA()},get statusBar(){return TA()},get askToFormat(){return Ke()},get mainMenuBar(){return EA()},get navigationBar(){return sA()},get escapeControlCharacters(){return Re()},get escapeUnicodeCharacters(){return hA()},get flattenColumns(){return eA()},get parser(){return RA()},get parseMemoizeOne(){return g(A)},get validator(){return oA()},get validationParser(){return ne()},get pathParser(){return h()},insideModal:!1,get onError(){return GA()},onChange:Oi,onChangeMode:Sn,onSelect:Yn,get onRenderValue(){return q()},get onClassName(){return CA()},onFocus:Dn,onBlur:Ho,get onRenderMenu(){return kA()},get onRenderContextMenu(){return KA()},onSortModal:Jn,onTransformModal:No,onJSONEditorModal:hn,$$legacy:!0}),ti=>b(AA,ti),()=>g(AA))});var Gt=gA(it,2),Xe=Ct=>{(function(ti,$e){var Nt,Wi;st($e,!1);var Tn=X(void 0,!0),ii=X(void 0,!0),Ri=X(void 0,!0),dt=X(void 0,!0),zn=wr("jsoneditor:SortModal"),QA=k($e,"id",9),_A=k($e,"json",9),Ce=k($e,"rootPath",9),Pt=k($e,"onSort",9),Li=k($e,"onClose",9),ai={value:1,label:"ascending"},Fn=[ai,{value:-1,label:"descending"}],Co="".concat(QA(),":").concat(nt(Ce())),Qn=X((Nt=KE()[Co])===null||Nt===void 0?void 0:Nt.selectedProperty,!0),un=X(((Wi=KE()[Co])===null||Wi===void 0?void 0:Wi.selectedDirection)||ai,!0),jt=X(void 0,!0);function Nn(){try{var Xo,Oe,ni;b(jt,void 0);var fn=((Xo=g(Qn))===null||Xo===void 0?void 0:Xo.value)||((Oe=g(dt))===null||Oe===void 0||(Oe=Oe[0])===null||Oe===void 0?void 0:Oe.value)||[],Yi=(ni=g(un))===null||ni===void 0?void 0:ni.value,ir=eaA(_A(),Ce(),fn,Yi);Pt()!==void 0&&Ce()!==void 0&&Pt()({operations:ir,rootPath:Ce(),itemPath:fn,direction:Yi}),Li()()}catch(Xi){b(jt,String(Xi))}}function ut(Xo){Xo.focus()}fA(()=>(W(_A()),W(Ce())),()=>{b(Tn,Fe(_A(),Ce()))}),fA(()=>g(Tn),()=>{b(ii,Array.isArray(g(Tn)))}),fA(()=>(g(ii),g(Tn)),()=>{b(Ri,g(ii)?r_(g(Tn)):void 0)}),fA(()=>(g(Ri),L1),()=>{b(dt,g(Ri)?g(Ri).map(L1):void 0)}),fA(()=>(KE(),g(Qn),g(un)),()=>{KE(KE()[Co]={selectedProperty:g(Qn),selectedDirection:g(un)}),zn("store state in memory",Co,KE()[Co])}),nn(),Rt(!0),U3(ti,{get onClose(){return Li()},className:"jse-sort-modal",children:(Xo,Oe)=>{var ni=_JA(),fn=Bt(ni),Yi=PA(()=>g(ii)?"Sort array items":"Sort object keys");dy(fn,{get title(){return g(Yi)},get onClose(){return Li()}});var ir=$(gA(fn,2)),Xi=gA($(ir)),ks=$(Xi),La=gA($(ks)),_o=$(La),yn=gA(ks),Gr=Pe=>{var qe=FJA(),oi=gA($(qe));bC($(oi),{showChevron:!0,get items(){return g(dt)},get value(){return g(Qn)},set value(xi){b(Qn,xi)},$$legacy:!0}),iA(Pe,qe)};MA(yn,Pe=>{var qe;g(ii)&&g(dt)&&((qe=g(dt))===null||qe===void 0?void 0:qe.length)>1&&Pe(Gr)});var z=gA(yn),wA=gA($(z));bC($(wA),{showChevron:!0,clearable:!1,items:Fn,get value(){return g(un)},set value(Pe){b(un,Pe)},$$legacy:!0});var ee=gA(ir,2),Me=$(ee),ke=Pe=>{var qe=NJA(),oi=$(qe);Ee(()=>Et(oi,g(jt))),iA(Pe,qe)};MA(Me,Pe=>{g(jt)&&Pe(ke)});var ze=$(gA(ee,2));Nr(()=>re("click",ze,Nn)),bs(ze,Pe=>ut?.(Pe)),Ee(Pe=>{var qe;GC(_o,Pe),ze.disabled=!!(g(ii)&&g(dt)&&((qe=g(dt))===null||qe===void 0?void 0:qe.length)>1)&&!g(Qn)},[()=>Ce()&&!sn(Ce())?Dl(Ce()):"(document root)"],PA),iA(Xo,ni)},$$slots:{default:!0}}),at()})(Ct,U1(()=>g(WA),{onClose:()=>{var ti;(ti=g(WA))===null||ti===void 0||ti.onClose(),b(WA,void 0)}}))};MA(Gt,Ct=>{g(WA)&&Ct(Xe)});var Ot=gA(Gt,2),Pi=Ct=>{YYA(Ct,U1(()=>g(Qe),{onClose:()=>{var ti;(ti=g(Qe))===null||ti===void 0||ti.onClose(),b(Qe,void 0)}}))};MA(Ot,Ct=>{g(Qe)&&Ct(Pi)});var Jt=gA(Ot,2),Ki=Ct=>{(function(ti,$e){st($e,!1);var Nt=X(void 0,!0),Wi=X(void 0,!0),Tn=X(void 0,!0),ii=X(void 0,!0),Ri=wr("jsoneditor:JSONEditorModal"),dt=k($e,"content",9),zn=k($e,"path",9),QA=k($e,"onPatch",9),_A=k($e,"readOnly",9),Ce=k($e,"indentation",9),Pt=k($e,"tabSize",9),Li=k($e,"truncateTextSize",9),ai=k($e,"mainMenuBar",9),Fn=k($e,"navigationBar",9),Co=k($e,"statusBar",9),Qn=k($e,"askToFormat",9),un=k($e,"escapeControlCharacters",9),jt=k($e,"escapeUnicodeCharacters",9),Nn=k($e,"flattenColumns",9),ut=k($e,"parser",9),Xo=k($e,"validator",9),Oe=k($e,"validationParser",9),ni=k($e,"pathParser",9),fn=k($e,"onRenderValue",9),Yi=k($e,"onClassName",9),ir=k($e,"onRenderMenu",9),Xi=k($e,"onRenderContextMenu",9),ks=k($e,"onSortModal",9),La=k($e,"onTransformModal",9),_o=k($e,"onClose",9),yn=X(void 0,!0),Gr=X(void 0,!0),z={mode:Me(dt()),content:dt(),selection:void 0,relativePath:zn()},wA=X([z],!0),ee=X(void 0,!0);function Me(rA){return k3(rA)&&ao(rA.json)?tr.table:tr.tree}function ke(){var rA,JA=(rA=ri(g(wA)))===null||rA===void 0?void 0:rA.selection;F3(JA)&&g(yn).scrollTo(je(JA))}function ze(){if(Ri("handleApply"),!_A())try{b(ee,void 0);var rA=g(Nt).relativePath,JA=g(Nt).content,Se=[{op:"replace",path:nt(rA),value:_oA(JA,ut()).json}];if(g(wA).length>1){var pe=_oA(g(wA)[g(wA).length-2].content,ut()).json,me={json:Ba(pe,Se)},ft=Be(Be({},g(wA)[g(wA).length-2]||z),{},{content:me});b(wA,[...g(wA).slice(0,g(wA).length-2),ft]),go(),ke()}else QA()(Se),_o()()}catch(mt){b(ee,String(mt))}}function Pe(){if(Ri("handleClose"),g(Gr))b(Gr,!1);else if(g(wA).length>1){var rA;b(wA,pi(g(wA))),go(),(rA=g(yn))===null||rA===void 0||rA.focus(),ke(),b(ee,void 0)}else _o()()}function qe(rA){Ri("handleChange",rA),Di(JA=>Be(Be({},JA),{},{content:rA}))}function oi(rA){Ri("handleChangeSelection",rA),Di(JA=>Be(Be({},JA),{},{selection:rA}))}function xi(rA){Ri("handleChangeMode",rA),Di(JA=>Be(Be({},JA),{},{mode:rA}))}function Di(rA){var JA=rA(ri(g(wA)));b(wA,[...pi(g(wA)),JA])}function cn(rA){b(ee,rA.toString()),console.error(rA)}function qr(rA){var JA,{content:Se,path:pe}=rA;Ri("handleJSONEditorModal",{content:Se,path:pe});var me={mode:Me(Se),content:Se,selection:void 0,relativePath:pe};b(wA,[...g(wA),me]),go(),(JA=g(yn))===null||JA===void 0||JA.focus()}function J(rA){rA.focus()}ls(()=>{var rA;(rA=g(yn))===null||rA===void 0||rA.focus()}),fA(()=>g(wA),()=>{b(Nt,ri(g(wA))||z)}),fA(()=>g(wA),()=>{b(Wi,g(wA).flatMap(rA=>rA.relativePath))}),fA(()=>(g(Wi),Dl),()=>{b(Tn,sn(g(Wi))?"(document root)":Dl(g(Wi)))}),fA(()=>W(ut()),()=>{b(ii,VB(ut().parse))}),nn(),Rt(!0),U3(ti,{onClose:Pe,className:"jse-jsoneditor-modal",get fullscreen(){return g(Gr)},children:(rA,JA)=>{var Se=LJA();c_($(Se),{children:(pe,me)=>{var ft=RJA(),mt=Bt(ft),ci=PA(()=>g(wA).length>1?" (".concat(g(wA).length,")"):"");dy(mt,{get title(){var Qt;return"Edit nested content ".concat((Qt=g(ci))!==null&&Qt!==void 0?Qt:"")},fullScreenButton:!0,onClose:Pe,get fullscreen(){return g(Gr)},set fullscreen(Qt){b(Gr,Qt)},$$legacy:!0});var rn=gA(mt,2),yi=gA($(rn),2),Rn=gA(yi,4);to(urA($(Rn),{get externalMode(){return g(Nt).mode},get content(){return g(Nt).content},get selection(){return g(Nt).selection},get readOnly(){return _A()},get indentation(){return Ce()},get tabSize(){return Pt()},get truncateTextSize(){return Li()},get statusBar(){return Co()},get askToFormat(){return Qn()},get mainMenuBar(){return ai()},get navigationBar(){return Fn()},get escapeControlCharacters(){return un()},get escapeUnicodeCharacters(){return jt()},get flattenColumns(){return Nn()},get parser(){return ut()},get parseMemoizeOne(){return g(ii)},get validator(){return Xo()},get validationParser(){return Oe()},get pathParser(){return ni()},insideModal:!0,onError:cn,onChange:qe,onChangeMode:xi,onSelect:oi,get onRenderValue(){return fn()},get onClassName(){return Yi()},onFocus:Kc,onBlur:Kc,get onRenderMenu(){return ir()},get onRenderContextMenu(){return Xi()},get onSortModal(){return ks()},get onTransformModal(){return La()},onJSONEditorModal:qr,$$legacy:!0}),Qt=>b(yn,Qt),()=>g(yn));var bt=$(gA(Rn,2)),Bo=Qt=>{var At=bJA(),Ni=$(At);Ee(()=>Et(Ni,g(ee))),iA(Qt,At)};MA(bt,Qt=>{g(ee)&&Qt(Bo)});var mn=gA(bt,2),Hn=Qt=>{var At=MJA();Si($(At),{data:mW}),re("click",At,Pe),iA(Qt,At)};MA(mn,Qt=>{g(wA).length>1&&Qt(Hn)});var ji=gA(mn,2),ht=Qt=>{var At=kJA();Nr(()=>re("click",At,ze)),bs(At,Ni=>J?.(Ni)),iA(Qt,At)},Fi=Qt=>{var At=SJA();re("click",At,Pe),iA(Qt,At)};MA(ji,Qt=>{_A()?Qt(Fi,!1):Qt(ht)}),Ee(()=>GC(yi,g(Tn))),iA(pe,ft)},$$slots:{default:!0}}),iA(rA,Se)},$$slots:{default:!0}}),at()})(Ct,U1(()=>g(dA),{onClose:()=>{var ti;(ti=g(dA))===null||ti===void 0||ti.onClose(),b(dA,void 0)}}))};MA(Jt,Ct=>{g(dA)&&Ct(Ki)}),Ee(Ct=>bA=xt(it,1,"jse-main svelte-57bmz4",null,bA,Ct),[()=>({"jse-focus":g(Y)})],PA),re("keydown",it,wo),iA(se,fe)},$$slots:{default:!0}}),kt(e,"get",DA),kt(e,"set",We),kt(e,"update",be),kt(e,"patch",qA),kt(e,"select",It),kt(e,"expand",Vi),kt(e,"collapse",on),kt(e,"transform",Hi),kt(e,"validate",Ci),kt(e,"acceptAutoRepair",Zi),kt(e,"scrollTo",Qi),kt(e,"findElement",Tt),kt(e,"focus",Ht),kt(e,"refresh",zi),kt(e,"updateProps",Ye),kt(e,"destroy",Ai),at({get:DA,set:We,update:be,patch:qA,select:It,expand:Vi,collapse:on,transform:Hi,validate:Ci,acceptAutoRepair:Zi,scrollTo:Qi,findElement:Tt,focus:Ht,refresh:zi,updateProps:Ye,destroy:Ai})}function daA(t){var{target:e,props:A}=t,i=R_A(UJA,{target:e,props:A});return i.destroy=yt(function*(){return function(n,o){var r=n_.get(n);return r?(n_.delete(n),r(o)):Promise.resolve()}(i)}),go(),i}var HC=class t{constructor(e){this.el=e}jsonString;editor=null;ngAfterViewInit(){let e={text:this.jsonString};this.editor=daA({target:document.getElementById("json-editor"),props:{content:e,mode:tr.text,mainMenuBar:!1}})}getJsonString(){return this.editor?.get().text}static \u0275fac=function(A){return new(A||t)(zA(te))};static \u0275cmp=YA({type:t,selectors:[["app-json-editor"]],inputs:{jsonString:"jsonString"},standalone:!1,decls:1,vars:0,consts:[["id","json-editor",1,"json-editor-container","jse-theme-dark"]],template:function(A,i){A&1&&UA(0,"div",0)},styles:[".jse-theme-dark[_ngcontent-%COMP%]{--jse-theme: dark;--jse-theme-color: #2f6dd0;--jse-theme-color-highlight: #467cd2;--jse-background-color: #1e1e1e;--jse-text-color: #d4d4d4;--jse-text-color-inverse: #4d4d4d;--jse-main-border: 1px solid #4f4f4f;--jse-menu-color: #fff;--jse-modal-background: #2f2f2f;--jse-modal-overlay-background: rgba(0, 0, 0, .5);--jse-modal-code-background: #2f2f2f;--jse-tooltip-color: var(--jse-text-color);--jse-tooltip-background: #4b4b4b;--jse-tooltip-border: 1px solid #737373;--jse-tooltip-action-button-color: inherit;--jse-tooltip-action-button-background: #737373;--jse-panel-background: #333333;--jse-panel-background-border: 1px solid #464646;--jse-panel-color: var(--jse-text-color);--jse-panel-color-readonly: #737373;--jse-panel-border: 1px solid #3c3c3c;--jse-panel-button-color-highlight: #e5e5e5;--jse-panel-button-background-highlight: #464646;--jse-navigation-bar-background: #656565;--jse-navigation-bar-background-highlight: #7e7e7e;--jse-navigation-bar-dropdown-color: var(--jse-text-color);--jse-context-menu-background: #4b4b4b;--jse-context-menu-background-highlight: #595959;--jse-context-menu-separator-color: #595959;--jse-context-menu-color: var(--jse-text-color);--jse-context-menu-pointer-background: #737373;--jse-context-menu-pointer-background-highlight: #818181;--jse-context-menu-pointer-color: var(--jse-context-menu-color);--jse-key-color: #9cdcfe;--jse-value-color: var(--jse-text-color);--jse-value-color-number: #b5cea8;--jse-value-color-boolean: #569cd6;--jse-value-color-null: #569cd6;--jse-value-color-string: #ce9178;--jse-value-color-url: #ce9178;--jse-delimiter-color: #949494;--jse-edit-outline: 2px solid var(--jse-text-color);--jse-selection-background-color: #464646;--jse-selection-background-inactive-color: #333333;--jse-hover-background-color: #343434;--jse-active-line-background-color: rgba(255, 255, 255, .06);--jse-search-match-background-color: #343434;--jse-collapsed-items-background-color: #333333;--jse-collapsed-items-selected-background-color: #565656;--jse-collapsed-items-link-color: #b2b2b2;--jse-collapsed-items-link-color-highlight: #ec8477;--jse-search-match-color: #724c27;--jse-search-match-outline: 1px solid #966535;--jse-search-match-active-color: #9f6c39;--jse-search-match-active-outline: 1px solid #bb7f43;--jse-tag-background: #444444;--jse-tag-color: #bdbdbd;--jse-table-header-background: #333333;--jse-table-header-background-highlight: #424242;--jse-table-row-odd-background: rgba(255, 255, 255, .1);--jse-input-background: #3d3d3d;--jse-input-border: var(--jse-main-border);--jse-button-background: #808080;--jse-button-background-highlight: #7a7a7a;--jse-button-color: #e0e0e0;--jse-button-secondary-background: #494949;--jse-button-secondary-background-highlight: #5d5d5d;--jse-button-secondary-background-disabled: #9d9d9d;--jse-button-secondary-color: var(--jse-text-color);--jse-a-color: #55abff;--jse-a-color-highlight: #4387c9;--jse-svelte-select-background: #3d3d3d;--jse-svelte-select-border: 1px solid #4f4f4f;--list-background: #3d3d3d;--item-hover-bg: #505050;--multi-item-bg: #5b5b5b;--input-color: #d4d4d4;--multi-clear-bg: #8a8a8a;--multi-item-clear-icon-color: #d4d4d4;--multi-item-outline: 1px solid #696969;--list-shadow: 0 2px 8px 0 rgba(0, 0, 0, .4);--jse-color-picker-background: #656565;--jse-color-picker-border-box-shadow: #8c8c8c 0 0 0 1px}.json-editor-container[_ngcontent-%COMP%]{height:300px;max-height:300px}"]})};var W3=class t{constructor(e,A){this.dialogRef=e;this.data=A;this.toolArgs=JSON.stringify(A.args,null,2),this.functionName=A.functionName}jsonEditorComponent;toolArgs="";functionName="";ngOnInit(){}onSave(){try{this.toolArgs=this.jsonEditorComponent.getJsonString();let e=JSON.parse(this.toolArgs);this.dialogRef.close(e)}catch(e){alert("Invalid JSON: "+e)}}onCancel(){this.dialogRef.close(null)}static \u0275fac=function(A){return new(A||t)(zA(cr),zA($r))};static \u0275cmp=YA({type:t,selectors:[["app-edit-function-args-dialog"]],viewQuery:function(A,i){if(A&1&&Ge(HC,5),A&2){let n;$A(n=Ae())&&(i.jsonEditorComponent=n.first)}},standalone:!1,decls:11,vars:2,consts:[[1,"dialog-container"],["mat-dialog-title",""],[3,"jsonString"],["align","end"],["mat-button","","mat-dialog-close",""],["mat-button","","cdkFocusInitial","",3,"click"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"h2",1),tA(2,"Edit function arguments"),R(),S(3,"mat-dialog-content"),tA(4),UA(5,"app-json-editor",2),R(),S(6,"mat-dialog-actions",3)(7,"button",4),tA(8,"Cancel"),R(),S(9,"button",5),mA("click",function(){return i.onSave()}),tA(10,"Save"),R()()()),A&2&&(_(4),ot(" ",i.functionName," "),_(),vA("jsonString",i.toolArgs))},dependencies:[ur,hs,ga,Ia,gg,HC],styles:[".dialog-container[_ngcontent-%COMP%]{border-radius:12px;padding:18px;width:500px;box-shadow:0 8px 16px #0006}.editor[_ngcontent-%COMP%]{padding-top:12px}"]})};var JJA=["input"],TJA=["label"],zJA=["*"],HJA=new BA("mat-checkbox-default-options",{providedIn:"root",factory:EaA});function EaA(){return{color:"accent",clickAction:"check-indeterminate",disabledInteractive:!1}}var Ms=function(t){return t[t.Init=0]="Init",t[t.Checked=1]="Checked",t[t.Unchecked=2]="Unchecked",t[t.Indeterminate=3]="Indeterminate",t}(Ms||{}),OJA={provide:uc,useExisting:nr(()=>gh),multi:!0},sG=class{source;checked},BaA=EaA(),gh=(()=>{class t{_elementRef=m(te);_changeDetectorRef=m(lt);_ngZone=m(de);_animationMode=m(mi,{optional:!0});_options=m(HJA,{optional:!0});focus(){this._inputElement.nativeElement.focus()}_createChangeEvent(A){let i=new sG;return i.source=this,i.checked=A,i}_getAnimationTargetElement(){return this._inputElement?.nativeElement}_animationClasses={uncheckedToChecked:"mdc-checkbox--anim-unchecked-checked",uncheckedToIndeterminate:"mdc-checkbox--anim-unchecked-indeterminate",checkedToUnchecked:"mdc-checkbox--anim-checked-unchecked",checkedToIndeterminate:"mdc-checkbox--anim-checked-indeterminate",indeterminateToChecked:"mdc-checkbox--anim-indeterminate-checked",indeterminateToUnchecked:"mdc-checkbox--anim-indeterminate-unchecked"};ariaLabel="";ariaLabelledby=null;ariaDescribedby;ariaExpanded;ariaControls;ariaOwns;_uniqueId;id;get inputId(){return`${this.id||this._uniqueId}-input`}required;labelPosition="after";name=null;change=new XA;indeterminateChange=new XA;value;disableRipple;_inputElement;_labelElement;tabIndex;color;disabledInteractive;_onTouched=()=>{};_currentAnimationClass="";_currentCheckState=Ms.Init;_controlValueAccessorChangeFn=()=>{};_validatorChangeFn=()=>{};constructor(){m(Ln).load(Qr);let A=m(new Er("tabindex"),{optional:!0});this._options=this._options||BaA,this.color=this._options.color||BaA.color,this.tabIndex=A==null?0:parseInt(A)||0,this.id=this._uniqueId=m($i).getId("mat-mdc-checkbox-"),this.disabledInteractive=this._options?.disabledInteractive??!1}ngOnChanges(A){A.required&&this._validatorChangeFn()}ngAfterViewInit(){this._syncIndeterminate(this._indeterminate)}get checked(){return this._checked}set checked(A){A!=this.checked&&(this._checked=A,this._changeDetectorRef.markForCheck())}_checked=!1;get disabled(){return this._disabled}set disabled(A){A!==this.disabled&&(this._disabled=A,this._changeDetectorRef.markForCheck())}_disabled=!1;get indeterminate(){return this._indeterminate}set indeterminate(A){let i=A!=this._indeterminate;this._indeterminate=A,i&&(this._indeterminate?this._transitionCheckState(Ms.Indeterminate):this._transitionCheckState(this.checked?Ms.Checked:Ms.Unchecked),this.indeterminateChange.emit(this._indeterminate)),this._syncIndeterminate(this._indeterminate)}_indeterminate=!1;_isRippleDisabled(){return this.disableRipple||this.disabled}_onLabelTextChange(){this._changeDetectorRef.detectChanges()}writeValue(A){this.checked=!!A}registerOnChange(A){this._controlValueAccessorChangeFn=A}registerOnTouched(A){this._onTouched=A}setDisabledState(A){this.disabled=A}validate(A){return this.required&&A.value!==!0?{required:!0}:null}registerOnValidatorChange(A){this._validatorChangeFn=A}_transitionCheckState(A){let i=this._currentCheckState,n=this._getAnimationTargetElement();if(!(i===A||!n)&&(this._currentAnimationClass&&n.classList.remove(this._currentAnimationClass),this._currentAnimationClass=this._getAnimationClassForCheckStateTransition(i,A),this._currentCheckState=A,this._currentAnimationClass.length>0)){n.classList.add(this._currentAnimationClass);let o=this._currentAnimationClass;this._ngZone.runOutsideAngular(()=>{setTimeout(()=>{n.classList.remove(o)},1e3)})}}_emitChangeEvent(){this._controlValueAccessorChangeFn(this.checked),this.change.emit(this._createChangeEvent(this.checked)),this._inputElement&&(this._inputElement.nativeElement.checked=this.checked)}toggle(){this.checked=!this.checked,this._controlValueAccessorChangeFn(this.checked)}_handleInputClick(){let A=this._options?.clickAction;!this.disabled&&A!=="noop"?(this.indeterminate&&A!=="check"&&Promise.resolve().then(()=>{this._indeterminate=!1,this.indeterminateChange.emit(this._indeterminate)}),this._checked=!this._checked,this._transitionCheckState(this._checked?Ms.Checked:Ms.Unchecked),this._emitChangeEvent()):(this.disabled&&this.disabledInteractive||!this.disabled&&A==="noop")&&(this._inputElement.nativeElement.checked=this.checked,this._inputElement.nativeElement.indeterminate=this.indeterminate)}_onInteractionEvent(A){A.stopPropagation()}_onBlur(){Promise.resolve().then(()=>{this._onTouched(),this._changeDetectorRef.markForCheck()})}_getAnimationClassForCheckStateTransition(A,i){if(this._animationMode==="NoopAnimations")return"";switch(A){case Ms.Init:if(i===Ms.Checked)return this._animationClasses.uncheckedToChecked;if(i==Ms.Indeterminate)return this._checked?this._animationClasses.checkedToIndeterminate:this._animationClasses.uncheckedToIndeterminate;break;case Ms.Unchecked:return i===Ms.Checked?this._animationClasses.uncheckedToChecked:this._animationClasses.uncheckedToIndeterminate;case Ms.Checked:return i===Ms.Unchecked?this._animationClasses.checkedToUnchecked:this._animationClasses.checkedToIndeterminate;case Ms.Indeterminate:return i===Ms.Checked?this._animationClasses.indeterminateToChecked:this._animationClasses.indeterminateToUnchecked}return""}_syncIndeterminate(A){let i=this._inputElement;i&&(i.nativeElement.indeterminate=A)}_onInputClick(){this._handleInputClick()}_onTouchTargetClick(){this._handleInputClick(),this.disabled||this._inputElement.nativeElement.focus()}_preventBubblingFromLabel(A){A.target&&this._labelElement.nativeElement.contains(A.target)&&A.stopPropagation()}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-checkbox"]],viewQuery:function(i,n){if(i&1&&(Ge(JJA,5),Ge(TJA,5)),i&2){let o;$A(o=Ae())&&(n._inputElement=o.first),$A(o=Ae())&&(n._labelElement=o.first)}},hostAttrs:[1,"mat-mdc-checkbox"],hostVars:16,hostBindings:function(i,n){i&2&&(Fs("id",n.id),_e("tabindex",null)("aria-label",null)("aria-labelledby",null),vo(n.color?"mat-"+n.color:"mat-accent"),ue("_mat-animation-noopable",n._animationMode==="NoopAnimations")("mdc-checkbox--disabled",n.disabled)("mat-mdc-checkbox-disabled",n.disabled)("mat-mdc-checkbox-checked",n.checked)("mat-mdc-checkbox-disabled-interactive",n.disabledInteractive))},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],ariaExpanded:[2,"aria-expanded","ariaExpanded",ae],ariaControls:[0,"aria-controls","ariaControls"],ariaOwns:[0,"aria-owns","ariaOwns"],id:"id",required:[2,"required","required",ae],labelPosition:"labelPosition",name:"name",value:"value",disableRipple:[2,"disableRipple","disableRipple",ae],tabIndex:[2,"tabIndex","tabIndex",A=>A==null?void 0:Mi(A)],color:"color",disabledInteractive:[2,"disabledInteractive","disabledInteractive",ae],checked:[2,"checked","checked",ae],disabled:[2,"disabled","disabled",ae],indeterminate:[2,"indeterminate","indeterminate",ae]},outputs:{change:"change",indeterminateChange:"indeterminateChange"},exportAs:["matCheckbox"],features:[ct([OJA,{provide:d0,useExisting:t,multi:!0}]),Kt],ngContentSelectors:zJA,decls:15,vars:23,consts:[["checkbox",""],["input",""],["label",""],["mat-internal-form-field","",3,"click","labelPosition"],[1,"mdc-checkbox"],[1,"mat-mdc-checkbox-touch-target",3,"click"],["type","checkbox",1,"mdc-checkbox__native-control",3,"blur","click","change","checked","indeterminate","disabled","id","required","tabIndex"],[1,"mdc-checkbox__ripple"],[1,"mdc-checkbox__background"],["focusable","false","viewBox","0 0 24 24","aria-hidden","true",1,"mdc-checkbox__checkmark"],["fill","none","d","M1.73,12.91 8.1,19.28 22.79,4.59",1,"mdc-checkbox__checkmark-path"],[1,"mdc-checkbox__mixedmark"],["mat-ripple","",1,"mat-mdc-checkbox-ripple","mat-focus-indicator",3,"matRippleTrigger","matRippleDisabled","matRippleCentered"],[1,"mdc-label",3,"for"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"div",3),mA("click",function(s){return LA(o),xA(n._preventBubblingFromLabel(s))}),S(1,"div",4,0)(3,"div",5),mA("click",function(){return LA(o),xA(n._onTouchTargetClick())}),R(),S(4,"input",6,1),mA("blur",function(){return LA(o),xA(n._onBlur())})("click",function(){return LA(o),xA(n._onInputClick())})("change",function(s){return LA(o),xA(n._onInteractionEvent(s))}),R(),UA(6,"div",7),S(7,"div",8),hr(),S(8,"svg",9),UA(9,"path",10),R(),uI(),UA(10,"div",11),R(),UA(11,"div",12),R(),S(12,"label",13,2),xe(14),R()()}if(i&2){let o=or(2);vA("labelPosition",n.labelPosition),_(4),ue("mdc-checkbox--selected",n.checked),vA("checked",n.checked)("indeterminate",n.indeterminate)("disabled",n.disabled&&!n.disabledInteractive)("id",n.inputId)("required",n.required)("tabIndex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex),_e("aria-label",n.ariaLabel||null)("aria-labelledby",n.ariaLabelledby)("aria-describedby",n.ariaDescribedby)("aria-checked",n.indeterminate?"mixed":null)("aria-controls",n.ariaControls)("aria-disabled",n.disabled&&n.disabledInteractive?!0:null)("aria-expanded",n.ariaExpanded)("aria-owns",n.ariaOwns)("name",n.name)("value",n.value),_(7),vA("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled)("matRippleCentered",!0),_(),vA("for",n.inputId)}},dependencies:[Gs,BB],styles:['.mdc-checkbox{display:inline-block;position:relative;flex:0 0 18px;box-sizing:content-box;width:18px;height:18px;line-height:0;white-space:nowrap;cursor:pointer;vertical-align:bottom;padding:calc((var(--mdc-checkbox-state-layer-size, 40px) - 18px)/2);margin:calc((var(--mdc-checkbox-state-layer-size, 40px) - var(--mdc-checkbox-state-layer-size, 40px))/2)}.mdc-checkbox:hover>.mdc-checkbox__ripple{opacity:var(--mdc-checkbox-unselected-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity));background-color:var(--mdc-checkbox-unselected-hover-state-layer-color, var(--mat-sys-on-surface))}.mdc-checkbox:hover>.mat-mdc-checkbox-ripple>.mat-ripple-element{background-color:var(--mdc-checkbox-unselected-hover-state-layer-color, var(--mat-sys-on-surface))}.mdc-checkbox .mdc-checkbox__native-control:focus+.mdc-checkbox__ripple{opacity:var(--mdc-checkbox-unselected-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity));background-color:var(--mdc-checkbox-unselected-focus-state-layer-color, var(--mat-sys-on-surface))}.mdc-checkbox .mdc-checkbox__native-control:focus~.mat-mdc-checkbox-ripple .mat-ripple-element{background-color:var(--mdc-checkbox-unselected-focus-state-layer-color, var(--mat-sys-on-surface))}.mdc-checkbox:active>.mdc-checkbox__native-control+.mdc-checkbox__ripple{opacity:var(--mdc-checkbox-unselected-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity));background-color:var(--mdc-checkbox-unselected-pressed-state-layer-color, var(--mat-sys-primary))}.mdc-checkbox:active>.mdc-checkbox__native-control~.mat-mdc-checkbox-ripple .mat-ripple-element{background-color:var(--mdc-checkbox-unselected-pressed-state-layer-color, var(--mat-sys-primary))}.mdc-checkbox:hover .mdc-checkbox__native-control:checked+.mdc-checkbox__ripple{opacity:var(--mdc-checkbox-selected-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity));background-color:var(--mdc-checkbox-selected-hover-state-layer-color, var(--mat-sys-primary))}.mdc-checkbox:hover .mdc-checkbox__native-control:checked~.mat-mdc-checkbox-ripple .mat-ripple-element{background-color:var(--mdc-checkbox-selected-hover-state-layer-color, var(--mat-sys-primary))}.mdc-checkbox .mdc-checkbox__native-control:focus:checked+.mdc-checkbox__ripple{opacity:var(--mdc-checkbox-selected-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity));background-color:var(--mdc-checkbox-selected-focus-state-layer-color, var(--mat-sys-primary))}.mdc-checkbox .mdc-checkbox__native-control:focus:checked~.mat-mdc-checkbox-ripple .mat-ripple-element{background-color:var(--mdc-checkbox-selected-focus-state-layer-color, var(--mat-sys-primary))}.mdc-checkbox:active>.mdc-checkbox__native-control:checked+.mdc-checkbox__ripple{opacity:var(--mdc-checkbox-selected-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity));background-color:var(--mdc-checkbox-selected-pressed-state-layer-color, var(--mat-sys-on-surface))}.mdc-checkbox:active>.mdc-checkbox__native-control:checked~.mat-mdc-checkbox-ripple .mat-ripple-element{background-color:var(--mdc-checkbox-selected-pressed-state-layer-color, var(--mat-sys-on-surface))}.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox .mdc-checkbox__native-control~.mat-mdc-checkbox-ripple .mat-ripple-element,.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox .mdc-checkbox__native-control+.mdc-checkbox__ripple{background-color:var(--mdc-checkbox-unselected-hover-state-layer-color, var(--mat-sys-on-surface))}.mdc-checkbox .mdc-checkbox__native-control{position:absolute;margin:0;padding:0;opacity:0;cursor:inherit;width:var(--mdc-checkbox-state-layer-size, 40px);height:var(--mdc-checkbox-state-layer-size, 40px);top:calc((var(--mdc-checkbox-state-layer-size, 40px) - var(--mdc-checkbox-state-layer-size, 40px))/2);right:calc((var(--mdc-checkbox-state-layer-size, 40px) - var(--mdc-checkbox-state-layer-size, 40px))/2);left:calc((var(--mdc-checkbox-state-layer-size, 40px) - var(--mdc-checkbox-state-layer-size, 40px))/2)}.mdc-checkbox--disabled{cursor:default;pointer-events:none}@media(forced-colors: active){.mdc-checkbox--disabled{opacity:.5}}.mdc-checkbox__background{display:inline-flex;position:absolute;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;border:2px solid currentColor;border-radius:2px;background-color:rgba(0,0,0,0);pointer-events:none;will-change:background-color,border-color;transition:background-color 90ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms cubic-bezier(0.4, 0, 0.6, 1);-webkit-print-color-adjust:exact;color-adjust:exact;border-color:var(--mdc-checkbox-unselected-icon-color, var(--mat-sys-on-surface-variant));top:calc((var(--mdc-checkbox-state-layer-size, 40px) - 18px)/2);left:calc((var(--mdc-checkbox-state-layer-size, 40px) - 18px)/2)}.mdc-checkbox__native-control:enabled:checked~.mdc-checkbox__background,.mdc-checkbox__native-control:enabled:indeterminate~.mdc-checkbox__background{border-color:var(--mdc-checkbox-selected-icon-color, var(--mat-sys-primary));background-color:var(--mdc-checkbox-selected-icon-color, var(--mat-sys-primary))}.mdc-checkbox--disabled .mdc-checkbox__background{border-color:var(--mdc-checkbox-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mdc-checkbox__native-control:disabled:checked~.mdc-checkbox__background,.mdc-checkbox__native-control:disabled:indeterminate~.mdc-checkbox__background{background-color:var(--mdc-checkbox-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));border-color:rgba(0,0,0,0)}.mdc-checkbox:hover>.mdc-checkbox__native-control:not(:checked)~.mdc-checkbox__background,.mdc-checkbox:hover>.mdc-checkbox__native-control:not(:indeterminate)~.mdc-checkbox__background{border-color:var(--mdc-checkbox-unselected-hover-icon-color, var(--mat-sys-on-surface));background-color:rgba(0,0,0,0)}.mdc-checkbox:hover>.mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mdc-checkbox:hover>.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background{border-color:var(--mdc-checkbox-selected-hover-icon-color, var(--mat-sys-primary));background-color:var(--mdc-checkbox-selected-hover-icon-color, var(--mat-sys-primary))}.mdc-checkbox__native-control:focus:focus:not(:checked)~.mdc-checkbox__background,.mdc-checkbox__native-control:focus:focus:not(:indeterminate)~.mdc-checkbox__background{border-color:var(--mdc-checkbox-unselected-focus-icon-color, var(--mat-sys-on-surface))}.mdc-checkbox__native-control:focus:focus:checked~.mdc-checkbox__background,.mdc-checkbox__native-control:focus:focus:indeterminate~.mdc-checkbox__background{border-color:var(--mdc-checkbox-selected-focus-icon-color, var(--mat-sys-primary));background-color:var(--mdc-checkbox-selected-focus-icon-color, var(--mat-sys-primary))}.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox:hover>.mdc-checkbox__native-control~.mdc-checkbox__background,.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox .mdc-checkbox__native-control:focus~.mdc-checkbox__background,.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__background{border-color:var(--mdc-checkbox-disabled-unselected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background{background-color:var(--mdc-checkbox-disabled-selected-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));border-color:rgba(0,0,0,0)}.mdc-checkbox__checkmark{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;opacity:0;transition:opacity 180ms cubic-bezier(0.4, 0, 0.6, 1);color:var(--mdc-checkbox-selected-checkmark-color, var(--mat-sys-on-primary))}@media(forced-colors: active){.mdc-checkbox__checkmark{color:CanvasText}}.mdc-checkbox--disabled .mdc-checkbox__checkmark,.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__checkmark{color:var(--mdc-checkbox-disabled-selected-checkmark-color, var(--mat-sys-surface))}@media(forced-colors: active){.mdc-checkbox--disabled .mdc-checkbox__checkmark,.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__checkmark{color:CanvasText}}.mdc-checkbox__checkmark-path{transition:stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.6, 1);stroke:currentColor;stroke-width:3.12px;stroke-dashoffset:29.7833385;stroke-dasharray:29.7833385}.mdc-checkbox__mixedmark{width:100%;height:0;transform:scaleX(0) rotate(0deg);border-width:1px;border-style:solid;opacity:0;transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1);border-color:var(--mdc-checkbox-selected-checkmark-color, var(--mat-sys-on-primary))}@media(forced-colors: active){.mdc-checkbox__mixedmark{margin:0 1px}}.mdc-checkbox--disabled .mdc-checkbox__mixedmark,.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__mixedmark{border-color:var(--mdc-checkbox-disabled-selected-checkmark-color, var(--mat-sys-surface))}.mdc-checkbox--anim-unchecked-checked .mdc-checkbox__background,.mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__background,.mdc-checkbox--anim-checked-unchecked .mdc-checkbox__background,.mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__background{animation-duration:180ms;animation-timing-function:linear}.mdc-checkbox--anim-unchecked-checked .mdc-checkbox__checkmark-path{animation:mdc-checkbox-unchecked-checked-checkmark-path 180ms linear;transition:none}.mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__mixedmark{animation:mdc-checkbox-unchecked-indeterminate-mixedmark 90ms linear;transition:none}.mdc-checkbox--anim-checked-unchecked .mdc-checkbox__checkmark-path{animation:mdc-checkbox-checked-unchecked-checkmark-path 90ms linear;transition:none}.mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__checkmark{animation:mdc-checkbox-checked-indeterminate-checkmark 90ms linear;transition:none}.mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__mixedmark{animation:mdc-checkbox-checked-indeterminate-mixedmark 90ms linear;transition:none}.mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__checkmark{animation:mdc-checkbox-indeterminate-checked-checkmark 500ms linear;transition:none}.mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__mixedmark{animation:mdc-checkbox-indeterminate-checked-mixedmark 500ms linear;transition:none}.mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__mixedmark{animation:mdc-checkbox-indeterminate-unchecked-mixedmark 300ms linear;transition:none}.mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background{transition:border-color 90ms cubic-bezier(0, 0, 0.2, 1),background-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mdc-checkbox__native-control:checked~.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path,.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path{stroke-dashoffset:0}.mdc-checkbox__native-control:checked~.mdc-checkbox__background>.mdc-checkbox__checkmark{transition:opacity 180ms cubic-bezier(0, 0, 0.2, 1),transform 180ms cubic-bezier(0, 0, 0.2, 1);opacity:1}.mdc-checkbox__native-control:checked~.mdc-checkbox__background>.mdc-checkbox__mixedmark{transform:scaleX(1) rotate(-45deg)}.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background>.mdc-checkbox__checkmark{transform:rotate(45deg);opacity:0;transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background>.mdc-checkbox__mixedmark{transform:scaleX(1) rotate(0deg);opacity:1}@keyframes mdc-checkbox-unchecked-checked-checkmark-path{0%,50%{stroke-dashoffset:29.7833385}50%{animation-timing-function:cubic-bezier(0, 0, 0.2, 1)}100%{stroke-dashoffset:0}}@keyframes mdc-checkbox-unchecked-indeterminate-mixedmark{0%,68.2%{transform:scaleX(0)}68.2%{animation-timing-function:cubic-bezier(0, 0, 0, 1)}100%{transform:scaleX(1)}}@keyframes mdc-checkbox-checked-unchecked-checkmark-path{from{animation-timing-function:cubic-bezier(0.4, 0, 1, 1);opacity:1;stroke-dashoffset:0}to{opacity:0;stroke-dashoffset:-29.7833385}}@keyframes mdc-checkbox-checked-indeterminate-checkmark{from{animation-timing-function:cubic-bezier(0, 0, 0.2, 1);transform:rotate(0deg);opacity:1}to{transform:rotate(45deg);opacity:0}}@keyframes mdc-checkbox-indeterminate-checked-checkmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);transform:rotate(45deg);opacity:0}to{transform:rotate(360deg);opacity:1}}@keyframes mdc-checkbox-checked-indeterminate-mixedmark{from{animation-timing-function:cubic-bezier(0, 0, 0.2, 1);transform:rotate(-45deg);opacity:0}to{transform:rotate(0deg);opacity:1}}@keyframes mdc-checkbox-indeterminate-checked-mixedmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);transform:rotate(0deg);opacity:1}to{transform:rotate(315deg);opacity:0}}@keyframes mdc-checkbox-indeterminate-unchecked-mixedmark{0%{animation-timing-function:linear;transform:scaleX(1);opacity:1}32.8%,100%{transform:scaleX(0);opacity:0}}.mat-mdc-checkbox{display:inline-block;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-checkbox._mat-animation-noopable>.mat-internal-form-field>.mdc-checkbox>.mat-mdc-checkbox-touch-target,.mat-mdc-checkbox._mat-animation-noopable>.mat-internal-form-field>.mdc-checkbox>.mdc-checkbox__native-control,.mat-mdc-checkbox._mat-animation-noopable>.mat-internal-form-field>.mdc-checkbox>.mdc-checkbox__ripple,.mat-mdc-checkbox._mat-animation-noopable>.mat-internal-form-field>.mdc-checkbox>.mat-mdc-checkbox-ripple::before,.mat-mdc-checkbox._mat-animation-noopable>.mat-internal-form-field>.mdc-checkbox>.mdc-checkbox__background,.mat-mdc-checkbox._mat-animation-noopable>.mat-internal-form-field>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark,.mat-mdc-checkbox._mat-animation-noopable>.mat-internal-form-field>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__checkmark>.mdc-checkbox__checkmark-path,.mat-mdc-checkbox._mat-animation-noopable>.mat-internal-form-field>.mdc-checkbox>.mdc-checkbox__background>.mdc-checkbox__mixedmark{transition:none !important;animation:none !important}.mat-mdc-checkbox label{cursor:pointer}.mat-mdc-checkbox .mat-internal-form-field{color:var(--mat-checkbox-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-checkbox-label-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-checkbox-label-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-checkbox-label-text-size, var(--mat-sys-body-medium-size));letter-spacing:var(--mat-checkbox-label-text-tracking, var(--mat-sys-body-medium-tracking));font-weight:var(--mat-checkbox-label-text-weight, var(--mat-sys-body-medium-weight))}.mat-mdc-checkbox.mat-mdc-checkbox-disabled.mat-mdc-checkbox-disabled-interactive{pointer-events:auto}.mat-mdc-checkbox.mat-mdc-checkbox-disabled.mat-mdc-checkbox-disabled-interactive input{cursor:default}.mat-mdc-checkbox.mat-mdc-checkbox-disabled label{cursor:default;color:var(--mat-checkbox-disabled-label-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-checkbox label:empty{display:none}.mat-mdc-checkbox .mdc-checkbox__ripple{opacity:0}.mat-mdc-checkbox .mat-mdc-checkbox-ripple,.mdc-checkbox__ripple{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:50%;pointer-events:none}.mat-mdc-checkbox .mat-mdc-checkbox-ripple:not(:empty),.mdc-checkbox__ripple:not(:empty){transform:translateZ(0)}.mat-mdc-checkbox-ripple .mat-ripple-element{opacity:.1}.mat-mdc-checkbox-touch-target{position:absolute;top:50%;left:50%;height:48px;width:48px;transform:translate(-50%, -50%);display:var(--mat-checkbox-touch-target-display, block)}.mat-mdc-checkbox .mat-mdc-checkbox-ripple::before{border-radius:50%}.mdc-checkbox__native-control:focus~.mat-focus-indicator::before{content:""}'],encapsulation:2,changeDetection:0})}return t})();var haA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[gh,Ve,Ve]})}return t})();var qJA=[[["caption"]],[["colgroup"],["col"]],"*"],VJA=["caption","colgroup, col","*"];function ZJA(t,e){t&1&&xe(0,2)}function WJA(t,e){t&1&&(S(0,"thead",0),Mr(1,1),R(),S(2,"tbody",0),Mr(3,2)(4,3),R(),S(5,"tfoot",0),Mr(6,4),R())}function XJA(t,e){t&1&&Mr(0,1)(1,2)(2,3)(3,4)}var Ll=new BA("CDK_TABLE");var Uy=(()=>{class t{template=m(vn);constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","cdkCellDef",""]]})}return t})(),Ky=(()=>{class t{template=m(vn);constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","cdkHeaderCellDef",""]]})}return t})(),faA=(()=>{class t{template=m(vn);constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","cdkFooterCellDef",""]]})}return t})(),Ih=(()=>{class t{_table=m(Ll,{optional:!0});_hasStickyChanged=!1;get name(){return this._name}set name(A){this._setNameInput(A)}_name;get sticky(){return this._sticky}set sticky(A){A!==this._sticky&&(this._sticky=A,this._hasStickyChanged=!0)}_sticky=!1;get stickyEnd(){return this._stickyEnd}set stickyEnd(A){A!==this._stickyEnd&&(this._stickyEnd=A,this._hasStickyChanged=!0)}_stickyEnd=!1;cell;headerCell;footerCell;cssClassFriendlyName;_columnCssClassName;constructor(){}hasStickyChanged(){let A=this._hasStickyChanged;return this.resetStickyChanged(),A}resetStickyChanged(){this._hasStickyChanged=!1}_updateColumnCssClassName(){this._columnCssClassName=[`cdk-column-${this.cssClassFriendlyName}`]}_setNameInput(A){A&&(this._name=A,this.cssClassFriendlyName=A.replace(/[^a-z0-9_-]/gi,"-"),this._updateColumnCssClassName())}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","cdkColumnDef",""]],contentQueries:function(i,n,o){if(i&1&&(Ii(o,Uy,5),Ii(o,Ky,5),Ii(o,faA,5)),i&2){let r;$A(r=Ae())&&(n.cell=r.first),$A(r=Ae())&&(n.headerCell=r.first),$A(r=Ae())&&(n.footerCell=r.first)}},inputs:{name:[0,"cdkColumnDef","name"],sticky:[2,"sticky","sticky",ae],stickyEnd:[2,"stickyEnd","stickyEnd",ae]},features:[ct([{provide:"MAT_SORT_HEADER_COLUMN_DEF",useExisting:t}])]})}return t})(),Fy=class{constructor(e,A){A.nativeElement.classList.add(...e._columnCssClassName)}},maA=(()=>{class t extends Fy{constructor(){super(m(Ih),m(te))}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["cdk-header-cell"],["th","cdk-header-cell",""]],hostAttrs:["role","columnheader",1,"cdk-header-cell"],features:[et]})}return t})();var paA=(()=>{class t extends Fy{constructor(){let A=m(Ih),i=m(te);super(A,i);let n=A._table?._getCellRole();n&&i.nativeElement.setAttribute("role",n)}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["cdk-cell"],["td","cdk-cell",""]],hostAttrs:[1,"cdk-cell"],features:[et]})}return t})(),Ny=class{tasks=[];endTasks=[]},_y=new BA("_COALESCED_STYLE_SCHEDULER"),cG=(()=>{class t{_currentSchedule=null;_ngZone=m(de);constructor(){}schedule(A){this._createScheduleIfNeeded(),this._currentSchedule.tasks.push(A)}scheduleEnd(A){this._createScheduleIfNeeded(),this._currentSchedule.endTasks.push(A)}_createScheduleIfNeeded(){this._currentSchedule||(this._currentSchedule=new Ny,this._ngZone.runOutsideAngular(()=>queueMicrotask(()=>{for(;this._currentSchedule.tasks.length||this._currentSchedule.endTasks.length;){let A=this._currentSchedule;this._currentSchedule=new Ny;for(let i of A.tasks)i();for(let i of A.endTasks)i()}this._currentSchedule=null})))}static \u0275fac=function(i){return new(i||t)};static \u0275prov=SA({token:t,factory:t.\u0275fac})}return t})();var lG=(()=>{class t{template=m(vn);_differs=m(Xl);columns;_columnsDiffer;constructor(){}ngOnChanges(A){if(!this._columnsDiffer){let i=A.columns&&A.columns.currentValue||[];this._columnsDiffer=this._differs.find(i).create(),this._columnsDiffer.diff(i)}}getColumnsDiff(){return this._columnsDiffer.diff(this.columns)}extractCellTemplate(A){return this instanceof X3?A.headerCell.template:this instanceof gG?A.footerCell.template:A.cell.template}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,features:[Kt]})}return t})(),X3=(()=>{class t extends lG{_table=m(Ll,{optional:!0});_hasStickyChanged=!1;get sticky(){return this._sticky}set sticky(A){A!==this._sticky&&(this._sticky=A,this._hasStickyChanged=!0)}_sticky=!1;constructor(){super(m(vn),m(Xl))}ngOnChanges(A){super.ngOnChanges(A)}hasStickyChanged(){let A=this._hasStickyChanged;return this.resetStickyChanged(),A}resetStickyChanged(){this._hasStickyChanged=!1}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","cdkHeaderRowDef",""]],inputs:{columns:[0,"cdkHeaderRowDef","columns"],sticky:[2,"cdkHeaderRowDefSticky","sticky",ae]},features:[et,Kt]})}return t})(),gG=(()=>{class t extends lG{_table=m(Ll,{optional:!0});_hasStickyChanged=!1;get sticky(){return this._sticky}set sticky(A){A!==this._sticky&&(this._sticky=A,this._hasStickyChanged=!0)}_sticky=!1;constructor(){super(m(vn),m(Xl))}ngOnChanges(A){super.ngOnChanges(A)}hasStickyChanged(){let A=this._hasStickyChanged;return this.resetStickyChanged(),A}resetStickyChanged(){this._hasStickyChanged=!1}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","cdkFooterRowDef",""]],inputs:{columns:[0,"cdkFooterRowDef","columns"],sticky:[2,"cdkFooterRowDefSticky","sticky",ae]},features:[et,Kt]})}return t})(),Yy=(()=>{class t extends lG{_table=m(Ll,{optional:!0});when;constructor(){super(m(vn),m(Xl))}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","cdkRowDef",""]],inputs:{columns:[0,"cdkRowDefColumns","columns"],when:[0,"cdkRowDefWhen","when"]},features:[et]})}return t})(),OC=(()=>{class t{_viewContainer=m(Un);cells;context;static mostRecentCellOutlet=null;constructor(){t.mostRecentCellOutlet=this}ngOnDestroy(){t.mostRecentCellOutlet===this&&(t.mostRecentCellOutlet=null)}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","cdkCellOutlet",""]]})}return t})(),IG=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["cdk-header-row"],["tr","cdk-header-row",""]],hostAttrs:["role","row",1,"cdk-header-row"],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(i,n){i&1&&Mr(0,0)},dependencies:[OC],encapsulation:2})}return t})();var CG=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["cdk-row"],["tr","cdk-row",""]],hostAttrs:["role","row",1,"cdk-row"],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(i,n){i&1&&Mr(0,0)},dependencies:[OC],encapsulation:2})}return t})(),waA=(()=>{class t{templateRef=m(vn);_contentClassName="cdk-no-data-row";constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["ng-template","cdkNoDataRow",""]]})}return t})(),QaA=["top","bottom","left","right"],aG=class{_isNativeHtmlTable;_stickCellCss;direction;_coalescedStyleScheduler;_isBrowser;_needsPositionStickyOnElement;_positionListener;_tableInjector;_elemSizeCache=new WeakMap;_resizeObserver=globalThis?.ResizeObserver?new globalThis.ResizeObserver(e=>this._updateCachedSizes(e)):null;_updatedStickyColumnsParamsToReplay=[];_stickyColumnsReplayTimeout=null;_cachedCellWidths=[];_borderCellCss;_destroyed=!1;constructor(e,A,i,n,o=!0,r=!0,s,a){this._isNativeHtmlTable=e,this._stickCellCss=A,this.direction=i,this._coalescedStyleScheduler=n,this._isBrowser=o,this._needsPositionStickyOnElement=r,this._positionListener=s,this._tableInjector=a,this._borderCellCss={top:`${A}-border-elem-top`,bottom:`${A}-border-elem-bottom`,left:`${A}-border-elem-left`,right:`${A}-border-elem-right`}}clearStickyPositioning(e,A){(A.includes("left")||A.includes("right"))&&this._removeFromStickyColumnReplayQueue(e);let i=[];for(let n of e)n.nodeType===n.ELEMENT_NODE&&i.push(n,...Array.from(n.children));this._afterNextRender({write:()=>{for(let n of i)this._removeStickyStyle(n,A)}})}updateStickyColumns(e,A,i,n=!0,o=!0){if(!e.length||!this._isBrowser||!(A.some(Q=>Q)||i.some(Q=>Q))){this._positionListener?.stickyColumnsUpdated({sizes:[]}),this._positionListener?.stickyEndColumnsUpdated({sizes:[]});return}let r=e[0],s=r.children.length,a=this.direction==="rtl",c=a?"right":"left",l=a?"left":"right",I=A.lastIndexOf(!0),C=i.indexOf(!0),d,B,E;o&&this._updateStickyColumnReplayQueue({rows:[...e],stickyStartStates:[...A],stickyEndStates:[...i]}),this._afterNextRender({earlyRead:()=>{d=this._getCellWidths(r,n),B=this._getStickyStartColumnPositions(d,A),E=this._getStickyEndColumnPositions(d,i)},write:()=>{for(let Q of e)for(let u=0;u!!Q)&&(this._positionListener.stickyColumnsUpdated({sizes:I===-1?[]:d.slice(0,I+1).map((Q,u)=>A[u]?Q:null)}),this._positionListener.stickyEndColumnsUpdated({sizes:C===-1?[]:d.slice(C).map((Q,u)=>i[u+C]?Q:null).reverse()}))}})}stickRows(e,A,i){if(!this._isBrowser)return;let n=i==="bottom"?e.slice().reverse():e,o=i==="bottom"?A.slice().reverse():A,r=[],s=[],a=[];this._afterNextRender({earlyRead:()=>{for(let c=0,l=0;c{let c=o.lastIndexOf(!0);for(let l=0;l{let i=e.querySelector("tfoot");i&&(A.some(n=>!n)?this._removeStickyStyle(i,["bottom"]):this._addStickyStyle(i,"bottom",0,!1))}})}destroy(){this._stickyColumnsReplayTimeout&&clearTimeout(this._stickyColumnsReplayTimeout),this._resizeObserver?.disconnect(),this._destroyed=!0}_removeStickyStyle(e,A){for(let n of A)e.style[n]="",e.classList.remove(this._borderCellCss[n]);QaA.some(n=>A.indexOf(n)===-1&&e.style[n])?e.style.zIndex=this._getCalculatedZIndex(e):(e.style.zIndex="",this._needsPositionStickyOnElement&&(e.style.position=""),e.classList.remove(this._stickCellCss))}_addStickyStyle(e,A,i,n){e.classList.add(this._stickCellCss),n&&e.classList.add(this._borderCellCss[A]),e.style[A]=`${i}px`,e.style.zIndex=this._getCalculatedZIndex(e),this._needsPositionStickyOnElement&&(e.style.cssText+="position: -webkit-sticky; position: sticky; ")}_getCalculatedZIndex(e){let A={top:100,bottom:10,left:1,right:1},i=0;for(let n of QaA)e.style[n]&&(i+=A[n]);return i?`${i}`:""}_getCellWidths(e,A=!0){if(!A&&this._cachedCellWidths.length)return this._cachedCellWidths;let i=[],n=e.children;for(let o=0;o0;o--)A[o]&&(i[o]=n,n+=e[o]);return i}_retrieveElementSize(e){let A=this._elemSizeCache.get(e);if(A)return A;let i=e.getBoundingClientRect(),n={width:i.width,height:i.height};return this._resizeObserver&&(this._elemSizeCache.set(e,n),this._resizeObserver.observe(e,{box:"border-box"})),n}_updateStickyColumnReplayQueue(e){this._removeFromStickyColumnReplayQueue(e.rows),this._stickyColumnsReplayTimeout||this._updatedStickyColumnsParamsToReplay.push(e)}_removeFromStickyColumnReplayQueue(e){let A=new Set(e);for(let i of this._updatedStickyColumnsParamsToReplay)i.rows=i.rows.filter(n=>!A.has(n));this._updatedStickyColumnsParamsToReplay=this._updatedStickyColumnsParamsToReplay.filter(i=>!!i.rows.length)}_updateCachedSizes(e){let A=!1;for(let i of e){let n=i.borderBoxSize?.length?{width:i.borderBoxSize[0].inlineSize,height:i.borderBoxSize[0].blockSize}:{width:i.contentRect.width,height:i.contentRect.height};n.width!==this._elemSizeCache.get(i.target)?.width&&$JA(i.target)&&(A=!0),this._elemSizeCache.set(i.target,n)}A&&this._updatedStickyColumnsParamsToReplay.length&&(this._stickyColumnsReplayTimeout&&clearTimeout(this._stickyColumnsReplayTimeout),this._stickyColumnsReplayTimeout=setTimeout(()=>{if(!this._destroyed){for(let i of this._updatedStickyColumnsParamsToReplay)this.updateStickyColumns(i.rows,i.stickyStartStates,i.stickyEndStates,!0,!1);this._updatedStickyColumnsParamsToReplay=[],this._stickyColumnsReplayTimeout=null}},0))}_afterNextRender(e){this._tableInjector?Vo(e,{injector:this._tableInjector}):this._coalescedStyleScheduler.schedule(()=>{e.earlyRead?.(),e.write()})}};function $JA(t){return["cdk-cell","cdk-header-cell","cdk-footer-cell"].some(e=>t.classList.contains(e))}var Gy=new BA("CDK_SPL");var dG=(()=>{class t{viewContainer=m(Un);elementRef=m(te);constructor(){let A=m(Ll);A._rowOutlet=this,A._outletAssigned()}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","rowOutlet",""]]})}return t})(),BG=(()=>{class t{viewContainer=m(Un);elementRef=m(te);constructor(){let A=m(Ll);A._headerRowOutlet=this,A._outletAssigned()}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","headerRowOutlet",""]]})}return t})(),EG=(()=>{class t{viewContainer=m(Un);elementRef=m(te);constructor(){let A=m(Ll);A._footerRowOutlet=this,A._outletAssigned()}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","footerRowOutlet",""]]})}return t})(),hG=(()=>{class t{viewContainer=m(Un);elementRef=m(te);constructor(){let A=m(Ll);A._noDataRowOutlet=this,A._outletAssigned()}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","noDataRowOutlet",""]]})}return t})();var QG=(()=>{class t{_differs=m(Xl);_changeDetectorRef=m(lt);_elementRef=m(te);_dir=m(bo,{optional:!0});_platform=m(Zt);_viewRepeater=m(Qu);_coalescedStyleScheduler=m(_y);_viewportRuler=m(mc);_stickyPositioningListener=m(Gy,{optional:!0,skipSelf:!0});_document=m(tt);_data;_onDestroy=new HA;_renderRows;_renderChangeSubscription;_columnDefsByName=new Map;_rowDefs;_headerRowDefs;_footerRowDefs;_dataDiffer;_defaultRowDef;_customColumnDefs=new Set;_customRowDefs=new Set;_customHeaderRowDefs=new Set;_customFooterRowDefs=new Set;_customNoDataRow;_headerRowDefChanged=!0;_footerRowDefChanged=!0;_stickyColumnStylesNeedReset=!0;_forceRecalculateCellWidths=!0;_cachedRenderRowsMap=new Map;_isNativeHtmlTable;_stickyStyler;stickyCssClass="cdk-table-sticky";needsPositionStickyOnElement=!0;_isServer;_isShowingNoDataRow=!1;_hasAllOutlets=!1;_hasInitialized=!1;_getCellRole(){if(this._cellRoleInternal===void 0){let A=this._elementRef.nativeElement.getAttribute("role");return A==="grid"||A==="treegrid"?"gridcell":"cell"}return this._cellRoleInternal}_cellRoleInternal=void 0;get trackBy(){return this._trackByFn}set trackBy(A){this._trackByFn=A}_trackByFn;get dataSource(){return this._dataSource}set dataSource(A){this._dataSource!==A&&this._switchDataSource(A)}_dataSource;get multiTemplateDataRows(){return this._multiTemplateDataRows}set multiTemplateDataRows(A){this._multiTemplateDataRows=A,this._rowOutlet&&this._rowOutlet.viewContainer.length&&(this._forceRenderDataRows(),this.updateStickyColumnStyles())}_multiTemplateDataRows=!1;get fixedLayout(){return this._fixedLayout}set fixedLayout(A){this._fixedLayout=A,this._forceRecalculateCellWidths=!0,this._stickyColumnStylesNeedReset=!0}_fixedLayout=!1;contentChanged=new XA;viewChange=new li({start:0,end:Number.MAX_VALUE});_rowOutlet;_headerRowOutlet;_footerRowOutlet;_noDataRowOutlet;_contentColumnDefs;_contentRowDefs;_contentHeaderRowDefs;_contentFooterRowDefs;_noDataRow;_injector=m(Dt);constructor(){m(new Er("role"),{optional:!0})||this._elementRef.nativeElement.setAttribute("role","table"),this._isServer=!this._platform.isBrowser,this._isNativeHtmlTable=this._elementRef.nativeElement.nodeName==="TABLE"}ngOnInit(){this._setupStickyStyler(),this._dataDiffer=this._differs.find([]).create((A,i)=>this.trackBy?this.trackBy(i.dataIndex,i.data):i),this._viewportRuler.change().pipe(wt(this._onDestroy)).subscribe(()=>{this._forceRecalculateCellWidths=!0})}ngAfterContentInit(){this._hasInitialized=!0}ngAfterContentChecked(){this._canRender()&&this._render()}ngOnDestroy(){this._stickyStyler?.destroy(),[this._rowOutlet?.viewContainer,this._headerRowOutlet?.viewContainer,this._footerRowOutlet?.viewContainer,this._cachedRenderRowsMap,this._customColumnDefs,this._customRowDefs,this._customHeaderRowDefs,this._customFooterRowDefs,this._columnDefsByName].forEach(A=>{A?.clear()}),this._headerRowDefs=[],this._footerRowDefs=[],this._defaultRowDef=null,this._onDestroy.next(),this._onDestroy.complete(),A8(this.dataSource)&&this.dataSource.disconnect(this)}renderRows(){this._renderRows=this._getAllRenderRows();let A=this._dataDiffer.diff(this._renderRows);if(!A){this._updateNoDataRow(),this.contentChanged.next();return}let i=this._rowOutlet.viewContainer;this._viewRepeater.applyChanges(A,i,(n,o,r)=>this._getEmbeddedViewArgs(n.item,r),n=>n.item.data,n=>{n.operation===hB.INSERTED&&n.context&&this._renderCellTemplateForItem(n.record.item.rowDef,n.context)}),this._updateRowIndexContext(),A.forEachIdentityChange(n=>{let o=i.get(n.currentIndex);o.context.$implicit=n.item.data}),this._updateNoDataRow(),this.contentChanged.next(),this.updateStickyColumnStyles()}addColumnDef(A){this._customColumnDefs.add(A)}removeColumnDef(A){this._customColumnDefs.delete(A)}addRowDef(A){this._customRowDefs.add(A)}removeRowDef(A){this._customRowDefs.delete(A)}addHeaderRowDef(A){this._customHeaderRowDefs.add(A),this._headerRowDefChanged=!0}removeHeaderRowDef(A){this._customHeaderRowDefs.delete(A),this._headerRowDefChanged=!0}addFooterRowDef(A){this._customFooterRowDefs.add(A),this._footerRowDefChanged=!0}removeFooterRowDef(A){this._customFooterRowDefs.delete(A),this._footerRowDefChanged=!0}setNoDataRow(A){this._customNoDataRow=A}updateStickyHeaderRowStyles(){let A=this._getRenderedRows(this._headerRowOutlet);if(this._isNativeHtmlTable){let n=uaA(this._headerRowOutlet,"thead");n&&(n.style.display=A.length?"":"none")}let i=this._headerRowDefs.map(n=>n.sticky);this._stickyStyler.clearStickyPositioning(A,["top"]),this._stickyStyler.stickRows(A,i,"top"),this._headerRowDefs.forEach(n=>n.resetStickyChanged())}updateStickyFooterRowStyles(){let A=this._getRenderedRows(this._footerRowOutlet);if(this._isNativeHtmlTable){let n=uaA(this._footerRowOutlet,"tfoot");n&&(n.style.display=A.length?"":"none")}let i=this._footerRowDefs.map(n=>n.sticky);this._stickyStyler.clearStickyPositioning(A,["bottom"]),this._stickyStyler.stickRows(A,i,"bottom"),this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement,i),this._footerRowDefs.forEach(n=>n.resetStickyChanged())}updateStickyColumnStyles(){let A=this._getRenderedRows(this._headerRowOutlet),i=this._getRenderedRows(this._rowOutlet),n=this._getRenderedRows(this._footerRowOutlet);(this._isNativeHtmlTable&&!this._fixedLayout||this._stickyColumnStylesNeedReset)&&(this._stickyStyler.clearStickyPositioning([...A,...i,...n],["left","right"]),this._stickyColumnStylesNeedReset=!1),A.forEach((o,r)=>{this._addStickyColumnStyles([o],this._headerRowDefs[r])}),this._rowDefs.forEach(o=>{let r=[];for(let s=0;s{this._addStickyColumnStyles([o],this._footerRowDefs[r])}),Array.from(this._columnDefsByName.values()).forEach(o=>o.resetStickyChanged())}_outletAssigned(){!this._hasAllOutlets&&this._rowOutlet&&this._headerRowOutlet&&this._footerRowOutlet&&this._noDataRowOutlet&&(this._hasAllOutlets=!0,this._canRender()&&this._render())}_canRender(){return this._hasAllOutlets&&this._hasInitialized}_render(){this._cacheRowDefs(),this._cacheColumnDefs(),!this._headerRowDefs.length&&!this._footerRowDefs.length&&this._rowDefs.length;let i=this._renderUpdatedColumns()||this._headerRowDefChanged||this._footerRowDefChanged;this._stickyColumnStylesNeedReset=this._stickyColumnStylesNeedReset||i,this._forceRecalculateCellWidths=i,this._headerRowDefChanged&&(this._forceRenderHeaderRows(),this._headerRowDefChanged=!1),this._footerRowDefChanged&&(this._forceRenderFooterRows(),this._footerRowDefChanged=!1),this.dataSource&&this._rowDefs.length>0&&!this._renderChangeSubscription?this._observeRenderChanges():this._stickyColumnStylesNeedReset&&this.updateStickyColumnStyles(),this._checkStickyStates()}_getAllRenderRows(){let A=[],i=this._cachedRenderRowsMap;this._cachedRenderRowsMap=new Map;for(let n=0;n{let s=n&&n.has(r)?n.get(r):[];if(s.length){let a=s.shift();return a.dataIndex=i,a}else return{data:A,rowDef:r,dataIndex:i}})}_cacheColumnDefs(){this._columnDefsByName.clear(),xy(this._getOwnDefs(this._contentColumnDefs),this._customColumnDefs).forEach(i=>{this._columnDefsByName.has(i.name),this._columnDefsByName.set(i.name,i)})}_cacheRowDefs(){this._headerRowDefs=xy(this._getOwnDefs(this._contentHeaderRowDefs),this._customHeaderRowDefs),this._footerRowDefs=xy(this._getOwnDefs(this._contentFooterRowDefs),this._customFooterRowDefs),this._rowDefs=xy(this._getOwnDefs(this._contentRowDefs),this._customRowDefs);let A=this._rowDefs.filter(i=>!i.when);!this.multiTemplateDataRows&&A.length>1,this._defaultRowDef=A[0]}_renderUpdatedColumns(){let A=(r,s)=>{let a=!!s.getColumnsDiff();return r||a},i=this._rowDefs.reduce(A,!1);i&&this._forceRenderDataRows();let n=this._headerRowDefs.reduce(A,!1);n&&this._forceRenderHeaderRows();let o=this._footerRowDefs.reduce(A,!1);return o&&this._forceRenderFooterRows(),i||n||o}_switchDataSource(A){this._data=[],A8(this.dataSource)&&this.dataSource.disconnect(this),this._renderChangeSubscription&&(this._renderChangeSubscription.unsubscribe(),this._renderChangeSubscription=null),A||(this._dataDiffer&&this._dataDiffer.diff([]),this._rowOutlet&&this._rowOutlet.viewContainer.clear()),this._dataSource=A}_observeRenderChanges(){if(!this.dataSource)return;let A;A8(this.dataSource)?A=this.dataSource.connect(this):a2(this.dataSource)?A=this.dataSource:Array.isArray(this.dataSource)&&(A=ve(this.dataSource)),this._renderChangeSubscription=A.pipe(wt(this._onDestroy)).subscribe(i=>{this._data=i||[],this.renderRows()})}_forceRenderHeaderRows(){this._headerRowOutlet.viewContainer.length>0&&this._headerRowOutlet.viewContainer.clear(),this._headerRowDefs.forEach((A,i)=>this._renderRow(this._headerRowOutlet,A,i)),this.updateStickyHeaderRowStyles()}_forceRenderFooterRows(){this._footerRowOutlet.viewContainer.length>0&&this._footerRowOutlet.viewContainer.clear(),this._footerRowDefs.forEach((A,i)=>this._renderRow(this._footerRowOutlet,A,i)),this.updateStickyFooterRowStyles()}_addStickyColumnStyles(A,i){let n=Array.from(i?.columns||[]).map(s=>{let a=this._columnDefsByName.get(s);return a}),o=n.map(s=>s.sticky),r=n.map(s=>s.stickyEnd);this._stickyStyler.updateStickyColumns(A,o,r,!this._fixedLayout||this._forceRecalculateCellWidths)}_getRenderedRows(A){let i=[];for(let n=0;n!o.when||o.when(i,A));else{let o=this._rowDefs.find(r=>r.when&&r.when(i,A))||this._defaultRowDef;o&&n.push(o)}return n.length,n}_getEmbeddedViewArgs(A,i){let n=A.rowDef,o={$implicit:A.data};return{templateRef:n.template,context:o,index:i}}_renderRow(A,i,n,o={}){let r=A.viewContainer.createEmbeddedView(i.template,o,n);return this._renderCellTemplateForItem(i,o),r}_renderCellTemplateForItem(A,i){for(let n of this._getCellTemplates(A))OC.mostRecentCellOutlet&&OC.mostRecentCellOutlet._viewContainer.createEmbeddedView(n,i);this._changeDetectorRef.markForCheck()}_updateRowIndexContext(){let A=this._rowOutlet.viewContainer;for(let i=0,n=A.length;i{let n=this._columnDefsByName.get(i);return A.extractCellTemplate(n)})}_forceRenderDataRows(){this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear(),this.renderRows()}_checkStickyStates(){let A=(i,n)=>i||n.hasStickyChanged();this._headerRowDefs.reduce(A,!1)&&this.updateStickyHeaderRowStyles(),this._footerRowDefs.reduce(A,!1)&&this.updateStickyFooterRowStyles(),Array.from(this._columnDefsByName.values()).reduce(A,!1)&&(this._stickyColumnStylesNeedReset=!0,this.updateStickyColumnStyles())}_setupStickyStyler(){let A=this._dir?this._dir.value:"ltr";this._stickyStyler=new aG(this._isNativeHtmlTable,this.stickyCssClass,A,this._coalescedStyleScheduler,this._platform.isBrowser,this.needsPositionStickyOnElement,this._stickyPositioningListener,this._injector),(this._dir?this._dir.change:ve()).pipe(wt(this._onDestroy)).subscribe(i=>{this._stickyStyler.direction=i,this.updateStickyColumnStyles()})}_getOwnDefs(A){return A.filter(i=>!i._table||i._table===this)}_updateNoDataRow(){let A=this._customNoDataRow||this._noDataRow;if(!A)return;let i=this._rowOutlet.viewContainer.length===0;if(i===this._isShowingNoDataRow)return;let n=this._noDataRowOutlet.viewContainer;if(i){let o=n.createEmbeddedView(A.templateRef),r=o.rootNodes[0];o.rootNodes.length===1&&r?.nodeType===this._document.ELEMENT_NODE&&(r.setAttribute("role","row"),r.classList.add(A._contentClassName))}else n.clear();this._isShowingNoDataRow=i,this._changeDetectorRef.markForCheck()}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["cdk-table"],["table","cdk-table",""]],contentQueries:function(i,n,o){if(i&1&&(Ii(o,waA,5),Ii(o,Ih,5),Ii(o,Yy,5),Ii(o,X3,5),Ii(o,gG,5)),i&2){let r;$A(r=Ae())&&(n._noDataRow=r.first),$A(r=Ae())&&(n._contentColumnDefs=r),$A(r=Ae())&&(n._contentRowDefs=r),$A(r=Ae())&&(n._contentHeaderRowDefs=r),$A(r=Ae())&&(n._contentFooterRowDefs=r)}},hostAttrs:[1,"cdk-table"],hostVars:2,hostBindings:function(i,n){i&2&&ue("cdk-table-fixed-layout",n.fixedLayout)},inputs:{trackBy:"trackBy",dataSource:"dataSource",multiTemplateDataRows:[2,"multiTemplateDataRows","multiTemplateDataRows",ae],fixedLayout:[2,"fixedLayout","fixedLayout",ae]},outputs:{contentChanged:"contentChanged"},exportAs:["cdkTable"],features:[ct([{provide:Ll,useExisting:t},{provide:Qu,useClass:QB},{provide:_y,useClass:cG},{provide:Gy,useValue:null}])],ngContentSelectors:VJA,decls:5,vars:2,consts:[["role","rowgroup"],["headerRowOutlet",""],["rowOutlet",""],["noDataRowOutlet",""],["footerRowOutlet",""]],template:function(i,n){i&1&&(Yt(qJA),xe(0),xe(1,1),NA(2,ZJA,1,0)(3,WJA,7,0)(4,XJA,4,0)),i&2&&(_(2),FA(n._isServer?2:-1),_(),FA(n._isNativeHtmlTable?3:4))},dependencies:[BG,dG,hG,EG],styles:[".cdk-table-fixed-layout{table-layout:fixed}"],encapsulation:2})}return t})();function xy(t,e){return t.concat(Array.from(e))}function uaA(t,e){let A=e.toUpperCase(),i=t.viewContainer.element.nativeElement;for(;i;){let n=i.nodeType===1?i.nodeName:null;if(n===A)return i;if(n==="TABLE")break;i=i.parentNode}return null}var DaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[uu]})}return t})();var ATA=[[["caption"]],[["colgroup"],["col"]],"*"],eTA=["caption","colgroup, col","*"];function tTA(t,e){t&1&&xe(0,2)}function iTA(t,e){t&1&&(S(0,"thead",0),Mr(1,1),R(),S(2,"tbody",2),Mr(3,3)(4,4),R(),S(5,"tfoot",0),Mr(6,5),R())}function nTA(t,e){t&1&&Mr(0,1)(1,3)(2,4)(3,5)}var yaA=(()=>{class t extends QG{stickyCssClass="mat-mdc-table-sticky";needsPositionStickyOnElement=!1;static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275cmp=YA({type:t,selectors:[["mat-table"],["table","mat-table",""]],hostAttrs:[1,"mat-mdc-table","mdc-data-table__table"],hostVars:2,hostBindings:function(i,n){i&2&&ue("mdc-table-fixed-layout",n.fixedLayout)},exportAs:["matTable"],features:[ct([{provide:QG,useExisting:t},{provide:Ll,useExisting:t},{provide:_y,useClass:cG},{provide:Qu,useClass:QB},{provide:Gy,useValue:null}]),et],ngContentSelectors:eTA,decls:5,vars:2,consts:[["role","rowgroup"],["headerRowOutlet",""],["role","rowgroup",1,"mdc-data-table__content"],["rowOutlet",""],["noDataRowOutlet",""],["footerRowOutlet",""]],template:function(i,n){i&1&&(Yt(ATA),xe(0),xe(1,1),NA(2,tTA,1,0)(3,iTA,7,0)(4,nTA,4,0)),i&2&&(_(2),FA(n._isServer?2:-1),_(),FA(n._isNativeHtmlTable?3:4))},dependencies:[BG,dG,hG,EG],styles:[".mat-mdc-table-sticky{position:sticky !important}mat-table{display:block}mat-header-row{min-height:56px}mat-row,mat-footer-row{min-height:48px}mat-row,mat-header-row,mat-footer-row{display:flex;border-width:0;border-bottom-width:1px;border-style:solid;align-items:center;box-sizing:border-box}mat-cell:first-of-type,mat-header-cell:first-of-type,mat-footer-cell:first-of-type{padding-left:24px}[dir=rtl] mat-cell:first-of-type:not(:only-of-type),[dir=rtl] mat-header-cell:first-of-type:not(:only-of-type),[dir=rtl] mat-footer-cell:first-of-type:not(:only-of-type){padding-left:0;padding-right:24px}mat-cell:last-of-type,mat-header-cell:last-of-type,mat-footer-cell:last-of-type{padding-right:24px}[dir=rtl] mat-cell:last-of-type:not(:only-of-type),[dir=rtl] mat-header-cell:last-of-type:not(:only-of-type),[dir=rtl] mat-footer-cell:last-of-type:not(:only-of-type){padding-right:0;padding-left:24px}mat-cell,mat-header-cell,mat-footer-cell{flex:1;display:flex;align-items:center;overflow:hidden;word-wrap:break-word;min-height:inherit}.mat-mdc-table{min-width:100%;border:0;border-spacing:0;table-layout:auto;white-space:normal;background-color:var(--mat-table-background-color, var(--mat-sys-surface))}.mdc-data-table__cell{box-sizing:border-box;overflow:hidden;text-align:left;text-overflow:ellipsis}[dir=rtl] .mdc-data-table__cell{text-align:right}.mdc-data-table__cell,.mdc-data-table__header-cell{padding:0 16px}.mat-mdc-header-row{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;height:var(--mat-table-header-container-height, 56px);color:var(--mat-table-header-headline-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-table-header-headline-font, var(--mat-sys-title-small-font, Roboto, sans-serif));line-height:var(--mat-table-header-headline-line-height, var(--mat-sys-title-small-line-height));font-size:var(--mat-table-header-headline-size, var(--mat-sys-title-small-size, 14px));font-weight:var(--mat-table-header-headline-weight, var(--mat-sys-title-small-weight, 500))}.mat-mdc-row{height:var(--mat-table-row-item-container-height, 52px);color:var(--mat-table-row-item-label-text-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)))}.mat-mdc-row,.mdc-data-table__content{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--mat-table-row-item-label-text-font, var(--mat-sys-body-medium-font, Roboto, sans-serif));line-height:var(--mat-table-row-item-label-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-table-row-item-label-text-size, var(--mat-sys-body-medium-size, 14px));font-weight:var(--mat-table-row-item-label-text-weight, var(--mat-sys-body-medium-weight))}.mat-mdc-footer-row{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;height:var(--mat-table-footer-container-height, 52px);color:var(--mat-table-row-item-label-text-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-table-footer-supporting-text-font, var(--mat-sys-body-medium-font, Roboto, sans-serif));line-height:var(--mat-table-footer-supporting-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-table-footer-supporting-text-size, var(--mat-sys-body-medium-size, 14px));font-weight:var(--mat-table-footer-supporting-text-weight, var(--mat-sys-body-medium-weight));letter-spacing:var(--mat-table-footer-supporting-text-tracking, var(--mat-sys-body-medium-tracking))}.mat-mdc-header-cell{border-bottom-color:var(--mat-table-row-item-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, 0.12)));border-bottom-width:var(--mat-table-row-item-outline-width, 1px);border-bottom-style:solid;letter-spacing:var(--mat-table-header-headline-tracking, var(--mat-sys-title-small-tracking));font-weight:inherit;line-height:inherit;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;outline:none;text-align:left}[dir=rtl] .mat-mdc-header-cell{text-align:right}.mdc-data-table__row:last-child>.mat-mdc-header-cell{border-bottom:none}.mat-mdc-cell{border-bottom-color:var(--mat-table-row-item-outline-color, var(--mat-sys-outline, rgba(0, 0, 0, 0.12)));border-bottom-width:var(--mat-table-row-item-outline-width, 1px);border-bottom-style:solid;letter-spacing:var(--mat-table-row-item-label-text-tracking, var(--mat-sys-body-medium-tracking));line-height:inherit}.mdc-data-table__row:last-child>.mat-mdc-cell{border-bottom:none}.mat-mdc-footer-cell{letter-spacing:var(--mat-table-row-item-label-text-tracking, var(--mat-sys-body-medium-tracking))}mat-row.mat-mdc-row,mat-header-row.mat-mdc-header-row,mat-footer-row.mat-mdc-footer-row{border-bottom:none}.mat-mdc-table tbody,.mat-mdc-table tfoot,.mat-mdc-table thead,.mat-mdc-cell,.mat-mdc-footer-cell,.mat-mdc-header-row,.mat-mdc-row,.mat-mdc-footer-row,.mat-mdc-table .mat-mdc-header-cell{background:inherit}.mat-mdc-table mat-header-row.mat-mdc-header-row,.mat-mdc-table mat-row.mat-mdc-row,.mat-mdc-table mat-footer-row.mat-mdc-footer-cell{height:unset}mat-header-cell.mat-mdc-header-cell,mat-cell.mat-mdc-cell,mat-footer-cell.mat-mdc-footer-cell{align-self:stretch}"],encapsulation:2})}return t})(),vaA=(()=>{class t extends Uy{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matCellDef",""]],features:[ct([{provide:Uy,useExisting:t}]),et]})}return t})(),baA=(()=>{class t extends Ky{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matHeaderCellDef",""]],features:[ct([{provide:Ky,useExisting:t}]),et]})}return t})();var MaA=(()=>{class t extends Ih{get name(){return this._name}set name(A){this._setNameInput(A)}_updateColumnCssClassName(){super._updateColumnCssClassName(),this._columnCssClassName.push(`mat-column-${this.cssClassFriendlyName}`)}static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matColumnDef",""]],inputs:{name:[0,"matColumnDef","name"]},features:[ct([{provide:Ih,useExisting:t},{provide:"MAT_SORT_HEADER_COLUMN_DEF",useExisting:t}]),et]})}return t})(),kaA=(()=>{class t extends maA{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["mat-header-cell"],["th","mat-header-cell",""]],hostAttrs:["role","columnheader",1,"mat-mdc-header-cell","mdc-data-table__header-cell"],features:[et]})}return t})();var SaA=(()=>{class t extends paA{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["mat-cell"],["td","mat-cell",""]],hostAttrs:[1,"mat-mdc-cell","mdc-data-table__cell"],features:[et]})}return t})();var RaA=(()=>{class t extends X3{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matHeaderRowDef",""]],inputs:{columns:[0,"matHeaderRowDef","columns"],sticky:[2,"matHeaderRowDefSticky","sticky",ae]},features:[ct([{provide:X3,useExisting:t}]),et]})}return t})();var LaA=(()=>{class t extends Yy{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matRowDef",""]],inputs:{columns:[0,"matRowDefColumns","columns"],when:[0,"matRowDefWhen","when"]},features:[ct([{provide:Yy,useExisting:t}]),et]})}return t})(),xaA=(()=>{class t extends IG{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275cmp=YA({type:t,selectors:[["mat-header-row"],["tr","mat-header-row",""]],hostAttrs:["role","row",1,"mat-mdc-header-row","mdc-data-table__header-row"],exportAs:["matHeaderRow"],features:[ct([{provide:IG,useExisting:t}]),et],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(i,n){i&1&&Mr(0,0)},dependencies:[OC],encapsulation:2})}return t})();var FaA=(()=>{class t extends CG{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275cmp=YA({type:t,selectors:[["mat-row"],["tr","mat-row",""]],hostAttrs:["role","row",1,"mat-mdc-row","mdc-data-table__row"],exportAs:["matRow"],features:[ct([{provide:CG,useExisting:t}]),et],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(i,n){i&1&&Mr(0,0)},dependencies:[OC],encapsulation:2})}return t})();var NaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,DaA,Ve]})}return t})(),oTA=9007199254740991,$3=class extends $6{_data;_renderData=new li([]);_filter=new li("");_internalPageChanges=new HA;_renderChangesSubscription=null;filteredData;get data(){return this._data.value}set data(e){e=Array.isArray(e)?e:[],this._data.next(e),this._renderChangesSubscription||this._filterData(e)}get filter(){return this._filter.value}set filter(e){this._filter.next(e),this._renderChangesSubscription||this._filterData(this.data)}get sort(){return this._sort}set sort(e){this._sort=e,this._updateChangeSubscription()}_sort;get paginator(){return this._paginator}set paginator(e){this._paginator=e,this._updateChangeSubscription()}_paginator;sortingDataAccessor=(e,A)=>{let i=e[A];if(OM(i)){let n=Number(i);return n{let i=A.active,n=A.direction;return!i||n==""?e:e.sort((o,r)=>{let s=this.sortingDataAccessor(o,i),a=this.sortingDataAccessor(r,i),c=typeof s,l=typeof a;c!==l&&(c==="number"&&(s+=""),l==="number"&&(a+=""));let I=0;return s!=null&&a!=null?s>a?I=1:s{let i=A.trim().toLowerCase();return Object.values(e).some(n=>`${n}`.toLowerCase().includes(i))};constructor(e=[]){super(),this._data=new li(e),this._updateChangeSubscription()}_updateChangeSubscription(){let e=this._sort?ho(this._sort.sortChange,this._sort.initialized):ve(null),A=this._paginator?ho(this._paginator.page,this._internalPageChanges,this._paginator.initialized):ve(null),i=this._data,n=Ls([i,this._filter]).pipe(Je(([s])=>this._filterData(s))),o=Ls([n,e]).pipe(Je(([s])=>this._orderData(s))),r=Ls([o,A]).pipe(Je(([s])=>this._pageData(s)));this._renderChangesSubscription?.unsubscribe(),this._renderChangesSubscription=r.subscribe(s=>this._renderData.next(s))}_filterData(e){return this.filteredData=this.filter==null||this.filter===""?e:e.filter(A=>this.filterPredicate(A,this.filter)),this.paginator&&this._updatePaginator(this.filteredData.length),this.filteredData}_orderData(e){return this.sort?this.sortData(e.slice(),this.sort):e}_pageData(e){if(!this.paginator)return e;let A=this.paginator.pageIndex*this.paginator.pageSize;return e.slice(A,A+this.paginator.pageSize)}_updatePaginator(e){Promise.resolve().then(()=>{let A=this.paginator;if(A&&(A.length=e,A.pageIndex>0)){let i=Math.ceil(A.length/A.pageSize)-1||0,n=Math.min(A.pageIndex,i);n!==A.pageIndex&&(A.pageIndex=n,this._internalPageChanges.next())}})}connect(){return this._renderChangesSubscription||this._updateChangeSubscription(),this._renderData}disconnect(){this._renderChangesSubscription?.unsubscribe(),this._renderChangesSubscription=null}};var _aA=[{metricName:"tool_trajectory_avg_score",threshold:1},{metricName:"response_match_score",threshold:.7}];var gs=[];for(let t=0;t<256;++t)gs.push((t+256).toString(16).slice(1));function GaA(t,e=0){return(gs[t[e+0]]+gs[t[e+1]]+gs[t[e+2]]+gs[t[e+3]]+"-"+gs[t[e+4]]+gs[t[e+5]]+"-"+gs[t[e+6]]+gs[t[e+7]]+"-"+gs[t[e+8]]+gs[t[e+9]]+"-"+gs[t[e+10]]+gs[t[e+11]]+gs[t[e+12]]+gs[t[e+13]]+gs[t[e+14]]+gs[t[e+15]]).toLowerCase()}var uG,sTA=new Uint8Array(16);function fG(){if(!uG){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");uG=crypto.getRandomValues.bind(crypto)}return uG(sTA)}var aTA=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),mG={randomUUID:aTA};function cTA(t,e,A){if(mG.randomUUID&&!e&&!t)return mG.randomUUID();t=t||{};let i=t.random??t.rng?.()??fG();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){if(A=A||0,A<0||A+16>e.length)throw new RangeError(`UUID byte range ${A}:${A+15} is out of buffer bounds`);for(let n=0;n<16;++n)e[A+n]=i[n];return e}return GaA(i)}var Af=cTA;var zc=class t{constructor(e){this.http=e}apiServerDomain=Es.getApiServerBaseUrl();getEvalSets(e){if(this.apiServerDomain!=null){let A=this.apiServerDomain+`/apps/${e}/eval_sets`;return this.http.get(A)}return new Ze}createNewEvalSet(e,A){if(this.apiServerDomain!=null){let i=this.apiServerDomain+`/apps/${e}/eval_sets/${A}`;return this.http.post(i,{})}return new Ze}listEvalCases(e,A){if(this.apiServerDomain!=null){let i=this.apiServerDomain+`/apps/${e}/eval_sets/${A}/evals`;return this.http.get(i,{})}return new Ze}addCurrentSession(e,A,i,n,o){let r=this.apiServerDomain+`/apps/${e}/eval_sets/${A}/add_session`;return this.http.post(r,{evalId:i,sessionId:n,userId:o})}runEval(e,A,i,n){let o=this.apiServerDomain+`/apps/${e}/eval_sets/${A}/run_eval`;return this.http.post(o,{evalIds:i,evalMetrics:n})}listEvalResults(e){if(this.apiServerDomain!=null){let A=this.apiServerDomain+`/apps/${e}/eval_results`;return this.http.get(A,{})}return new Ze}getEvalResult(e,A){if(this.apiServerDomain!=null){let i=this.apiServerDomain+`/apps/${e}/eval_results/${A}`;return this.http.get(i,{})}return new Ze}getEvalCase(e,A,i){if(this.apiServerDomain!=null){let n=this.apiServerDomain+`/apps/${e}/eval_sets/${A}/evals/${i}`;return this.http.get(n,{})}return new Ze}updateEvalCase(e,A,i,n){let o=this.apiServerDomain+`/apps/${e}/eval_sets/${A}/evals/${i}`;return this.http.put(o,{evalId:i,conversation:n.conversation,sessionInput:n.sessionInput,creationTimestamp:n.creationTimestamp})}deleteEvalCase(e,A,i){let n=this.apiServerDomain+`/apps/${e}/eval_sets/${A}/evals/${i}`;return this.http.delete(n,{})}static \u0275fac=function(A){return new(A||t)(he(Bs))};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var KaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["ng-component"]],hostAttrs:["cdk-text-field-style-loader",""],decls:0,vars:0,template:function(i,n){},styles:["textarea.cdk-textarea-autosize{resize:none}textarea.cdk-textarea-autosize-measuring{padding:2px 0 !important;box-sizing:content-box !important;height:auto !important;overflow:hidden !important}textarea.cdk-textarea-autosize-measuring-firefox{padding:2px 0 !important;box-sizing:content-box !important;height:0 !important}@keyframes cdk-text-field-autofill-start{/*!*/}@keyframes cdk-text-field-autofill-end{/*!*/}.cdk-text-field-autofill-monitored:-webkit-autofill{animation:cdk-text-field-autofill-start 0s 1ms}.cdk-text-field-autofill-monitored:not(:-webkit-autofill){animation:cdk-text-field-autofill-end 0s 1ms}"],encapsulation:2,changeDetection:0})}return t})(),UaA=og({passive:!0}),YaA=(()=>{class t{_platform=m(Zt);_ngZone=m(de);_styleLoader=m(Ln);_monitoredElements=new Map;constructor(){}monitor(A){if(!this._platform.isBrowser)return Ar;this._styleLoader.load(KaA);let i=sa(A),n=this._monitoredElements.get(i);if(n)return n.subject;let o=new HA,r="cdk-text-field-autofilled",s=a=>{a.animationName==="cdk-text-field-autofill-start"&&!i.classList.contains(r)?(i.classList.add(r),this._ngZone.run(()=>o.next({target:a.target,isAutofilled:!0}))):a.animationName==="cdk-text-field-autofill-end"&&i.classList.contains(r)&&(i.classList.remove(r),this._ngZone.run(()=>o.next({target:a.target,isAutofilled:!1})))};return this._ngZone.runOutsideAngular(()=>{i.addEventListener("animationstart",s,UaA),i.classList.add("cdk-text-field-autofill-monitored")}),this._monitoredElements.set(i,{subject:o,unlisten:()=>{i.removeEventListener("animationstart",s,UaA)}}),o}stopMonitoring(A){let i=sa(A),n=this._monitoredElements.get(i);n&&(n.unlisten(),n.subject.complete(),i.classList.remove("cdk-text-field-autofill-monitored"),i.classList.remove("cdk-text-field-autofilled"),this._monitoredElements.delete(i))}ngOnDestroy(){this._monitoredElements.forEach((A,i)=>this.stopMonitoring(i))}static \u0275fac=function(i){return new(i||t)};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var JaA=(()=>{class t{_elementRef=m(te);_platform=m(Zt);_ngZone=m(de);_renderer=m(Gi);_resizeEvents=new HA;_previousValue;_initialHeight;_destroyed=new HA;_listenerCleanups;_minRows;_maxRows;_enabled=!0;_previousMinRows=-1;_textareaElement;get minRows(){return this._minRows}set minRows(A){this._minRows=Ns(A),this._setMinHeight()}get maxRows(){return this._maxRows}set maxRows(A){this._maxRows=Ns(A),this._setMaxHeight()}get enabled(){return this._enabled}set enabled(A){this._enabled!==A&&((this._enabled=A)?this.resizeToFitContent(!0):this.reset())}get placeholder(){return this._textareaElement.placeholder}set placeholder(A){this._cachedPlaceholderHeight=void 0,A?this._textareaElement.setAttribute("placeholder",A):this._textareaElement.removeAttribute("placeholder"),this._cacheTextareaPlaceholderHeight()}_cachedLineHeight;_cachedPlaceholderHeight;_document=m(tt,{optional:!0});_hasFocus;_isViewInited=!1;constructor(){m(Ln).load(KaA),this._textareaElement=this._elementRef.nativeElement}_setMinHeight(){let A=this.minRows&&this._cachedLineHeight?`${this.minRows*this._cachedLineHeight}px`:null;A&&(this._textareaElement.style.minHeight=A)}_setMaxHeight(){let A=this.maxRows&&this._cachedLineHeight?`${this.maxRows*this._cachedLineHeight}px`:null;A&&(this._textareaElement.style.maxHeight=A)}ngAfterViewInit(){this._platform.isBrowser&&(this._initialHeight=this._textareaElement.style.height,this.resizeToFitContent(),this._ngZone.runOutsideAngular(()=>{this._listenerCleanups=[this._renderer.listen("window","resize",()=>this._resizeEvents.next()),this._renderer.listen(this._textareaElement,"focus",this._handleFocusEvent),this._renderer.listen(this._textareaElement,"blur",this._handleFocusEvent)],this._resizeEvents.pipe(Cd(16)).subscribe(()=>{this._cachedLineHeight=this._cachedPlaceholderHeight=void 0,this.resizeToFitContent(!0)})}),this._isViewInited=!0,this.resizeToFitContent(!0))}ngOnDestroy(){this._listenerCleanups?.forEach(A=>A()),this._resizeEvents.complete(),this._destroyed.next(),this._destroyed.complete()}_cacheTextareaLineHeight(){if(this._cachedLineHeight)return;let A=this._textareaElement.cloneNode(!1),i=A.style;A.rows=1,i.position="absolute",i.visibility="hidden",i.border="none",i.padding="0",i.height="",i.minHeight="",i.maxHeight="",i.top=i.bottom=i.left=i.right="auto",i.overflow="hidden",this._textareaElement.parentNode.appendChild(A),this._cachedLineHeight=A.clientHeight,A.remove(),this._setMinHeight(),this._setMaxHeight()}_measureScrollHeight(){let A=this._textareaElement,i=A.style.marginBottom||"",n=this._platform.FIREFOX,o=n&&this._hasFocus,r=n?"cdk-textarea-autosize-measuring-firefox":"cdk-textarea-autosize-measuring";o&&(A.style.marginBottom=`${A.clientHeight}px`),A.classList.add(r);let s=A.scrollHeight-4;return A.classList.remove(r),o&&(A.style.marginBottom=i),s}_cacheTextareaPlaceholderHeight(){if(!this._isViewInited||this._cachedPlaceholderHeight!=null)return;if(!this.placeholder){this._cachedPlaceholderHeight=0;return}let A=this._textareaElement.value;this._textareaElement.value=this._textareaElement.placeholder,this._cachedPlaceholderHeight=this._measureScrollHeight(),this._textareaElement.value=A}_handleFocusEvent=A=>{this._hasFocus=A.type==="focus"};ngDoCheck(){this._platform.isBrowser&&this.resizeToFitContent()}resizeToFitContent(A=!1){if(!this._enabled||(this._cacheTextareaLineHeight(),this._cacheTextareaPlaceholderHeight(),!this._cachedLineHeight))return;let i=this._elementRef.nativeElement,n=i.value;if(!A&&this._minRows===this._previousMinRows&&n===this._previousValue)return;let o=this._measureScrollHeight(),r=Math.max(o,this._cachedPlaceholderHeight||0);i.style.height=`${r}px`,this._ngZone.runOutsideAngular(()=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(()=>this._scrollToCaretPosition(i)):setTimeout(()=>this._scrollToCaretPosition(i))}),this._previousValue=n,this._previousMinRows=this._minRows}reset(){this._initialHeight!==void 0&&(this._textareaElement.style.height=this._initialHeight)}_noopInputHandler(){}_scrollToCaretPosition(A){let{selectionStart:i,selectionEnd:n}=A;!this._destroyed.isStopped&&this._hasFocus&&A.setSelectionRange(i,n)}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["textarea","cdkTextareaAutosize",""]],hostAttrs:["rows","1",1,"cdk-textarea-autosize"],hostBindings:function(i,n){i&1&&mA("input",function(){return n._noopInputHandler()})},inputs:{minRows:[0,"cdkAutosizeMinRows","minRows"],maxRows:[0,"cdkAutosizeMaxRows","maxRows"],enabled:[2,"cdkTextareaAutosize","enabled",ae],placeholder:"placeholder"},exportAs:["cdkTextareaAutosize"]})}return t})(),TaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({})}return t})();var gTA=new BA("MAT_INPUT_VALUE_ACCESSOR"),ITA=["button","checkbox","file","hidden","image","radio","range","reset","submit"],CTA=new BA("MAT_INPUT_CONFIG"),P1=(()=>{class t{_elementRef=m(te);_platform=m(Zt);ngControl=m(Pa,{optional:!0,self:!0});_autofillMonitor=m(YaA);_ngZone=m(de);_formField=m(wu,{optional:!0});_renderer=m(Gi);_uid=m($i).getId("mat-input-");_previousNativeValue;_inputValueAccessor;_signalBasedValueAccessor;_previousPlaceholder;_errorStateTracker;_config=m(CTA,{optional:!0});_cleanupIosKeyup;_cleanupWebkitWheel;_formFieldDescribedBy;_isServer;_isNativeSelect;_isTextarea;_isInFormField;focused=!1;stateChanges=new HA;controlType="mat-input";autofilled=!1;get disabled(){return this._disabled}set disabled(A){this._disabled=Yo(A),this.focused&&(this.focused=!1,this.stateChanges.next())}_disabled=!1;get id(){return this._id}set id(A){this._id=A||this._uid}_id;placeholder;name;get required(){return this._required??this.ngControl?.control?.hasValidator(Oa.required)??!1}set required(A){this._required=Yo(A)}_required;get type(){return this._type}set type(A){let i=this._type;this._type=A||"text",this._validateType(),!this._isTextarea&&TM().has(this._type)&&(this._elementRef.nativeElement.type=this._type),this._type!==i&&this._ensureWheelDefaultBehavior()}_type="text";get errorStateMatcher(){return this._errorStateTracker.matcher}set errorStateMatcher(A){this._errorStateTracker.matcher=A}userAriaDescribedBy;get value(){return this._signalBasedValueAccessor?this._signalBasedValueAccessor.value():this._inputValueAccessor.value}set value(A){A!==this.value&&(this._signalBasedValueAccessor?this._signalBasedValueAccessor.value.set(A):this._inputValueAccessor.value=A,this.stateChanges.next())}get readonly(){return this._readonly}set readonly(A){this._readonly=Yo(A)}_readonly=!1;disabledInteractive;get errorState(){return this._errorStateTracker.errorState}set errorState(A){this._errorStateTracker.errorState=A}_neverEmptyInputTypes=["date","datetime","datetime-local","month","time","week"].filter(A=>TM().has(A));constructor(){let A=m(jQ,{optional:!0}),i=m(bI,{optional:!0}),n=m(dB),o=m(gTA,{optional:!0,self:!0}),r=this._elementRef.nativeElement,s=r.nodeName.toLowerCase();o?h2(o.value)?this._signalBasedValueAccessor=o:this._inputValueAccessor=o:this._inputValueAccessor=r,this._previousNativeValue=this.value,this.id=this.id,this._platform.IOS&&this._ngZone.runOutsideAngular(()=>{this._cleanupIosKeyup=this._renderer.listen(r,"keyup",this._iOSKeyupListener)}),this._errorStateTracker=new UI(n,this.ngControl,i,A,this.stateChanges),this._isServer=!this._platform.isBrowser,this._isNativeSelect=s==="select",this._isTextarea=s==="textarea",this._isInFormField=!!this._formField,this.disabledInteractive=this._config?.disabledInteractive||!1,this._isNativeSelect&&(this.controlType=r.multiple?"mat-native-select-multiple":"mat-native-select"),this._signalBasedValueAccessor&&mQ(()=>{this._signalBasedValueAccessor.value(),this.stateChanges.next()})}ngAfterViewInit(){this._platform.isBrowser&&this._autofillMonitor.monitor(this._elementRef.nativeElement).subscribe(A=>{this.autofilled=A.isAutofilled,this.stateChanges.next()})}ngOnChanges(){this.stateChanges.next()}ngOnDestroy(){this.stateChanges.complete(),this._platform.isBrowser&&this._autofillMonitor.stopMonitoring(this._elementRef.nativeElement),this._cleanupIosKeyup?.(),this._cleanupWebkitWheel?.()}ngDoCheck(){this.ngControl&&(this.updateErrorState(),this.ngControl.disabled!==null&&this.ngControl.disabled!==this.disabled&&(this.disabled=this.ngControl.disabled,this.stateChanges.next())),this._dirtyCheckNativeValue(),this._dirtyCheckPlaceholder()}focus(A){this._elementRef.nativeElement.focus(A)}updateErrorState(){this._errorStateTracker.updateErrorState()}_focusChanged(A){if(A!==this.focused){if(!this._isNativeSelect&&A&&this.disabled&&this.disabledInteractive){let i=this._elementRef.nativeElement;i.type==="number"?(i.type="text",i.setSelectionRange(0,0),i.type="number"):i.setSelectionRange(0,0)}this.focused=A,this.stateChanges.next()}}_onInput(){}_dirtyCheckNativeValue(){let A=this._elementRef.nativeElement.value;this._previousNativeValue!==A&&(this._previousNativeValue=A,this.stateChanges.next())}_dirtyCheckPlaceholder(){let A=this._getPlaceholder();if(A!==this._previousPlaceholder){let i=this._elementRef.nativeElement;this._previousPlaceholder=A,A?i.setAttribute("placeholder",A):i.removeAttribute("placeholder")}}_getPlaceholder(){return this.placeholder||null}_validateType(){ITA.indexOf(this._type)>-1}_isNeverEmpty(){return this._neverEmptyInputTypes.indexOf(this._type)>-1}_isBadInput(){let A=this._elementRef.nativeElement.validity;return A&&A.badInput}get empty(){return!this._isNeverEmpty()&&!this._elementRef.nativeElement.value&&!this._isBadInput()&&!this.autofilled}get shouldLabelFloat(){if(this._isNativeSelect){let A=this._elementRef.nativeElement,i=A.options[0];return this.focused||A.multiple||!this.empty||!!(A.selectedIndex>-1&&i&&i.label)}else return this.focused&&!this.disabled||!this.empty}setDescribedByIds(A){let i=this._elementRef.nativeElement,n=i.getAttribute("aria-describedby"),o;if(n){let r=this._formFieldDescribedBy||A;o=A.concat(n.split(" ").filter(s=>s&&!r.includes(s)))}else o=A;this._formFieldDescribedBy=A,o.length?i.setAttribute("aria-describedby",o.join(" ")):i.removeAttribute("aria-describedby")}onContainerClick(){this.focused||this.focus()}_isInlineSelect(){let A=this._elementRef.nativeElement;return this._isNativeSelect&&(A.multiple||A.size>1)}_iOSKeyupListener=A=>{let i=A.target;!i.value&&i.selectionStart===0&&i.selectionEnd===0&&(i.setSelectionRange(1,1),i.setSelectionRange(0,0))};_webkitBlinkWheelListener=()=>{};_ensureWheelDefaultBehavior(){this._cleanupWebkitWheel?.(),this._type==="number"&&(this._platform.BLINK||this._platform.WEBKIT)&&(this._cleanupWebkitWheel=this._renderer.listen(this._elementRef.nativeElement,"wheel",this._webkitBlinkWheelListener))}_getReadonlyAttribute(){return this._isNativeSelect?null:this.readonly||this.disabled&&this.disabledInteractive?"true":null}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["input","matInput",""],["textarea","matInput",""],["select","matNativeControl",""],["input","matNativeControl",""],["textarea","matNativeControl",""]],hostAttrs:[1,"mat-mdc-input-element"],hostVars:21,hostBindings:function(i,n){i&1&&mA("focus",function(){return n._focusChanged(!0)})("blur",function(){return n._focusChanged(!1)})("input",function(){return n._onInput()}),i&2&&(Fs("id",n.id)("disabled",n.disabled&&!n.disabledInteractive)("required",n.required),_e("name",n.name||null)("readonly",n._getReadonlyAttribute())("aria-disabled",n.disabled&&n.disabledInteractive?"true":null)("aria-invalid",n.empty&&n.required?null:n.errorState)("aria-required",n.required)("id",n.id),ue("mat-input-server",n._isServer)("mat-mdc-form-field-textarea-control",n._isInFormField&&n._isTextarea)("mat-mdc-form-field-input-control",n._isInFormField)("mat-mdc-input-disabled-interactive",n.disabledInteractive)("mdc-text-field__input",n._isInFormField)("mat-mdc-native-select-inline",n._isInlineSelect()))},inputs:{disabled:"disabled",id:"id",placeholder:"placeholder",name:"name",required:"required",type:"type",errorStateMatcher:"errorStateMatcher",userAriaDescribedBy:[0,"aria-describedby","userAriaDescribedBy"],value:"value",readonly:"readonly",disabledInteractive:[2,"disabledInteractive","disabledInteractive",ae]},exportAs:["matInput"],features:[ct([{provide:pu,useExisting:t}]),Kt]})}return t})(),Ty=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,f0,f0,TaA,Ve]})}return t})();var ef=class t{constructor(e,A,i){this.evalService=e;this.data=A;this.dialogRef=i}newCaseId="case"+Af().slice(0,6);createNewEvalCase(){!this.newCaseId||this.newCaseId==""?alert("Cannot create eval set with empty id!"):this.evalService.addCurrentSession(this.data.appName,this.data.evalSetId,this.newCaseId,this.data.sessionId,this.data.userId).subscribe(e=>{this.dialogRef.close(!0)})}static \u0275fac=function(A){return new(A||t)(zA(zc),zA($r),zA(cr))};static \u0275cmp=YA({type:t,selectors:[["app-add-eval-session-dialog"]],standalone:!1,decls:11,vars:1,consts:[["mat-dialog-title",""],[2,"padding-left","20px","padding-right","24px"],["matInput","",3,"ngModelChange","keydown.enter","ngModel"],["align","end"],["mat-button","","mat-dialog-close",""],["mat-button","","cdkFocusInitial","",3,"click"]],template:function(A,i){A&1&&(S(0,"h2",0),tA(1,"Add Current Session To Eval Set"),R(),S(2,"mat-dialog-content"),tA(3,` Please enter the eval case name `),R(),S(4,"mat-form-field",1)(5,"input",2),ta("ngModelChange",function(o){return Ja(i.newCaseId,o)||(i.newCaseId=o),o}),mA("keydown.enter",function(){return i.createNewEvalCase()}),R()(),S(6,"mat-dialog-actions",3)(7,"button",4),tA(8,"Cancel"),R(),S(9,"button",5),mA("click",function(){return i.createNewEvalCase()}),tA(10,"Create"),R()()),A&2&&(_(5),ea("ngModel",i.newCaseId))},dependencies:[fc,na,ja,lg,P1,ur,hs,ga,Ia,gg],encapsulation:2})};var tf=class t{constructor(e,A,i){this.evalService=e;this.data=A;this.dialogRef=i}newSetId="evalset"+Af().slice(0,6);createNewEvalSet(){!this.newSetId||this.newSetId==""?alert("Cannot create eval set with empty id!"):this.evalService.createNewEvalSet(this.data.appName,this.newSetId).subscribe(e=>{this.dialogRef.close(!0)})}static \u0275fac=function(A){return new(A||t)(zA(zc),zA($r),zA(cr))};static \u0275cmp=YA({type:t,selectors:[["app-new-eval-set-dialog-component"]],standalone:!1,decls:11,vars:1,consts:[["mat-dialog-title",""],[2,"padding-left","20px","padding-right","24px"],["matInput","",3,"ngModelChange","keydown.enter","ngModel"],["align","end"],["mat-button","","mat-dialog-close",""],["mat-button","","cdkFocusInitial","",3,"click"]],template:function(A,i){A&1&&(S(0,"h2",0),tA(1,"Create New Eval Set"),R(),S(2,"mat-dialog-content"),tA(3,` Please enter the eval set name -`),R(),S(4,"mat-form-field",1)(5,"input",2),ta("ngModelChange",function(o){return Ja(i.newSetId,o)||(i.newSetId=o),o}),mA("keydown.enter",function(){return i.createNewEvalSet()}),R()(),S(6,"mat-dialog-actions",3)(7,"button",4),tA(8,"Cancel"),R(),S(9,"button",5),mA("click",function(){return i.createNewEvalSet()}),tA(10,"Create"),R()()),A&2&&(_(5),ea("ngModel",i.newSetId))},dependencies:[fc,na,ja,lg,P1,ur,hs,ga,Ia,gg],encapsulation:2})};var dTA=["knob"],BTA=["valueIndicatorContainer"];function ETA(t,e){if(t&1&&(S(0,"div",2,1)(2,"div",5)(3,"span",6),tA(4),R()()()),t&2){let A=P();_(4),Mt(A.valueIndicatorText)}}var hTA=["trackActive"],QTA=["*"];function uTA(t,e){if(t&1&&UA(0,"div"),t&2){let A=e.$implicit,i=e.$index,n=P(3);vo(A===0?"mdc-slider__tick-mark--active":"mdc-slider__tick-mark--inactive"),so("transform",n._calcTickMarkTransform(i))}}function fTA(t,e){if(t&1&&ln(0,uTA,1,4,"div",8,Kd),t&2){let A=P(2);gn(A._tickMarks)}}function mTA(t,e){if(t&1&&(S(0,"div",6,1),NA(2,fTA,2,0),R()),t&2){let A=P();_(2),FA(A._cachedWidth?2:-1)}}function pTA(t,e){if(t&1&&UA(0,"mat-slider-visual-thumb",7),t&2){let A=P();vA("discrete",A.discrete)("thumbPosition",1)("valueIndicatorText",A.startValueIndicatorText)}}var $t=function(t){return t[t.START=1]="START",t[t.END=2]="END",t}($t||{}),Ch=function(t){return t[t.ACTIVE=0]="ACTIVE",t[t.INACTIVE=1]="INACTIVE",t}(Ch||{}),pG=new BA("_MatSlider"),zaA=new BA("_MatSliderThumb"),wTA=new BA("_MatSliderRangeThumb"),HaA=new BA("_MatSliderVisualThumb");var DTA=(()=>{class t{_cdr=m(lt);_ngZone=m(de);_slider=m(pG);_renderer=m(Gi);_listenerCleanups;discrete;thumbPosition;valueIndicatorText;_ripple;_knob;_valueIndicatorContainer;_sliderInput;_sliderInputEl;_hoverRippleRef;_focusRippleRef;_activeRippleRef;_isHovered=!1;_isActive=!1;_isValueIndicatorVisible=!1;_hostElement=m(te).nativeElement;_platform=m(Zt);constructor(){}ngAfterViewInit(){let A=this._slider._getInput(this.thumbPosition);A&&(this._ripple.radius=24,this._sliderInput=A,this._sliderInputEl=this._sliderInput._hostElement,this._ngZone.runOutsideAngular(()=>{let i=this._sliderInputEl,n=this._renderer;this._listenerCleanups=[n.listen(i,"pointermove",this._onPointerMove),n.listen(i,"pointerdown",this._onDragStart),n.listen(i,"pointerup",this._onDragEnd),n.listen(i,"pointerleave",this._onMouseLeave),n.listen(i,"focus",this._onFocus),n.listen(i,"blur",this._onBlur)]}))}ngOnDestroy(){this._listenerCleanups?.forEach(A=>A())}_onPointerMove=A=>{if(this._sliderInput._isFocused)return;let i=this._hostElement.getBoundingClientRect(),n=this._slider._isCursorOnSliderThumb(A,i);this._isHovered=n,n?this._showHoverRipple():this._hideRipple(this._hoverRippleRef)};_onMouseLeave=()=>{this._isHovered=!1,this._hideRipple(this._hoverRippleRef)};_onFocus=()=>{this._hideRipple(this._hoverRippleRef),this._showFocusRipple(),this._hostElement.classList.add("mdc-slider__thumb--focused")};_onBlur=()=>{this._isActive||this._hideRipple(this._focusRippleRef),this._isHovered&&this._showHoverRipple(),this._hostElement.classList.remove("mdc-slider__thumb--focused")};_onDragStart=A=>{A.button===0&&(this._isActive=!0,this._showActiveRipple())};_onDragEnd=()=>{this._isActive=!1,this._hideRipple(this._activeRippleRef),this._sliderInput._isFocused||this._hideRipple(this._focusRippleRef),this._platform.SAFARI&&this._showHoverRipple()};_showHoverRipple(){this._isShowingRipple(this._hoverRippleRef)||(this._hoverRippleRef=this._showRipple({enterDuration:0,exitDuration:0}),this._hoverRippleRef?.element.classList.add("mat-mdc-slider-hover-ripple"))}_showFocusRipple(){this._isShowingRipple(this._focusRippleRef)||(this._focusRippleRef=this._showRipple({enterDuration:0,exitDuration:0},!0),this._focusRippleRef?.element.classList.add("mat-mdc-slider-focus-ripple"))}_showActiveRipple(){this._isShowingRipple(this._activeRippleRef)||(this._activeRippleRef=this._showRipple({enterDuration:225,exitDuration:400}),this._activeRippleRef?.element.classList.add("mat-mdc-slider-active-ripple"))}_isShowingRipple(A){return A?.state===_s.FADING_IN||A?.state===_s.VISIBLE}_showRipple(A,i){if(!this._slider.disabled&&(this._showValueIndicator(),this._slider._isRange&&this._slider._getThumb(this.thumbPosition===$t.START?$t.END:$t.START)._showValueIndicator(),!(this._slider._globalRippleOptions?.disabled&&!i)))return this._ripple.launch({animation:this._slider._noopAnimations?{enterDuration:0,exitDuration:0}:A,centered:!0,persistent:!0})}_hideRipple(A){if(A?.fadeOut(),this._isShowingAnyRipple())return;this._slider._isRange||this._hideValueIndicator();let i=this._getSibling();i._isShowingAnyRipple()||(this._hideValueIndicator(),i._hideValueIndicator())}_showValueIndicator(){this._hostElement.classList.add("mdc-slider__thumb--with-indicator")}_hideValueIndicator(){this._hostElement.classList.remove("mdc-slider__thumb--with-indicator")}_getSibling(){return this._slider._getThumb(this.thumbPosition===$t.START?$t.END:$t.START)}_getValueIndicatorContainer(){return this._valueIndicatorContainer?.nativeElement}_getKnob(){return this._knob.nativeElement}_isShowingAnyRipple(){return this._isShowingRipple(this._hoverRippleRef)||this._isShowingRipple(this._focusRippleRef)||this._isShowingRipple(this._activeRippleRef)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-slider-visual-thumb"]],viewQuery:function(i,n){if(i&1&&(Ge(Gs,5),Ge(dTA,5),Ge(BTA,5)),i&2){let o;$A(o=Ae())&&(n._ripple=o.first),$A(o=Ae())&&(n._knob=o.first),$A(o=Ae())&&(n._valueIndicatorContainer=o.first)}},hostAttrs:[1,"mdc-slider__thumb","mat-mdc-slider-visual-thumb"],inputs:{discrete:"discrete",thumbPosition:"thumbPosition",valueIndicatorText:"valueIndicatorText"},features:[ct([{provide:HaA,useExisting:t}])],decls:4,vars:2,consts:[["knob",""],["valueIndicatorContainer",""],[1,"mdc-slider__value-indicator-container"],[1,"mdc-slider__thumb-knob"],["matRipple","",1,"mat-focus-indicator",3,"matRippleDisabled"],[1,"mdc-slider__value-indicator"],[1,"mdc-slider__value-indicator-text"]],template:function(i,n){i&1&&(NA(0,ETA,5,1,"div",2),UA(1,"div",3,0)(3,"div",4)),i&2&&(FA(n.discrete?0:-1),_(3),vA("matRippleDisabled",!0))},dependencies:[Gs],styles:[".mat-mdc-slider-visual-thumb .mat-ripple{height:100%;width:100%}.mat-mdc-slider .mdc-slider__tick-marks{justify-content:start}.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--active,.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--inactive{position:absolute;left:2px}"],encapsulation:2,changeDetection:0})}return t})(),OaA=(()=>{class t{_ngZone=m(de);_cdr=m(lt);_elementRef=m(te);_dir=m(bo,{optional:!0});_globalRippleOptions=m(L2,{optional:!0});_trackActive;_thumbs;_input;_inputs;get disabled(){return this._disabled}set disabled(A){this._disabled=A;let i=this._getInput($t.END),n=this._getInput($t.START);i&&(i.disabled=this._disabled),n&&(n.disabled=this._disabled)}_disabled=!1;get discrete(){return this._discrete}set discrete(A){this._discrete=A,this._updateValueIndicatorUIs()}_discrete=!1;showTickMarks=!1;get min(){return this._min}set min(A){let i=isNaN(A)?this._min:A;this._min!==i&&this._updateMin(i)}_min=0;color;disableRipple=!1;_updateMin(A){let i=this._min;this._min=A,this._isRange?this._updateMinRange({old:i,new:A}):this._updateMinNonRange(A),this._onMinMaxOrStepChange()}_updateMinRange(A){let i=this._getInput($t.END),n=this._getInput($t.START),o=i.value,r=n.value;n.min=A.new,i.min=Math.max(A.new,n.value),n.max=Math.min(i.max,i.value),n._updateWidthInactive(),i._updateWidthInactive(),A.newA.old?this._onTranslateXChangeBySideEffect(n,i):this._onTranslateXChangeBySideEffect(i,n),o!==i.value&&this._onValueChange(i),r!==n.value&&this._onValueChange(n)}_updateMaxNonRange(A){let i=this._getInput($t.END);if(i){let n=i.value;i.max=A,i._updateThumbUIByValue(),this._updateTrackUI(i),n!==i.value&&this._onValueChange(i)}}get step(){return this._step}set step(A){let i=isNaN(A)?this._step:A;this._step!==i&&this._updateStep(i)}_step=1;_updateStep(A){this._step=A,this._isRange?this._updateStepRange():this._updateStepNonRange(),this._onMinMaxOrStepChange()}_updateStepRange(){let A=this._getInput($t.END),i=this._getInput($t.START),n=A.value,o=i.value,r=i.value;A.min=this._min,i.max=this._max,A.step=this._step,i.step=this._step,this._platform.SAFARI&&(A.value=A.value,i.value=i.value),A.min=Math.max(this._min,i.value),i.max=Math.min(this._max,A.value),i._updateWidthInactive(),A._updateWidthInactive(),A.value`${A}`;_tickMarks;_noopAnimations;_dirChangeSubscription;_resizeObserver;_cachedWidth;_cachedLeft;_rippleRadius=24;startValueIndicatorText="";endValueIndicatorText="";_endThumbTransform;_startThumbTransform;_isRange=!1;_isRtl=!1;_hasViewInitialized=!1;_tickMarkTrackWidth=0;_hasAnimation=!1;_resizeTimer=null;_platform=m(Zt);constructor(){m(Ln).load(Qr);let A=m(mi,{optional:!0});this._noopAnimations=A==="NoopAnimations",this._dir&&(this._dirChangeSubscription=this._dir.change.subscribe(()=>this._onDirChange()),this._isRtl=this._dir.value==="rtl")}_knobRadius=8;_inputPadding;ngAfterViewInit(){this._platform.isBrowser&&this._updateDimensions();let A=this._getInput($t.END),i=this._getInput($t.START);this._isRange=!!A&&!!i,this._cdr.detectChanges();let n=this._getThumb($t.END);this._rippleRadius=n._ripple.radius,this._inputPadding=this._rippleRadius-this._knobRadius,this._isRange?this._initUIRange(A,i):this._initUINonRange(A),this._updateTrackUI(A),this._updateTickMarkUI(),this._updateTickMarkTrackUI(),this._observeHostResize(),this._cdr.detectChanges()}_initUINonRange(A){A.initProps(),A.initUI(),this._updateValueIndicatorUI(A),this._hasViewInitialized=!0,A._updateThumbUIByValue()}_initUIRange(A,i){A.initProps(),A.initUI(),i.initProps(),i.initUI(),A._updateMinMax(),i._updateMinMax(),A._updateStaticStyles(),i._updateStaticStyles(),this._updateValueIndicatorUIs(),this._hasViewInitialized=!0,A._updateThumbUIByValue(),i._updateThumbUIByValue()}ngOnDestroy(){this._dirChangeSubscription.unsubscribe(),this._resizeObserver?.disconnect(),this._resizeObserver=null}_onDirChange(){this._isRtl=this._dir?.value==="rtl",this._isRange?this._onDirChangeRange():this._onDirChangeNonRange(),this._updateTickMarkUI()}_onDirChangeRange(){let A=this._getInput($t.END),i=this._getInput($t.START);A._setIsLeftThumb(),i._setIsLeftThumb(),A.translateX=A._calcTranslateXByValue(),i.translateX=i._calcTranslateXByValue(),A._updateStaticStyles(),i._updateStaticStyles(),A._updateWidthInactive(),i._updateWidthInactive(),A._updateThumbUIByValue(),i._updateThumbUIByValue()}_onDirChangeNonRange(){this._getInput($t.END)._updateThumbUIByValue()}_observeHostResize(){typeof ResizeObserver>"u"||!ResizeObserver||this._ngZone.runOutsideAngular(()=>{this._resizeObserver=new ResizeObserver(()=>{this._isActive()||(this._resizeTimer&&clearTimeout(this._resizeTimer),this._onResize())}),this._resizeObserver.observe(this._elementRef.nativeElement)})}_isActive(){return this._getThumb($t.START)._isActive||this._getThumb($t.END)._isActive}_getValue(A=$t.END){let i=this._getInput(A);return i?i.value:this.min}_skipUpdate(){return!!(this._getInput($t.START)?._skipUIUpdate||this._getInput($t.END)?._skipUIUpdate)}_updateDimensions(){this._cachedWidth=this._elementRef.nativeElement.offsetWidth,this._cachedLeft=this._elementRef.nativeElement.getBoundingClientRect().left}_setTrackActiveStyles(A){let i=this._trackActive.nativeElement.style;i.left=A.left,i.right=A.right,i.transformOrigin=A.transformOrigin,i.transform=A.transform}_calcTickMarkTransform(A){let i=A*(this._tickMarkTrackWidth/(this._tickMarks.length-1));return`translateX(${this._isRtl?this._cachedWidth-6-i:i}px`}_onTranslateXChange(A){this._hasViewInitialized&&(this._updateThumbUI(A),this._updateTrackUI(A),this._updateOverlappingThumbUI(A))}_onTranslateXChangeBySideEffect(A,i){this._hasViewInitialized&&(A._updateThumbUIByValue(),i._updateThumbUIByValue())}_onValueChange(A){this._hasViewInitialized&&(this._updateValueIndicatorUI(A),this._updateTickMarkUI(),this._cdr.detectChanges())}_onMinMaxOrStepChange(){this._hasViewInitialized&&(this._updateTickMarkUI(),this._updateTickMarkTrackUI(),this._cdr.markForCheck())}_onResize(){if(this._hasViewInitialized){if(this._updateDimensions(),this._isRange){let A=this._getInput($t.END),i=this._getInput($t.START);A._updateThumbUIByValue(),i._updateThumbUIByValue(),A._updateStaticStyles(),i._updateStaticStyles(),A._updateMinMax(),i._updateMinMax(),A._updateWidthInactive(),i._updateWidthInactive()}else{let A=this._getInput($t.END);A&&A._updateThumbUIByValue()}this._updateTickMarkUI(),this._updateTickMarkTrackUI(),this._cdr.detectChanges()}}_thumbsOverlap=!1;_areThumbsOverlapping(){let A=this._getInput($t.START),i=this._getInput($t.END);return!A||!i?!1:i.translateX-A.translateX<20}_updateOverlappingThumbClassNames(A){let i=A.getSibling(),n=this._getThumb(A.thumbPosition);this._getThumb(i.thumbPosition)._hostElement.classList.remove("mdc-slider__thumb--top"),n._hostElement.classList.toggle("mdc-slider__thumb--top",this._thumbsOverlap)}_updateOverlappingThumbUI(A){!this._isRange||this._skipUpdate()||this._thumbsOverlap!==this._areThumbsOverlapping()&&(this._thumbsOverlap=!this._thumbsOverlap,this._updateOverlappingThumbClassNames(A))}_updateThumbUI(A){if(this._skipUpdate())return;let i=this._getThumb(A.thumbPosition===$t.END?$t.END:$t.START);i._hostElement.style.transform=`translateX(${A.translateX}px)`}_updateValueIndicatorUI(A){if(this._skipUpdate())return;let i=this.displayWith(A.value);if(this._hasViewInitialized?A._valuetext.set(i):A._hostElement.setAttribute("aria-valuetext",i),this.discrete){A.thumbPosition===$t.START?this.startValueIndicatorText=i:this.endValueIndicatorText=i;let n=this._getThumb(A.thumbPosition);i.length<3?n._hostElement.classList.add("mdc-slider__thumb--short-value"):n._hostElement.classList.remove("mdc-slider__thumb--short-value")}}_updateValueIndicatorUIs(){let A=this._getInput($t.END),i=this._getInput($t.START);A&&this._updateValueIndicatorUI(A),i&&this._updateValueIndicatorUI(i)}_updateTickMarkTrackUI(){if(!this.showTickMarks||this._skipUpdate())return;let A=this._step&&this._step>0?this._step:1,n=(Math.floor(this.max/A)*A-this.min)/(this.max-this.min);this._tickMarkTrackWidth=(this._cachedWidth-6)*n}_updateTrackUI(A){this._skipUpdate()||(this._isRange?this._updateTrackUIRange(A):this._updateTrackUINonRange(A))}_updateTrackUIRange(A){let i=A.getSibling();if(!i||!this._cachedWidth)return;let n=Math.abs(i.translateX-A.translateX)/this._cachedWidth;A._isLeftThumb&&this._cachedWidth?this._setTrackActiveStyles({left:"auto",right:`${this._cachedWidth-i.translateX}px`,transformOrigin:"right",transform:`scaleX(${n})`}):this._setTrackActiveStyles({left:`${i.translateX}px`,right:"auto",transformOrigin:"left",transform:`scaleX(${n})`})}_updateTrackUINonRange(A){this._isRtl?this._setTrackActiveStyles({left:"auto",right:"0px",transformOrigin:"right",transform:`scaleX(${1-A.fillPercentage})`}):this._setTrackActiveStyles({left:"0px",right:"auto",transformOrigin:"left",transform:`scaleX(${A.fillPercentage})`})}_updateTickMarkUI(){if(!this.showTickMarks||this.step===void 0||this.min===void 0||this.max===void 0)return;let A=this.step>0?this.step:1;this._isRange?this._updateTickMarkUIRange(A):this._updateTickMarkUINonRange(A)}_updateTickMarkUINonRange(A){let i=this._getValue(),n=Math.max(Math.round((i-this.min)/A),0)+1,o=Math.max(Math.round((this.max-i)/A),0)-1;this._isRtl?n++:o++,this._tickMarks=Array(n).fill(Ch.ACTIVE).concat(Array(o).fill(Ch.INACTIVE))}_updateTickMarkUIRange(A){let i=this._getValue(),n=this._getValue($t.START),o=Math.max(Math.round((n-this.min)/A),0),r=Math.max(Math.round((i-n)/A)+1,0),s=Math.max(Math.round((this.max-i)/A),0);this._tickMarks=Array(o).fill(Ch.INACTIVE).concat(Array(r).fill(Ch.ACTIVE),Array(s).fill(Ch.INACTIVE))}_getInput(A){if(A===$t.END&&this._input)return this._input;if(this._inputs?.length)return A===$t.START?this._inputs.first:this._inputs.last}_getThumb(A){return A===$t.END?this._thumbs?.last:this._thumbs?.first}_setTransition(A){this._hasAnimation=!this._platform.IOS&&A&&!this._noopAnimations,this._elementRef.nativeElement.classList.toggle("mat-mdc-slider-with-animation",this._hasAnimation)}_isCursorOnSliderThumb(A,i){let n=i.width/2,o=i.x+n,r=i.y+n,s=A.clientX-o,a=A.clientY-r;return Math.pow(s,2)+Math.pow(a,2)wG),multi:!0};var wG=(()=>{class t{_ngZone=m(de);_elementRef=m(te);_cdr=m(lt);_slider=m(pG);_platform=m(Zt);_listenerCleanups;get value(){return Mi(this._hostElement.value,0)}set value(A){A=isNaN(A)?0:A;let i=A+"";if(!this._hasSetInitialValue){this._initialValue=i;return}this._isActive||this._setValue(i)}_setValue(A){this._hostElement.value=A,this._updateThumbUIByValue(),this._slider._onValueChange(this),this._cdr.detectChanges(),this._slider._cdr.markForCheck()}valueChange=new XA;dragStart=new XA;dragEnd=new XA;get translateX(){return this._slider.min>=this._slider.max?(this._translateX=this._tickMarkOffset,this._translateX):(this._translateX===void 0&&(this._translateX=this._calcTranslateXByValue()),this._translateX)}set translateX(A){this._translateX=A}_translateX;thumbPosition=$t.END;get min(){return Mi(this._hostElement.min,0)}set min(A){this._hostElement.min=A+"",this._cdr.detectChanges()}get max(){return Mi(this._hostElement.max,0)}set max(A){this._hostElement.max=A+"",this._cdr.detectChanges()}get step(){return Mi(this._hostElement.step,0)}set step(A){this._hostElement.step=A+"",this._cdr.detectChanges()}get disabled(){return ae(this._hostElement.disabled)}set disabled(A){this._hostElement.disabled=A,this._cdr.detectChanges(),this._slider.disabled!==this.disabled&&(this._slider.disabled=this.disabled)}get percentage(){return this._slider.min>=this._slider.max?this._slider._isRtl?1:0:(this.value-this._slider.min)/(this._slider.max-this._slider.min)}get fillPercentage(){return this._slider._cachedWidth?this._translateX===0?0:this.translateX/this._slider._cachedWidth:this._slider._isRtl?1:0}_hostElement=this._elementRef.nativeElement;_valuetext=Ko("");_knobRadius=8;_tickMarkOffset=3;_isActive=!1;_isFocused=!1;_setIsFocused(A){this._isFocused=A}_hasSetInitialValue=!1;_initialValue;_formControl;_destroyed=new HA;_skipUIUpdate=!1;_onChangeFn;_onTouchedFn=()=>{};_isControlInitialized=!1;constructor(){let A=m(Gi);this._ngZone.runOutsideAngular(()=>{this._listenerCleanups=[A.listen(this._hostElement,"pointerdown",this._onPointerDown.bind(this)),A.listen(this._hostElement,"pointermove",this._onPointerMove.bind(this)),A.listen(this._hostElement,"pointerup",this._onPointerUp.bind(this))]})}ngOnDestroy(){this._listenerCleanups.forEach(A=>A()),this._destroyed.next(),this._destroyed.complete(),this.dragStart.complete(),this.dragEnd.complete()}initProps(){this._updateWidthInactive(),this.disabled!==this._slider.disabled&&(this._slider.disabled=!0),this.step=this._slider.step,this.min=this._slider.min,this.max=this._slider.max,this._initValue()}initUI(){this._updateThumbUIByValue()}_initValue(){this._hasSetInitialValue=!0,this._initialValue===void 0?this.value=this._getDefaultValue():(this._hostElement.value=this._initialValue,this._updateThumbUIByValue(),this._slider._onValueChange(this),this._cdr.detectChanges())}_getDefaultValue(){return this.min}_onBlur(){this._setIsFocused(!1),this._onTouchedFn()}_onFocus(){this._slider._setTransition(!1),this._slider._updateTrackUI(this),this._setIsFocused(!0)}_onChange(){this.valueChange.emit(this.value),this._isActive&&this._updateThumbUIByValue({withAnimation:!0})}_onInput(){this._onChangeFn?.(this.value),(this._slider.step||!this._isActive)&&this._updateThumbUIByValue({withAnimation:!0}),this._slider._onValueChange(this)}_onNgControlValueChange(){(!this._isActive||!this._isFocused)&&(this._slider._onValueChange(this),this._updateThumbUIByValue()),this._slider.disabled=this._formControl.disabled}_onPointerDown(A){if(!(this.disabled||A.button!==0)){if(this._platform.IOS){let i=this._slider._isCursorOnSliderThumb(A,this._slider._getThumb(this.thumbPosition)._hostElement.getBoundingClientRect());this._isActive=i,this._updateWidthActive(),this._slider._updateDimensions();return}this._isActive=!0,this._setIsFocused(!0),this._updateWidthActive(),this._slider._updateDimensions(),this._slider.step||this._updateThumbUIByPointerEvent(A,{withAnimation:!0}),this.disabled||(this._handleValueCorrection(A),this.dragStart.emit({source:this,parent:this._slider,value:this.value}))}}_handleValueCorrection(A){this._skipUIUpdate=!0,setTimeout(()=>{this._skipUIUpdate=!1,this._fixValue(A)},0)}_fixValue(A){let i=A.clientX-this._slider._cachedLeft,n=this._slider._cachedWidth,o=this._slider.step===0?1:this._slider.step,r=Math.floor((this._slider.max-this._slider.min)/o),s=this._slider._isRtl?1-i/n:i/n,c=Math.round(s*r)/r*(this._slider.max-this._slider.min)+this._slider.min,l=Math.round(c/o)*o,I=this.value;if(l===I){this._slider._onValueChange(this),this._slider.step>0?this._updateThumbUIByValue():this._updateThumbUIByPointerEvent(A,{withAnimation:this._slider._hasAnimation});return}this.value=l,this.valueChange.emit(this.value),this._onChangeFn?.(this.value),this._slider._onValueChange(this),this._slider.step>0?this._updateThumbUIByValue():this._updateThumbUIByPointerEvent(A,{withAnimation:this._slider._hasAnimation})}_onPointerMove(A){!this._slider.step&&this._isActive&&this._updateThumbUIByPointerEvent(A)}_onPointerUp(){this._isActive&&(this._isActive=!1,this._platform.SAFARI&&this._setIsFocused(!1),this.dragEnd.emit({source:this,parent:this._slider,value:this.value}),setTimeout(()=>this._updateWidthInactive(),this._platform.IOS?10:0))}_clamp(A){let i=this._tickMarkOffset,n=this._slider._cachedWidth-this._tickMarkOffset;return Math.max(Math.min(A,n),i)}_calcTranslateXByValue(){return this._slider._isRtl?(1-this.percentage)*(this._slider._cachedWidth-this._tickMarkOffset*2)+this._tickMarkOffset:this.percentage*(this._slider._cachedWidth-this._tickMarkOffset*2)+this._tickMarkOffset}_calcTranslateXByPointerEvent(A){return A.clientX-this._slider._cachedLeft}_updateWidthActive(){}_updateWidthInactive(){this._hostElement.style.padding=`0 ${this._slider._inputPadding}px`,this._hostElement.style.width=`calc(100% + ${this._slider._inputPadding-this._tickMarkOffset*2}px)`,this._hostElement.style.left=`-${this._slider._rippleRadius-this._tickMarkOffset}px`}_updateThumbUIByValue(A){this.translateX=this._clamp(this._calcTranslateXByValue()),this._updateThumbUI(A)}_updateThumbUIByPointerEvent(A,i){this.translateX=this._clamp(this._calcTranslateXByPointerEvent(A)),this._updateThumbUI(i)}_updateThumbUI(A){this._slider._setTransition(!!A?.withAnimation),this._slider._onTranslateXChange(this)}writeValue(A){(this._isControlInitialized||A!==null)&&(this.value=A)}registerOnChange(A){this._onChangeFn=A,this._isControlInitialized=!0}registerOnTouched(A){this._onTouchedFn=A}setDisabledState(A){this.disabled=A}focus(){this._hostElement.focus()}blur(){this._hostElement.blur()}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["input","matSliderThumb",""]],hostAttrs:["type","range",1,"mdc-slider__input"],hostVars:1,hostBindings:function(i,n){i&1&&mA("change",function(){return n._onChange()})("input",function(){return n._onInput()})("blur",function(){return n._onBlur()})("focus",function(){return n._onFocus()}),i&2&&_e("aria-valuetext",n._valuetext())},inputs:{value:[2,"value","value",Mi]},outputs:{valueChange:"valueChange",dragStart:"dragStart",dragEnd:"dragEnd"},exportAs:["matSliderThumb"],features:[ct([yTA,{provide:zaA,useExisting:t}])]})}return t})();var PaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Xa]})}return t})();var nf=class t{constructor(e,A,i){this.dialogRef=e;this.fb=A;this.data=i;this.evalForm=this.fb.group({tool_trajectory_avg_score_threshold:[this.getEvalMetricThresholdFromData("tool_trajectory_avg_score"),[Oa.required,Oa.min(0),Oa.max(1)]],response_match_score_threshold:[this.getEvalMetricThresholdFromData("response_match_score"),[Oa.required,Oa.min(0),Oa.max(1)]]}),this.evalMetrics=this.data.evalMetrics}evalForm;evalMetrics=[];getEvalMetricThresholdFromData(e){return this.evalMetrics.find(A=>A.metricName===e)?.threshold??0}onStart(){if(this.evalForm.valid){let{tool_trajectory_avg_score_threshold:e,response_match_score_threshold:A}=this.evalForm.value;for(let i of this.evalMetrics)i.metricName==="tool_trajectory_avg_score"?i.threshold=e:i.metricName==="response_match_score"&&(i.threshold=A);this.dialogRef.close(this.evalMetrics)}}onCancel(){this.dialogRef.close(null)}static \u0275fac=function(A){return new(A||t)(zA(cr),zA(BH),zA($r))};static \u0275cmp=YA({type:t,selectors:[["app-run-eval-config-dialog"]],standalone:!1,decls:26,vars:3,consts:[[1,"dialog-container"],["mat-dialog-title","",1,"dialog-title"],[1,"eval-form",3,"formGroup"],[1,"metric-row"],[1,"metric-name"],[1,"flex-1","pl-4"],["min","0","max","1","step","0.1","thumbLabel","",1,"threshold-slider"],["matSliderThumb","","formControlName","tool_trajectory_avg_score_threshold"],[1,"threshold-value"],["matSliderThumb","","formControlName","response_match_score_threshold"],["align","end",1,"dialog-actions"],["mat-button","",1,"cancel-button",3,"click"],["mat-button","",1,"save-button",3,"click"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"h2",1),tA(2,"EVALUATION METRIC"),R(),S(3,"mat-dialog-content")(4,"form",2)(5,"div",3)(6,"div",4),tA(7,"Tool trajectory avg score: "),R(),S(8,"div",5)(9,"mat-slider",6),UA(10,"input",7),R(),S(11,"span",8),tA(12),R()()(),S(13,"div",3)(14,"div",4),tA(15,"Response match score: "),R(),S(16,"div",5)(17,"mat-slider",6),UA(18,"input",9),R(),S(19,"span",8),tA(20),R()()()()(),S(21,"mat-dialog-actions",10)(22,"button",11),mA("click",function(){return i.onCancel()}),tA(23,"Cancel"),R(),S(24,"button",12),mA("click",function(){return i.onStart()}),tA(25,"Start"),R()()()),A&2&&(_(4),vA("formGroup",i.evalForm),_(8),ot(" ",i.evalForm.controls.tool_trajectory_avg_score_threshold.value," "),_(8),ot(" ",i.evalForm.controls.response_match_score_threshold.value," "))},dependencies:[CH,fc,na,rH,ur,hs,ga,Ia,OaA,wG,bI,lM],styles:[".dialog-container[_ngcontent-%COMP%]{border-radius:12px;padding:18px;width:500px;box-shadow:0 8px 16px #0006}.threshold-slider[_ngcontent-%COMP%]{--mdc-slider-active-track-color: #4285f4;--mdc-slider-inactive-track-color: #616161;--mdc-slider-handle-color: #4285f4;--mdc-slider-ripple-color: #4285f4;width:100px}.metric-row[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center}.metric-name[_ngcontent-%COMP%]{width:250px}.threshold-value[_ngcontent-%COMP%]{margin-left:20px}.mdc-slider__thumb--with-indicator[_ngcontent-%COMP%]{background-color:var(--mdc-slider-handle-color, black);border:none!important;box-shadow:none!important}"]})};var Jg=class t{constructor(e){this.http=e}apiServerDomain=Es.getApiServerBaseUrl();createSession(e,A){if(this.apiServerDomain!=null){let i=this.apiServerDomain+`/apps/${A}/users/${e}/sessions`;return this.http.post(i,null)}return new Ze}listSessions(e,A){if(this.apiServerDomain!=null){let i=this.apiServerDomain+`/apps/${A}/users/${e}/sessions`;return this.http.get(i)}return new Ze}deleteSession(e,A,i){let n=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}`;return this.http.delete(n)}getSession(e,A,i){let n=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}`;return this.http.get(n)}importSession(e,A,i){if(this.apiServerDomain!=null){let n=this.apiServerDomain+`/apps/${A}/users/${e}/sessions`;return this.http.post(n,{appName:A,userId:e,events:i})}return new Ze}static \u0275fac=function(A){return new(A||t)(he(Bs))};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var bTA=["determinateSpinner"];function MTA(t,e){if(t&1&&(hr(),S(0,"svg",11),UA(1,"circle",12),R()),t&2){let A=P();_e("viewBox",A._viewBox()),_(),so("stroke-dasharray",A._strokeCircumference(),"px")("stroke-dashoffset",A._strokeCircumference()/2,"px")("stroke-width",A._circleStrokeWidth(),"%"),_e("r",A._circleRadius())}}var kTA=new BA("mat-progress-spinner-default-options",{providedIn:"root",factory:STA});function STA(){return{diameter:jaA}}var jaA=100,RTA=10,qaA=(()=>{class t{_elementRef=m(te);_noopAnimations;get color(){return this._color||this._defaultColor}set color(A){this._color=A}_color;_defaultColor="primary";_determinateCircle;constructor(){let A=m(mi,{optional:!0}),i=m(kTA);this._noopAnimations=A==="NoopAnimations"&&!!i&&!i._forceAnimations,this.mode=this._elementRef.nativeElement.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",i&&(i.color&&(this.color=this._defaultColor=i.color),i.diameter&&(this.diameter=i.diameter),i.strokeWidth&&(this.strokeWidth=i.strokeWidth))}mode;get value(){return this.mode==="determinate"?this._value:0}set value(A){this._value=Math.max(0,Math.min(100,A||0))}_value=0;get diameter(){return this._diameter}set diameter(A){this._diameter=A||0}_diameter=jaA;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(A){this._strokeWidth=A||0}_strokeWidth;_circleRadius(){return(this.diameter-RTA)/2}_viewBox(){let A=this._circleRadius()*2+this.strokeWidth;return`0 0 ${A} ${A}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode==="determinate"?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(i,n){if(i&1&&Ge(bTA,5),i&2){let o;$A(o=Ae())&&(n._determinateCircle=o.first)}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(i,n){i&2&&(_e("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",n.mode==="determinate"?n.value:null)("mode",n.mode),vo("mat-"+n.color),so("width",n.diameter,"px")("height",n.diameter,"px")("--mdc-circular-progress-size",n.diameter+"px")("--mdc-circular-progress-active-indicator-width",n.diameter+"px"),ue("_mat-animation-noopable",n._noopAnimations)("mdc-circular-progress--indeterminate",n.mode==="indeterminate"))},inputs:{color:"color",mode:"mode",value:[2,"value","value",Mi],diameter:[2,"diameter","diameter",Mi],strokeWidth:[2,"strokeWidth","strokeWidth",Mi]},exportAs:["matProgressSpinner"],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(i,n){if(i&1&&(NA(0,MTA,2,8,"ng-template",null,0,fQ),S(2,"div",2,1),hr(),S(4,"svg",3),UA(5,"circle",4),R()(),uI(),S(6,"div",5)(7,"div",6)(8,"div",7),Mr(9,8),R(),S(10,"div",9),Mr(11,8),R(),S(12,"div",10),Mr(13,8),R()()()),i&2){let o=or(1);_(4),_e("viewBox",n._viewBox()),_(),so("stroke-dasharray",n._strokeCircumference(),"px")("stroke-dashoffset",n._strokeDashOffset(),"px")("stroke-width",n._circleStrokeWidth(),"%"),_e("r",n._circleRadius()),_(4),vA("ngTemplateOutlet",o),_(2),vA("ngTemplateOutlet",o),_(2),vA("ngTemplateOutlet",o)}},dependencies:[vQ],styles:[".mat-mdc-progress-spinner{display:block;overflow:hidden;line-height:0;position:relative;direction:ltr;transition:opacity 250ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-progress-spinner circle{stroke-width:var(--mdc-circular-progress-active-indicator-width, 4px)}.mat-mdc-progress-spinner._mat-animation-noopable,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle{transition:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container{animation:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle{stroke-dasharray:0 !important}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle{stroke:currentColor;stroke:CanvasText}}.mdc-circular-progress__determinate-container,.mdc-circular-progress__indeterminate-circle-graphic,.mdc-circular-progress__indeterminate-container,.mdc-circular-progress__spinner-layer{position:absolute;width:100%;height:100%}.mdc-circular-progress__determinate-container{transform:rotate(-90deg)}.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container{opacity:0}.mdc-circular-progress__indeterminate-container{font-size:0;letter-spacing:0;white-space:nowrap;opacity:0}.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container{opacity:1;animation:mdc-circular-progress-container-rotate 1568.2352941176ms linear infinite}.mdc-circular-progress__determinate-circle-graphic,.mdc-circular-progress__indeterminate-circle-graphic{fill:rgba(0,0,0,0)}.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:var(--mdc-circular-progress-active-indicator-color, var(--mat-sys-primary))}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:CanvasText}}.mdc-circular-progress__determinate-circle{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1)}.mdc-circular-progress__gap-patch{position:absolute;top:0;left:47.5%;box-sizing:border-box;width:5%;height:100%;overflow:hidden}.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic{left:-900%;width:2000%;transform:rotate(180deg)}.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic{width:200%}.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{left:-100%}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress__circle-clipper{display:inline-flex;position:relative;width:50%;height:100%;overflow:hidden}.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}@keyframes mdc-circular-progress-container-rotate{to{transform:rotate(360deg)}}@keyframes mdc-circular-progress-spinner-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdc-circular-progress-left-spin{from{transform:rotate(265deg)}50%{transform:rotate(130deg)}to{transform:rotate(265deg)}}@keyframes mdc-circular-progress-right-spin{from{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}to{transform:rotate(-265deg)}}"],encapsulation:2,changeDetection:0})}return t})();var VaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve]})}return t})();function xTA(t,e){if(t&1){let A=De();S(0,"div",1)(1,"div"),tA(2,"All eval sets"),R(),S(3,"mat-icon",2),mA("click",function(){LA(A);let n=P();return xA(n.openNewEvalSetDialog())}),tA(4,"add"),R()()}}function FTA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",3)(2,"div",4),tA(3," Create New Evaluation Set "),R(),S(4,"div",5),tA(5," An evaluation set is a curated collection of evaluation cases, where each case includes input-output examples for assessing agent performance. "),R(),S(6,"div",6),mA("click",function(){LA(A);let n=P();return xA(n.openNewEvalSetDialog())}),tA(7," Create Evaluation Set "),R()()()}}function NTA(t,e){if(t&1){let A=De();S(0,"div",8),mA("click",function(){let n=LA(A).$implicit,o=P(2);return xA(o.selectEvalSet(n))}),S(1,"div",9)(2,"span",10),tA(3,"folder"),R(),S(4,"div",11),tA(5),R()(),S(6,"div")(7,"mat-icon",12),tA(8,"chevron_right"),R()()()}if(t&2){let A=e.$implicit;_(5),Mt(A)}}function _TA(t,e){if(t&1&&(S(0,"div"),ln(1,NTA,9,1,"div",7,Kn),R()),t&2){let A=P();_(),gn(A.evalsets)}}function GTA(t,e){if(t&1){let A=De();S(0,"th",29)(1,"mat-checkbox",30),mA("change",function(n){LA(A);let o=P(4);return xA(n?o.toggleAllRows():null)}),R()()}if(t&2){let A=P(4);_(),vA("checked",A.selection.hasValue()&&A.isAllSelected())("indeterminate",A.selection.hasValue()&&!A.isAllSelected())}}function UTA(t,e){if(t&1){let A=De();S(0,"td",31)(1,"mat-checkbox",32),mA("click",function(n){return LA(A),xA(n.stopPropagation())})("change",function(n){let o=LA(A).$implicit,r=P(4);return xA(n?r.selection.toggle(o):null)}),R()()}if(t&2){let A=e.$implicit,i=P(4);_(),vA("checked",i.selection.isSelected(A))}}function KTA(t,e){t&1&&(S(0,"th",29),tA(1," Case ID "),R())}function YTA(t,e){if(t&1){let A=De();S(0,"td",33),mA("click",function(){let n=LA(A).$implicit,o=P(4);return xA(o.getEvalCase(n))}),tA(1),R()}if(t&2){let A,i=e.$implicit,n=P(4);ue("selected-eval-case",i===((A=n.selectedEvalCase())==null?null:A.evalId)),_(),ot(" ",i," ")}}function JTA(t,e){t&1&&(S(0,"th",29),tA(1," Result "),R())}function TTA(t,e){if(t&1){let A=De();S(0,"button",35),mA("click",function(){LA(A);let n=P().$implicit,o=P(4);return xA(o.getSession(n))}),S(1,"span",36),tA(2),R(),S(3,"div",37),tA(4),R()()}if(t&2){let A=P().$implicit,i=P(4);vA("ngClass",i.getEvalResultForCase(A)==1?"result-btn pass":"result-btn fail"),_(2),ot(" ",i.getEvalResultForCase(A)==1?"check":"close"," "),_(2),ot("",i.getEvalResultForCase(A)==1?"Pass":"Fail"," ")}}function zTA(t,e){if(t&1&&(S(0,"td",31),NA(1,TTA,5,3,"button",34),R()),t&2){let A=e.$implicit,i=P(4);_(),FA(i.getEvalResultForCase(A)?1:-1)}}function HTA(t,e){t&1&&UA(0,"tr",38)}function OTA(t,e){t&1&&UA(0,"tr",39)}function PTA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",16)(2,"button",17),mA("click",function(){LA(A);let n=P(3);return xA(n.openEvalConfigDialog())}),tA(3,"Run Evaluation"),R(),S(4,"mat-icon",18),mA("click",function(){LA(A);let n=P(3);return xA(n.toggleEvalHistoryButton())}),tA(5,"history"),R()(),S(6,"div",19)(7,"table",20),f2(8,21),NA(9,GTA,2,2,"th",22)(10,UTA,2,1,"td",23),m2(),f2(11,24),NA(12,KTA,2,0,"th",22)(13,YTA,2,3,"td",25),m2(),f2(14,26),NA(15,JTA,2,0,"th",22)(16,zTA,2,1,"td",23),m2(),NA(17,HTA,1,0,"tr",27)(18,OTA,1,0,"tr",28),R()()()}if(t&2){let A=P(3);_(7),vA("dataSource",A.dataSource),_(10),vA("matHeaderRowDef",A.displayedColumns),_(),vA("matRowDefColumns",A.displayedColumns)}}function jTA(t,e){if(t&1&&(S(0,"div")(1,"span",50),tA(2,"|"),R(),S(3,"span",51),tA(4),R()()),t&2){let A=P().$implicit,i=P(4);_(4),ot("",i.getFailCountForCurrentResult(A.evaluationResults.evaluationResults)," Failed")}}function qTA(t,e){if(t&1&&(S(0,"span",52),tA(1),R()),t&2){let A=e.$implicit;_(),Mb(" ",A.metricName,": ",A.threshold," ")}}function VTA(t,e){if(t&1&&(S(0,"div",46),ln(1,qTA,2,2,"span",52,Kn),R()),t&2){let A=P().$implicit,i=P(4);_(),gn(i.getEvalMetrics(A))}}function ZTA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",53)(2,"span"),tA(3),R(),S(4,"button",54),mA("click",function(){let n=LA(A).$implicit,o=P(6);return xA(o.getHistorySession(n))}),S(5,"span",36),tA(6),R(),S(7,"div",37),tA(8),R()()()()}if(t&2){let A=e.$implicit;_(3),ot(" ",A.evalId," "),_(),vA("ngClass",A.finalEvalStatus==1?"result-btn pass":"result-btn fail"),_(2),ot(" ",A.finalEvalStatus==1?"check":"close"," "),_(2),ot("",A.finalEvalStatus==1?"PASS":"FAIL"," ")}}function WTA(t,e){if(t&1&&(S(0,"div",49),ln(1,ZTA,9,4,"div",null,Kn),R()),t&2){let A=P().$implicit,i=P(4);_(),gn(i.generateHistoryEvaluationDatasource(A.timestamp))}}function XTA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",40)(2,"div",41)(3,"div",42)(4,"div",43),tA(5),R(),S(6,"div",44)(7,"span",45),tA(8),R(),NA(9,jTA,5,1,"div"),R(),NA(10,VTA,3,0,"div",46),R(),S(11,"div",47)(12,"mat-icon",48),mA("click",function(){let n=LA(A).$implicit,o=P(4);return xA(o.toggleHistoryStatusCard(n.timestamp))}),tA(13),R()()(),NA(14,WTA,3,0,"div",49),R()()}if(t&2){let A=e.$implicit,i=P(4);_(5),Mt(i.formatTimestamp(A.timestamp)),_(3),ot("",i.getPassCountForCurrentResult(A.evaluationResults.evaluationResults)," Passed"),_(),FA(i.getFailCountForCurrentResult(A.evaluationResults.evaluationResults)>0?9:-1),_(),FA(i.getEvalMetrics(A)?10:-1),_(3),Mt(i.getEvaluationStatusCardActionButtonIcon(A.timestamp)),_(),FA(i.isEvaluationStatusCardToggled(A.timestamp)?14:-1)}}function $TA(t,e){if(t&1&&(S(0,"div"),ln(1,XTA,15,6,"div",null,Kn),R()),t&2){let A=P(3);_(),gn(A.getEvalHistoryOfCurrentSetSorted())}}function AzA(t,e){if(t&1&&(S(0,"div"),NA(1,PTA,19,3,"div")(2,$TA,3,0,"div"),R()),t&2){let A=P(2);_(),FA(A.showEvalHistory()?-1:1),_(),FA(A.showEvalHistory()?2:-1)}}function ezA(t,e){if(t&1){let A=De();S(0,"button",55),mA("click",function(){LA(A);let n=P(2);return xA(n.openNewEvalCaseDialog())}),S(1,"div",56)(2,"mat-icon"),tA(3,"add"),R(),S(4,"div",57),tA(5),R()()()}if(t&2){let A=P(2);_(5),ot(" Add current session to ",A.selectedEvalSet," ")}}function tzA(t,e){t&1&&(S(0,"div"),UA(1,"mat-spinner",58),R()),t&2&&(_(),vA("diameter",28)("strokeWidth",3))}function izA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",9)(2,"mat-icon",13),mA("click",function(){LA(A);let n=P();return xA(n.clearSelectedEvalSet())}),tA(3,"chevron_left"),R(),S(4,"div",14),mA("click",function(){LA(A);let n=P();return xA(n.clearSelectedEvalSet())}),tA(5),R()(),NA(6,AzA,3,2,"div")(7,ezA,6,1,"button",15)(8,tzA,2,2,"div"),R()}if(t&2){let A=P();_(5),ot(" ",A.selectedEvalSet," "),_(),FA(A.evalCases.length>0&&!A.evalRunning()?6:-1),_(),FA(!A.evalRunning()&&!A.showEvalHistory()?7:-1),_(),FA(A.evalRunning()?8:-1)}}var PC=class t{constructor(e,A){this.evalService=e;this.sessionService=A;this.evalCasesSubject.subscribe(i=>{!this.selectedEvalCase()&&this.deletedEvalCaseIndex>=0&&i.length>0?(this.selectNewEvalCase(i),this.deletedEvalCaseIndex=-1):i.length===0&&this.shouldReturnToSession.emit(!0)})}checkboxes;appName="";userId="";sessionId="";sessionSelected=new XA;shouldShowTab=new XA;evalNotInstalledMsg=new XA;evalCaseSelected=new XA;evalSetIdSelected=new XA;shouldReturnToSession=new XA;evalCasesSubject=new li([]);changeDetectorRef=m(lt);flagService=m(vB);displayedColumns=["select","evalId","finalEvalStatus"];evalsets=[];selectedEvalSet="";evalCases=[];selectedEvalCase=Ko(null);deletedEvalCaseIndex=-1;dataSource=new $3(this.evalCases);selection=new F2(!0,[]);showEvalHistory=Ko(!1);evalRunning=Ko(!1);evalMetrics=_aA;currentEvalResultBySet=new Map;dialog=m(Us);appEvaluationResults={};ngOnChanges(e){e.appName&&(this.selectedEvalSet="",this.evalCases=[],this.getEvalSet(),this.getEvaluationResult())}ngOnInit(){}selectNewEvalCase(e){let A=this.deletedEvalCaseIndex;this.deletedEvalCaseIndex===e.length&&(A=0),this.getEvalCase(e[A])}getEvalSet(){this.appName!=""&&this.evalService.getEvalSets(this.appName).pipe(dr(e=>e.status===404&&e.statusText==="Not Found"?(this.shouldShowTab.emit(!1),ve(null)):ve([]))).subscribe(e=>{e!==null&&(this.shouldShowTab.emit(!0),this.evalsets=e)})}openNewEvalSetDialog(){this.dialog.open(tf,{width:"600px",data:{appName:this.appName}}).afterClosed().subscribe(A=>{A&&this.getEvalSet()})}openNewEvalCaseDialog(){this.dialog.open(ef,{width:"600px",data:{appName:this.appName,userId:this.userId,sessionId:this.sessionId,evalSetId:this.selectedEvalSet}}).afterClosed().subscribe(A=>{A&&this.listEvalCases()})}listEvalCases(){this.evalCases=[],this.evalService.listEvalCases(this.appName,this.selectedEvalSet).subscribe(e=>{this.evalCases=e,this.dataSource=new $3(this.evalCases),this.evalCasesSubject.next(this.evalCases),this.changeDetectorRef.detectChanges()})}runEval(){if(this.evalRunning.set(!0),this.selection.selected.length==0){alert("No case selected!"),this.evalRunning.set(!1);return}this.evalService.runEval(this.appName,this.selectedEvalSet,this.selection.selected,this.evalMetrics).pipe(dr(e=>(e.error?.detail?.includes("not installed")&&this.evalNotInstalledMsg.emit(e.error.detail),ve([])))).subscribe(e=>{this.evalRunning.set(!1),this.currentEvalResultBySet.set(this.selectedEvalSet,e),this.getEvaluationResult()})}selectEvalSet(e){this.selectedEvalSet=e,this.listEvalCases()}clearSelectedEvalSet(){if(this.showEvalHistory()){this.toggleEvalHistoryButton();return}this.selectedEvalSet=""}isAllSelected(){let e=this.selection.selected.length,A=this.dataSource.data.length;return e===A}toggleAllRows(){if(this.isAllSelected()){this.selection.clear();return}this.selection.select(...this.dataSource.data)}getEvalResultForCase(e){let A=this.currentEvalResultBySet.get(this.selectedEvalSet)?.filter(i=>i.evalId==e);if(!(!A||A.length==0))return A[0].finalEvalStatus}formatToolUses(e){let A=[];for(let i of e)A.push({name:i.name,args:i.args});return A}addEvalCaseResultToEvents(e,A){let i=A.evalMetricResultPerInvocation,n=-1;if(i)for(let o=0;on.evalId==e)[0],i=A.sessionId;this.sessionService.getSession(this.userId,this.appName,i).subscribe(n=>{this.addEvalCaseResultToEvents(n,A);let o=this.fromApiResultToSession(n);this.sessionSelected.emit(o)})}toggleEvalHistoryButton(){this.showEvalHistory.set(!this.showEvalHistory())}getEvalHistoryOfCurrentSet(){return this.appEvaluationResults[this.appName][this.selectedEvalSet]}getEvalHistoryOfCurrentSetSorted(){let e=this.getEvalHistoryOfCurrentSet();return Object.keys(e).sort((n,o)=>o.localeCompare(n)).map(n=>({timestamp:n,evaluationResults:e[n]}))}getPassCountForCurrentResult(e){return e.filter(A=>A.finalEvalStatus==1).length}getFailCountForCurrentResult(e){return e.filter(A=>A.finalEvalStatus==2).length}formatTimestamp(e){let A=Number(e);if(isNaN(A))return"Invalid timestamp provided";let i=new Date(A*1e3);if(isNaN(i.getTime()))return"Invalid date created from timestamp";let n={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return new Intl.DateTimeFormat("en-US",n).format(i)}getEvaluationStatusCardActionButtonIcon(e){return this.getEvalHistoryOfCurrentSet()[e].isToggled?"keyboard_arrow_up":"keyboard_arrow_down"}toggleHistoryStatusCard(e){this.getEvalHistoryOfCurrentSet()[e].isToggled=!this.getEvalHistoryOfCurrentSet()[e].isToggled}isEvaluationStatusCardToggled(e){return this.getEvalHistoryOfCurrentSet()[e].isToggled}generateHistoryEvaluationDatasource(e){return this.getEvalHistoryOfCurrentSet()[e].evaluationResults}getHistorySession(e){this.addEvalCaseResultToEvents(e.sessionDetails,e);let A=this.fromApiResultToSession(e.sessionDetails);this.sessionSelected.emit(A)}getEvalCase(e){this.evalService.getEvalCase(this.appName,this.selectedEvalSet,e).subscribe(A=>{this.selectedEvalCase.set(A),this.evalCaseSelected.emit(A),this.evalSetIdSelected.emit(this.selectedEvalSet)})}resetEvalCase(){this.selectedEvalCase.set(null)}resetEvalResults(){this.currentEvalResultBySet.clear()}deleteEvalCase(e){this.evalService.deleteEvalCase(this.appName,this.selectedEvalSet,e).subscribe(A=>{this.deletedEvalCaseIndex=this.evalCases.indexOf(e),this.selectedEvalCase.set(null),this.listEvalCases()})}getEvaluationResult(){this.evalService.listEvalResults(this.appName).pipe(dr(e=>e.status===404&&e.statusText==="Not Found"?(this.shouldShowTab.emit(!1),ve(null)):ve([]))).subscribe(e=>{for(let A of e)this.evalService.getEvalResult(this.appName,A).subscribe(i=>{this.appEvaluationResults[this.appName]||(this.appEvaluationResults[this.appName]={}),this.appEvaluationResults[this.appName][i.evalSetId]||(this.appEvaluationResults[this.appName][i.evalSetId]={});let n=i.creationTimestamp;this.appEvaluationResults[this.appName][i.evalSetId][n]||(this.appEvaluationResults[this.appName][i.evalSetId][n]={isToggled:!1,evaluationResults:[]});let o={isToggled:!1,evaluationResults:i.evalCaseResults.map(r=>({setId:r.id,evalId:r.evalId,finalEvalStatus:r.finalEvalStatus,evalMetricResults:r.evalMetricResults,evalMetricResultPerInvocation:r.evalMetricResultPerInvocation,sessionId:r.sessionId,sessionDetails:r.sessionDetails,overallEvalMetricResults:r.overallEvalMetricResults??[]}))};this.appEvaluationResults[this.appName][i.evalSetId][n]=o})})}openEvalConfigDialog(){if(this.selection.selected.length==0){alert("No case selected!");return}this.dialog.open(nf,{maxWidth:"90vw",maxHeight:"90vh",data:{evalMetrics:this.evalMetrics}}).afterClosed().subscribe(A=>{A&&(this.evalMetrics=A,this.runEval())})}getEvalMetrics(e){if(!e||!e.evaluationResults||!e.evaluationResults.evaluationResults)return this.evalMetrics;let A=e.evaluationResults.evaluationResults;return A.length===0?this.evalMetrics:typeof A[0].overallEvalMetricResults>"u"||!A[0].overallEvalMetricResults||A[0].overallEvalMetricResults.length===0?this.evalMetrics:A[0].overallEvalMetricResults.map(n=>({metricName:n.metricName,threshold:n.threshold}))}static \u0275fac=function(A){return new(A||t)(zA(zc),zA(Jg))};static \u0275cmp=YA({type:t,selectors:[["app-eval-tab"]],viewQuery:function(A,i){if(A&1&&Ge(gh,5),A&2){let n;$A(n=Ae())&&(i.checkboxes=n)}},inputs:{appName:"appName",userId:"userId",sessionId:"sessionId"},outputs:{sessionSelected:"sessionSelected",shouldShowTab:"shouldShowTab",evalNotInstalledMsg:"evalNotInstalledMsg",evalCaseSelected:"evalCaseSelected",evalSetIdSelected:"evalSetIdSelected",shouldReturnToSession:"shouldReturnToSession"},standalone:!1,features:[Kt],decls:5,vars:4,consts:[[1,"eval-container"],[1,"eval-set-actions"],["matTooltip","Create new evaluation set",2,"cursor","pointer",3,"click"],[1,"empty-eval-info"],[1,"info-title"],[1,"info-detail"],[1,"info-create",3,"click"],[1,"eval-set-row"],[1,"eval-set-row",3,"click"],[2,"display","flex"],[1,"material-symbols-outlined",2,"margin-right","10px","padding-top","16px"],[2,"font-family","Roboto","font-size","14px","padding","16px","padding-top","20px"],[2,"padding-top","20px","color","#9AA0A6"],[2,"color","white","cursor","pointer",3,"click"],[2,"color","#9AA0A6","padding-top","2px","cursor","pointer",3,"click"],[1,"save-session-btn"],[1,"evaluation-tab-header"],[1,"run-eval-btn",3,"click"],["matTooltip","View eval run history",1,"evaluation-history-icon",3,"click"],[1,"mat-table-container",2,"margin-top","16px"],["mat-table","",3,"dataSource"],["matColumnDef","select"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","evalId"],["mat-cell","","class","eval-case-id",3,"selected-eval-case","click",4,"matCellDef"],["matColumnDef","finalEvalStatus"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["mat-header-cell",""],[3,"change","checked","indeterminate"],["mat-cell",""],[3,"click","change","checked"],["mat-cell","",1,"eval-case-id",3,"click"],["matTooltip","View eval run result",3,"ngClass"],["matTooltip","View eval run result",3,"click","ngClass"],[1,"material-symbols-outlined"],[2,"padding-top","4px"],["mat-header-row",""],["mat-row",""],[1,"status-card"],[1,"status-card__overview"],[1,"status-card__info"],[1,"status-card__timestamp"],[1,"status-card__summary"],[1,"status-card__passed"],[1,"status-card__metrics"],[1,"status-card__action"],[3,"click"],[1,"status-card__history-cases"],[1,"status-card__separator"],[1,"status-card__failed"],[1,"status-card__metric"],[1,"status-card__history-case"],[3,"click","ngClass"],[1,"save-session-btn",3,"click"],[1,"save-session-btn-detail"],[1,"save-session-btn-text"],[1,"eval-spinner",3,"diameter","strokeWidth"]],template:function(A,i){A&1&&(S(0,"div",0),NA(1,xTA,5,0,"div",1)(2,FTA,8,0,"div")(3,_TA,3,0,"div")(4,izA,9,4,"div"),R()),A&2&&(_(),FA(i.selectedEvalSet==""?1:-1),_(),FA(i.evalsets.length==0?2:-1),_(),FA(i.evalsets.length>0&&i.selectedEvalSet==""?3:-1),_(),FA(i.selectedEvalSet!=""?4:-1))},dependencies:[Ha,T2,gh,yaA,baA,RaA,MaA,vaA,LaA,kaA,SaA,xaA,FaA,wB,qaA],styles:[".eval-container[_ngcontent-%COMP%]{margin-top:20px;padding-left:25px;padding-right:25px}.eval-case-id[_ngcontent-%COMP%]{cursor:pointer}.eval-set-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;color:#9aa0a6;font-style:normal;font-weight:700;font-size:14px}.empty-eval-info[_ngcontent-%COMP%]{margin-top:12px;background-color:#202124;border-radius:8px;box-shadow:0 2px 6px 2px #00000026,0 1px 2px #0000004d}.info-title[_ngcontent-%COMP%]{color:#e8eaed;font-family:Roboto;font-size:14px;font-weight:500;padding-top:13px;padding-right:16px;padding-left:16px}.info-detail[_ngcontent-%COMP%]{color:#e8eaed;font-family:Roboto;font-size:14px;font-weight:400;padding-top:13px;padding-right:16px;padding-left:16px;letter-spacing:.2px}.info-create[_ngcontent-%COMP%]{color:var(--Blue-300, #8ab4f8);font-size:14px;font-style:normal;font-weight:500;padding-right:16px;padding-left:16px;margin-top:19px;padding-bottom:16px;cursor:pointer}.eval-set-row[_ngcontent-%COMP%]{display:flex;justify-content:space-between;cursor:pointer}.selected-eval-case[_ngcontent-%COMP%]{font-weight:900;color:#8ab4f8}.save-session-btn[_ngcontent-%COMP%]{width:100%;background:linear-gradient(0deg,#8ab4f83d 0% 100%),#202124;border:none;border-radius:4px;margin-top:12px;cursor:pointer}.save-session-btn-detail[_ngcontent-%COMP%]{display:flex;padding:8px 16px 8px 12px;justify-content:center}.save-session-btn-text[_ngcontent-%COMP%]{padding-top:2px;color:var(--Blue-100, #d2e3fc);font-family:Google Sans;font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:.25px}.run-eval-btn[_ngcontent-%COMP%]{border-radius:4px;border:1px solid var(--Grey-700, #5f6368);background-color:transparent;padding:8px 24px;margin-top:16px;color:#8ab4f8;cursor:pointer}.run-eval-btn[_ngcontent-%COMP%]:hover{background-color:#202124}.result-btn[_ngcontent-%COMP%]{display:flex;background-color:transparent;border-radius:4px;border:1px solid var(--Grey-700, #5f6368);margin-top:4px;cursor:pointer}.result-btn[_ngcontent-%COMP%]:hover{background-color:#202124}.result-btn.pass[_ngcontent-%COMP%]{color:#44c265}.result-btn.fail[_ngcontent-%COMP%]{color:#ff8983}.evaluation-tab-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%}.evaluation-history-icon[_ngcontent-%COMP%]{cursor:pointer;margin-top:4px}.status-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;border-radius:8px;background-color:#2d2d2d;padding:12px 16px;margin-top:12px}.status-card__overview[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%}.status-card__info[_ngcontent-%COMP%]{display:flex;flex-direction:column}.status-card__timestamp[_ngcontent-%COMP%]{font-size:.9em;color:#e0e0e0;margin-bottom:5px}.status-card__summary[_ngcontent-%COMP%]{display:flex;align-items:center;font-size:.95em;font-weight:500}.status-card__metrics[_ngcontent-%COMP%]{display:flex;align-items:center;font-size:.75em;font-weight:300;margin-top:3px}.status-card__metric[_ngcontent-%COMP%]{width:180px;color:#bbb}.status-card__failed[_ngcontent-%COMP%]{color:#ff6b6b}.status-card__separator[_ngcontent-%COMP%]{color:#666;margin:0 8px}.status-card__passed[_ngcontent-%COMP%]{color:#63e6be}.status-card__action[_ngcontent-%COMP%]{display:flex;align-items:center}.status-card__action[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#bdbdbd;cursor:pointer;transition:transform .2s ease-in-out}.status-card__action[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]:hover{opacity:.8}.status-card__action[_ngcontent-%COMP%] .status-card__icon[_ngcontent-%COMP%]{color:#bdbdbd;font-size:1.2em;cursor:pointer}.status-card__action[_ngcontent-%COMP%] .status-card__icon[_ngcontent-%COMP%]:hover{opacity:.8}.status-card__history-cases[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-top:3px;justify-content:flex-start;width:100%}.status-card__history-case[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:15px}.eval-spinner[_ngcontent-%COMP%]{margin-top:12px}"],changeDetection:0})};function ozA(t,e){t&1&&UA(0,"div",6)}function rzA(t,e){if(t&1&&(S(0,"div",3)(1,"div",5),ln(2,ozA,1,0,"div",6,Kd),R(),S(4,"span",7),tA(5),R(),S(6,"div",8),tA(7),S(8,"span",9),tA(9),R()(),S(10,"div",10)(11,"div",11),tA(12),R()()()),t&2){let A=e.$implicit,i=P();_(2),gn(i.getArray(A.level)),_(3),ot(" ",i.getSpanIcon(A.span.name)," "),_(),so("width",400-A.level*20,"px"),_(),ot(" ",A.span.name," "),_(2),ot(" (",(i.toMs(A.span.end_time)-i.toMs(A.span.start_time)).toFixed(2),"ms) "),_(2),so("left",i.getRelativeStart(A.span),"%")("width",i.getRelativeWidth(A.span),"%"),_(),ot(" ",(i.toMs(A.span.end_time)-i.toMs(A.span.start_time)).toFixed(2),"ms ")}}var of=class t{constructor(e,A){this.dialogRef=e;this.data=A}tree=[];baseStartTimeMs=0;totalDurationMs=1;flatTree=[];traceLabelIconMap=new Map([["Invocation","start"],["agent_run","directions_run"],["tool","build"],["call_llm","chat"]]);ngOnInit(){this.tree=this.buildSpanTree(this.data.spans),this.flatTree=this.flattenTree(this.tree);let e=this.getGlobalTimes(this.data.spans);this.baseStartTimeMs=e.start,this.totalDurationMs=e.duration}buildSpanTree(e){let A=e.map(o=>nA({},o)),i=new Map,n=[];return A.forEach(o=>i.set(o.span_id,o)),A.forEach(o=>{if(o.parent_span_id&&i.has(o.parent_span_id)){let r=i.get(o.parent_span_id);r.children=r.children||[],r.children.push(o)}else n.push(o)}),n}getGlobalTimes(e){let A=Math.min(...e.map(n=>this.toMs(n.start_time))),i=Math.max(...e.map(n=>this.toMs(n.end_time)));return{start:A,duration:i-A}}toMs(e){return e/1e6}getRelativeStart(e){return(this.toMs(e.start_time)-this.baseStartTimeMs)/this.totalDurationMs*100}getRelativeWidth(e){return(this.toMs(e.end_time)-this.toMs(e.start_time))/this.totalDurationMs*100}flattenTree(e,A=0){return e.flatMap(n=>[{span:n,level:A},...n.children?this.flattenTree(n.children,A+1):[]])}getSpanIcon(e){for(let[A,i]of this.traceLabelIconMap.entries())if(e.startsWith(A))return i;return"start"}getArray(e){return Array.from({length:e})}static \u0275fac=function(A){return new(A||t)(zA(cr),zA($r))};static \u0275cmp=YA({type:t,selectors:[["app-trace-chart"]],standalone:!1,decls:9,vars:1,consts:[["mat-dialog-title",""],[2,"margin-top","8px"],[1,"trace-container"],[1,"trace-row"],["mat-button","","mat-dialog-close",""],[1,"trace-indent"],[1,"indent-connector"],[1,"material-symbols-outlined",2,"margin-right","8px"],[1,"trace-label"],[1,"trace-duration"],[1,"trace-bar-container"],[1,"trace-bar"]],template:function(A,i){A&1&&(S(0,"h2",0),tA(1),R(),S(2,"mat-dialog-content",1)(3,"div",2),ln(4,rzA,13,10,"div",3,Kn),R()(),S(6,"mat-dialog-actions")(7,"button",4),tA(8,"Close"),R()()),A&2&&(_(),ot("Invocation ",i.data.invocId,""),_(3),gn(i.flatTree))},dependencies:[ur,hs,ga,Ia,gg],styles:[".trace-container[_ngcontent-%COMP%]{width:100%;white-space:nowrap;font-size:12px}.trace-label[_ngcontent-%COMP%]{width:400px;color:#e3e3e3;text-overflow:ellipsis;font-family:Google Sans Mono,monospace;font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:0px}.trace-bar-container[_ngcontent-%COMP%]{width:50vw;position:relative;height:16px}.trace-bar[_ngcontent-%COMP%]{position:absolute;height:18px;background-color:#2f4d65;border-radius:4px;padding-left:4px;overflow:hidden;font-size:11px;line-height:16px;color:#8dabbf;font-family:Google Sans}.trace-duration[_ngcontent-%COMP%]{color:#888;font-weight:400;margin-left:4px}.trace-row[_ngcontent-%COMP%]{display:flex;align-items:stretch;position:relative;height:32px}.trace-indent[_ngcontent-%COMP%]{display:flex;flex-shrink:0;height:100%}.indent-connector[_ngcontent-%COMP%]{width:20px;position:relative;height:100%}.vertical-line[_ngcontent-%COMP%]{position:absolute;top:0;bottom:0;left:9px;width:1px;background-color:#ccc}.horizontal-line[_ngcontent-%COMP%]{position:absolute;top:50%;left:9px;width:10px;height:1px;background-color:#ccc}"]})};var ZaA=(()=>{class t{get vertical(){return this._vertical}set vertical(A){this._vertical=Yo(A)}_vertical=!1;get inset(){return this._inset}set inset(A){this._inset=Yo(A)}_inset=!1;static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-divider"]],hostAttrs:["role","separator",1,"mat-divider"],hostVars:7,hostBindings:function(i,n){i&2&&(_e("aria-orientation",n.vertical?"vertical":"horizontal"),ue("mat-divider-vertical",n.vertical)("mat-divider-horizontal",!n.vertical)("mat-divider-inset",n.inset))},inputs:{vertical:"vertical",inset:"inset"},decls:0,vars:0,template:function(i,n){},styles:[".mat-divider{display:block;margin:0;border-top-style:solid;border-top-color:var(--mat-divider-color, var(--mat-sys-outline));border-top-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-vertical{border-top:0;border-right-style:solid;border-right-color:var(--mat-divider-color, var(--mat-sys-outline));border-right-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-inset{margin-left:80px}[dir=rtl] .mat-divider.mat-divider-inset{margin-left:auto;margin-right:80px}"],encapsulation:2,changeDetection:0})}return t})(),WaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Ve]})}return t})();var azA=["*"],czA='.mdc-list{margin:0;padding:8px 0;list-style-type:none}.mdc-list:focus{outline:none}.mdc-list-item{display:flex;position:relative;justify-content:flex-start;overflow:hidden;padding:0;align-items:stretch;cursor:pointer;padding-left:16px;padding-right:16px;background-color:var(--mdc-list-list-item-container-color, transparent);border-radius:var(--mdc-list-list-item-container-shape, var(--mat-sys-corner-none))}.mdc-list-item.mdc-list-item--selected{background-color:var(--mdc-list-list-item-selected-container-color)}.mdc-list-item:focus{outline:0}.mdc-list-item.mdc-list-item--disabled{cursor:auto}.mdc-list-item.mdc-list-item--with-one-line{height:var(--mdc-list-list-item-one-line-container-height, 48px)}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-two-lines{height:var(--mdc-list-list-item-two-line-container-height, 64px)}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-three-lines{height:var(--mdc-list-list-item-three-line-container-height, 88px)}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--selected::before,.mdc-list-item.mdc-list-item--selected:focus::before,.mdc-list-item:not(.mdc-list-item--selected):focus::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;content:"";pointer-events:none}a.mdc-list-item{color:inherit;text-decoration:none}.mdc-list-item__start{fill:currentColor;flex-shrink:0;pointer-events:none}.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mdc-list-list-item-leading-icon-color, var(--mat-sys-on-surface-variant));width:var(--mdc-list-list-item-leading-icon-size, 24px);height:var(--mdc-list-list-item-leading-icon-size, 24px);margin-left:16px;margin-right:32px}[dir=rtl] .mdc-list-item--with-leading-icon .mdc-list-item__start{margin-left:32px;margin-right:16px}.mdc-list-item--with-leading-icon:hover .mdc-list-item__start{color:var(--mdc-list-list-item-hover-leading-icon-color)}.mdc-list-item--with-leading-avatar .mdc-list-item__start{width:var(--mdc-list-list-item-leading-avatar-size, 40px);height:var(--mdc-list-list-item-leading-avatar-size, 40px);margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item--with-leading-avatar .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-avatar .mdc-list-item__start{margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item__end{flex-shrink:0;pointer-events:none}.mdc-list-item--with-trailing-meta .mdc-list-item__end{font-family:var(--mdc-list-list-item-trailing-supporting-text-font, var(--mat-sys-label-small-font));line-height:var(--mdc-list-list-item-trailing-supporting-text-line-height, var(--mat-sys-label-small-line-height));font-size:var(--mdc-list-list-item-trailing-supporting-text-size, var(--mat-sys-label-small-size));font-weight:var(--mdc-list-list-item-trailing-supporting-text-weight, var(--mat-sys-label-small-weight));letter-spacing:var(--mdc-list-list-item-trailing-supporting-text-tracking, var(--mat-sys-label-small-tracking))}.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mdc-list-list-item-trailing-icon-color, var(--mat-sys-on-surface-variant));width:var(--mdc-list-list-item-trailing-icon-size, 24px);height:var(--mdc-list-list-item-trailing-icon-size, 24px)}.mdc-list-item--with-trailing-icon:hover .mdc-list-item__end{color:var(--mdc-list-list-item-hover-trailing-icon-color)}.mdc-list-item.mdc-list-item--with-trailing-meta .mdc-list-item__end{color:var(--mdc-list-list-item-trailing-supporting-text-color, var(--mat-sys-on-surface-variant))}.mdc-list-item--selected.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mdc-list-list-item-selected-trailing-icon-color, var(--mat-sys-primary))}.mdc-list-item__content{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;align-self:center;flex:1;pointer-events:none}.mdc-list-item--with-two-lines .mdc-list-item__content,.mdc-list-item--with-three-lines .mdc-list-item__content{align-self:stretch}.mdc-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:var(--mdc-list-list-item-label-text-color, var(--mat-sys-on-surface));font-family:var(--mdc-list-list-item-label-text-font, var(--mat-sys-body-large-font));line-height:var(--mdc-list-list-item-label-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mdc-list-list-item-label-text-size, var(--mat-sys-body-large-size));font-weight:var(--mdc-list-list-item-label-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mdc-list-list-item-label-text-tracking, var(--mat-sys-body-large-tracking))}.mdc-list-item:hover .mdc-list-item__primary-text{color:var(--mdc-list-list-item-hover-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:focus .mdc-list-item__primary-text{color:var(--mdc-list-list-item-focus-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-three-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item__secondary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;color:var(--mdc-list-list-item-supporting-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mdc-list-list-item-supporting-text-font, var(--mat-sys-body-medium-font));line-height:var(--mdc-list-list-item-supporting-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mdc-list-list-item-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mdc-list-list-item-supporting-text-weight, var(--mat-sys-body-medium-weight));letter-spacing:var(--mdc-list-list-item-supporting-text-tracking, var(--mat-sys-body-medium-tracking))}.mdc-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:"";vertical-align:0}.mdc-list-item--with-three-lines .mdc-list-item__secondary-text{white-space:normal;line-height:20px}.mdc-list-item--with-overline .mdc-list-item__secondary-text{white-space:nowrap;line-height:auto}.mdc-list-item--with-leading-radio.mdc-list-item,.mdc-list-item--with-leading-checkbox.mdc-list-item,.mdc-list-item--with-leading-icon.mdc-list-item,.mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:0;padding-right:16px}[dir=rtl] .mdc-list-item--with-leading-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-checkbox.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:16px;padding-right:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end{display:block;margin-top:0;line-height:normal}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-trailing-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-icon.mdc-list-item{padding-left:0;padding-right:0}.mdc-list-item--with-trailing-icon .mdc-list-item__end{margin-left:16px;margin-right:16px}.mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-meta .mdc-list-item__end{-webkit-user-select:none;user-select:none;margin-left:28px;margin-right:16px}[dir=rtl] .mdc-list-item--with-trailing-meta .mdc-list-item__end{margin-left:16px;margin-right:28px}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end{display:block;line-height:normal;align-self:flex-start;margin-top:0}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end::before,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio .mdc-list-item__start,.mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:8px;margin-right:24px}[dir=rtl] .mdc-list-item--with-leading-radio .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:24px;margin-right:8px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__start,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:8px}.mdc-list-item--with-trailing-radio.mdc-list-item,.mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-left:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-right:0}.mdc-list-item--with-trailing-radio .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:24px;margin-right:8px}[dir=rtl] .mdc-list-item--with-trailing-radio .mdc-list-item__end,[dir=rtl] .mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:8px;margin-right:24px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:8px}.mdc-list-group__subheader{margin:.75rem 16px}.mdc-list-item--disabled .mdc-list-item__start,.mdc-list-item--disabled .mdc-list-item__content,.mdc-list-item--disabled .mdc-list-item__end{opacity:1}.mdc-list-item--disabled .mdc-list-item__primary-text,.mdc-list-item--disabled .mdc-list-item__secondary-text{opacity:var(--mdc-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--disabled.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mdc-list-list-item-disabled-leading-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-disabled-leading-icon-opacity, 0.38)}.mdc-list-item--disabled.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mdc-list-list-item-disabled-trailing-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-disabled-trailing-icon-opacity, 0.38)}.mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing,[dir=rtl] .mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing{padding-left:0;padding-right:0}.mdc-list-item.mdc-list-item--disabled .mdc-list-item__primary-text{color:var(--mdc-list-list-item-disabled-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:hover::before{background-color:var(--mdc-list-list-item-hover-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mdc-list-item.mdc-list-item--disabled::before{background-color:var(--mdc-list-list-item-disabled-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-disabled-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item:focus::before{background-color:var(--mdc-list-list-item-focus-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item--disabled .mdc-radio,.mdc-list-item--disabled .mdc-checkbox{opacity:var(--mdc-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar{border-radius:var(--mdc-list-list-item-leading-avatar-shape, var(--mat-sys-corner-full));background-color:var(--mdc-list-list-item-leading-avatar-color, var(--mat-sys-primary-container))}.mat-mdc-list-item-icon{font-size:var(--mdc-list-list-item-leading-icon-size, 24px)}@media(forced-colors: active){a.mdc-list-item--activated::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}a.mdc-list-item--activated [dir=rtl]::after{right:auto;left:16px}}.mat-mdc-list-base{display:block}.mat-mdc-list-base .mdc-list-item__start,.mat-mdc-list-base .mdc-list-item__end,.mat-mdc-list-base .mdc-list-item__content{pointer-events:auto}.mat-mdc-list-item,.mat-mdc-list-option{width:100%;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-list-item:not(.mat-mdc-list-item-interactive),.mat-mdc-list-option:not(.mat-mdc-list-item-interactive){cursor:default}.mat-mdc-list-item .mat-divider-inset,.mat-mdc-list-option .mat-divider-inset{position:absolute;left:0;right:0;bottom:0}.mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,.mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-left:72px}[dir=rtl] .mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,[dir=rtl] .mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-right:72px}.mat-mdc-list-item-interactive::before{top:0;left:0;right:0;bottom:0;position:absolute;content:"";opacity:0;pointer-events:none;border-radius:inherit}.mat-mdc-list-item>.mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-list-item:focus>.mat-focus-indicator::before{content:""}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-line.mdc-list-item__secondary-text{white-space:nowrap;line-height:normal}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-unscoped-content.mdc-list-item__secondary-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);text-align:start}mat-action-list button::-moz-focus-inner{border:0}.mdc-list-item--with-leading-icon .mdc-list-item__start{margin-inline-start:var(--mat-list-list-item-leading-icon-start-space, 16px);margin-inline-end:var(--mat-list-list-item-leading-icon-end-space, 16px)}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full));--mat-focus-indicator-border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full))}.mat-mdc-nav-list .mat-mdc-list-item.mdc-list-item--activated{background-color:var(--mat-list-active-indicator-color, var(--mat-sys-secondary-container))}',lzA=["unscopedContent"],gzA=["text"],IzA=[[["","matListItemAvatar",""],["","matListItemIcon",""]],[["","matListItemTitle",""]],[["","matListItemLine",""]],"*",[["","matListItemMeta",""]],[["mat-divider"]]],CzA=["[matListItemAvatar],[matListItemIcon]","[matListItemTitle]","[matListItemLine]","*","[matListItemMeta]","mat-divider"];var dzA=new BA("ListOption"),BzA=(()=>{class t{_elementRef=m(te);constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matListItemTitle",""]],hostAttrs:[1,"mat-mdc-list-item-title","mdc-list-item__primary-text"]})}return t})(),EzA=(()=>{class t{_elementRef=m(te);constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matListItemLine",""]],hostAttrs:[1,"mat-mdc-list-item-line","mdc-list-item__secondary-text"]})}return t})(),hzA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matListItemMeta",""]],hostAttrs:[1,"mat-mdc-list-item-meta","mdc-list-item__end"]})}return t})(),XaA=(()=>{class t{_listOption=m(dzA,{optional:!0});constructor(){}_isAlignedAtStart(){return!this._listOption||this._listOption?._getTogglePosition()==="after"}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,hostVars:4,hostBindings:function(i,n){i&2&&ue("mdc-list-item__start",n._isAlignedAtStart())("mdc-list-item__end",!n._isAlignedAtStart())}})}return t})(),QzA=(()=>{class t extends XaA{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matListItemAvatar",""]],hostAttrs:[1,"mat-mdc-list-item-avatar"],features:[et]})}return t})(),uzA=(()=>{class t extends XaA{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matListItemIcon",""]],hostAttrs:[1,"mat-mdc-list-item-icon"],features:[et]})}return t})(),fzA=new BA("MAT_LIST_CONFIG"),yG=(()=>{class t{_isNonInteractive=!0;get disableRipple(){return this._disableRipple}set disableRipple(A){this._disableRipple=Yo(A)}_disableRipple=!1;get disabled(){return this._disabled}set disabled(A){this._disabled=Yo(A)}_disabled=!1;_defaultOptions=m(fzA,{optional:!0});static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,hostVars:1,hostBindings:function(i,n){i&2&&_e("aria-disabled",n.disabled)},inputs:{disableRipple:"disableRipple",disabled:"disabled"}})}return t})(),mzA=(()=>{class t{_elementRef=m(te);_ngZone=m(de);_listBase=m(yG,{optional:!0});_platform=m(Zt);_hostElement;_isButtonElement;_noopAnimations;_avatars;_icons;set lines(A){this._explicitLines=Ns(A,null),this._updateItemLines(!1)}_explicitLines=null;get disableRipple(){return this.disabled||this._disableRipple||this._noopAnimations||!!this._listBase?.disableRipple}set disableRipple(A){this._disableRipple=Yo(A)}_disableRipple=!1;get disabled(){return this._disabled||!!this._listBase?.disabled}set disabled(A){this._disabled=Yo(A)}_disabled=!1;_subscriptions=new _t;_rippleRenderer=null;_hasUnscopedTextContent=!1;rippleConfig;get rippleDisabled(){return this.disableRipple||!!this.rippleConfig.disabled}constructor(){m(Ln).load(Qr);let A=m(L2,{optional:!0}),i=m(mi,{optional:!0});this.rippleConfig=A||{},this._hostElement=this._elementRef.nativeElement,this._isButtonElement=this._hostElement.nodeName.toLowerCase()==="button",this._noopAnimations=i==="NoopAnimations",this._listBase&&!this._listBase._isNonInteractive&&this._initInteractiveListItem(),this._isButtonElement&&!this._hostElement.hasAttribute("type")&&this._hostElement.setAttribute("type","button")}ngAfterViewInit(){this._monitorProjectedLinesAndTitle(),this._updateItemLines(!0)}ngOnDestroy(){this._subscriptions.unsubscribe(),this._rippleRenderer!==null&&this._rippleRenderer._removeTriggerEvents()}_hasIconOrAvatar(){return!!(this._avatars.length||this._icons.length)}_initInteractiveListItem(){this._hostElement.classList.add("mat-mdc-list-item-interactive"),this._rippleRenderer=new CB(this,this._ngZone,this._hostElement,this._platform,m(Dt)),this._rippleRenderer.setupTriggerEvents(this._hostElement)}_monitorProjectedLinesAndTitle(){this._ngZone.runOutsideAngular(()=>{this._subscriptions.add(ho(this._lines.changes,this._titles.changes).subscribe(()=>this._updateItemLines(!1)))})}_updateItemLines(A){if(!this._lines||!this._titles||!this._unscopedContent)return;A&&this._checkDomForUnscopedTextContent();let i=this._explicitLines??this._inferLinesFromContent(),n=this._unscopedContent.nativeElement;if(this._hostElement.classList.toggle("mat-mdc-list-item-single-line",i<=1),this._hostElement.classList.toggle("mdc-list-item--with-one-line",i<=1),this._hostElement.classList.toggle("mdc-list-item--with-two-lines",i===2),this._hostElement.classList.toggle("mdc-list-item--with-three-lines",i===3),this._hasUnscopedTextContent){let o=this._titles.length===0&&i===1;n.classList.toggle("mdc-list-item__primary-text",o),n.classList.toggle("mdc-list-item__secondary-text",!o)}else n.classList.remove("mdc-list-item__primary-text"),n.classList.remove("mdc-list-item__secondary-text")}_inferLinesFromContent(){let A=this._titles.length+this._lines.length;return this._hasUnscopedTextContent&&(A+=1),A}_checkDomForUnscopedTextContent(){this._hasUnscopedTextContent=Array.from(this._unscopedContent.nativeElement.childNodes).filter(A=>A.nodeType!==A.COMMENT_NODE).some(A=>!!(A.textContent&&A.textContent.trim()))}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,contentQueries:function(i,n,o){if(i&1&&(Ii(o,QzA,4),Ii(o,uzA,4)),i&2){let r;$A(r=Ae())&&(n._avatars=r),$A(r=Ae())&&(n._icons=r)}},hostVars:4,hostBindings:function(i,n){i&2&&(_e("aria-disabled",n.disabled)("disabled",n._isButtonElement&&n.disabled||null),ue("mdc-list-item--disabled",n.disabled))},inputs:{lines:"lines",disableRipple:"disableRipple",disabled:"disabled"}})}return t})();var $aA=(()=>{class t extends yG{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275cmp=YA({type:t,selectors:[["mat-list"]],hostAttrs:[1,"mat-mdc-list","mat-mdc-list-base","mdc-list"],exportAs:["matList"],features:[ct([{provide:yG,useExisting:t}]),et],ngContentSelectors:azA,decls:1,vars:0,template:function(i,n){i&1&&(Yt(),xe(0))},styles:[czA],encapsulation:2,changeDetection:0})}return t})(),AcA=(()=>{class t extends mzA{_lines;_titles;_meta;_unscopedContent;_itemText;get activated(){return this._activated}set activated(A){this._activated=Yo(A)}_activated=!1;_getAriaCurrent(){return this._hostElement.nodeName==="A"&&this._activated?"page":null}_hasBothLeadingAndTrailing(){return this._meta.length!==0&&(this._avatars.length!==0||this._icons.length!==0)}static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275cmp=YA({type:t,selectors:[["mat-list-item"],["a","mat-list-item",""],["button","mat-list-item",""]],contentQueries:function(i,n,o){if(i&1&&(Ii(o,EzA,5),Ii(o,BzA,5),Ii(o,hzA,5)),i&2){let r;$A(r=Ae())&&(n._lines=r),$A(r=Ae())&&(n._titles=r),$A(r=Ae())&&(n._meta=r)}},viewQuery:function(i,n){if(i&1&&(Ge(lzA,5),Ge(gzA,5)),i&2){let o;$A(o=Ae())&&(n._unscopedContent=o.first),$A(o=Ae())&&(n._itemText=o.first)}},hostAttrs:[1,"mat-mdc-list-item","mdc-list-item"],hostVars:13,hostBindings:function(i,n){i&2&&(_e("aria-current",n._getAriaCurrent()),ue("mdc-list-item--activated",n.activated)("mdc-list-item--with-leading-avatar",n._avatars.length!==0)("mdc-list-item--with-leading-icon",n._icons.length!==0)("mdc-list-item--with-trailing-meta",n._meta.length!==0)("mat-mdc-list-item-both-leading-and-trailing",n._hasBothLeadingAndTrailing())("_mat-animation-noopable",n._noopAnimations))},inputs:{activated:"activated"},exportAs:["matListItem"],features:[et],ngContentSelectors:CzA,decls:10,vars:0,consts:[["unscopedContent",""],[1,"mdc-list-item__content"],[1,"mat-mdc-list-item-unscoped-content",3,"cdkObserveContent"],[1,"mat-focus-indicator"]],template:function(i,n){if(i&1){let o=De();Yt(IzA),xe(0),S(1,"span",1),xe(2,1),xe(3,2),S(4,"span",2,0),mA("cdkObserveContent",function(){return LA(o),xA(n._updateItemLines(!0))}),xe(6,3),R()(),xe(7,4),xe(8,5),UA(9,"div",3)}},dependencies:[N6],encapsulation:2,changeDetection:0})}return t})();var ecA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[gB,Ve,Xa,ck,WaA]})}return t})();var wzA=["button"],DzA=["*"];function yzA(t,e){if(t&1&&(S(0,"div",2),UA(1,"mat-pseudo-checkbox",6),R()),t&2){let A=P();_(),vA("disabled",A.disabled)}}var tcA=new BA("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:vzA});function vzA(){return{hideSingleSelectionIndicator:!1,hideMultipleSelectionIndicator:!1,disabledInteractive:!1}}var icA=new BA("MatButtonToggleGroup"),bzA={provide:uc,useExisting:nr(()=>vG),multi:!0},Hy=class{source;value;constructor(e,A){this.source=e,this.value=A}},vG=(()=>{class t{_changeDetector=m(lt);_dir=m(bo,{optional:!0});_multiple=!1;_disabled=!1;_disabledInteractive=!1;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(A){this._name=A,this._markButtonsForCheck()}_name=m($i).getId("mat-button-toggle-group-");vertical;get value(){let A=this._selectionModel?this._selectionModel.selected:[];return this.multiple?A.map(i=>i.value):A[0]?A[0].value:void 0}set value(A){this._setSelectionByValue(A),this.valueChange.emit(this.value)}valueChange=new XA;get selected(){let A=this._selectionModel?this._selectionModel.selected:[];return this.multiple?A:A[0]||null}get multiple(){return this._multiple}set multiple(A){this._multiple=A,this._markButtonsForCheck()}get disabled(){return this._disabled}set disabled(A){this._disabled=A,this._markButtonsForCheck()}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(A){this._disabledInteractive=A,this._markButtonsForCheck()}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new XA;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(A){this._hideSingleSelectionIndicator=A,this._markButtonsForCheck()}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(A){this._hideMultipleSelectionIndicator=A,this._markButtonsForCheck()}_hideMultipleSelectionIndicator;constructor(){let A=m(tcA,{optional:!0});this.appearance=A&&A.appearance?A.appearance:"standard",this.hideSingleSelectionIndicator=A?.hideSingleSelectionIndicator??!1,this.hideMultipleSelectionIndicator=A?.hideMultipleSelectionIndicator??!1}ngOnInit(){this._selectionModel=new F2(this.multiple,void 0,!1)}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(A=>A.checked)),this.multiple||this._initializeTabIndex()}writeValue(A){this.value=A,this._changeDetector.markForCheck()}registerOnChange(A){this._controlValueAccessorChangeFn=A}registerOnTouched(A){this._onTouched=A}setDisabledState(A){this.disabled=A}_keydown(A){if(this.multiple||this.disabled)return;let n=A.target.id,o=this._buttonToggles.toArray().findIndex(s=>s.buttonId===n),r=null;switch(A.keyCode){case 32:case 13:r=this._buttonToggles.get(o)||null;break;case 38:r=this._getNextButton(o,-1);break;case 37:r=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:r=this._getNextButton(o,1);break;case 39:r=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}r&&(A.preventDefault(),r._onButtonClick(),r.focus())}_emitChangeEvent(A){let i=new Hy(A,this.value);this._rawValue=i.value,this._controlValueAccessorChangeFn(i.value),this.change.emit(i)}_syncButtonToggle(A,i,n=!1,o=!1){!this.multiple&&this.selected&&!A.checked&&(this.selected.checked=!1),this._selectionModel?i?this._selectionModel.select(A):this._selectionModel.deselect(A):o=!0,o?Promise.resolve().then(()=>this._updateModelValue(A,n)):this._updateModelValue(A,n)}_isSelected(A){return this._selectionModel&&this._selectionModel.isSelected(A)}_isPrechecked(A){return typeof this._rawValue>"u"?!1:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(i=>A.value!=null&&i===A.value):A.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(A=>{A.tabIndex=-1}),this.selected)this.selected.tabIndex=0;else for(let A=0;Athis._selectValue(n,i))):(this._clearSelection(),this._selectValue(A,i)),!this.multiple&&i.every(n=>n.tabIndex===-1)){for(let n of i)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(A=>{A.checked=!1,this.multiple||(A.tabIndex=-1)})}_selectValue(A,i){for(let n of i)if(n.value===A){n.checked=!0,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(A,i){i&&this._emitChangeEvent(A),this.valueChange.emit(this.value)}_markButtonsForCheck(){this._buttonToggles?.forEach(A=>A._markForCheck())}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["mat-button-toggle-group"]],contentQueries:function(i,n,o){if(i&1&&Ii(o,Oy,5),i&2){let r;$A(r=Ae())&&(n._buttonToggles=r)}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(i,n){i&1&&mA("keydown",function(r){return n._keydown(r)}),i&2&&(_e("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),ue("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"))},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",ae],value:"value",multiple:[2,"multiple","multiple",ae],disabled:[2,"disabled","disabled",ae],disabledInteractive:[2,"disabledInteractive","disabledInteractive",ae],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",ae],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",ae]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[ct([bzA,{provide:icA,useExisting:t}])]})}return t})(),Oy=(()=>{class t{_changeDetectorRef=m(lt);_elementRef=m(te);_focusMonitor=m(Jr);_idGenerator=m($i);_animationMode=m(mi,{optional:!0});_checked=!1;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return`${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex}set tabIndex(A){A!==this._tabIndex&&(this._tabIndex=A,this._markForCheck())}_tabIndex;disableRipple;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(A){this._appearance=A}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(A){A!==this._checked&&(this._checked=A,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck())}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(A){this._disabled=A}_disabled=!1;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(A){this._disabledInteractive=A}_disabledInteractive;change=new XA;constructor(){m(Ln).load(Qr);let A=m(icA,{optional:!0}),i=m(new Er("tabindex"),{optional:!0})||"",n=m(tcA,{optional:!0});this._tabIndex=parseInt(i)||0,this.buttonToggleGroup=A,this.appearance=n&&n.appearance?n.appearance:"standard",this.disabledInteractive=n?.disabledInteractive??!1}ngOnInit(){let A=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),A&&(A._isPrechecked(this)?this.checked=!0:A._isSelected(this)!==this._checked&&A._syncButtonToggle(this,this._checked))}ngAfterViewInit(){this._animationMode!=="NoopAnimations"&&this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,!0)}ngOnDestroy(){let A=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),A&&A._isSelected(this)&&A._syncButtonToggle(this,!1,!1,!0)}focus(A){this._buttonElement.nativeElement.focus(A)}_onButtonClick(){if(this.disabled)return;let A=this.isSingleSelector()?!0:!this._checked;if(A!==this._checked&&(this._checked=A,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,!0),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let i=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);i&&(i.tabIndex=-1),this.tabIndex=0}this.change.emit(new Hy(this,this.value))}_markForCheck(){this._changeDetectorRef.markForCheck()}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-button-toggle"]],viewQuery:function(i,n){if(i&1&&Ge(wzA,5),i&2){let o;$A(o=Ae())&&(n._buttonElement=o.first)}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(i,n){i&1&&mA("focus",function(){return n.focus()}),i&2&&(_e("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),ue("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"))},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",ae],appearance:"appearance",checked:[2,"checked","checked",ae],disabled:[2,"disabled","disabled",ae],disabledInteractive:[2,"disabledInteractive","disabledInteractive",ae]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:DzA,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"button",1,0),mA("click",function(){return LA(o),xA(n._onButtonClick())}),NA(2,yzA,2,1,"div",2),S(3,"span",3),xe(4),R()(),UA(5,"span",4)(6,"span",5)}if(i&2){let o=or(1);vA("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),_e("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),_(2),FA(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),_(4),vA("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled)}},dependencies:[Gs,ak],styles:[".mat-button-toggle-standalone,.mat-button-toggle-group{position:relative;display:inline-flex;flex-direction:row;white-space:nowrap;overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);transform:translateZ(0);border-radius:var(--mat-legacy-button-toggle-shape)}.mat-button-toggle-standalone:not([class*=mat-elevation-z]),.mat-button-toggle-group:not([class*=mat-elevation-z]){box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}@media(forced-colors: active){.mat-button-toggle-standalone,.mat-button-toggle-group{outline:solid 1px}}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border:solid 1px var(--mat-standard-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard .mat-pseudo-checkbox,.mat-button-toggle-group-appearance-standard .mat-pseudo-checkbox{--mat-minimal-pseudo-checkbox-selected-checkmark-color: var(--mat-standard-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard:not([class*=mat-elevation-z]),.mat-button-toggle-group-appearance-standard:not([class*=mat-elevation-z]){box-shadow:none}@media(forced-colors: active){.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{outline:0}}.mat-button-toggle-vertical{flex-direction:column}.mat-button-toggle-vertical .mat-button-toggle-label-content{display:block}.mat-button-toggle{white-space:nowrap;position:relative;color:var(--mat-legacy-button-toggle-text-color);font-family:var(--mat-legacy-button-toggle-label-text-font);font-size:var(--mat-legacy-button-toggle-label-text-size);line-height:var(--mat-legacy-button-toggle-label-text-line-height);font-weight:var(--mat-legacy-button-toggle-label-text-weight);letter-spacing:var(--mat-legacy-button-toggle-label-text-tracking);--mat-minimal-pseudo-checkbox-selected-checkmark-color: var(--mat-legacy-button-toggle-selected-state-text-color)}.mat-button-toggle.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-legacy-button-toggle-focus-state-layer-opacity)}.mat-button-toggle .mat-icon svg{vertical-align:top}.mat-button-toggle-checkbox-wrapper{display:inline-block;justify-content:flex-start;align-items:center;width:0;height:18px;line-height:18px;overflow:hidden;box-sizing:border-box;position:absolute;top:50%;left:16px;transform:translate3d(0, -50%, 0)}[dir=rtl] .mat-button-toggle-checkbox-wrapper{left:auto;right:16px}.mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:12px}[dir=rtl] .mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:auto;right:12px}.mat-button-toggle-checked .mat-button-toggle-checkbox-wrapper{width:18px}.mat-button-toggle-animations-enabled .mat-button-toggle-checkbox-wrapper{transition:width 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-checkbox-wrapper{transition:none}.mat-button-toggle-checked{color:var(--mat-legacy-button-toggle-selected-state-text-color);background-color:var(--mat-legacy-button-toggle-selected-state-background-color)}.mat-button-toggle-disabled{pointer-events:none;color:var(--mat-legacy-button-toggle-disabled-state-text-color);background-color:var(--mat-legacy-button-toggle-disabled-state-background-color);--mat-minimal-pseudo-checkbox-disabled-selected-checkmark-color: var(--mat-legacy-button-toggle-disabled-state-text-color)}.mat-button-toggle-disabled.mat-button-toggle-checked{background-color:var(--mat-legacy-button-toggle-disabled-selected-state-background-color)}.mat-button-toggle-disabled-interactive{pointer-events:auto}.mat-button-toggle-appearance-standard{color:var(--mat-standard-button-toggle-text-color, var(--mat-sys-on-surface));background-color:var(--mat-standard-button-toggle-background-color, transparent);font-family:var(--mat-standard-button-toggle-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-standard-button-toggle-label-text-size, var(--mat-sys-label-large-size));line-height:var(--mat-standard-button-toggle-label-text-line-height, var(--mat-sys-label-large-line-height));font-weight:var(--mat-standard-button-toggle-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-standard-button-toggle-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:solid 1px var(--mat-standard-button-toggle-divider-color, var(--mat-sys-outline))}[dir=rtl] .mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:solid 1px var(--mat-standard-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:none;border-top:solid 1px var(--mat-standard-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-appearance-standard.mat-button-toggle-checked{color:var(--mat-standard-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container));background-color:var(--mat-standard-button-toggle-selected-state-background-color, var(--mat-sys-secondary-container))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled{color:var(--mat-standard-button-toggle-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-standard-button-toggle-disabled-state-background-color, transparent)}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled .mat-pseudo-checkbox{--mat-minimal-pseudo-checkbox-disabled-selected-checkmark-color: var(--mat-standard-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled.mat-button-toggle-checked{color:var(--mat-standard-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-standard-button-toggle-disabled-selected-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{background-color:var(--mat-standard-button-toggle-state-layer-color, var(--mat-sys-on-surface))}.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{opacity:var(--mat-standard-button-toggle-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-button-toggle-appearance-standard.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-standard-button-toggle-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}@media(hover: none){.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{display:none}}.mat-button-toggle-label-content{-webkit-user-select:none;user-select:none;display:inline-block;padding:0 16px;line-height:var(--mat-legacy-button-toggle-height);position:relative}.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{padding:0 12px;line-height:var(--mat-standard-button-toggle-height, 40px)}.mat-button-toggle-label-content>*{vertical-align:middle}.mat-button-toggle-focus-overlay{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit;pointer-events:none;opacity:0;background-color:var(--mat-legacy-button-toggle-state-layer-color)}@media(forced-colors: active){.mat-button-toggle-checked .mat-button-toggle-focus-overlay{border-bottom:solid 500px;opacity:.5;height:0}.mat-button-toggle-checked:hover .mat-button-toggle-focus-overlay{opacity:.6}.mat-button-toggle-checked.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{border-bottom:solid 500px}}.mat-button-toggle .mat-button-toggle-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-button-toggle-button{border:0;background:none;color:inherit;padding:0;margin:0;font:inherit;outline:none;width:100%;cursor:pointer}.mat-button-toggle-animations-enabled .mat-button-toggle-button{transition:padding 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-button{transition:none}.mat-button-toggle-disabled .mat-button-toggle-button{cursor:default}.mat-button-toggle-button::-moz-focus-inner{border:0}.mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:30px}[dir=rtl] .mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:0;padding-right:30px}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard{--mat-focus-indicator-border-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border-bottom-right-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-left-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border-bottom-left-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-bottom-right-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border-bottom-left-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border-top-left-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}"],encapsulation:2,changeDetection:0})}return t})(),ncA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Xa,Oy,Ve]})}return t})();function kzA(t,e){t&1&&(S(0,"p"),tA(1,"Conversations"),R())}function SzA(t,e){t&1&&(S(0,"p"),tA(1,"Trace"),R())}function RzA(t,e){if(t&1){let A=De();S(0,"mat-button-toggle-group",5),ta("ngModelChange",function(n){LA(A);let o=P(2);return Ja(o.view,n)||(o.view=n),xA(n)}),S(1,"mat-button-toggle",6),tA(2,"Events"),R(),S(3,"mat-button-toggle",7),tA(4,"Trace"),R()()}if(t&2){let A=P(2);ea("ngModel",A.view)}}function LzA(t,e){if(t&1){let A=De();S(0,"mat-list-item",8),mA("click",function(){let n=LA(A).$implicit,o=P(3);return xA(o.selectEvent(n.key))}),S(1,"span",9),tA(2),R(),S(3,"span",10),tA(4),R()()}if(t&2){let A=e.$implicit,i=e.$index;_(2),Mt(i),_(2),Mt(A.value.title)}}function xzA(t,e){if(t&1&&(S(0,"mat-list",4),ln(1,LzA,5,2,"mat-list-item",null,Kn),Ta(3,"keyvalue"),R()),t&2){let A=P(2);_(),gn(uQ(3,0,A.eventsMap,A.mapOrderPreservingSort))}}function FzA(t,e){if(t&1){let A=De();S(0,"mat-list-item",8),mA("click",function(){let n=LA(A).$implicit,o=P(3);return xA(o.openDialog(n.key))}),S(1,"span",9),tA(2),R(),S(3,"span"),tA(4),R()()}if(t&2){let A=e.$implicit,i=e.$index,n=P(3);_(2),Mt(i),_(2),ot("Invocation ",n.findInvocIdFromTraceId(A.key),"")}}function NzA(t,e){if(t&1&&(S(0,"mat-list",4),ln(1,FzA,5,2,"mat-list-item",null,Kn),Ta(3,"keyvalue"),R()),t&2){let A=P(2);_(),gn(uQ(3,0,A.invocTraces,A.mapOrderPreservingSort))}}function _zA(t,e){if(t&1&&(S(0,"div",1)(1,"div",2),NA(2,kzA,2,0,"p")(3,SzA,2,0,"p")(4,RzA,5,1,"mat-button-toggle-group",3),R(),NA(5,xzA,4,3,"mat-list",4)(6,NzA,4,3,"mat-list",4),R()),t&2){let A=P();_(2),FA(A.isTraceView()?-1:2),_(),FA(A.isTraceView()?3:-1),_(),FA(A.traceData?4:-1),_(),FA(A.isTraceView()?-1:5),_(),FA(A.isTraceView()?6:-1)}}function GzA(t,e){t&1&&(S(0,"div")(1,"p"),tA(2,"No conversations"),R()())}var jC=class t{constructor(e){this.dialog=e}eventsMap=new Map;selectedEvent=new XA;traceData=[];llmRequest=void 0;llmResponse=void 0;llmRequestKey="gcp.vertex.agent.llm_request";llmResponseKey="gcp.vertex.agent.llm_response";isDetailsPanelOpen=!1;view="events";invocTraces=new Map;ngOnChanges(e){"traceData"in e&&this.prcessTraceDataToInvocTrace()}showJson=Array(this.eventsMap.size).fill(!1);toggleJson(e){this.showJson[e]=!this.showJson[e]}selectEvent(e){this.selectedEvent.emit(e)}isTraceView(){return this.view=="trace"}mapOrderPreservingSort=(e,A)=>0;prcessTraceDataToInvocTrace(){!this.traceData||this.traceData.length==0||(this.invocTraces=this.traceData.reduce((e,A)=>{let i=A.trace_id,n=e.get(i);return n?(n.push(A),n.sort((o,r)=>o.start_time-r.start_time)):e.set(i,[A]),e},new Map))}findInvocIdFromTraceId(e){return this.invocTraces.get(e)?.find(i=>i.attributes!==void 0&&"gcp.vertex.agent.invocation_id"in i.attributes).attributes["gcp.vertex.agent.invocation_id"]}openDialog(e){let A=this.dialog.open(of,{width:"auto",maxWidth:"90vw",data:{spans:this.invocTraces.get(e),invocId:this.findInvocIdFromTraceId(e)}})}static \u0275fac=function(A){return new(A||t)(zA(Us))};static \u0275cmp=YA({type:t,selectors:[["app-event-tab"]],inputs:{eventsMap:"eventsMap",traceData:"traceData"},outputs:{selectedEvent:"selectedEvent"},standalone:!1,features:[Kt],decls:3,vars:2,consts:[[1,"events-wrapper"],[1,"events-container"],[1,"event-header"],["name","fontStyle","aria-label","Font Style",2,"scale","0.8",3,"ngModel"],[1,"event-list"],["name","fontStyle","aria-label","Font Style",2,"scale","0.8",3,"ngModelChange","ngModel"],["value","events"],["value","trace"],[3,"click"],[1,"event-index"],[1,"event-title"]],template:function(A,i){A&1&&(S(0,"div",0),NA(1,_zA,7,5,"div",1)(2,GzA,3,0,"div"),R()),A&2&&(_(),FA(i.eventsMap.size>0?1:-1),_(),FA(i.eventsMap.size==0?2:-1))},dependencies:[na,ja,$aA,AcA,vG,Oy,MQ],styles:[".events-wrapper[_ngcontent-%COMP%]{padding-left:25px;padding-right:25px;color:#9aa0a6;font-size:14px;font-weight:700}.event-index[_ngcontent-%COMP%]{color:#80868b;font-family:Roboto;font-size:14px;font-style:normal;font-weight:400;margin-right:10px}.event-title[_ngcontent-%COMP%]{font-family:Google Sans Mono,monospace}.spacer[_ngcontent-%COMP%]{flex:1 1 auto}.events-container[_ngcontent-%COMP%]{margin-top:20px}.event-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;margin-top:20px}.function-event-button[_ngcontent-%COMP%]{margin-top:11px}.event-list[_ngcontent-%COMP%]{--mat-list-active-indicator-color: orange}.event-list[_ngcontent-%COMP%]{--mdc-list-list-item-container-color: #2b2b2f}.event-list[_ngcontent-%COMP%]{--mdc-list-list-item-label-text-size: 14px}.event-list[_ngcontent-%COMP%]{--mdc-list-list-item-label-text-weight: 400}.event-list[_ngcontent-%COMP%]{--mdc-list-list-item-one-line-container-height: 52px}[_nghost-%COMP%] .mdc-list-item{border:1px solid #5f6368;cursor:pointer}[_nghost-%COMP%] .mdc-list-item:hover{background-color:#1c1b1c}.event-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"]})};function KzA(t,e){t&1&&(S(0,"h2",0),tA(1,"Events List"),R())}function YzA(t,e){t&1&&(S(0,"h2",0),tA(1,"Send Response To Pending Event"),R())}function JzA(t,e){t&1&&(S(0,"h2",4),tA(1,"Events List"),R())}function TzA(t,e){t&1&&(S(0,"h2",4),tA(1,"Send Response To Pending Event"),R())}function zzA(t,e){if(t&1){let A=De();S(0,"div")(1,"p"),tA(2,"Name"),R(),S(3,"p"),tA(4),R(),S(5,"p"),tA(6,"Args"),R(),S(7,"p"),tA(8),R(),S(9,"mat-form-field",5)(10,"mat-label"),tA(11,"Response"),R(),S(12,"textarea",6),ta("ngModelChange",function(n){LA(A);let o=P();return Ja(o.selectedEvent.response,n)||(o.selectedEvent.response=n),xA(n)}),R()()()}if(t&2){let A=P();_(4),Mt(A.selectedEvent.name),_(4),Mt(A.argsToJson(A.selectedEvent.args)),_(4),ea("ngModel",A.selectedEvent.response)}}function HzA(t,e){if(t&1){let A=De();S(0,"button",7),mA("click",function(){LA(A);let n=P();return xA(n.sendResponse())}),tA(1),R()}if(t&2){let A=P();vA("disabled",A.sending),_(),ot(" ",A.sending?"Sending...":"Send"," ")}}var rf=class t{constructor(e,A,i){this.dialogRef=e;this.data=A;this.agentService=i;this.selectedEvent=A.event,this.appName=A.appName,this.userId=A.userId,this.sessionId=A.sessionId,this.functionCallEventId=A.functionCallEventId}selectedEvent=null;appName;userId;sessionId;functionCallEventId;sending=!1;response=[];argsToJson(e){return JSON.stringify(e)}sendResponse(){this.sending=!0;let e={appName:this.appName,userId:this.userId,sessionId:this.sessionId,newMessage:{role:"user",parts:[]}};this.selectedEvent.response&&(e.functionCallEventId=this.functionCallEventId,e.newMessage.parts.push({function_response:{id:this.selectedEvent.id,name:this.selectedEvent.name,response:{response:this.selectedEvent.response}}})),this.agentService.runSse(e).subscribe({next:A=>_n(this,null,function*(){let i=JSON.parse(A);this.response.push(i)}),error:A=>console.error("SSE error:",A),complete:()=>{this.sending=!1,this.dialogRef.close({response:this.response,events:[this.selectedEvent]})}})}static \u0275fac=function(A){return new(A||t)(zA(cr),zA($r),zA(K2))};static \u0275cmp=YA({type:t,selectors:[["app-pending-event-dialog"]],standalone:!1,decls:10,vars:6,consts:[["mat-dialog-title",""],["mat-dialog-title","","class","dialog-title",4,"ngIf"],["mat-button","",3,"disabled"],["mat-button","","mat-dialog-close",""],["mat-dialog-title","",1,"dialog-title"],["appearance","outline",1,"response-textarea"],["matInput","",3,"ngModelChange","ngModel"],["mat-button","",3,"click","disabled"]],template:function(A,i){A&1&&(NA(0,KzA,2,0,"h2",0)(1,YzA,2,0,"h2",0)(2,JzA,2,0,"h2",1)(3,TzA,2,0,"h2",1),S(4,"mat-dialog-content"),NA(5,zzA,13,3,"div"),R(),S(6,"mat-dialog-actions"),NA(7,HzA,2,2,"button",2),S(8,"button",3),tA(9,"Close"),R()()),A&2&&(FA(i.selectedEvent?-1:0),_(),FA(i.selectedEvent?1:-1),_(),vA("ngIf",!i.selectedEvent),_(),vA("ngIf",i.selectedEvent),_(2),FA(i.selectedEvent?5:-1),_(2),FA(i.selectedEvent&&i.selectedEvent.response?7:-1))},dependencies:[DQ,fc,na,ja,lg,r8,P1,ur,hs,ga,Ia,gg],styles:[".response-textarea[_ngcontent-%COMP%]{min-width:500px;margin-top:15px}.dialog-title[_ngcontent-%COMP%]{font-weight:700;font-size:large}"]})};var dh=class t{constructor(e,A){this.dialogRef=e;this.data=A}onConfirm(){this.dialogRef.close(!0)}onCancel(){this.dialogRef.close(!1)}static \u0275fac=function(A){return new(A||t)(zA(cr),zA($r))};static \u0275cmp=YA({type:t,selectors:[["app-delete-session-dialog"]],standalone:!1,decls:11,vars:4,consts:[[1,"confirm-delete-wrapper"],["mat-dialog-title",""],["align","end"],["mat-button","",3,"click"],["mat-button","","cdkFocusInitial","",3,"click"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"h2",1),tA(2),R(),S(3,"mat-dialog-content")(4,"p"),tA(5),R()(),S(6,"mat-dialog-actions",2)(7,"button",3),mA("click",function(){return i.onCancel()}),tA(8),R(),S(9,"button",4),mA("click",function(){return i.onConfirm()}),tA(10),R()()()),A&2&&(_(2),Mt(i.data.title),_(3),Mt(i.data.message),_(3),Mt(i.data.cancelButtonText),_(2),Mt(i.data.confirmButtonText))},dependencies:[ur,hs,ga,Ia],encapsulation:2})};function OzA(t,e){if(t&1){let A=De();S(0,"div",3),mA("click",function(){let n=LA(A).$implicit,o=P();return xA(o.getSession(n.id))}),S(1,"div",4)(2,"div",5),tA(3),R(),S(4,"div",6),tA(5),R()()()}if(t&2){let A=e.$implicit,i=P();vA("ngClass",A.id===i.sessionId?"session-item current":"session-item"),_(3),ot(" ",A.id," "),_(2),ot(" ",i.getDate(A)," ")}}var qC=class t{constructor(e,A){this.sessionService=e;this.dialog=A;this.refreshSessionsSubject.pipe(no(()=>this.sessionService.listSessions(this.userId,this.appName))).subscribe(i=>{i=i.sort((n,o)=>Number(o.lastUpdateTime)-Number(n.lastUpdateTime)),this.sessionList=i})}userId="";appName="";sessionId="";sessionSelected=new XA;sessionReloaded=new XA;sessionList=[];refreshSessionsSubject=new HA;ngOnInit(){setTimeout(()=>{this.refreshSessionsSubject.next()},500)}getSession(e){this.sessionService.getSession(this.userId,this.appName,e).subscribe(A=>{let i=this.fromApiResultToSession(A);this.sessionSelected.emit(i)})}getDate(e){let A=e.lastUpdateTime;return new Date(A*1e3).toLocaleString()}fromApiResultToSession(e){return{id:e?.id??"",appName:e?.appName??"",userId:e?.userId??"",state:e?.state??[],events:e?.events??[]}}reloadSession(e){this.sessionService.getSession(this.userId,this.appName,e).subscribe(A=>{let i=this.fromApiResultToSession(A);this.sessionReloaded.emit(i)})}refreshSession(e){if(this.refreshSessionsSubject.next(),!(this.sessionList.length<=1)){let A=this.sessionList.findIndex(i=>i.id==e);return A==this.sessionList.length-1&&(A=-1),this.sessionList[A+1]}}static \u0275fac=function(A){return new(A||t)(zA(Jg),zA(Us))};static \u0275cmp=YA({type:t,selectors:[["app-session-tab"]],inputs:{userId:"userId",appName:"appName",sessionId:"sessionId"},outputs:{sessionSelected:"sessionSelected",sessionReloaded:"sessionReloaded"},standalone:!1,decls:4,vars:0,consts:[[1,"session-wrapper"],[1,"session-tab-container",2,"margin-top","16px"],[3,"ngClass"],[3,"click","ngClass"],[1,"session-info"],[1,"session-id"],[1,"session-date"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"div",1),ln(2,OzA,6,3,"div",2,Kn),R()()),A&2&&(_(2),gn(i.sessionList))},dependencies:[Ha],styles:[".session-wrapper[_ngcontent-%COMP%]{padding-left:25px;padding-right:25px;color:#9aa0a6;font-size:14px;font-weight:700}.session-item[_ngcontent-%COMP%]{display:flex;justify-content:space-between;border:none;background-color:#303030;border-radius:8px;margin-bottom:4px;cursor:pointer}.session-item[_ngcontent-%COMP%]:hover{background-color:#141414}.session-item.current[_ngcontent-%COMP%]{background-color:#004a77}.session-id[_ngcontent-%COMP%]{color:#e8eaed;font-family:Google Sans Mono,monospace;font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:.25px}.session-date[_ngcontent-%COMP%]{color:#9aa0a6;font-family:Roboto;font-size:12px;font-style:normal;font-weight:400;line-height:16px;letter-spacing:.3px}.session-info[_ngcontent-%COMP%]{padding:11px}"]})};var Bh=class t{constructor(e){this.http=e}apiServerDomain=Es.getApiServerBaseUrl();getLatestArtifact(e,A,i,n){let o=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}/artifacts/${n}`;return this.http.get(o)}getArtifactVersion(e,A,i,n,o){let r=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}/artifacts/${n}/versions/${o}`;return this.http.get(r)}static \u0275fac=function(A){return new(A||t)(he(Bs))};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var qzA={url:"",deserializer:t=>JSON.parse(t.data),serializer:t=>JSON.stringify(t)},VzA="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",sf=class t extends cd{constructor(e,A){if(super(),this._socket=null,e instanceof Ze)this.destination=A,this.source=e;else{let i=this._config=Object.assign({},qzA);if(this._output=new HA,typeof e=="string")i.url=e;else for(let n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);if(!i.WebSocketCtor&&WebSocket)i.WebSocketCtor=WebSocket;else if(!i.WebSocketCtor)throw new Error("no WebSocket constructor can be found");this.destination=new qc}}lift(e){let A=new t(this._config,this.destination);return A.operator=e,A.source=this,A}_resetState(){this._socket=null,this.source||(this.destination=new qc),this._output=new HA}multiplex(e,A,i){let n=this;return new Ze(o=>{try{n.next(e())}catch(s){o.error(s)}let r=n.subscribe({next:s=>{try{i(s)&&o.next(s)}catch(a){o.error(a)}},error:s=>o.error(s),complete:()=>o.complete()});return()=>{try{n.next(A())}catch(s){o.error(s)}r.unsubscribe()}})}_connectSocket(){let{WebSocketCtor:e,protocol:A,url:i,binaryType:n}=this._config,o=this._output,r=null;try{r=A?new e(i,A):new e(i),this._socket=r,n&&(this._socket.binaryType=n)}catch(a){o.error(a);return}let s=new _t(()=>{this._socket=null,r&&r.readyState===1&&r.close()});r.onopen=a=>{let{_socket:c}=this;if(!c){r.close(),this._resetState();return}let{openObserver:l}=this._config;l&&l.next(a);let I=this.destination;this.destination=Zg.create(C=>{if(r.readyState===1)try{let{serializer:d}=this._config;r.send(d(C))}catch(d){this.destination.error(d)}},C=>{let{closingObserver:d}=this._config;d&&d.next(void 0),C&&C.code?r.close(C.code,C.reason):o.error(new TypeError(VzA)),this._resetState()},()=>{let{closingObserver:C}=this._config;C&&C.next(void 0),r.close(),this._resetState()}),I&&I instanceof qc&&s.add(I.subscribe(this.destination))},r.onerror=a=>{this._resetState(),o.error(a)},r.onclose=a=>{r===this._socket&&this._resetState();let{closeObserver:c}=this._config;c&&c.next(a),a.wasClean?o.complete():o.error(a)},r.onmessage=a=>{try{let{deserializer:c}=this._config;o.next(c(a))}catch(c){o.error(c)}}}_subscribe(e){let{source:A}=this;return A?A.subscribe(e):(this._socket||this._connectSocket(),this._output.subscribe(e),e.add(()=>{let{_socket:i}=this;this._output.observers.length===0&&(i&&(i.readyState===1||i.readyState===0)&&i.close(),this._resetState())}),e)}unsubscribe(){let{_socket:e}=this;e&&(e.readyState===1||e.readyState===0)&&e.close(),this._resetState(),super.unsubscribe()}};var Tg=class t{socket$;messages$=new li("");audioContext=new AudioContext({sampleRate:22e3});audioBuffer=[];audioIntervalId=null;lastAudioTime=0;closeReasonSubject=new HA;constructor(){}connect(e){this.socket$=new sf({url:e,serializer:A=>JSON.stringify(A),deserializer:A=>A.data,closeObserver:{next:A=>{this.emitWsCloseReason(A.reason)}}}),this.socket$.subscribe(A=>{this.handleIncomingAudio(A),this.messages$.next(A)},A=>{console.error("WebSocket error:",A)}),this.audioIntervalId=setInterval(()=>this.processBufferedAudio(),250)}sendMessage(e){if(e.blob.data=this.arrayBufferToBase64(e.blob.data.buffer),!this.socket$||this.socket$.closed){console.error("WebSocket is not open.");return}this.socket$.next(e)}closeConnection(){clearInterval(this.audioIntervalId),this.audioIntervalId=null,this.socket$&&this.socket$.complete()}getMessages(){return this.messages$.asObservable()}arrayBufferToBase64(e){let A="",i=new Uint8Array(e),n=i.byteLength;for(let o=0;on+o.length,0),A=new Uint8Array(e),i=0;for(let n of this.audioBuffer)A.set(n,i),i+=n.length;this.playPCM(A),this.audioBuffer=[]}base64ToUint8Array(e){let A=atob(this.urlSafeBase64ToBase64(e)),i=A.length,n=new Uint8Array(i);for(let o=0;o=32768&&(a-=65536),A[s]=a/32768}let i=this.audioContext.createBuffer(1,A.length,22e3);i.copyToChannel(A,0);let n=this.audioContext.createBufferSource();n.buffer=i,n.connect(this.audioContext.destination);let o=this.audioContext.currentTime,r=Math.max(this.lastAudioTime,o);n.start(r),this.lastAudioTime=r+i.duration}urlSafeBase64ToBase64(e){let A=e.replace(/_/g,"/").replace(/-/g,"+");for(;A.length%4!==0;)A+="=";return A}emitWsCloseReason(e){this.closeReasonSubject.next(e)}onCloseReason(){return this.closeReasonSubject.asObservable()}static \u0275fac=function(A){return new(A||t)};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var Eh=class t{constructor(e){this.wsService=e}mediaRecorder;stream;audioContext;source;processor;audioBuffer=[];audioIntervalId=null;startRecording(){return _n(this,null,function*(){try{this.stream=yield navigator.mediaDevices.getUserMedia({audio:!0}),this.audioContext=new AudioContext,yield this.audioContext.audioWorklet.addModule("./assets/audio-processor.js"),this.source=this.audioContext.createMediaStreamSource(this.stream);let e=new AudioWorkletNode(this.audioContext,"audio-processor");e.port.onmessage=A=>{let i=A.data,n=this.float32ToPCM(i);this.audioBuffer.push(n)},this.source.connect(e),e.connect(this.audioContext.destination),this.audioIntervalId=setInterval(()=>this.sendBufferedAudio(),250)}catch(e){console.error("Error accessing microphone:",e)}})}sendBufferedAudio(){if(this.audioBuffer.length===0)return;let e=this.audioBuffer.reduce((o,r)=>o+r.length,0),A=new Uint8Array(e),i=0;for(let o of this.audioBuffer)A.set(o,i),i+=o.length;let n={blob:{mime_type:"audio/pcm",data:A}};this.wsService.sendMessage(n),this.audioBuffer=[]}stopRecording(){this.processor&&this.processor.disconnect(),this.source&&this.source.disconnect(),this.audioContext&&this.audioContext.close(),this.stream&&this.stream.getTracks().forEach(e=>e.stop()),this.audioIntervalId&&(clearInterval(this.audioIntervalId),this.audioIntervalId=null)}float32ToPCM(e){let A=new ArrayBuffer(e.length*2),i=new DataView(A);for(let n=0;nthis.captureAndSendFrame(),1e3)}catch(A){console.error("Error accessing camera/microphone:",A)}})}captureAndSendFrame(){return _n(this,null,function*(){try{let e=yield this.captureFrame(),i={blob:{mime_type:"image/jpeg",data:yield this.blobToUint8Array(e)}};this.wsService.sendMessage(i)}catch(e){console.error("Error capturing frame:",e)}})}blobToUint8Array(e){return _n(this,null,function*(){let A=yield e.arrayBuffer();return new Uint8Array(A)})}captureFrame(){return _n(this,null,function*(){return new Promise((e,A)=>{try{let i=document.createElement("canvas");i.width=this.videoElement.videoWidth,i.height=this.videoElement.videoHeight;let n=i.getContext("2d");if(!n){A(new Error("Canvas context not supported"));return}n.drawImage(this.videoElement,0,0,i.width,i.height),i.toBlob(o=>{o?e(o):A(new Error("Failed to create image blob"))},"image/png")}catch(i){A(i)}})})}sendBufferedVideo(){if(this.videoBuffer.length===0)return;let e=this.videoBuffer.reduce((o,r)=>o+r.length,0),A=new Uint8Array(e),i=0;for(let o of this.videoBuffer)A.set(o,i),i+=o.length;let n={blob:{mime_type:"image/jpeg",data:A}};this.wsService.sendMessage(n),this.videoBuffer=[]}stopRecording(e){this.mediaRecorder&&this.mediaRecorder.stop(),this.stream&&this.stream.getTracks().forEach(A=>A.stop()),clearInterval(this.videoIntervalId),this.clearVideoElement(e)}clearVideoElement(e){let A=e.nativeElement.querySelector("video");A&&this.renderer.removeChild(e.nativeElement,A)}static \u0275fac=function(A){return new(A||t)(he(Tg),he(ds))};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var j1=class t{constructor(e){this.http=e}apiServerDomain=Es.getApiServerBaseUrl();getEventTrace(e){let A=this.apiServerDomain+`/debug/trace/${e}`;return this.http.get(A)}getTrace(e){let A=this.apiServerDomain+`/debug/trace/session/${e}`;return this.http.get(A)}getEvent(e,A,i,n){let o=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}/events/${n}/graph`;return this.http.get(o)}static \u0275fac=function(A){return new(A||t)(he(Bs))};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var zg=class t{selectedTraceRowSource=new li(void 0);selectedTraceRow$=this.selectedTraceRowSource.asObservable();eventDataSource=new li(void 0);eventData$=this.eventDataSource.asObservable();hoveredMessageIndiciesSource=new li([]);hoveredMessageIndicies$=this.hoveredMessageIndiciesSource.asObservable();messagesSource=new li([]);messages$=this.messagesSource.asObservable();selectedRow(e){this.selectedTraceRowSource.next(e)}setEventData(e){this.eventDataSource.next(e)}setMessages(e){this.messagesSource.next(e)}setHoveredMessages(e,A){if(!e){this.hoveredMessageIndiciesSource.next([]);return}let i=e.attributes,n=i&&i["gcp.vertex.agent.event_id"],o=0,r=[];for(let s of this.messagesSource.value){if(s.role=="user"){o++;continue}if(this.eventDataSource.value?.get(s.eventId).invocationId!=A){o++;continue}if(n)if(i["gcp.vertex.agent.event_id"]==s.eventId){r.push(o),o++;continue}else{o++;continue}else{r.push(o),o++;continue}}this.hoveredMessageIndiciesSource.next(r)}resetTraceService(){this.eventDataSource.next(void 0),this.messagesSource.next([]),this.hoveredMessageIndiciesSource.next([])}static \u0275fac=function(A){return new(A||t)};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var XzA=["*"];var $zA=new BA("MAT_CARD_CONFIG"),rcA=(()=>{class t{appearance;constructor(){let A=m($zA,{optional:!0});this.appearance=A?.appearance||"raised"}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-card"]],hostAttrs:[1,"mat-mdc-card","mdc-card"],hostVars:4,hostBindings:function(i,n){i&2&&ue("mat-mdc-card-outlined",n.appearance==="outlined")("mdc-card--outlined",n.appearance==="outlined")},inputs:{appearance:"appearance"},exportAs:["matCard"],ngContentSelectors:XzA,decls:1,vars:0,template:function(i,n){i&1&&(Yt(),xe(0))},styles:['.mat-mdc-card{display:flex;flex-direction:column;box-sizing:border-box;position:relative;border-style:solid;border-width:0;background-color:var(--mdc-elevated-card-container-color, var(--mat-sys-surface-container-low));border-color:var(--mdc-elevated-card-container-color, var(--mat-sys-surface-container-low));border-radius:var(--mdc-elevated-card-container-shape, var(--mat-sys-corner-medium));box-shadow:var(--mdc-elevated-card-container-elevation, var(--mat-sys-level1))}.mat-mdc-card::after{position:absolute;top:0;left:0;width:100%;height:100%;border:solid 1px rgba(0,0,0,0);content:"";display:block;pointer-events:none;box-sizing:border-box;border-radius:var(--mdc-elevated-card-container-shape, var(--mat-sys-corner-medium))}.mat-mdc-card-outlined{background-color:var(--mdc-outlined-card-container-color, var(--mat-sys-surface));border-radius:var(--mdc-outlined-card-container-shape, var(--mat-sys-corner-medium));border-width:var(--mdc-outlined-card-outline-width, 1px);border-color:var(--mdc-outlined-card-outline-color, var(--mat-sys-outline-variant));box-shadow:var(--mdc-outlined-card-container-elevation, var(--mat-sys-level0))}.mat-mdc-card-outlined::after{border:none}.mdc-card__media{position:relative;box-sizing:border-box;background-repeat:no-repeat;background-position:center;background-size:cover}.mdc-card__media::before{display:block;content:""}.mdc-card__media:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.mdc-card__media:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.mat-mdc-card-actions{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;min-height:52px;padding:8px}.mat-mdc-card-title{font-family:var(--mat-card-title-text-font, var(--mat-sys-title-large-font));line-height:var(--mat-card-title-text-line-height, var(--mat-sys-title-large-line-height));font-size:var(--mat-card-title-text-size, var(--mat-sys-title-large-size));letter-spacing:var(--mat-card-title-text-tracking, var(--mat-sys-title-large-tracking));font-weight:var(--mat-card-title-text-weight, var(--mat-sys-title-large-weight))}.mat-mdc-card-subtitle{color:var(--mat-card-subtitle-text-color, var(--mat-sys-on-surface));font-family:var(--mat-card-subtitle-text-font, var(--mat-sys-title-medium-font));line-height:var(--mat-card-subtitle-text-line-height, var(--mat-sys-title-medium-line-height));font-size:var(--mat-card-subtitle-text-size, var(--mat-sys-title-medium-size));letter-spacing:var(--mat-card-subtitle-text-tracking, var(--mat-sys-title-medium-tracking));font-weight:var(--mat-card-subtitle-text-weight, var(--mat-sys-title-medium-weight))}.mat-mdc-card-title,.mat-mdc-card-subtitle{display:block;margin:0}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle{padding:16px 16px 0}.mat-mdc-card-header{display:flex;padding:16px 16px 0}.mat-mdc-card-content{display:block;padding:0 16px}.mat-mdc-card-content:first-child{padding-top:16px}.mat-mdc-card-content:last-child{padding-bottom:16px}.mat-mdc-card-title-group{display:flex;justify-content:space-between;width:100%}.mat-mdc-card-avatar{height:40px;width:40px;border-radius:50%;flex-shrink:0;margin-bottom:16px;object-fit:cover}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title{line-height:normal}.mat-mdc-card-sm-image{width:80px;height:80px}.mat-mdc-card-md-image{width:112px;height:112px}.mat-mdc-card-lg-image{width:152px;height:152px}.mat-mdc-card-xl-image{width:240px;height:240px}.mat-mdc-card-subtitle~.mat-mdc-card-title,.mat-mdc-card-title~.mat-mdc-card-subtitle,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-title-group .mat-mdc-card-title,.mat-mdc-card-title-group .mat-mdc-card-subtitle{padding-top:0}.mat-mdc-card-content>:last-child:not(.mat-mdc-card-footer){margin-bottom:0}.mat-mdc-card-actions-align-end{justify-content:flex-end}'],encapsulation:2,changeDetection:0})}return t})();var scA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Ve]})}return t})();var eHA=t=>["segment",t],tHA=(t,e)=>({"segment-main":!0,expandable:t,expanded:e});function iHA(t,e){t&1&&UA(0,"div",9)}function nHA(t,e){if(t&1&&(S(0,"span",10),tA(1),R()),t&2){let A=P().$implicit;_(),Mt(A.description)}}function oHA(t,e){if(t&1&&(S(0,"section",11),UA(1,"ngx-json-viewer",12),R()),t&2){let A=P().$implicit,i=P();_(),vA("json",A.value)("expanded",i.expanded)("depth",i.depth)("_currentDepth",i._currentDepth+1)}}function rHA(t,e){if(t&1){let A=De();S(0,"section",2)(1,"section",3),mA("click",function(){let n=LA(A).$implicit,o=P();return xA(o.toggle(n))}),NA(2,iHA,1,0,"div",4),S(3,"span",5),tA(4),R(),S(5,"span",6),tA(6,": "),R(),NA(7,nHA,2,1,"span",7),R(),NA(8,oHA,2,4,"section",8),R()}if(t&2){let A=e.$implicit,i=P();vA("ngClass",Yr(6,eHA,"segment-type-"+A.type)),_(),vA("ngClass",p2(8,tHA,i.isExpandable(A),A.expanded)),_(),vA("ngIf",i.isExpandable(A)),_(2),Mt(A.key),_(3),vA("ngIf",!A.expanded||!i.isExpandable(A)),_(),vA("ngIf",A.expanded&&i.isExpandable(A))}}var Qh=(()=>{class t{constructor(){this.expanded=!0,this.depth=-1,this._currentDepth=0,this.segments=[]}ngOnChanges(){this.segments=[],this.json=this.decycle(this.json),typeof this.json=="object"?Object.keys(this.json).forEach(A=>{this.segments.push(this.parseKeyValue(A,this.json[A]))}):this.segments.push(this.parseKeyValue(`(${typeof this.json})`,this.json))}isExpandable(A){return A.type==="object"||A.type==="array"}toggle(A){this.isExpandable(A)&&(A.expanded=!A.expanded)}parseKeyValue(A,i){let n={key:A,value:i,type:void 0,description:""+i,expanded:this.isExpanded()};switch(typeof n.value){case"number":{n.type="number";break}case"boolean":{n.type="boolean";break}case"function":{n.type="function";break}case"string":{n.type="string",n.description='"'+n.value+'"';break}case"undefined":{n.type="undefined",n.description="undefined";break}case"object":{n.value===null?(n.type="null",n.description="null"):Array.isArray(n.value)?(n.type="array",n.description="Array["+n.value.length+"] "+JSON.stringify(n.value)):n.value instanceof Date?n.type="date":(n.type="object",n.description="Object "+JSON.stringify(n.value));break}}return n}isExpanded(){return this.expanded&&!(this.depth>-1&&this._currentDepth>=this.depth)}decycle(A){let i=new WeakMap;return function n(o,r){let s,a;return typeof o=="object"&&o!==null&&!(o instanceof Boolean)&&!(o instanceof Date)&&!(o instanceof Number)&&!(o instanceof RegExp)&&!(o instanceof String)?(s=i.get(o),s!==void 0?{$ref:s}:(i.set(o,r),Array.isArray(o)?(a=[],o.forEach(function(c,l){a[l]=n(c,r+"["+l+"]")})):(a={},Object.keys(o).forEach(function(c){a[c]=n(o[c],r+"["+JSON.stringify(c)+"]")})),a)):o}(A,"$")}}return t.\u0275fac=function(A){return new(A||t)},t.\u0275cmp=YA({type:t,selectors:[["ngx-json-viewer"]],inputs:{json:"json",expanded:"expanded",depth:"depth",_currentDepth:"_currentDepth"},standalone:!1,features:[Kt],decls:2,vars:1,consts:[[1,"ngx-json-viewer"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[3,"click","ngClass"],["class","toggler",4,"ngIf"],[1,"segment-key"],[1,"segment-separator"],["class","segment-value",4,"ngIf"],["class","children",4,"ngIf"],[1,"toggler"],[1,"segment-value"],[1,"children"],[3,"json","expanded","depth","_currentDepth"]],template:function(A,i){A&1&&(S(0,"section",0),NA(1,rHA,9,11,"section",1),R()),A&2&&(_(),vA("ngForOf",i.segments))},dependencies:[Ha,kp,DQ,t],styles:['@charset "UTF-8";.ngx-json-viewer[_ngcontent-%COMP%]{font-family:var(--ngx-json-font-family, monospace);font-size:var(--ngx-json-font-size, 1em);width:100%;height:100%;overflow:hidden;position:relative}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%]{padding:2px;margin:1px 1px 1px 12px}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%]{word-wrap:break-word}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .toggler[_ngcontent-%COMP%]{position:absolute;margin-left:-14px;margin-top:3px;font-size:.8em;line-height:1.2em;vertical-align:middle;color:var(--ngx-json-toggler, #787878)}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .toggler[_ngcontent-%COMP%]:after{display:inline-block;content:"\\25ba";transition:transform .1s ease-in}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .segment-key[_ngcontent-%COMP%]{color:var(--ngx-json-key, #4E187C)}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .segment-separator[_ngcontent-%COMP%]{color:var(--ngx-json-separator, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-value, #000)}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .children[_ngcontent-%COMP%]{margin-left:12px}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-string[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-string, #FF6B6B)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-number[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-number, #009688)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-boolean[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-boolean, #B938A4)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-date[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-date, #05668D)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-array[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-array, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-object[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-object, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-function[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-function, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-null[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-null, #fff)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-undefined[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-undefined, #fff)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-null[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{background-color:var(--ngx-json-null-bg, red)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-undefined[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-key[_ngcontent-%COMP%]{color:var(--ngx-json-undefined-key, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-undefined[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{background-color:var(--ngx-json-undefined-key, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-object[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%], .ngx-json-viewer[_ngcontent-%COMP%] .segment-type-array[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%]{white-space:nowrap}.ngx-json-viewer[_ngcontent-%COMP%] .expanded[_ngcontent-%COMP%] > .toggler[_ngcontent-%COMP%]:after{transform:rotate(90deg)}.ngx-json-viewer[_ngcontent-%COMP%] .expandable[_ngcontent-%COMP%], .ngx-json-viewer[_ngcontent-%COMP%] .expandable[_ngcontent-%COMP%] > .toggler[_ngcontent-%COMP%]{cursor:pointer}']}),t})(),acA=(()=>{class t{}return t.\u0275fac=function(A){return new(A||t)},t.\u0275mod=ge({type:t}),t.\u0275inj=le({imports:[g0]}),t})();var ccA=["*"],sHA=["content"],aHA=[[["mat-drawer"]],[["mat-drawer-content"]],"*"],cHA=["mat-drawer","mat-drawer-content","*"];function lHA(t,e){if(t&1){let A=De();S(0,"div",1),mA("click",function(){LA(A);let n=P();return xA(n._onBackdropClicked())}),R()}if(t&2){let A=P();ue("mat-drawer-shown",A._isShowingBackdrop())}}function gHA(t,e){t&1&&(S(0,"mat-drawer-content"),xe(1,2),R())}var IHA=new BA("MAT_DRAWER_DEFAULT_AUTOSIZE",{providedIn:"root",factory:CHA}),lcA=new BA("MAT_DRAWER_CONTAINER");function CHA(){return!1}var SG=(()=>{class t extends h0{_platform=m(Zt);_changeDetectorRef=m(lt);_container=m(LG);constructor(){let A=m(te),i=m(N2),n=m(de);super(A,i,n)}ngAfterContentInit(){this._container._contentMarginChanges.subscribe(()=>{this._changeDetectorRef.markForCheck()})}_shouldBeHidden(){if(this._platform.isBrowser)return!1;let{start:A,end:i}=this._container;return A!=null&&A.mode!=="over"&&A.opened||i!=null&&i.mode!=="over"&&i.opened}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-drawer-content"]],hostAttrs:[1,"mat-drawer-content"],hostVars:6,hostBindings:function(i,n){i&2&&(so("margin-left",n._container._contentMargins.left,"px")("margin-right",n._container._contentMargins.right,"px"),ue("mat-drawer-content-hidden",n._shouldBeHidden()))},features:[ct([{provide:h0,useExisting:t}]),et],ngContentSelectors:ccA,decls:1,vars:0,template:function(i,n){i&1&&(Yt(),xe(0))},encapsulation:2,changeDetection:0})}return t})(),RG=(()=>{class t{_elementRef=m(te);_focusTrapFactory=m(P6);_focusMonitor=m(Jr);_platform=m(Zt);_ngZone=m(de);_renderer=m(Gi);_interactivityChecker=m(hu);_doc=m(tt,{optional:!0});_container=m(lcA,{optional:!0});_focusTrap=null;_elementFocusedBeforeDrawerWasOpened=null;_eventCleanups;_isAttached;_anchor;get position(){return this._position}set position(A){A=A==="end"?"end":"start",A!==this._position&&(this._isAttached&&this._updatePositionInParent(A),this._position=A,this.onPositionChanged.emit())}_position="start";get mode(){return this._mode}set mode(A){this._mode=A,this._updateFocusTrapState(),this._modeChanged.next()}_mode="over";get disableClose(){return this._disableClose}set disableClose(A){this._disableClose=Yo(A)}_disableClose=!1;get autoFocus(){let A=this._autoFocus;return A??(this.mode==="side"?"dialog":"first-tabbable")}set autoFocus(A){(A==="true"||A==="false"||A==null)&&(A=Yo(A)),this._autoFocus=A}_autoFocus;get opened(){return this._opened}set opened(A){this.toggle(Yo(A))}_opened=!1;_openedVia;_animationStarted=new HA;_animationEnd=new HA;openedChange=new XA(!0);_openedStream=this.openedChange.pipe(pt(A=>A),Je(()=>{}));openedStart=this._animationStarted.pipe(pt(()=>this.opened),dd(void 0));_closedStream=this.openedChange.pipe(pt(A=>!A),Je(()=>{}));closedStart=this._animationStarted.pipe(pt(()=>!this.opened),dd(void 0));_destroyed=new HA;onPositionChanged=new XA;_content;_modeChanged=new HA;_injector=m(Dt);_changeDetectorRef=m(lt);constructor(){this.openedChange.pipe(wt(this._destroyed)).subscribe(A=>{A?(this._doc&&(this._elementFocusedBeforeDrawerWasOpened=this._doc.activeElement),this._takeFocus()):this._isFocusWithinDrawer()&&this._restoreFocus(this._openedVia||"program")}),this._ngZone.runOutsideAngular(()=>{let A=this._elementRef.nativeElement;Oh(A,"keydown").pipe(pt(i=>i.keyCode===27&&!this.disableClose&&!rr(i)),wt(this._destroyed)).subscribe(i=>this._ngZone.run(()=>{this.close(),i.stopPropagation(),i.preventDefault()})),this._eventCleanups=[this._renderer.listen(A,"transitionrun",this._handleTransitionEvent),this._renderer.listen(A,"transitionend",this._handleTransitionEvent),this._renderer.listen(A,"transitioncancel",this._handleTransitionEvent)]}),this._animationEnd.subscribe(()=>{this.openedChange.emit(this._opened)})}_forceFocus(A,i){this._interactivityChecker.isFocusable(A)||(A.tabIndex=-1,this._ngZone.runOutsideAngular(()=>{let n=()=>{o(),r(),A.removeAttribute("tabindex")},o=this._renderer.listen(A,"blur",n),r=this._renderer.listen(A,"mousedown",n)})),A.focus(i)}_focusByCssSelector(A,i){let n=this._elementRef.nativeElement.querySelector(A);n&&this._forceFocus(n,i)}_takeFocus(){if(!this._focusTrap)return;let A=this._elementRef.nativeElement;switch(this.autoFocus){case!1:case"dialog":return;case!0:case"first-tabbable":Vo(()=>{!this._focusTrap.focusInitialElement()&&typeof A.focus=="function"&&A.focus()},{injector:this._injector});break;case"first-heading":this._focusByCssSelector('h1, h2, h3, h4, h5, h6, [role="heading"]');break;default:this._focusByCssSelector(this.autoFocus);break}}_restoreFocus(A){this.autoFocus!=="dialog"&&(this._elementFocusedBeforeDrawerWasOpened?this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened,A):this._elementRef.nativeElement.blur(),this._elementFocusedBeforeDrawerWasOpened=null)}_isFocusWithinDrawer(){let A=this._doc.activeElement;return!!A&&this._elementRef.nativeElement.contains(A)}ngAfterViewInit(){this._isAttached=!0,this._position==="end"&&this._updatePositionInParent("end"),this._platform.isBrowser&&(this._focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement),this._updateFocusTrapState())}ngOnDestroy(){this._eventCleanups.forEach(A=>A()),this._focusTrap?.destroy(),this._anchor?.remove(),this._anchor=null,this._animationStarted.complete(),this._animationEnd.complete(),this._modeChanged.complete(),this._destroyed.next(),this._destroyed.complete()}open(A){return this.toggle(!0,A)}close(){return this.toggle(!1)}_closeViaBackdropClick(){return this._setOpen(!1,!0,"mouse")}toggle(A=!this.opened,i){A&&i&&(this._openedVia=i);let n=this._setOpen(A,!A&&this._isFocusWithinDrawer(),this._openedVia||"program");return A||(this._openedVia=null),n}_setOpen(A,i,n){return A===this._opened?Promise.resolve(A?"open":"close"):(this._opened=A,this._container?._transitionsEnabled?this._setIsAnimating(!0):setTimeout(()=>{this._animationStarted.next(),this._animationEnd.next()}),this._elementRef.nativeElement.classList.toggle("mat-drawer-opened",A),!A&&i&&this._restoreFocus(n),this._changeDetectorRef.markForCheck(),this._updateFocusTrapState(),new Promise(o=>{this.openedChange.pipe(Pn(1)).subscribe(r=>o(r?"open":"close"))}))}_setIsAnimating(A){this._elementRef.nativeElement.classList.toggle("mat-drawer-animating",A)}_getWidth(){return this._elementRef.nativeElement.offsetWidth||0}_updateFocusTrapState(){this._focusTrap&&(this._focusTrap.enabled=!!this._container?.hasBackdrop&&this.opened)}_updatePositionInParent(A){if(!this._platform.isBrowser)return;let i=this._elementRef.nativeElement,n=i.parentNode;A==="end"?(this._anchor||(this._anchor=this._doc.createComment("mat-drawer-anchor"),n.insertBefore(this._anchor,i)),n.appendChild(i)):this._anchor&&this._anchor.parentNode.insertBefore(i,this._anchor)}_handleTransitionEvent=A=>{let i=this._elementRef.nativeElement;A.target===i&&this._ngZone.run(()=>{A.type==="transitionrun"?this._animationStarted.next(A):(A.type==="transitionend"&&this._setIsAnimating(!1),this._animationEnd.next(A))})};static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-drawer"]],viewQuery:function(i,n){if(i&1&&Ge(sHA,5),i&2){let o;$A(o=Ae())&&(n._content=o.first)}},hostAttrs:["tabIndex","-1",1,"mat-drawer"],hostVars:11,hostBindings:function(i,n){i&2&&(_e("align",null),so("visibility",!n._container&&!n.opened?"hidden":null),ue("mat-drawer-end",n.position==="end")("mat-drawer-over",n.mode==="over")("mat-drawer-push",n.mode==="push")("mat-drawer-side",n.mode==="side"))},inputs:{position:"position",mode:"mode",disableClose:"disableClose",autoFocus:"autoFocus",opened:"opened"},outputs:{openedChange:"openedChange",_openedStream:"opened",openedStart:"openedStart",_closedStream:"closed",closedStart:"closedStart",onPositionChanged:"positionChanged"},exportAs:["matDrawer"],ngContentSelectors:ccA,decls:3,vars:0,consts:[["content",""],["cdkScrollable","",1,"mat-drawer-inner-container"]],template:function(i,n){i&1&&(Yt(),S(0,"div",1,0),xe(2),R())},dependencies:[h0],encapsulation:2,changeDetection:0})}return t})(),LG=(()=>{class t{_dir=m(bo,{optional:!0});_element=m(te);_ngZone=m(de);_changeDetectorRef=m(lt);_animationMode=m(mi,{optional:!0});_transitionsEnabled=!1;_allDrawers;_drawers=new Ec;_content;_userContent;get start(){return this._start}get end(){return this._end}get autosize(){return this._autosize}set autosize(A){this._autosize=Yo(A)}_autosize=m(IHA);get hasBackdrop(){return this._drawerHasBackdrop(this._start)||this._drawerHasBackdrop(this._end)}set hasBackdrop(A){this._backdropOverride=A==null?null:Yo(A)}_backdropOverride;backdropClick=new XA;_start;_end;_left;_right;_destroyed=new HA;_doCheckSubject=new HA;_contentMargins={left:null,right:null};_contentMarginChanges=new HA;get scrollable(){return this._userContent||this._content}_injector=m(Dt);constructor(){let A=m(Zt),i=m(mc);this._dir?.change.pipe(wt(this._destroyed)).subscribe(()=>{this._validateDrawers(),this.updateContentMargins()}),i.change().pipe(wt(this._destroyed)).subscribe(()=>this.updateContentMargins()),this._animationMode!=="NoopAnimations"&&A.isBrowser&&this._ngZone.runOutsideAngular(()=>{setTimeout(()=>{this._element.nativeElement.classList.add("mat-drawer-transition"),this._transitionsEnabled=!0},200)})}ngAfterContentInit(){this._allDrawers.changes.pipe(Qo(this._allDrawers),wt(this._destroyed)).subscribe(A=>{this._drawers.reset(A.filter(i=>!i._container||i._container===this)),this._drawers.notifyOnChanges()}),this._drawers.changes.pipe(Qo(null)).subscribe(()=>{this._validateDrawers(),this._drawers.forEach(A=>{this._watchDrawerToggle(A),this._watchDrawerPosition(A),this._watchDrawerMode(A)}),(!this._drawers.length||this._isDrawerOpen(this._start)||this._isDrawerOpen(this._end))&&this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),this._ngZone.runOutsideAngular(()=>{this._doCheckSubject.pipe(Vc(10),wt(this._destroyed)).subscribe(()=>this.updateContentMargins())})}ngOnDestroy(){this._contentMarginChanges.complete(),this._doCheckSubject.complete(),this._drawers.destroy(),this._destroyed.next(),this._destroyed.complete()}open(){this._drawers.forEach(A=>A.open())}close(){this._drawers.forEach(A=>A.close())}updateContentMargins(){let A=0,i=0;if(this._left&&this._left.opened){if(this._left.mode=="side")A+=this._left._getWidth();else if(this._left.mode=="push"){let n=this._left._getWidth();A+=n,i-=n}}if(this._right&&this._right.opened){if(this._right.mode=="side")i+=this._right._getWidth();else if(this._right.mode=="push"){let n=this._right._getWidth();i+=n,A-=n}}A=A||null,i=i||null,(A!==this._contentMargins.left||i!==this._contentMargins.right)&&(this._contentMargins={left:A,right:i},this._ngZone.run(()=>this._contentMarginChanges.next(this._contentMargins)))}ngDoCheck(){this._autosize&&this._isPushed()&&this._ngZone.runOutsideAngular(()=>this._doCheckSubject.next())}_watchDrawerToggle(A){A._animationStarted.pipe(wt(this._drawers.changes)).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),A.mode!=="side"&&A.openedChange.pipe(wt(this._drawers.changes)).subscribe(()=>this._setContainerClass(A.opened))}_watchDrawerPosition(A){A.onPositionChanged.pipe(wt(this._drawers.changes)).subscribe(()=>{Vo({read:()=>this._validateDrawers()},{injector:this._injector})})}_watchDrawerMode(A){A._modeChanged.pipe(wt(ho(this._drawers.changes,this._destroyed))).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()})}_setContainerClass(A){let i=this._element.nativeElement.classList,n="mat-drawer-container-has-open";A?i.add(n):i.remove(n)}_validateDrawers(){this._start=this._end=null,this._drawers.forEach(A=>{A.position=="end"?(this._end!=null,this._end=A):(this._start!=null,this._start=A)}),this._right=this._left=null,this._dir&&this._dir.value==="rtl"?(this._left=this._end,this._right=this._start):(this._left=this._start,this._right=this._end)}_isPushed(){return this._isDrawerOpen(this._start)&&this._start.mode!="over"||this._isDrawerOpen(this._end)&&this._end.mode!="over"}_onBackdropClicked(){this.backdropClick.emit(),this._closeModalDrawersViaBackdrop()}_closeModalDrawersViaBackdrop(){[this._start,this._end].filter(A=>A&&!A.disableClose&&this._drawerHasBackdrop(A)).forEach(A=>A._closeViaBackdropClick())}_isShowingBackdrop(){return this._isDrawerOpen(this._start)&&this._drawerHasBackdrop(this._start)||this._isDrawerOpen(this._end)&&this._drawerHasBackdrop(this._end)}_isDrawerOpen(A){return A!=null&&A.opened}_drawerHasBackdrop(A){return this._backdropOverride==null?!!A&&A.mode!=="side":this._backdropOverride}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-drawer-container"]],contentQueries:function(i,n,o){if(i&1&&(Ii(o,SG,5),Ii(o,RG,5)),i&2){let r;$A(r=Ae())&&(n._content=r.first),$A(r=Ae())&&(n._allDrawers=r)}},viewQuery:function(i,n){if(i&1&&Ge(SG,5),i&2){let o;$A(o=Ae())&&(n._userContent=o.first)}},hostAttrs:[1,"mat-drawer-container"],hostVars:2,hostBindings:function(i,n){i&2&&ue("mat-drawer-container-explicit-backdrop",n._backdropOverride)},inputs:{autosize:"autosize",hasBackdrop:"hasBackdrop"},outputs:{backdropClick:"backdropClick"},exportAs:["matDrawerContainer"],features:[ct([{provide:lcA,useExisting:t}])],ngContentSelectors:cHA,decls:4,vars:2,consts:[[1,"mat-drawer-backdrop",3,"mat-drawer-shown"],[1,"mat-drawer-backdrop",3,"click"]],template:function(i,n){i&1&&(Yt(aHA),NA(0,lHA,1,2,"div",0),xe(1),xe(2,1),NA(3,gHA,2,0,"mat-drawer-content")),i&2&&(FA(n.hasBackdrop?0:-1),_(3),FA(n._content?-1:3))},dependencies:[SG],styles:[".mat-drawer-container{position:relative;z-index:1;color:var(--mat-sidenav-content-text-color, var(--mat-sys-on-background));background-color:var(--mat-sidenav-content-background-color, var(--mat-sys-background));box-sizing:border-box;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible;background-color:var(--mat-sidenav-scrim-color, color-mix(in srgb, var(--mat-sys-neutral-variant20) 40%, transparent))}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:background-color,visibility}@media(forced-colors: active){.mat-drawer-backdrop{opacity:.5}}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-content.mat-drawer-content-hidden{opacity:0}.mat-drawer-transition .mat-drawer-content{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;color:var(--mat-sidenav-container-text-color, var(--mat-sys-on-surface-variant));box-shadow:var(--mat-sidenav-container-elevation-shadow, none);background-color:var(--mat-sidenav-container-background-color, var(--mat-sys-surface));border-top-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));width:var(--mat-sidenav-container-width, 360px);display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%, 0, 0)}@media(forced-colors: active){.mat-drawer,[dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}}@media(forced-colors: active){[dir=rtl] .mat-drawer,.mat-drawer.mat-drawer-end{border-left:solid 1px currentColor;border-right:none}}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%, 0, 0);border-top-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .mat-drawer{border-top-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-right-radius:0;border-bottom-right-radius:0;transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer.mat-drawer-end{border-top-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-left-radius:0;border-bottom-left-radius:0;left:0;right:auto;transform:translate3d(-100%, 0, 0)}.mat-drawer-transition .mat-drawer{transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-drawer:not(.mat-drawer-opened):not(.mat-drawer-animating){visibility:hidden;box-shadow:none}.mat-drawer:not(.mat-drawer-opened):not(.mat-drawer-animating) .mat-drawer-inner-container{display:none}.mat-drawer.mat-drawer-opened.mat-drawer-opened{transform:none}.mat-drawer-side{box-shadow:none;border-right-color:var(--mat-sidenav-container-divider-color, transparent);border-right-width:1px;border-right-style:solid}.mat-drawer-side.mat-drawer-end{border-left-color:var(--mat-sidenav-container-divider-color, transparent);border-left-width:1px;border-left-style:solid;border-right:none}[dir=rtl] .mat-drawer-side{border-left-color:var(--mat-sidenav-container-divider-color, transparent);border-left-width:1px;border-left-style:solid;border-right:none}[dir=rtl] .mat-drawer-side.mat-drawer-end{border-right-color:var(--mat-sidenav-container-divider-color, transparent);border-right-width:1px;border-right-style:solid;border-left:none}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto}.mat-sidenav-fixed{position:fixed}"],encapsulation:2,changeDetection:0})}return t})();var gcA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,E0,E0,Ve]})}return t})();var _G=["*"];function BHA(t,e){t&1&&xe(0)}var EHA=["tabListContainer"],hHA=["tabList"],QHA=["tabListInner"],uHA=["nextPaginator"],fHA=["previousPaginator"],mHA=t=>({animationDuration:t}),pHA=(t,e)=>({value:t,params:e});function wHA(t,e){}var DHA=["tabBodyWrapper"],yHA=["tabHeader"];function vHA(t,e){}function bHA(t,e){if(t&1&&NA(0,vHA,0,0,"ng-template",12),t&2){let A=P().$implicit;vA("cdkPortalOutlet",A.templateLabel)}}function MHA(t,e){if(t&1&&tA(0),t&2){let A=P().$implicit;Mt(A.textLabel)}}function kHA(t,e){if(t&1){let A=De();S(0,"div",7,2),mA("click",function(){let n=LA(A),o=n.$implicit,r=n.$index,s=P(),a=or(1);return xA(s._handleClick(o,a,r))})("cdkFocusChange",function(n){let o=LA(A).$index,r=P();return xA(r._tabFocusChanged(n,o))}),UA(2,"span",8)(3,"div",9),S(4,"span",10)(5,"span",11),NA(6,bHA,1,1,null,12)(7,MHA,1,1),R()()()}if(t&2){let A=e.$implicit,i=e.$index,n=or(1),o=P();vo(A.labelClass),ue("mdc-tab--active",o.selectedIndex===i),vA("id",o._getTabLabelId(i))("disabled",A.disabled)("fitInkBarToContent",o.fitInkBarToContent),_e("tabIndex",o._getTabIndex(i))("aria-posinset",i+1)("aria-setsize",o._tabs.length)("aria-controls",o._getTabContentId(i))("aria-selected",o.selectedIndex===i)("aria-label",A.ariaLabel||null)("aria-labelledby",!A.ariaLabel&&A.ariaLabelledby?A.ariaLabelledby:null),_(3),vA("matRippleTrigger",n)("matRippleDisabled",A.disabled||o.disableRipple),_(3),FA(A.templateLabel?6:7)}}function SHA(t,e){t&1&&xe(0)}function RHA(t,e){if(t&1){let A=De();S(0,"mat-tab-body",13),mA("_onCentered",function(){LA(A);let n=P();return xA(n._removeTabBodyWrapperHeight())})("_onCentering",function(n){LA(A);let o=P();return xA(o._setTabBodyWrapperHeight(n))}),R()}if(t&2){let A=e.$implicit,i=e.$index,n=P();vo(A.bodyClass),ue("mat-mdc-tab-body-active",n.selectedIndex===i),vA("id",n._getTabContentId(i))("content",A.content)("position",A.position)("origin",A.origin)("animationDuration",n.animationDuration)("preserveContent",n.preserveContent),_e("tabindex",n.contentTabIndex!=null&&n.selectedIndex===i?n.contentTabIndex:null)("aria-labelledby",n._getTabLabelId(i))("aria-hidden",n.selectedIndex!==i)}}var LHA=new BA("MatTabContent"),xHA=(()=>{class t{template=m(vn);constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matTabContent",""]],features:[ct([{provide:LHA,useExisting:t}])]})}return t})(),FHA=new BA("MatTabLabel"),dcA=new BA("MAT_TAB"),GG=(()=>{class t extends OO{_closestTab=m(dcA,{optional:!0});static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","mat-tab-label",""],["","matTabLabel",""]],features:[ct([{provide:FHA,useExisting:t}]),et]})}return t})(),BcA=new BA("MAT_TAB_GROUP"),af=(()=>{class t{_viewContainerRef=m(Un);_closestTabGroup=m(BcA,{optional:!0});disabled=!1;get templateLabel(){return this._templateLabel}set templateLabel(A){this._setTemplateLabelInput(A)}_templateLabel;_explicitContent=void 0;_implicitContent;textLabel="";ariaLabel;ariaLabelledby;labelClass;bodyClass;_contentPortal=null;get content(){return this._contentPortal}_stateChanges=new HA;position=null;origin=null;isActive=!1;constructor(){m(Ln).load(Qr)}ngOnChanges(A){(A.hasOwnProperty("textLabel")||A.hasOwnProperty("disabled"))&&this._stateChanges.next()}ngOnDestroy(){this._stateChanges.complete()}ngOnInit(){this._contentPortal=new aa(this._explicitContent||this._implicitContent,this._viewContainerRef)}_setTemplateLabelInput(A){A&&A._closestTab===this&&(this._templateLabel=A)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-tab"]],contentQueries:function(i,n,o){if(i&1&&(Ii(o,GG,5),Ii(o,xHA,7,vn)),i&2){let r;$A(r=Ae())&&(n.templateLabel=r.first),$A(r=Ae())&&(n._explicitContent=r.first)}},viewQuery:function(i,n){if(i&1&&Ge(vn,7),i&2){let o;$A(o=Ae())&&(n._implicitContent=o.first)}},hostAttrs:["hidden",""],inputs:{disabled:[2,"disabled","disabled",ae],textLabel:[0,"label","textLabel"],ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],labelClass:"labelClass",bodyClass:"bodyClass"},exportAs:["matTab"],features:[ct([{provide:dcA,useExisting:t}]),Kt],ngContentSelectors:_G,decls:1,vars:0,template:function(i,n){i&1&&(Yt(),NA(0,BHA,1,0,"ng-template"))},encapsulation:2})}return t})(),xG="mdc-tab-indicator--active",IcA="mdc-tab-indicator--no-transition",FG=class{_items;_currentItem;constructor(e){this._items=e}hide(){this._items.forEach(e=>e.deactivateInkBar()),this._currentItem=void 0}alignToElement(e){let A=this._items.find(n=>n.elementRef.nativeElement===e),i=this._currentItem;if(A!==i&&(i?.deactivateInkBar(),A)){let n=i?.elementRef.nativeElement.getBoundingClientRect?.();A.activateInkBar(n),this._currentItem=A}}},NHA=(()=>{class t{_elementRef=m(te);_inkBarElement;_inkBarContentElement;_fitToContent=!1;get fitInkBarToContent(){return this._fitToContent}set fitInkBarToContent(A){this._fitToContent!==A&&(this._fitToContent=A,this._inkBarElement&&this._appendInkBarElement())}activateInkBar(A){let i=this._elementRef.nativeElement;if(!A||!i.getBoundingClientRect||!this._inkBarContentElement){i.classList.add(xG);return}let n=i.getBoundingClientRect(),o=A.width/n.width,r=A.left-n.left;i.classList.add(IcA),this._inkBarContentElement.style.setProperty("transform",`translateX(${r}px) scaleX(${o})`),i.getBoundingClientRect(),i.classList.remove(IcA),i.classList.add(xG),this._inkBarContentElement.style.setProperty("transform","")}deactivateInkBar(){this._elementRef.nativeElement.classList.remove(xG)}ngOnInit(){this._createInkBarElement()}ngOnDestroy(){this._inkBarElement?.remove(),this._inkBarElement=this._inkBarContentElement=null}_createInkBarElement(){let A=this._elementRef.nativeElement.ownerDocument||document,i=this._inkBarElement=A.createElement("span"),n=this._inkBarContentElement=A.createElement("span");i.className="mdc-tab-indicator",n.className="mdc-tab-indicator__content mdc-tab-indicator__content--underline",i.appendChild(this._inkBarContentElement),this._appendInkBarElement()}_appendInkBarElement(){this._inkBarElement;let A=this._fitToContent?this._elementRef.nativeElement.querySelector(".mdc-tab__content"):this._elementRef.nativeElement;A.appendChild(this._inkBarElement)}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,inputs:{fitInkBarToContent:[2,"fitInkBarToContent","fitInkBarToContent",ae]}})}return t})();var EcA=(()=>{class t extends NHA{elementRef=m(te);disabled=!1;focus(){this.elementRef.nativeElement.focus()}getOffsetLeft(){return this.elementRef.nativeElement.offsetLeft}getOffsetWidth(){return this.elementRef.nativeElement.offsetWidth}static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matTabLabelWrapper",""]],hostVars:3,hostBindings:function(i,n){i&2&&(_e("aria-disabled",!!n.disabled),ue("mat-mdc-tab-disabled",n.disabled))},inputs:{disabled:[2,"disabled","disabled",ae]},features:[et]})}return t})(),CcA={passive:!0},_HA=650,GHA=100,UHA=(()=>{class t{_elementRef=m(te);_changeDetectorRef=m(lt);_viewportRuler=m(mc);_dir=m(bo,{optional:!0});_ngZone=m(de);_platform=m(Zt);_sharedResizeObserver=m(n8);_injector=m(Dt);_renderer=m(Gi);_animationMode=m(mi,{optional:!0});_eventCleanups;_scrollDistance=0;_selectedIndexChanged=!1;_destroyed=new HA;_showPaginationControls=!1;_disableScrollAfter=!0;_disableScrollBefore=!0;_tabLabelCount;_scrollDistanceChanged;_keyManager;_currentTextContent;_stopScrolling=new HA;disablePagination=!1;get selectedIndex(){return this._selectedIndex}set selectedIndex(A){let i=isNaN(A)?0:A;this._selectedIndex!=i&&(this._selectedIndexChanged=!0,this._selectedIndex=i,this._keyManager&&this._keyManager.updateActiveItem(i))}_selectedIndex=0;selectFocusedIndex=new XA;indexFocused=new XA;constructor(){this._eventCleanups=this._ngZone.runOutsideAngular(()=>[this._renderer.listen(this._elementRef.nativeElement,"mouseleave",()=>this._stopInterval())])}ngAfterViewInit(){this._eventCleanups.push(HM(this._renderer,this._previousPaginator.nativeElement,"touchstart",()=>this._handlePaginatorPress("before"),CcA),HM(this._renderer,this._nextPaginator.nativeElement,"touchstart",()=>this._handlePaginatorPress("after"),CcA))}ngAfterContentInit(){let A=this._dir?this._dir.change:ve("ltr"),i=this._sharedResizeObserver.observe(this._elementRef.nativeElement).pipe(Vc(32),wt(this._destroyed)),n=this._viewportRuler.change(150).pipe(wt(this._destroyed)),o=()=>{this.updatePagination(),this._alignInkBarToSelectedTab()};this._keyManager=new du(this._items).withHorizontalOrientation(this._getLayoutDirection()).withHomeAndEnd().withWrap().skipPredicate(()=>!1),this._keyManager.updateActiveItem(this._selectedIndex),Vo(o,{injector:this._injector}),ho(A,n,i,this._items.changes,this._itemsResized()).pipe(wt(this._destroyed)).subscribe(()=>{this._ngZone.run(()=>{Promise.resolve().then(()=>{this._scrollDistance=Math.max(0,Math.min(this._getMaxScrollDistance(),this._scrollDistance)),o()})}),this._keyManager.withHorizontalOrientation(this._getLayoutDirection())}),this._keyManager.change.subscribe(r=>{this.indexFocused.emit(r),this._setTabFocus(r)})}_itemsResized(){return typeof ResizeObserver!="function"?Ar:this._items.changes.pipe(Qo(this._items),no(A=>new Ze(i=>this._ngZone.runOutsideAngular(()=>{let n=new ResizeObserver(o=>i.next(o));return A.forEach(o=>n.observe(o.elementRef.nativeElement)),()=>{n.disconnect()}}))),eI(1),pt(A=>A.some(i=>i.contentRect.width>0&&i.contentRect.height>0)))}ngAfterContentChecked(){this._tabLabelCount!=this._items.length&&(this.updatePagination(),this._tabLabelCount=this._items.length,this._changeDetectorRef.markForCheck()),this._selectedIndexChanged&&(this._scrollToLabel(this._selectedIndex),this._checkScrollingControls(),this._alignInkBarToSelectedTab(),this._selectedIndexChanged=!1,this._changeDetectorRef.markForCheck()),this._scrollDistanceChanged&&(this._updateTabScrollPosition(),this._scrollDistanceChanged=!1,this._changeDetectorRef.markForCheck())}ngOnDestroy(){this._eventCleanups.forEach(A=>A()),this._keyManager?.destroy(),this._destroyed.next(),this._destroyed.complete(),this._stopScrolling.complete()}_handleKeydown(A){if(!rr(A))switch(A.keyCode){case 13:case 32:if(this.focusIndex!==this.selectedIndex){let i=this._items.get(this.focusIndex);i&&!i.disabled&&(this.selectFocusedIndex.emit(this.focusIndex),this._itemSelected(A))}break;default:this._keyManager.onKeydown(A)}}_onContentChanges(){let A=this._elementRef.nativeElement.textContent;A!==this._currentTextContent&&(this._currentTextContent=A||"",this._ngZone.run(()=>{this.updatePagination(),this._alignInkBarToSelectedTab(),this._changeDetectorRef.markForCheck()}))}updatePagination(){this._checkPaginationEnabled(),this._checkScrollingControls(),this._updateTabScrollPosition()}get focusIndex(){return this._keyManager?this._keyManager.activeItemIndex:0}set focusIndex(A){!this._isValidIndex(A)||this.focusIndex===A||!this._keyManager||this._keyManager.setActiveItem(A)}_isValidIndex(A){return this._items?!!this._items.toArray()[A]:!0}_setTabFocus(A){if(this._showPaginationControls&&this._scrollToLabel(A),this._items&&this._items.length){this._items.toArray()[A].focus();let i=this._tabListContainer.nativeElement;this._getLayoutDirection()=="ltr"?i.scrollLeft=0:i.scrollLeft=i.scrollWidth-i.offsetWidth}}_getLayoutDirection(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}_updateTabScrollPosition(){if(this.disablePagination)return;let A=this.scrollDistance,i=this._getLayoutDirection()==="ltr"?-A:A;this._tabList.nativeElement.style.transform=`translateX(${Math.round(i)}px)`,(this._platform.TRIDENT||this._platform.EDGE)&&(this._tabListContainer.nativeElement.scrollLeft=0)}get scrollDistance(){return this._scrollDistance}set scrollDistance(A){this._scrollTo(A)}_scrollHeader(A){let i=this._tabListContainer.nativeElement.offsetWidth,n=(A=="before"?-1:1)*i/3;return this._scrollTo(this._scrollDistance+n)}_handlePaginatorClick(A){this._stopInterval(),this._scrollHeader(A)}_scrollToLabel(A){if(this.disablePagination)return;let i=this._items?this._items.toArray()[A]:null;if(!i)return;let n=this._tabListContainer.nativeElement.offsetWidth,{offsetLeft:o,offsetWidth:r}=i.elementRef.nativeElement,s,a;this._getLayoutDirection()=="ltr"?(s=o,a=s+r):(a=this._tabListInner.nativeElement.offsetWidth-o,s=a-r);let c=this.scrollDistance,l=this.scrollDistance+n;sl&&(this.scrollDistance+=Math.min(a-l,s-c))}_checkPaginationEnabled(){if(this.disablePagination)this._showPaginationControls=!1;else{let A=this._tabListInner.nativeElement.scrollWidth,i=this._elementRef.nativeElement.offsetWidth,n=A-i>=5;n||(this.scrollDistance=0),n!==this._showPaginationControls&&(this._showPaginationControls=n,this._changeDetectorRef.markForCheck())}}_checkScrollingControls(){this.disablePagination?this._disableScrollAfter=this._disableScrollBefore=!0:(this._disableScrollBefore=this.scrollDistance==0,this._disableScrollAfter=this.scrollDistance==this._getMaxScrollDistance(),this._changeDetectorRef.markForCheck())}_getMaxScrollDistance(){let A=this._tabListInner.nativeElement.scrollWidth,i=this._tabListContainer.nativeElement.offsetWidth;return A-i||0}_alignInkBarToSelectedTab(){let A=this._items&&this._items.length?this._items.toArray()[this.selectedIndex]:null,i=A?A.elementRef.nativeElement:null;i?this._inkBar.alignToElement(i):this._inkBar.hide()}_stopInterval(){this._stopScrolling.next()}_handlePaginatorPress(A,i){i&&i.button!=null&&i.button!==0||(this._stopInterval(),AI(_HA,GHA).pipe(wt(ho(this._stopScrolling,this._destroyed))).subscribe(()=>{let{maxScrollDistance:n,distance:o}=this._scrollHeader(A);(o===0||o>=n)&&this._stopInterval()}))}_scrollTo(A){if(this.disablePagination)return{maxScrollDistance:0,distance:0};let i=this._getMaxScrollDistance();return this._scrollDistance=Math.max(0,Math.min(i,A)),this._scrollDistanceChanged=!0,this._checkScrollingControls(),{maxScrollDistance:i,distance:this._scrollDistance}}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,inputs:{disablePagination:[2,"disablePagination","disablePagination",ae],selectedIndex:[2,"selectedIndex","selectedIndex",Mi]},outputs:{selectFocusedIndex:"selectFocusedIndex",indexFocused:"indexFocused"}})}return t})(),KHA=(()=>{class t extends UHA{_items;_tabListContainer;_tabList;_tabListInner;_nextPaginator;_previousPaginator;_inkBar;ariaLabel;ariaLabelledby;disableRipple=!1;ngAfterContentInit(){this._inkBar=new FG(this._items),super.ngAfterContentInit()}_itemSelected(A){A.preventDefault()}static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275cmp=YA({type:t,selectors:[["mat-tab-header"]],contentQueries:function(i,n,o){if(i&1&&Ii(o,EcA,4),i&2){let r;$A(r=Ae())&&(n._items=r)}},viewQuery:function(i,n){if(i&1&&(Ge(EHA,7),Ge(hHA,7),Ge(QHA,7),Ge(uHA,5),Ge(fHA,5)),i&2){let o;$A(o=Ae())&&(n._tabListContainer=o.first),$A(o=Ae())&&(n._tabList=o.first),$A(o=Ae())&&(n._tabListInner=o.first),$A(o=Ae())&&(n._nextPaginator=o.first),$A(o=Ae())&&(n._previousPaginator=o.first)}},hostAttrs:[1,"mat-mdc-tab-header"],hostVars:4,hostBindings:function(i,n){i&2&&ue("mat-mdc-tab-header-pagination-controls-enabled",n._showPaginationControls)("mat-mdc-tab-header-rtl",n._getLayoutDirection()=="rtl")},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],disableRipple:[2,"disableRipple","disableRipple",ae]},features:[et],ngContentSelectors:_G,decls:13,vars:10,consts:[["previousPaginator",""],["tabListContainer",""],["tabList",""],["tabListInner",""],["nextPaginator",""],["mat-ripple","",1,"mat-mdc-tab-header-pagination","mat-mdc-tab-header-pagination-before",3,"click","mousedown","touchend","matRippleDisabled"],[1,"mat-mdc-tab-header-pagination-chevron"],[1,"mat-mdc-tab-label-container",3,"keydown"],["role","tablist",1,"mat-mdc-tab-list",3,"cdkObserveContent"],[1,"mat-mdc-tab-labels"],["mat-ripple","",1,"mat-mdc-tab-header-pagination","mat-mdc-tab-header-pagination-after",3,"mousedown","click","touchend","matRippleDisabled"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"div",5,0),mA("click",function(){return LA(o),xA(n._handlePaginatorClick("before"))})("mousedown",function(s){return LA(o),xA(n._handlePaginatorPress("before",s))})("touchend",function(){return LA(o),xA(n._stopInterval())}),UA(2,"div",6),R(),S(3,"div",7,1),mA("keydown",function(s){return LA(o),xA(n._handleKeydown(s))}),S(5,"div",8,2),mA("cdkObserveContent",function(){return LA(o),xA(n._onContentChanges())}),S(7,"div",9,3),xe(9),R()()(),S(10,"div",10,4),mA("mousedown",function(s){return LA(o),xA(n._handlePaginatorPress("after",s))})("click",function(){return LA(o),xA(n._handlePaginatorClick("after"))})("touchend",function(){return LA(o),xA(n._stopInterval())}),UA(12,"div",6),R()}i&2&&(ue("mat-mdc-tab-header-pagination-disabled",n._disableScrollBefore),vA("matRippleDisabled",n._disableScrollBefore||n.disableRipple),_(3),ue("_mat-animation-noopable",n._animationMode==="NoopAnimations"),_(2),_e("aria-label",n.ariaLabel||null)("aria-labelledby",n.ariaLabelledby||null),_(5),ue("mat-mdc-tab-header-pagination-disabled",n._disableScrollAfter),vA("matRippleDisabled",n._disableScrollAfter||n.disableRipple))},dependencies:[Gs,N6],styles:[".mat-mdc-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mdc-tab-indicator .mdc-tab-indicator__content{transition-duration:var(--mat-tab-animation-duration, 250ms)}.mat-mdc-tab-header-pagination{-webkit-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:rgba(0,0,0,0);touch-action:none;box-sizing:content-box;outline:0}.mat-mdc-tab-header-pagination::-moz-focus-inner{border:0}.mat-mdc-tab-header-pagination .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-controls-enabled .mat-mdc-tab-header-pagination{display:flex}.mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after{padding-left:4px}.mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-pagination-after{padding-right:4px}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-mdc-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;height:8px;width:8px;border-color:var(--mat-tab-header-pagination-icon-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-disabled{box-shadow:none;cursor:default;pointer-events:none}.mat-mdc-tab-header-pagination-disabled .mat-mdc-tab-header-pagination-chevron{opacity:.4}.mat-mdc-tab-list{flex-grow:1;position:relative;transition:transform 500ms cubic-bezier(0.35, 0, 0.25, 1)}._mat-animation-noopable .mat-mdc-tab-list{transition:none}.mat-mdc-tab-label-container{display:flex;flex-grow:1;overflow:hidden;z-index:1;border-bottom-style:solid;border-bottom-width:var(--mat-tab-header-divider-height, 1px);border-bottom-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-group-inverted-header .mat-mdc-tab-label-container{border-bottom:none;border-top-style:solid;border-top-width:var(--mat-tab-header-divider-height, 1px);border-top-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-labels{display:flex;flex:1 0 auto}[mat-align-tabs=center]>.mat-mdc-tab-header .mat-mdc-tab-labels{justify-content:center}[mat-align-tabs=end]>.mat-mdc-tab-header .mat-mdc-tab-labels{justify-content:flex-end}.cdk-drop-list .mat-mdc-tab-labels,.mat-mdc-tab-labels.cdk-drop-list{min-height:var(--mdc-secondary-navigation-tab-container-height, 48px)}.mat-mdc-tab::before{margin:5px}@media(forced-colors: active){.mat-mdc-tab[aria-disabled=true]{color:GrayText}}"],encapsulation:2})}return t})(),YHA=new BA("MAT_TABS_CONFIG"),JHA={translateTab:cg("translateTab",[wc("center, void, left-origin-center, right-origin-center",ar({transform:"none",visibility:"visible"})),wc("left",ar({transform:"translate3d(-100%, 0, 0)",minHeight:"1px",visibility:"hidden"})),wc("right",ar({transform:"translate3d(100%, 0, 0)",minHeight:"1px",visibility:"hidden"})),la("* => left, * => right, left => center, right => center",$a("{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)")),la("void => left-origin-center",[ar({transform:"translate3d(-100%, 0, 0)",visibility:"hidden"}),$a("{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)")]),la("void => right-origin-center",[ar({transform:"translate3d(100%, 0, 0)",visibility:"hidden"}),$a("{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)")])])},THA=(()=>{class t extends ca{_host=m(hcA);_centeringSub=_t.EMPTY;_leavingSub=_t.EMPTY;constructor(){super()}ngOnInit(){super.ngOnInit(),this._centeringSub=this._host._beforeCentering.pipe(Qo(this._host._isCenterPosition(this._host._position))).subscribe(A=>{this._host._content&&A&&!this.hasAttached()&&this.attach(this._host._content)}),this._leavingSub=this._host._afterLeavingCenter.subscribe(()=>{this._host.preserveContent||this.detach()})}ngOnDestroy(){super.ngOnDestroy(),this._centeringSub.unsubscribe(),this._leavingSub.unsubscribe()}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matTabBodyHost",""]],features:[et]})}return t})(),hcA=(()=>{class t{_elementRef=m(te);_dir=m(bo,{optional:!0});_positionIndex;_dirChangeSubscription=_t.EMPTY;_position;_translateTabComplete=new HA;_onCentering=new XA;_beforeCentering=new XA;_afterLeavingCenter=new XA;_onCentered=new XA(!0);_portalHost;_content;origin;animationDuration="500ms";preserveContent=!1;set position(A){this._positionIndex=A,this._computePositionAnimationState()}constructor(){if(this._dir){let A=m(lt);this._dirChangeSubscription=this._dir.change.subscribe(i=>{this._computePositionAnimationState(i),A.markForCheck()})}this._translateTabComplete.subscribe(A=>{this._isCenterPosition(A.toState)&&this._isCenterPosition(this._position)&&this._onCentered.emit(),this._isCenterPosition(A.fromState)&&!this._isCenterPosition(this._position)&&this._afterLeavingCenter.emit()})}ngOnInit(){this._position=="center"&&this.origin!=null&&(this._position=this._computePositionFromOrigin(this.origin))}ngOnDestroy(){this._dirChangeSubscription.unsubscribe(),this._translateTabComplete.complete()}_onTranslateTabStarted(A){let i=this._isCenterPosition(A.toState);this._beforeCentering.emit(i),i&&this._onCentering.emit(this._elementRef.nativeElement.clientHeight)}_getLayoutDirection(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}_isCenterPosition(A){return A=="center"||A=="left-origin-center"||A=="right-origin-center"}_computePositionAnimationState(A=this._getLayoutDirection()){this._positionIndex<0?this._position=A=="ltr"?"left":"right":this._positionIndex>0?this._position=A=="ltr"?"right":"left":this._position="center"}_computePositionFromOrigin(A){let i=this._getLayoutDirection();return i=="ltr"&&A<=0||i=="rtl"&&A>0?"left-origin-center":"right-origin-center"}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-tab-body"]],viewQuery:function(i,n){if(i&1&&Ge(ca,5),i&2){let o;$A(o=Ae())&&(n._portalHost=o.first)}},hostAttrs:[1,"mat-mdc-tab-body"],inputs:{_content:[0,"content","_content"],origin:"origin",animationDuration:"animationDuration",preserveContent:"preserveContent",position:"position"},outputs:{_onCentering:"_onCentering",_beforeCentering:"_beforeCentering",_afterLeavingCenter:"_afterLeavingCenter",_onCentered:"_onCentered"},decls:3,vars:6,consts:[["content",""],["cdkScrollable","",1,"mat-mdc-tab-body-content"],["matTabBodyHost",""]],template:function(i,n){if(i&1){let o=De();S(0,"div",1,0),mA("@translateTab.start",function(s){return LA(o),xA(n._onTranslateTabStarted(s))})("@translateTab.done",function(s){return LA(o),xA(n._translateTabComplete.next(s))}),NA(2,wHA,0,0,"ng-template",2),R()}i&2&&vA("@translateTab",p2(3,pHA,n._position,Yr(1,mHA,n.animationDuration)))},dependencies:[THA,h0],styles:['.mat-mdc-tab-body{top:0;left:0;right:0;bottom:0;position:absolute;display:block;overflow:hidden;outline:0;flex-basis:100%}.mat-mdc-tab-body.mat-mdc-tab-body-active{position:relative;overflow-x:hidden;overflow-y:auto;z-index:1;flex-grow:1}.mat-mdc-tab-group.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body.mat-mdc-tab-body-active{overflow-y:hidden}.mat-mdc-tab-body-content{height:100%;overflow:auto}.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body-content{overflow:hidden}.mat-mdc-tab-body-content[style*="visibility: hidden"]{display:none}'],encapsulation:2,data:{animation:[JHA.translateTab]}})}return t})(),zHA=!0,Py=(()=>{class t{_elementRef=m(te);_changeDetectorRef=m(lt);_animationMode=m(mi,{optional:!0});_allTabs;_tabBodyWrapper;_tabHeader;_tabs=new Ec;_indexToSelect=0;_lastFocusedTabIndex=null;_tabBodyWrapperHeight=0;_tabsSubscription=_t.EMPTY;_tabLabelSubscription=_t.EMPTY;color;get fitInkBarToContent(){return this._fitInkBarToContent}set fitInkBarToContent(A){this._fitInkBarToContent=A,this._changeDetectorRef.markForCheck()}_fitInkBarToContent=!1;stretchTabs=!0;alignTabs=null;dynamicHeight=!1;get selectedIndex(){return this._selectedIndex}set selectedIndex(A){this._indexToSelect=isNaN(A)?null:A}_selectedIndex=null;headerPosition="above";get animationDuration(){return this._animationDuration}set animationDuration(A){let i=A+"";this._animationDuration=/^\d+$/.test(i)?A+"ms":i}_animationDuration;get contentTabIndex(){return this._contentTabIndex}set contentTabIndex(A){this._contentTabIndex=isNaN(A)?null:A}_contentTabIndex;disablePagination=!1;disableRipple=!1;preserveContent=!1;get backgroundColor(){return this._backgroundColor}set backgroundColor(A){if(!zHA)throw new Error("mat-tab-group background color must be set through the Sass theming API");let i=this._elementRef.nativeElement.classList;i.remove("mat-tabs-with-background",`mat-background-${this.backgroundColor}`),A&&i.add("mat-tabs-with-background",`mat-background-${A}`),this._backgroundColor=A}_backgroundColor;ariaLabel;ariaLabelledby;selectedIndexChange=new XA;focusChange=new XA;animationDone=new XA;selectedTabChange=new XA(!0);_groupId;_isServer=!m(Zt).isBrowser;constructor(){let A=m(YHA,{optional:!0});this._groupId=m($i).getId("mat-tab-group-"),this.animationDuration=A&&A.animationDuration?A.animationDuration:"500ms",this.disablePagination=A&&A.disablePagination!=null?A.disablePagination:!1,this.dynamicHeight=A&&A.dynamicHeight!=null?A.dynamicHeight:!1,A?.contentTabIndex!=null&&(this.contentTabIndex=A.contentTabIndex),this.preserveContent=!!A?.preserveContent,this.fitInkBarToContent=A&&A.fitInkBarToContent!=null?A.fitInkBarToContent:!1,this.stretchTabs=A&&A.stretchTabs!=null?A.stretchTabs:!0,this.alignTabs=A&&A.alignTabs!=null?A.alignTabs:null}ngAfterContentChecked(){let A=this._indexToSelect=this._clampTabIndex(this._indexToSelect);if(this._selectedIndex!=A){let i=this._selectedIndex==null;if(!i){this.selectedTabChange.emit(this._createChangeEvent(A));let n=this._tabBodyWrapper.nativeElement;n.style.minHeight=n.clientHeight+"px"}Promise.resolve().then(()=>{this._tabs.forEach((n,o)=>n.isActive=o===A),i||(this.selectedIndexChange.emit(A),this._tabBodyWrapper.nativeElement.style.minHeight="")})}this._tabs.forEach((i,n)=>{i.position=n-A,this._selectedIndex!=null&&i.position==0&&!i.origin&&(i.origin=A-this._selectedIndex)}),this._selectedIndex!==A&&(this._selectedIndex=A,this._lastFocusedTabIndex=null,this._changeDetectorRef.markForCheck())}ngAfterContentInit(){this._subscribeToAllTabChanges(),this._subscribeToTabLabels(),this._tabsSubscription=this._tabs.changes.subscribe(()=>{let A=this._clampTabIndex(this._indexToSelect);if(A===this._selectedIndex){let i=this._tabs.toArray(),n;for(let o=0;o{i[A].isActive=!0,this.selectedTabChange.emit(this._createChangeEvent(A))})}this._changeDetectorRef.markForCheck()})}_subscribeToAllTabChanges(){this._allTabs.changes.pipe(Qo(this._allTabs)).subscribe(A=>{this._tabs.reset(A.filter(i=>i._closestTabGroup===this||!i._closestTabGroup)),this._tabs.notifyOnChanges()})}ngOnDestroy(){this._tabs.destroy(),this._tabsSubscription.unsubscribe(),this._tabLabelSubscription.unsubscribe()}realignInkBar(){this._tabHeader&&this._tabHeader._alignInkBarToSelectedTab()}updatePagination(){this._tabHeader&&this._tabHeader.updatePagination()}focusTab(A){let i=this._tabHeader;i&&(i.focusIndex=A)}_focusChanged(A){this._lastFocusedTabIndex=A,this.focusChange.emit(this._createChangeEvent(A))}_createChangeEvent(A){let i=new NG;return i.index=A,this._tabs&&this._tabs.length&&(i.tab=this._tabs.toArray()[A]),i}_subscribeToTabLabels(){this._tabLabelSubscription&&this._tabLabelSubscription.unsubscribe(),this._tabLabelSubscription=ho(...this._tabs.map(A=>A._stateChanges)).subscribe(()=>this._changeDetectorRef.markForCheck())}_clampTabIndex(A){return Math.min(this._tabs.length-1,Math.max(A||0,0))}_getTabLabelId(A){return`${this._groupId}-label-${A}`}_getTabContentId(A){return`${this._groupId}-content-${A}`}_setTabBodyWrapperHeight(A){if(!this.dynamicHeight||!this._tabBodyWrapperHeight)return;let i=this._tabBodyWrapper.nativeElement;i.style.height=this._tabBodyWrapperHeight+"px",this._tabBodyWrapper.nativeElement.offsetHeight&&(i.style.height=A+"px")}_removeTabBodyWrapperHeight(){let A=this._tabBodyWrapper.nativeElement;this._tabBodyWrapperHeight=A.clientHeight,A.style.height="",this.animationDone.emit()}_handleClick(A,i,n){i.focusIndex=n,A.disabled||(this.selectedIndex=n)}_getTabIndex(A){let i=this._lastFocusedTabIndex??this.selectedIndex;return A===i?0:-1}_tabFocusChanged(A,i){A&&A!=="mouse"&&A!=="touch"&&(this._tabHeader.focusIndex=i)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-tab-group"]],contentQueries:function(i,n,o){if(i&1&&Ii(o,af,5),i&2){let r;$A(r=Ae())&&(n._allTabs=r)}},viewQuery:function(i,n){if(i&1&&(Ge(DHA,5),Ge(yHA,5)),i&2){let o;$A(o=Ae())&&(n._tabBodyWrapper=o.first),$A(o=Ae())&&(n._tabHeader=o.first)}},hostAttrs:[1,"mat-mdc-tab-group"],hostVars:11,hostBindings:function(i,n){i&2&&(_e("mat-align-tabs",n.alignTabs),vo("mat-"+(n.color||"primary")),so("--mat-tab-animation-duration",n.animationDuration),ue("mat-mdc-tab-group-dynamic-height",n.dynamicHeight)("mat-mdc-tab-group-inverted-header",n.headerPosition==="below")("mat-mdc-tab-group-stretch-tabs",n.stretchTabs))},inputs:{color:"color",fitInkBarToContent:[2,"fitInkBarToContent","fitInkBarToContent",ae],stretchTabs:[2,"mat-stretch-tabs","stretchTabs",ae],alignTabs:[0,"mat-align-tabs","alignTabs"],dynamicHeight:[2,"dynamicHeight","dynamicHeight",ae],selectedIndex:[2,"selectedIndex","selectedIndex",Mi],headerPosition:"headerPosition",animationDuration:"animationDuration",contentTabIndex:[2,"contentTabIndex","contentTabIndex",Mi],disablePagination:[2,"disablePagination","disablePagination",ae],disableRipple:[2,"disableRipple","disableRipple",ae],preserveContent:[2,"preserveContent","preserveContent",ae],backgroundColor:"backgroundColor",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"]},outputs:{selectedIndexChange:"selectedIndexChange",focusChange:"focusChange",animationDone:"animationDone",selectedTabChange:"selectedTabChange"},exportAs:["matTabGroup"],features:[ct([{provide:BcA,useExisting:t}])],ngContentSelectors:_G,decls:9,vars:8,consts:[["tabHeader",""],["tabBodyWrapper",""],["tabNode",""],[3,"indexFocused","selectFocusedIndex","selectedIndex","disableRipple","disablePagination","aria-label","aria-labelledby"],["role","tab","matTabLabelWrapper","","cdkMonitorElementFocus","",1,"mdc-tab","mat-mdc-tab","mat-focus-indicator",3,"id","mdc-tab--active","class","disabled","fitInkBarToContent"],[1,"mat-mdc-tab-body-wrapper"],["role","tabpanel",3,"id","mat-mdc-tab-body-active","class","content","position","origin","animationDuration","preserveContent"],["role","tab","matTabLabelWrapper","","cdkMonitorElementFocus","",1,"mdc-tab","mat-mdc-tab","mat-focus-indicator",3,"click","cdkFocusChange","id","disabled","fitInkBarToContent"],[1,"mdc-tab__ripple"],["mat-ripple","",1,"mat-mdc-tab-ripple",3,"matRippleTrigger","matRippleDisabled"],[1,"mdc-tab__content"],[1,"mdc-tab__text-label"],[3,"cdkPortalOutlet"],["role","tabpanel",3,"_onCentered","_onCentering","id","content","position","origin","animationDuration","preserveContent"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"mat-tab-header",3,0),mA("indexFocused",function(s){return LA(o),xA(n._focusChanged(s))})("selectFocusedIndex",function(s){return LA(o),xA(n.selectedIndex=s)}),ln(2,kHA,8,17,"div",4,Kn),R(),NA(4,SHA,1,0),S(5,"div",5,1),ln(7,RHA,1,13,"mat-tab-body",6,Kn),R()}i&2&&(vA("selectedIndex",n.selectedIndex||0)("disableRipple",n.disableRipple)("disablePagination",n.disablePagination)("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby),_(2),gn(n._tabs),_(2),FA(n._isServer?4:-1),_(),ue("_mat-animation-noopable",n._animationMode==="NoopAnimations"),_(2),gn(n._tabs))},dependencies:[KHA,EcA,SO,Gs,ca,hcA],styles:['.mdc-tab{min-width:90px;padding:0 24px;display:flex;flex:1 0 auto;justify-content:center;box-sizing:border-box;border:none;outline:none;text-align:center;white-space:nowrap;cursor:pointer;z-index:1}.mdc-tab__content{display:flex;align-items:center;justify-content:center;height:inherit;pointer-events:none}.mdc-tab__text-label{transition:150ms color linear;display:inline-block;line-height:1;z-index:2}.mdc-tab--active .mdc-tab__text-label{transition-delay:100ms}._mat-animation-noopable .mdc-tab__text-label{transition:none}.mdc-tab-indicator{display:flex;position:absolute;top:0;left:0;justify-content:center;width:100%;height:100%;pointer-events:none;z-index:1}.mdc-tab-indicator__content{transition:var(--mat-tab-animation-duration, 250ms) transform cubic-bezier(0.4, 0, 0.2, 1);transform-origin:left;opacity:0}.mdc-tab-indicator__content--underline{align-self:flex-end;box-sizing:border-box;width:100%;border-top-style:solid}.mdc-tab-indicator--active .mdc-tab-indicator__content{opacity:1}._mat-animation-noopable .mdc-tab-indicator__content,.mdc-tab-indicator--no-transition .mdc-tab-indicator__content{transition:none}.mat-mdc-tab-ripple.mat-mdc-tab-ripple{position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none}.mat-mdc-tab{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;background:none;height:var(--mdc-secondary-navigation-tab-container-height, 48px);font-family:var(--mat-tab-header-label-text-font, var(--mat-sys-title-small-font));font-size:var(--mat-tab-header-label-text-size, var(--mat-sys-title-small-size));letter-spacing:var(--mat-tab-header-label-text-tracking, var(--mat-sys-title-small-tracking));line-height:var(--mat-tab-header-label-text-line-height, var(--mat-sys-title-small-line-height));font-weight:var(--mat-tab-header-label-text-weight, var(--mat-sys-title-small-weight))}.mat-mdc-tab.mdc-tab{flex-grow:0}.mat-mdc-tab .mdc-tab-indicator__content--underline{border-color:var(--mdc-tab-indicator-active-indicator-color, var(--mat-sys-primary));border-top-width:var(--mdc-tab-indicator-active-indicator-height, 2px);border-radius:var(--mdc-tab-indicator-active-indicator-shape, 0)}.mat-mdc-tab:hover .mdc-tab__text-label{color:var(--mat-tab-header-inactive-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab:focus .mdc-tab__text-label{color:var(--mat-tab-header-inactive-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active .mdc-tab__text-label{color:var(--mat-tab-header-active-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active .mdc-tab__ripple::before,.mat-mdc-tab.mdc-tab--active .mat-ripple-element{background-color:var(--mat-tab-header-active-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:hover .mdc-tab__text-label{color:var(--mat-tab-header-active-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:hover .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-hover-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab.mdc-tab--active:focus .mdc-tab__text-label{color:var(--mat-tab-header-active-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:focus .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-focus-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab.mat-mdc-tab-disabled{opacity:.4;pointer-events:none}.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__content{pointer-events:none}.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__ripple::before,.mat-mdc-tab.mat-mdc-tab-disabled .mat-ripple-element{background-color:var(--mat-tab-header-disabled-ripple-color)}.mat-mdc-tab .mdc-tab__ripple::before{content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;opacity:0;pointer-events:none;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab .mdc-tab__text-label{color:var(--mat-tab-header-inactive-label-text-color, var(--mat-sys-on-surface));display:inline-flex;align-items:center}.mat-mdc-tab .mdc-tab__content{position:relative;pointer-events:auto}.mat-mdc-tab:hover .mdc-tab__ripple::before{opacity:.04}.mat-mdc-tab.cdk-program-focused .mdc-tab__ripple::before,.mat-mdc-tab.cdk-keyboard-focused .mdc-tab__ripple::before{opacity:.12}.mat-mdc-tab .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-group.mat-mdc-tab-group-stretch-tabs>.mat-mdc-tab-header .mat-mdc-tab{flex-grow:1}.mat-mdc-tab-group{display:flex;flex-direction:column;max-width:100%}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination{background-color:var(--mat-tab-header-with-background-background-color)}.mat-mdc-tab-group.mat-tabs-with-background.mat-primary>.mat-mdc-tab-header .mat-mdc-tab .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background.mat-primary>.mat-mdc-tab-header .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-focus-indicator::before,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-focus-indicator::before{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-ripple-element,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mdc-tab__ripple::before,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-ripple-element,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mdc-tab__ripple::before{background-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header{flex-direction:column-reverse}.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header .mdc-tab-indicator__content--underline{align-self:flex-start}.mat-mdc-tab-body-wrapper{position:relative;overflow:hidden;display:flex;transition:height 500ms cubic-bezier(0.35, 0, 0.25, 1)}.mat-mdc-tab-body-wrapper._mat-animation-noopable{transition:none !important;animation:none !important}'],encapsulation:2})}return t})(),NG=class{index;tab};var QcA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Ve]})}return t})();function HHA(t,e){t&1&&UA(0,"div",2)}var OHA=new BA("MAT_PROGRESS_BAR_DEFAULT_OPTIONS");var mcA=(()=>{class t{_elementRef=m(te);_ngZone=m(de);_changeDetectorRef=m(lt);_renderer=m(Gi);_cleanupTransitionEnd;_animationMode=m(mi,{optional:!0});constructor(){let A=m(OHA,{optional:!0});this._isNoopAnimation=this._animationMode==="NoopAnimations",A&&(A.color&&(this.color=this._defaultColor=A.color),this.mode=A.mode||this.mode)}_isNoopAnimation=!1;get color(){return this._color||this._defaultColor}set color(A){this._color=A}_color;_defaultColor="primary";get value(){return this._value}set value(A){this._value=fcA(A||0),this._changeDetectorRef.markForCheck()}_value=0;get bufferValue(){return this._bufferValue||0}set bufferValue(A){this._bufferValue=fcA(A||0),this._changeDetectorRef.markForCheck()}_bufferValue=0;animationEnd=new XA;get mode(){return this._mode}set mode(A){this._mode=A,this._changeDetectorRef.markForCheck()}_mode="determinate";ngAfterViewInit(){this._ngZone.runOutsideAngular(()=>{this._cleanupTransitionEnd=this._renderer.listen(this._elementRef.nativeElement,"transitionend",this._transitionendHandler)})}ngOnDestroy(){this._cleanupTransitionEnd?.()}_getPrimaryBarTransform(){return`scaleX(${this._isIndeterminate()?1:this.value/100})`}_getBufferBarFlexBasis(){return`${this.mode==="buffer"?this.bufferValue:100}%`}_isIndeterminate(){return this.mode==="indeterminate"||this.mode==="query"}_transitionendHandler=A=>{this.animationEnd.observers.length===0||!A.target||!A.target.classList.contains("mdc-linear-progress__primary-bar")||(this.mode==="determinate"||this.mode==="buffer")&&this._ngZone.run(()=>this.animationEnd.next({value:this.value}))};static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-progress-bar"]],hostAttrs:["role","progressbar","aria-valuemin","0","aria-valuemax","100","tabindex","-1",1,"mat-mdc-progress-bar","mdc-linear-progress"],hostVars:10,hostBindings:function(i,n){i&2&&(_e("aria-valuenow",n._isIndeterminate()?null:n.value)("mode",n.mode),vo("mat-"+n.color),ue("_mat-animation-noopable",n._isNoopAnimation)("mdc-linear-progress--animation-ready",!n._isNoopAnimation)("mdc-linear-progress--indeterminate",n._isIndeterminate()))},inputs:{color:"color",value:[2,"value","value",Mi],bufferValue:[2,"bufferValue","bufferValue",Mi],mode:"mode"},outputs:{animationEnd:"animationEnd"},exportAs:["matProgressBar"],decls:7,vars:5,consts:[["aria-hidden","true",1,"mdc-linear-progress__buffer"],[1,"mdc-linear-progress__buffer-bar"],[1,"mdc-linear-progress__buffer-dots"],["aria-hidden","true",1,"mdc-linear-progress__bar","mdc-linear-progress__primary-bar"],[1,"mdc-linear-progress__bar-inner"],["aria-hidden","true",1,"mdc-linear-progress__bar","mdc-linear-progress__secondary-bar"]],template:function(i,n){i&1&&(S(0,"div",0),UA(1,"div",1),NA(2,HHA,1,0,"div",2),R(),S(3,"div",3),UA(4,"span",4),R(),S(5,"div",5),UA(6,"span",4),R()),i&2&&(_(),so("flex-basis",n._getBufferBarFlexBasis()),_(),FA(n.mode==="buffer"?2:-1),_(),so("transform",n._getPrimaryBarTransform()))},styles:[`.mat-mdc-progress-bar{display:block;text-align:start}.mat-mdc-progress-bar[mode=query]{transform:scaleX(-1)}.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__buffer-dots,.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__primary-bar,.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__secondary-bar,.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__bar-inner.mdc-linear-progress__bar-inner{animation:none}.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__primary-bar,.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__buffer-bar{transition:transform 1ms}.mdc-linear-progress{position:relative;width:100%;transform:translateZ(0);outline:1px solid rgba(0,0,0,0);overflow-x:hidden;transition:opacity 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);height:max(var(--mdc-linear-progress-track-height, 4px),var(--mdc-linear-progress-active-indicator-height, 4px))}@media(forced-colors: active){.mdc-linear-progress{outline-color:CanvasText}}.mdc-linear-progress__bar{position:absolute;top:0;bottom:0;margin:auto 0;width:100%;animation:none;transform-origin:top left;transition:transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);height:var(--mdc-linear-progress-active-indicator-height, 4px)}.mdc-linear-progress--indeterminate .mdc-linear-progress__bar{transition:none}[dir=rtl] .mdc-linear-progress__bar{right:0;transform-origin:center right}.mdc-linear-progress__bar-inner{display:inline-block;position:absolute;width:100%;animation:none;border-top-style:solid;border-color:var(--mdc-linear-progress-active-indicator-color, var(--mat-sys-primary));border-top-width:var(--mdc-linear-progress-active-indicator-height, 4px)}.mdc-linear-progress__buffer{display:flex;position:absolute;top:0;bottom:0;margin:auto 0;width:100%;overflow:hidden;height:var(--mdc-linear-progress-track-height, 4px);border-radius:var(--mdc-linear-progress-track-shape, var(--mat-sys-corner-none))}.mdc-linear-progress__buffer-dots{-webkit-mask-image:url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='xMinYMin slice'%3E%3Ccircle cx='1' cy='1' r='1'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='xMinYMin slice'%3E%3Ccircle cx='1' cy='1' r='1'/%3E%3C/svg%3E");background-repeat:repeat-x;flex:auto;transform:rotate(180deg);animation:mdc-linear-progress-buffering 250ms infinite linear;background-color:var(--mdc-linear-progress-track-color, var(--mat-sys-surface-variant))}@media(forced-colors: active){.mdc-linear-progress__buffer-dots{background-color:ButtonBorder}}[dir=rtl] .mdc-linear-progress__buffer-dots{animation:mdc-linear-progress-buffering-reverse 250ms infinite linear;transform:rotate(0)}.mdc-linear-progress__buffer-bar{flex:0 1 100%;transition:flex-basis 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);background-color:var(--mdc-linear-progress-track-color, var(--mat-sys-surface-variant))}.mdc-linear-progress__primary-bar{transform:scaleX(0)}.mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar{left:-145.166611%}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar{animation:mdc-linear-progress-primary-indeterminate-translate 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar>.mdc-linear-progress__bar-inner{animation:mdc-linear-progress-primary-indeterminate-scale 2s infinite linear}[dir=rtl] .mdc-linear-progress.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar{animation-name:mdc-linear-progress-primary-indeterminate-translate-reverse}[dir=rtl] .mdc-linear-progress.mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar{right:-145.166611%;left:auto}.mdc-linear-progress__secondary-bar{display:none}.mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar{left:-54.888891%;display:block}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar{animation:mdc-linear-progress-secondary-indeterminate-translate 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar>.mdc-linear-progress__bar-inner{animation:mdc-linear-progress-secondary-indeterminate-scale 2s infinite linear}[dir=rtl] .mdc-linear-progress.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar{animation-name:mdc-linear-progress-secondary-indeterminate-translate-reverse}[dir=rtl] .mdc-linear-progress.mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar{right:-54.888891%;left:auto}@keyframes mdc-linear-progress-buffering{from{transform:rotate(180deg) translateX(calc(var(--mdc-linear-progress-track-height, 4px) * -2.5))}}@keyframes mdc-linear-progress-primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes mdc-linear-progress-primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes mdc-linear-progress-secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes mdc-linear-progress-secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes mdc-linear-progress-primary-indeterminate-translate-reverse{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(-83.67142%)}100%{transform:translateX(-200.611057%)}}@keyframes mdc-linear-progress-secondary-indeterminate-translate-reverse{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(-37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(-84.386165%)}100%{transform:translateX(-160.277782%)}}@keyframes mdc-linear-progress-buffering-reverse{from{transform:translateX(-10px)}}`],encapsulation:2,changeDetection:0})}return t})();function fcA(t,e=0,A=100){return Math.max(e,Math.min(A,t))}var pcA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve]})}return t})();function YG(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ZC=YG();function McA(t){ZC=t}var gf={exec:()=>null};function xn(t,e=""){let A=typeof t=="string"?t:t.source,i={replace:(n,o)=>{let r=typeof o=="string"?o:o.source;return r=r.replace(Ps.caret,"$1"),A=A.replace(n,r),i},getRegex:()=>new RegExp(A,e)};return i}var Ps={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},jHA=/^(?:[ \t]*(?:\n|$))+/,qHA=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,VHA=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Cf=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ZHA=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,JG=/(?:[*+-]|\d{1,9}[.)])/,kcA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ScA=xn(kcA).replace(/bull/g,JG).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),WHA=xn(kcA).replace(/bull/g,JG).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),TG=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,XHA=/^[^\n]+/,zG=/(?!\s*\])(?:\\.|[^\[\]\\])+/,$HA=xn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",zG).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),AOA=xn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,JG).getRegex(),Vy="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",HG=/|$))/,eOA=xn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",HG).replace("tag",Vy).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),RcA=xn(TG).replace("hr",Cf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Vy).getRegex(),tOA=xn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",RcA).getRegex(),OG={blockquote:tOA,code:qHA,def:$HA,fences:VHA,heading:ZHA,hr:Cf,html:eOA,lheading:ScA,list:AOA,newline:jHA,paragraph:RcA,table:gf,text:XHA},wcA=xn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Cf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Vy).getRegex(),iOA=Ne(nA({},OG),{lheading:WHA,table:wcA,paragraph:xn(TG).replace("hr",Cf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",wcA).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Vy).getRegex()}),nOA=Ne(nA({},OG),{html:xn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",HG).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:gf,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:xn(TG).replace("hr",Cf).replace("heading",` *#{1,6} *[^ +`),R(),S(4,"mat-form-field",1)(5,"input",2),ta("ngModelChange",function(o){return Ja(i.newSetId,o)||(i.newSetId=o),o}),mA("keydown.enter",function(){return i.createNewEvalSet()}),R()(),S(6,"mat-dialog-actions",3)(7,"button",4),tA(8,"Cancel"),R(),S(9,"button",5),mA("click",function(){return i.createNewEvalSet()}),tA(10,"Create"),R()()),A&2&&(_(5),ea("ngModel",i.newSetId))},dependencies:[fc,na,ja,lg,P1,ur,hs,ga,Ia,gg],encapsulation:2})};var dTA=["knob"],BTA=["valueIndicatorContainer"];function ETA(t,e){if(t&1&&(S(0,"div",2,1)(2,"div",5)(3,"span",6),tA(4),R()()()),t&2){let A=P();_(4),Mt(A.valueIndicatorText)}}var hTA=["trackActive"],QTA=["*"];function uTA(t,e){if(t&1&&UA(0,"div"),t&2){let A=e.$implicit,i=e.$index,n=P(3);vo(A===0?"mdc-slider__tick-mark--active":"mdc-slider__tick-mark--inactive"),so("transform",n._calcTickMarkTransform(i))}}function fTA(t,e){if(t&1&&ln(0,uTA,1,4,"div",8,Kd),t&2){let A=P(2);gn(A._tickMarks)}}function mTA(t,e){if(t&1&&(S(0,"div",6,1),NA(2,fTA,2,0),R()),t&2){let A=P();_(2),FA(A._cachedWidth?2:-1)}}function pTA(t,e){if(t&1&&UA(0,"mat-slider-visual-thumb",7),t&2){let A=P();vA("discrete",A.discrete)("thumbPosition",1)("valueIndicatorText",A.startValueIndicatorText)}}var $t=function(t){return t[t.START=1]="START",t[t.END=2]="END",t}($t||{}),Ch=function(t){return t[t.ACTIVE=0]="ACTIVE",t[t.INACTIVE=1]="INACTIVE",t}(Ch||{}),pG=new BA("_MatSlider"),zaA=new BA("_MatSliderThumb"),wTA=new BA("_MatSliderRangeThumb"),HaA=new BA("_MatSliderVisualThumb");var DTA=(()=>{class t{_cdr=m(lt);_ngZone=m(de);_slider=m(pG);_renderer=m(Gi);_listenerCleanups;discrete;thumbPosition;valueIndicatorText;_ripple;_knob;_valueIndicatorContainer;_sliderInput;_sliderInputEl;_hoverRippleRef;_focusRippleRef;_activeRippleRef;_isHovered=!1;_isActive=!1;_isValueIndicatorVisible=!1;_hostElement=m(te).nativeElement;_platform=m(Zt);constructor(){}ngAfterViewInit(){let A=this._slider._getInput(this.thumbPosition);A&&(this._ripple.radius=24,this._sliderInput=A,this._sliderInputEl=this._sliderInput._hostElement,this._ngZone.runOutsideAngular(()=>{let i=this._sliderInputEl,n=this._renderer;this._listenerCleanups=[n.listen(i,"pointermove",this._onPointerMove),n.listen(i,"pointerdown",this._onDragStart),n.listen(i,"pointerup",this._onDragEnd),n.listen(i,"pointerleave",this._onMouseLeave),n.listen(i,"focus",this._onFocus),n.listen(i,"blur",this._onBlur)]}))}ngOnDestroy(){this._listenerCleanups?.forEach(A=>A())}_onPointerMove=A=>{if(this._sliderInput._isFocused)return;let i=this._hostElement.getBoundingClientRect(),n=this._slider._isCursorOnSliderThumb(A,i);this._isHovered=n,n?this._showHoverRipple():this._hideRipple(this._hoverRippleRef)};_onMouseLeave=()=>{this._isHovered=!1,this._hideRipple(this._hoverRippleRef)};_onFocus=()=>{this._hideRipple(this._hoverRippleRef),this._showFocusRipple(),this._hostElement.classList.add("mdc-slider__thumb--focused")};_onBlur=()=>{this._isActive||this._hideRipple(this._focusRippleRef),this._isHovered&&this._showHoverRipple(),this._hostElement.classList.remove("mdc-slider__thumb--focused")};_onDragStart=A=>{A.button===0&&(this._isActive=!0,this._showActiveRipple())};_onDragEnd=()=>{this._isActive=!1,this._hideRipple(this._activeRippleRef),this._sliderInput._isFocused||this._hideRipple(this._focusRippleRef),this._platform.SAFARI&&this._showHoverRipple()};_showHoverRipple(){this._isShowingRipple(this._hoverRippleRef)||(this._hoverRippleRef=this._showRipple({enterDuration:0,exitDuration:0}),this._hoverRippleRef?.element.classList.add("mat-mdc-slider-hover-ripple"))}_showFocusRipple(){this._isShowingRipple(this._focusRippleRef)||(this._focusRippleRef=this._showRipple({enterDuration:0,exitDuration:0},!0),this._focusRippleRef?.element.classList.add("mat-mdc-slider-focus-ripple"))}_showActiveRipple(){this._isShowingRipple(this._activeRippleRef)||(this._activeRippleRef=this._showRipple({enterDuration:225,exitDuration:400}),this._activeRippleRef?.element.classList.add("mat-mdc-slider-active-ripple"))}_isShowingRipple(A){return A?.state===_s.FADING_IN||A?.state===_s.VISIBLE}_showRipple(A,i){if(!this._slider.disabled&&(this._showValueIndicator(),this._slider._isRange&&this._slider._getThumb(this.thumbPosition===$t.START?$t.END:$t.START)._showValueIndicator(),!(this._slider._globalRippleOptions?.disabled&&!i)))return this._ripple.launch({animation:this._slider._noopAnimations?{enterDuration:0,exitDuration:0}:A,centered:!0,persistent:!0})}_hideRipple(A){if(A?.fadeOut(),this._isShowingAnyRipple())return;this._slider._isRange||this._hideValueIndicator();let i=this._getSibling();i._isShowingAnyRipple()||(this._hideValueIndicator(),i._hideValueIndicator())}_showValueIndicator(){this._hostElement.classList.add("mdc-slider__thumb--with-indicator")}_hideValueIndicator(){this._hostElement.classList.remove("mdc-slider__thumb--with-indicator")}_getSibling(){return this._slider._getThumb(this.thumbPosition===$t.START?$t.END:$t.START)}_getValueIndicatorContainer(){return this._valueIndicatorContainer?.nativeElement}_getKnob(){return this._knob.nativeElement}_isShowingAnyRipple(){return this._isShowingRipple(this._hoverRippleRef)||this._isShowingRipple(this._focusRippleRef)||this._isShowingRipple(this._activeRippleRef)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-slider-visual-thumb"]],viewQuery:function(i,n){if(i&1&&(Ge(Gs,5),Ge(dTA,5),Ge(BTA,5)),i&2){let o;$A(o=Ae())&&(n._ripple=o.first),$A(o=Ae())&&(n._knob=o.first),$A(o=Ae())&&(n._valueIndicatorContainer=o.first)}},hostAttrs:[1,"mdc-slider__thumb","mat-mdc-slider-visual-thumb"],inputs:{discrete:"discrete",thumbPosition:"thumbPosition",valueIndicatorText:"valueIndicatorText"},features:[ct([{provide:HaA,useExisting:t}])],decls:4,vars:2,consts:[["knob",""],["valueIndicatorContainer",""],[1,"mdc-slider__value-indicator-container"],[1,"mdc-slider__thumb-knob"],["matRipple","",1,"mat-focus-indicator",3,"matRippleDisabled"],[1,"mdc-slider__value-indicator"],[1,"mdc-slider__value-indicator-text"]],template:function(i,n){i&1&&(NA(0,ETA,5,1,"div",2),UA(1,"div",3,0)(3,"div",4)),i&2&&(FA(n.discrete?0:-1),_(3),vA("matRippleDisabled",!0))},dependencies:[Gs],styles:[".mat-mdc-slider-visual-thumb .mat-ripple{height:100%;width:100%}.mat-mdc-slider .mdc-slider__tick-marks{justify-content:start}.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--active,.mat-mdc-slider .mdc-slider__tick-marks .mdc-slider__tick-mark--inactive{position:absolute;left:2px}"],encapsulation:2,changeDetection:0})}return t})(),OaA=(()=>{class t{_ngZone=m(de);_cdr=m(lt);_elementRef=m(te);_dir=m(bo,{optional:!0});_globalRippleOptions=m(L2,{optional:!0});_trackActive;_thumbs;_input;_inputs;get disabled(){return this._disabled}set disabled(A){this._disabled=A;let i=this._getInput($t.END),n=this._getInput($t.START);i&&(i.disabled=this._disabled),n&&(n.disabled=this._disabled)}_disabled=!1;get discrete(){return this._discrete}set discrete(A){this._discrete=A,this._updateValueIndicatorUIs()}_discrete=!1;showTickMarks=!1;get min(){return this._min}set min(A){let i=isNaN(A)?this._min:A;this._min!==i&&this._updateMin(i)}_min=0;color;disableRipple=!1;_updateMin(A){let i=this._min;this._min=A,this._isRange?this._updateMinRange({old:i,new:A}):this._updateMinNonRange(A),this._onMinMaxOrStepChange()}_updateMinRange(A){let i=this._getInput($t.END),n=this._getInput($t.START),o=i.value,r=n.value;n.min=A.new,i.min=Math.max(A.new,n.value),n.max=Math.min(i.max,i.value),n._updateWidthInactive(),i._updateWidthInactive(),A.newA.old?this._onTranslateXChangeBySideEffect(n,i):this._onTranslateXChangeBySideEffect(i,n),o!==i.value&&this._onValueChange(i),r!==n.value&&this._onValueChange(n)}_updateMaxNonRange(A){let i=this._getInput($t.END);if(i){let n=i.value;i.max=A,i._updateThumbUIByValue(),this._updateTrackUI(i),n!==i.value&&this._onValueChange(i)}}get step(){return this._step}set step(A){let i=isNaN(A)?this._step:A;this._step!==i&&this._updateStep(i)}_step=1;_updateStep(A){this._step=A,this._isRange?this._updateStepRange():this._updateStepNonRange(),this._onMinMaxOrStepChange()}_updateStepRange(){let A=this._getInput($t.END),i=this._getInput($t.START),n=A.value,o=i.value,r=i.value;A.min=this._min,i.max=this._max,A.step=this._step,i.step=this._step,this._platform.SAFARI&&(A.value=A.value,i.value=i.value),A.min=Math.max(this._min,i.value),i.max=Math.min(this._max,A.value),i._updateWidthInactive(),A._updateWidthInactive(),A.value`${A}`;_tickMarks;_noopAnimations;_dirChangeSubscription;_resizeObserver;_cachedWidth;_cachedLeft;_rippleRadius=24;startValueIndicatorText="";endValueIndicatorText="";_endThumbTransform;_startThumbTransform;_isRange=!1;_isRtl=!1;_hasViewInitialized=!1;_tickMarkTrackWidth=0;_hasAnimation=!1;_resizeTimer=null;_platform=m(Zt);constructor(){m(Ln).load(Qr);let A=m(mi,{optional:!0});this._noopAnimations=A==="NoopAnimations",this._dir&&(this._dirChangeSubscription=this._dir.change.subscribe(()=>this._onDirChange()),this._isRtl=this._dir.value==="rtl")}_knobRadius=8;_inputPadding;ngAfterViewInit(){this._platform.isBrowser&&this._updateDimensions();let A=this._getInput($t.END),i=this._getInput($t.START);this._isRange=!!A&&!!i,this._cdr.detectChanges();let n=this._getThumb($t.END);this._rippleRadius=n._ripple.radius,this._inputPadding=this._rippleRadius-this._knobRadius,this._isRange?this._initUIRange(A,i):this._initUINonRange(A),this._updateTrackUI(A),this._updateTickMarkUI(),this._updateTickMarkTrackUI(),this._observeHostResize(),this._cdr.detectChanges()}_initUINonRange(A){A.initProps(),A.initUI(),this._updateValueIndicatorUI(A),this._hasViewInitialized=!0,A._updateThumbUIByValue()}_initUIRange(A,i){A.initProps(),A.initUI(),i.initProps(),i.initUI(),A._updateMinMax(),i._updateMinMax(),A._updateStaticStyles(),i._updateStaticStyles(),this._updateValueIndicatorUIs(),this._hasViewInitialized=!0,A._updateThumbUIByValue(),i._updateThumbUIByValue()}ngOnDestroy(){this._dirChangeSubscription.unsubscribe(),this._resizeObserver?.disconnect(),this._resizeObserver=null}_onDirChange(){this._isRtl=this._dir?.value==="rtl",this._isRange?this._onDirChangeRange():this._onDirChangeNonRange(),this._updateTickMarkUI()}_onDirChangeRange(){let A=this._getInput($t.END),i=this._getInput($t.START);A._setIsLeftThumb(),i._setIsLeftThumb(),A.translateX=A._calcTranslateXByValue(),i.translateX=i._calcTranslateXByValue(),A._updateStaticStyles(),i._updateStaticStyles(),A._updateWidthInactive(),i._updateWidthInactive(),A._updateThumbUIByValue(),i._updateThumbUIByValue()}_onDirChangeNonRange(){this._getInput($t.END)._updateThumbUIByValue()}_observeHostResize(){typeof ResizeObserver>"u"||!ResizeObserver||this._ngZone.runOutsideAngular(()=>{this._resizeObserver=new ResizeObserver(()=>{this._isActive()||(this._resizeTimer&&clearTimeout(this._resizeTimer),this._onResize())}),this._resizeObserver.observe(this._elementRef.nativeElement)})}_isActive(){return this._getThumb($t.START)._isActive||this._getThumb($t.END)._isActive}_getValue(A=$t.END){let i=this._getInput(A);return i?i.value:this.min}_skipUpdate(){return!!(this._getInput($t.START)?._skipUIUpdate||this._getInput($t.END)?._skipUIUpdate)}_updateDimensions(){this._cachedWidth=this._elementRef.nativeElement.offsetWidth,this._cachedLeft=this._elementRef.nativeElement.getBoundingClientRect().left}_setTrackActiveStyles(A){let i=this._trackActive.nativeElement.style;i.left=A.left,i.right=A.right,i.transformOrigin=A.transformOrigin,i.transform=A.transform}_calcTickMarkTransform(A){let i=A*(this._tickMarkTrackWidth/(this._tickMarks.length-1));return`translateX(${this._isRtl?this._cachedWidth-6-i:i}px`}_onTranslateXChange(A){this._hasViewInitialized&&(this._updateThumbUI(A),this._updateTrackUI(A),this._updateOverlappingThumbUI(A))}_onTranslateXChangeBySideEffect(A,i){this._hasViewInitialized&&(A._updateThumbUIByValue(),i._updateThumbUIByValue())}_onValueChange(A){this._hasViewInitialized&&(this._updateValueIndicatorUI(A),this._updateTickMarkUI(),this._cdr.detectChanges())}_onMinMaxOrStepChange(){this._hasViewInitialized&&(this._updateTickMarkUI(),this._updateTickMarkTrackUI(),this._cdr.markForCheck())}_onResize(){if(this._hasViewInitialized){if(this._updateDimensions(),this._isRange){let A=this._getInput($t.END),i=this._getInput($t.START);A._updateThumbUIByValue(),i._updateThumbUIByValue(),A._updateStaticStyles(),i._updateStaticStyles(),A._updateMinMax(),i._updateMinMax(),A._updateWidthInactive(),i._updateWidthInactive()}else{let A=this._getInput($t.END);A&&A._updateThumbUIByValue()}this._updateTickMarkUI(),this._updateTickMarkTrackUI(),this._cdr.detectChanges()}}_thumbsOverlap=!1;_areThumbsOverlapping(){let A=this._getInput($t.START),i=this._getInput($t.END);return!A||!i?!1:i.translateX-A.translateX<20}_updateOverlappingThumbClassNames(A){let i=A.getSibling(),n=this._getThumb(A.thumbPosition);this._getThumb(i.thumbPosition)._hostElement.classList.remove("mdc-slider__thumb--top"),n._hostElement.classList.toggle("mdc-slider__thumb--top",this._thumbsOverlap)}_updateOverlappingThumbUI(A){!this._isRange||this._skipUpdate()||this._thumbsOverlap!==this._areThumbsOverlapping()&&(this._thumbsOverlap=!this._thumbsOverlap,this._updateOverlappingThumbClassNames(A))}_updateThumbUI(A){if(this._skipUpdate())return;let i=this._getThumb(A.thumbPosition===$t.END?$t.END:$t.START);i._hostElement.style.transform=`translateX(${A.translateX}px)`}_updateValueIndicatorUI(A){if(this._skipUpdate())return;let i=this.displayWith(A.value);if(this._hasViewInitialized?A._valuetext.set(i):A._hostElement.setAttribute("aria-valuetext",i),this.discrete){A.thumbPosition===$t.START?this.startValueIndicatorText=i:this.endValueIndicatorText=i;let n=this._getThumb(A.thumbPosition);i.length<3?n._hostElement.classList.add("mdc-slider__thumb--short-value"):n._hostElement.classList.remove("mdc-slider__thumb--short-value")}}_updateValueIndicatorUIs(){let A=this._getInput($t.END),i=this._getInput($t.START);A&&this._updateValueIndicatorUI(A),i&&this._updateValueIndicatorUI(i)}_updateTickMarkTrackUI(){if(!this.showTickMarks||this._skipUpdate())return;let A=this._step&&this._step>0?this._step:1,n=(Math.floor(this.max/A)*A-this.min)/(this.max-this.min);this._tickMarkTrackWidth=(this._cachedWidth-6)*n}_updateTrackUI(A){this._skipUpdate()||(this._isRange?this._updateTrackUIRange(A):this._updateTrackUINonRange(A))}_updateTrackUIRange(A){let i=A.getSibling();if(!i||!this._cachedWidth)return;let n=Math.abs(i.translateX-A.translateX)/this._cachedWidth;A._isLeftThumb&&this._cachedWidth?this._setTrackActiveStyles({left:"auto",right:`${this._cachedWidth-i.translateX}px`,transformOrigin:"right",transform:`scaleX(${n})`}):this._setTrackActiveStyles({left:`${i.translateX}px`,right:"auto",transformOrigin:"left",transform:`scaleX(${n})`})}_updateTrackUINonRange(A){this._isRtl?this._setTrackActiveStyles({left:"auto",right:"0px",transformOrigin:"right",transform:`scaleX(${1-A.fillPercentage})`}):this._setTrackActiveStyles({left:"0px",right:"auto",transformOrigin:"left",transform:`scaleX(${A.fillPercentage})`})}_updateTickMarkUI(){if(!this.showTickMarks||this.step===void 0||this.min===void 0||this.max===void 0)return;let A=this.step>0?this.step:1;this._isRange?this._updateTickMarkUIRange(A):this._updateTickMarkUINonRange(A)}_updateTickMarkUINonRange(A){let i=this._getValue(),n=Math.max(Math.round((i-this.min)/A),0)+1,o=Math.max(Math.round((this.max-i)/A),0)-1;this._isRtl?n++:o++,this._tickMarks=Array(n).fill(Ch.ACTIVE).concat(Array(o).fill(Ch.INACTIVE))}_updateTickMarkUIRange(A){let i=this._getValue(),n=this._getValue($t.START),o=Math.max(Math.round((n-this.min)/A),0),r=Math.max(Math.round((i-n)/A)+1,0),s=Math.max(Math.round((this.max-i)/A),0);this._tickMarks=Array(o).fill(Ch.INACTIVE).concat(Array(r).fill(Ch.ACTIVE),Array(s).fill(Ch.INACTIVE))}_getInput(A){if(A===$t.END&&this._input)return this._input;if(this._inputs?.length)return A===$t.START?this._inputs.first:this._inputs.last}_getThumb(A){return A===$t.END?this._thumbs?.last:this._thumbs?.first}_setTransition(A){this._hasAnimation=!this._platform.IOS&&A&&!this._noopAnimations,this._elementRef.nativeElement.classList.toggle("mat-mdc-slider-with-animation",this._hasAnimation)}_isCursorOnSliderThumb(A,i){let n=i.width/2,o=i.x+n,r=i.y+n,s=A.clientX-o,a=A.clientY-r;return Math.pow(s,2)+Math.pow(a,2)wG),multi:!0};var wG=(()=>{class t{_ngZone=m(de);_elementRef=m(te);_cdr=m(lt);_slider=m(pG);_platform=m(Zt);_listenerCleanups;get value(){return Mi(this._hostElement.value,0)}set value(A){A=isNaN(A)?0:A;let i=A+"";if(!this._hasSetInitialValue){this._initialValue=i;return}this._isActive||this._setValue(i)}_setValue(A){this._hostElement.value=A,this._updateThumbUIByValue(),this._slider._onValueChange(this),this._cdr.detectChanges(),this._slider._cdr.markForCheck()}valueChange=new XA;dragStart=new XA;dragEnd=new XA;get translateX(){return this._slider.min>=this._slider.max?(this._translateX=this._tickMarkOffset,this._translateX):(this._translateX===void 0&&(this._translateX=this._calcTranslateXByValue()),this._translateX)}set translateX(A){this._translateX=A}_translateX;thumbPosition=$t.END;get min(){return Mi(this._hostElement.min,0)}set min(A){this._hostElement.min=A+"",this._cdr.detectChanges()}get max(){return Mi(this._hostElement.max,0)}set max(A){this._hostElement.max=A+"",this._cdr.detectChanges()}get step(){return Mi(this._hostElement.step,0)}set step(A){this._hostElement.step=A+"",this._cdr.detectChanges()}get disabled(){return ae(this._hostElement.disabled)}set disabled(A){this._hostElement.disabled=A,this._cdr.detectChanges(),this._slider.disabled!==this.disabled&&(this._slider.disabled=this.disabled)}get percentage(){return this._slider.min>=this._slider.max?this._slider._isRtl?1:0:(this.value-this._slider.min)/(this._slider.max-this._slider.min)}get fillPercentage(){return this._slider._cachedWidth?this._translateX===0?0:this.translateX/this._slider._cachedWidth:this._slider._isRtl?1:0}_hostElement=this._elementRef.nativeElement;_valuetext=Ko("");_knobRadius=8;_tickMarkOffset=3;_isActive=!1;_isFocused=!1;_setIsFocused(A){this._isFocused=A}_hasSetInitialValue=!1;_initialValue;_formControl;_destroyed=new HA;_skipUIUpdate=!1;_onChangeFn;_onTouchedFn=()=>{};_isControlInitialized=!1;constructor(){let A=m(Gi);this._ngZone.runOutsideAngular(()=>{this._listenerCleanups=[A.listen(this._hostElement,"pointerdown",this._onPointerDown.bind(this)),A.listen(this._hostElement,"pointermove",this._onPointerMove.bind(this)),A.listen(this._hostElement,"pointerup",this._onPointerUp.bind(this))]})}ngOnDestroy(){this._listenerCleanups.forEach(A=>A()),this._destroyed.next(),this._destroyed.complete(),this.dragStart.complete(),this.dragEnd.complete()}initProps(){this._updateWidthInactive(),this.disabled!==this._slider.disabled&&(this._slider.disabled=!0),this.step=this._slider.step,this.min=this._slider.min,this.max=this._slider.max,this._initValue()}initUI(){this._updateThumbUIByValue()}_initValue(){this._hasSetInitialValue=!0,this._initialValue===void 0?this.value=this._getDefaultValue():(this._hostElement.value=this._initialValue,this._updateThumbUIByValue(),this._slider._onValueChange(this),this._cdr.detectChanges())}_getDefaultValue(){return this.min}_onBlur(){this._setIsFocused(!1),this._onTouchedFn()}_onFocus(){this._slider._setTransition(!1),this._slider._updateTrackUI(this),this._setIsFocused(!0)}_onChange(){this.valueChange.emit(this.value),this._isActive&&this._updateThumbUIByValue({withAnimation:!0})}_onInput(){this._onChangeFn?.(this.value),(this._slider.step||!this._isActive)&&this._updateThumbUIByValue({withAnimation:!0}),this._slider._onValueChange(this)}_onNgControlValueChange(){(!this._isActive||!this._isFocused)&&(this._slider._onValueChange(this),this._updateThumbUIByValue()),this._slider.disabled=this._formControl.disabled}_onPointerDown(A){if(!(this.disabled||A.button!==0)){if(this._platform.IOS){let i=this._slider._isCursorOnSliderThumb(A,this._slider._getThumb(this.thumbPosition)._hostElement.getBoundingClientRect());this._isActive=i,this._updateWidthActive(),this._slider._updateDimensions();return}this._isActive=!0,this._setIsFocused(!0),this._updateWidthActive(),this._slider._updateDimensions(),this._slider.step||this._updateThumbUIByPointerEvent(A,{withAnimation:!0}),this.disabled||(this._handleValueCorrection(A),this.dragStart.emit({source:this,parent:this._slider,value:this.value}))}}_handleValueCorrection(A){this._skipUIUpdate=!0,setTimeout(()=>{this._skipUIUpdate=!1,this._fixValue(A)},0)}_fixValue(A){let i=A.clientX-this._slider._cachedLeft,n=this._slider._cachedWidth,o=this._slider.step===0?1:this._slider.step,r=Math.floor((this._slider.max-this._slider.min)/o),s=this._slider._isRtl?1-i/n:i/n,c=Math.round(s*r)/r*(this._slider.max-this._slider.min)+this._slider.min,l=Math.round(c/o)*o,I=this.value;if(l===I){this._slider._onValueChange(this),this._slider.step>0?this._updateThumbUIByValue():this._updateThumbUIByPointerEvent(A,{withAnimation:this._slider._hasAnimation});return}this.value=l,this.valueChange.emit(this.value),this._onChangeFn?.(this.value),this._slider._onValueChange(this),this._slider.step>0?this._updateThumbUIByValue():this._updateThumbUIByPointerEvent(A,{withAnimation:this._slider._hasAnimation})}_onPointerMove(A){!this._slider.step&&this._isActive&&this._updateThumbUIByPointerEvent(A)}_onPointerUp(){this._isActive&&(this._isActive=!1,this._platform.SAFARI&&this._setIsFocused(!1),this.dragEnd.emit({source:this,parent:this._slider,value:this.value}),setTimeout(()=>this._updateWidthInactive(),this._platform.IOS?10:0))}_clamp(A){let i=this._tickMarkOffset,n=this._slider._cachedWidth-this._tickMarkOffset;return Math.max(Math.min(A,n),i)}_calcTranslateXByValue(){return this._slider._isRtl?(1-this.percentage)*(this._slider._cachedWidth-this._tickMarkOffset*2)+this._tickMarkOffset:this.percentage*(this._slider._cachedWidth-this._tickMarkOffset*2)+this._tickMarkOffset}_calcTranslateXByPointerEvent(A){return A.clientX-this._slider._cachedLeft}_updateWidthActive(){}_updateWidthInactive(){this._hostElement.style.padding=`0 ${this._slider._inputPadding}px`,this._hostElement.style.width=`calc(100% + ${this._slider._inputPadding-this._tickMarkOffset*2}px)`,this._hostElement.style.left=`-${this._slider._rippleRadius-this._tickMarkOffset}px`}_updateThumbUIByValue(A){this.translateX=this._clamp(this._calcTranslateXByValue()),this._updateThumbUI(A)}_updateThumbUIByPointerEvent(A,i){this.translateX=this._clamp(this._calcTranslateXByPointerEvent(A)),this._updateThumbUI(i)}_updateThumbUI(A){this._slider._setTransition(!!A?.withAnimation),this._slider._onTranslateXChange(this)}writeValue(A){(this._isControlInitialized||A!==null)&&(this.value=A)}registerOnChange(A){this._onChangeFn=A,this._isControlInitialized=!0}registerOnTouched(A){this._onTouchedFn=A}setDisabledState(A){this.disabled=A}focus(){this._hostElement.focus()}blur(){this._hostElement.blur()}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["input","matSliderThumb",""]],hostAttrs:["type","range",1,"mdc-slider__input"],hostVars:1,hostBindings:function(i,n){i&1&&mA("change",function(){return n._onChange()})("input",function(){return n._onInput()})("blur",function(){return n._onBlur()})("focus",function(){return n._onFocus()}),i&2&&_e("aria-valuetext",n._valuetext())},inputs:{value:[2,"value","value",Mi]},outputs:{valueChange:"valueChange",dragStart:"dragStart",dragEnd:"dragEnd"},exportAs:["matSliderThumb"],features:[ct([yTA,{provide:zaA,useExisting:t}])]})}return t})();var PaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Xa]})}return t})();var nf=class t{constructor(e,A,i){this.dialogRef=e;this.fb=A;this.data=i;this.evalMetrics=this.data.evalMetrics,this.evalForm=this.fb.group({tool_trajectory_avg_score_threshold:[this.getEvalMetricThresholdFromData("tool_trajectory_avg_score"),[Oa.required,Oa.min(0),Oa.max(1)]],response_match_score_threshold:[this.getEvalMetricThresholdFromData("response_match_score"),[Oa.required,Oa.min(0),Oa.max(1)]]})}evalForm;evalMetrics=[];getEvalMetricThresholdFromData(e){return this.evalMetrics.find(A=>A.metricName===e)?.threshold??0}onStart(){if(this.evalForm.valid){let{tool_trajectory_avg_score_threshold:e,response_match_score_threshold:A}=this.evalForm.value;for(let i of this.evalMetrics)i.metricName==="tool_trajectory_avg_score"?i.threshold=e:i.metricName==="response_match_score"&&(i.threshold=A);this.dialogRef.close(this.evalMetrics)}}onCancel(){this.dialogRef.close(null)}static \u0275fac=function(A){return new(A||t)(zA(cr),zA(BH),zA($r))};static \u0275cmp=YA({type:t,selectors:[["app-run-eval-config-dialog"]],standalone:!1,decls:26,vars:3,consts:[[1,"dialog-container"],["mat-dialog-title","",1,"dialog-title"],[1,"eval-form",3,"formGroup"],[1,"metric-row"],[1,"metric-name"],[1,"flex-1","pl-4"],["min","0","max","1","step","0.1","thumbLabel","",1,"threshold-slider"],["matSliderThumb","","formControlName","tool_trajectory_avg_score_threshold"],[1,"threshold-value"],["matSliderThumb","","formControlName","response_match_score_threshold"],["align","end",1,"dialog-actions"],["mat-button","",1,"cancel-button",3,"click"],["mat-button","",1,"save-button",3,"click"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"h2",1),tA(2,"EVALUATION METRIC"),R(),S(3,"mat-dialog-content")(4,"form",2)(5,"div",3)(6,"div",4),tA(7,"Tool trajectory avg score: "),R(),S(8,"div",5)(9,"mat-slider",6),UA(10,"input",7),R(),S(11,"span",8),tA(12),R()()(),S(13,"div",3)(14,"div",4),tA(15,"Response match score: "),R(),S(16,"div",5)(17,"mat-slider",6),UA(18,"input",9),R(),S(19,"span",8),tA(20),R()()()()(),S(21,"mat-dialog-actions",10)(22,"button",11),mA("click",function(){return i.onCancel()}),tA(23,"Cancel"),R(),S(24,"button",12),mA("click",function(){return i.onStart()}),tA(25,"Start"),R()()()),A&2&&(_(4),vA("formGroup",i.evalForm),_(8),ot(" ",i.evalForm.controls.tool_trajectory_avg_score_threshold.value," "),_(8),ot(" ",i.evalForm.controls.response_match_score_threshold.value," "))},dependencies:[CH,fc,na,rH,ur,hs,ga,Ia,OaA,wG,bI,lM],styles:[".dialog-container[_ngcontent-%COMP%]{border-radius:12px;padding:18px;width:500px;box-shadow:0 8px 16px #0006}.threshold-slider[_ngcontent-%COMP%]{--mdc-slider-active-track-color: #4285f4;--mdc-slider-inactive-track-color: #616161;--mdc-slider-handle-color: #4285f4;--mdc-slider-ripple-color: #4285f4;width:100px}.metric-row[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center}.metric-name[_ngcontent-%COMP%]{width:250px}.threshold-value[_ngcontent-%COMP%]{margin-left:20px}.mdc-slider__thumb--with-indicator[_ngcontent-%COMP%]{background-color:var(--mdc-slider-handle-color, black);border:none!important;box-shadow:none!important}"]})};var Jg=class t{constructor(e){this.http=e}apiServerDomain=Es.getApiServerBaseUrl();createSession(e,A){if(this.apiServerDomain!=null){let i=this.apiServerDomain+`/apps/${A}/users/${e}/sessions`;return this.http.post(i,null)}return new Ze}listSessions(e,A){if(this.apiServerDomain!=null){let i=this.apiServerDomain+`/apps/${A}/users/${e}/sessions`;return this.http.get(i)}return new Ze}deleteSession(e,A,i){let n=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}`;return this.http.delete(n)}getSession(e,A,i){let n=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}`;return this.http.get(n)}importSession(e,A,i){if(this.apiServerDomain!=null){let n=this.apiServerDomain+`/apps/${A}/users/${e}/sessions`;return this.http.post(n,{appName:A,userId:e,events:i})}return new Ze}static \u0275fac=function(A){return new(A||t)(he(Bs))};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var bTA=["determinateSpinner"];function MTA(t,e){if(t&1&&(hr(),S(0,"svg",11),UA(1,"circle",12),R()),t&2){let A=P();_e("viewBox",A._viewBox()),_(),so("stroke-dasharray",A._strokeCircumference(),"px")("stroke-dashoffset",A._strokeCircumference()/2,"px")("stroke-width",A._circleStrokeWidth(),"%"),_e("r",A._circleRadius())}}var kTA=new BA("mat-progress-spinner-default-options",{providedIn:"root",factory:STA});function STA(){return{diameter:jaA}}var jaA=100,RTA=10,qaA=(()=>{class t{_elementRef=m(te);_noopAnimations;get color(){return this._color||this._defaultColor}set color(A){this._color=A}_color;_defaultColor="primary";_determinateCircle;constructor(){let A=m(mi,{optional:!0}),i=m(kTA);this._noopAnimations=A==="NoopAnimations"&&!!i&&!i._forceAnimations,this.mode=this._elementRef.nativeElement.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",i&&(i.color&&(this.color=this._defaultColor=i.color),i.diameter&&(this.diameter=i.diameter),i.strokeWidth&&(this.strokeWidth=i.strokeWidth))}mode;get value(){return this.mode==="determinate"?this._value:0}set value(A){this._value=Math.max(0,Math.min(100,A||0))}_value=0;get diameter(){return this._diameter}set diameter(A){this._diameter=A||0}_diameter=jaA;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(A){this._strokeWidth=A||0}_strokeWidth;_circleRadius(){return(this.diameter-RTA)/2}_viewBox(){let A=this._circleRadius()*2+this.strokeWidth;return`0 0 ${A} ${A}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode==="determinate"?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(i,n){if(i&1&&Ge(bTA,5),i&2){let o;$A(o=Ae())&&(n._determinateCircle=o.first)}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(i,n){i&2&&(_e("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",n.mode==="determinate"?n.value:null)("mode",n.mode),vo("mat-"+n.color),so("width",n.diameter,"px")("height",n.diameter,"px")("--mdc-circular-progress-size",n.diameter+"px")("--mdc-circular-progress-active-indicator-width",n.diameter+"px"),ue("_mat-animation-noopable",n._noopAnimations)("mdc-circular-progress--indeterminate",n.mode==="indeterminate"))},inputs:{color:"color",mode:"mode",value:[2,"value","value",Mi],diameter:[2,"diameter","diameter",Mi],strokeWidth:[2,"strokeWidth","strokeWidth",Mi]},exportAs:["matProgressSpinner"],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(i,n){if(i&1&&(NA(0,MTA,2,8,"ng-template",null,0,fQ),S(2,"div",2,1),hr(),S(4,"svg",3),UA(5,"circle",4),R()(),uI(),S(6,"div",5)(7,"div",6)(8,"div",7),Mr(9,8),R(),S(10,"div",9),Mr(11,8),R(),S(12,"div",10),Mr(13,8),R()()()),i&2){let o=or(1);_(4),_e("viewBox",n._viewBox()),_(),so("stroke-dasharray",n._strokeCircumference(),"px")("stroke-dashoffset",n._strokeDashOffset(),"px")("stroke-width",n._circleStrokeWidth(),"%"),_e("r",n._circleRadius()),_(4),vA("ngTemplateOutlet",o),_(2),vA("ngTemplateOutlet",o),_(2),vA("ngTemplateOutlet",o)}},dependencies:[vQ],styles:[".mat-mdc-progress-spinner{display:block;overflow:hidden;line-height:0;position:relative;direction:ltr;transition:opacity 250ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-progress-spinner circle{stroke-width:var(--mdc-circular-progress-active-indicator-width, 4px)}.mat-mdc-progress-spinner._mat-animation-noopable,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle{transition:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container{animation:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle{stroke-dasharray:0 !important}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle{stroke:currentColor;stroke:CanvasText}}.mdc-circular-progress__determinate-container,.mdc-circular-progress__indeterminate-circle-graphic,.mdc-circular-progress__indeterminate-container,.mdc-circular-progress__spinner-layer{position:absolute;width:100%;height:100%}.mdc-circular-progress__determinate-container{transform:rotate(-90deg)}.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container{opacity:0}.mdc-circular-progress__indeterminate-container{font-size:0;letter-spacing:0;white-space:nowrap;opacity:0}.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container{opacity:1;animation:mdc-circular-progress-container-rotate 1568.2352941176ms linear infinite}.mdc-circular-progress__determinate-circle-graphic,.mdc-circular-progress__indeterminate-circle-graphic{fill:rgba(0,0,0,0)}.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:var(--mdc-circular-progress-active-indicator-color, var(--mat-sys-primary))}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:CanvasText}}.mdc-circular-progress__determinate-circle{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1)}.mdc-circular-progress__gap-patch{position:absolute;top:0;left:47.5%;box-sizing:border-box;width:5%;height:100%;overflow:hidden}.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic{left:-900%;width:2000%;transform:rotate(180deg)}.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic{width:200%}.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{left:-100%}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress__circle-clipper{display:inline-flex;position:relative;width:50%;height:100%;overflow:hidden}.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}@keyframes mdc-circular-progress-container-rotate{to{transform:rotate(360deg)}}@keyframes mdc-circular-progress-spinner-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdc-circular-progress-left-spin{from{transform:rotate(265deg)}50%{transform:rotate(130deg)}to{transform:rotate(265deg)}}@keyframes mdc-circular-progress-right-spin{from{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}to{transform:rotate(-265deg)}}"],encapsulation:2,changeDetection:0})}return t})();var VaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve]})}return t})();function xTA(t,e){if(t&1){let A=De();S(0,"div",1)(1,"div"),tA(2,"All eval sets"),R(),S(3,"mat-icon",2),mA("click",function(){LA(A);let n=P();return xA(n.openNewEvalSetDialog())}),tA(4,"add"),R()()}}function FTA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",3)(2,"div",4),tA(3," Create New Evaluation Set "),R(),S(4,"div",5),tA(5," An evaluation set is a curated collection of evaluation cases, where each case includes input-output examples for assessing agent performance. "),R(),S(6,"div",6),mA("click",function(){LA(A);let n=P();return xA(n.openNewEvalSetDialog())}),tA(7," Create Evaluation Set "),R()()()}}function NTA(t,e){if(t&1){let A=De();S(0,"div",8),mA("click",function(){let n=LA(A).$implicit,o=P(2);return xA(o.selectEvalSet(n))}),S(1,"div",9)(2,"span",10),tA(3,"folder"),R(),S(4,"div",11),tA(5),R()(),S(6,"div")(7,"mat-icon",12),tA(8,"chevron_right"),R()()()}if(t&2){let A=e.$implicit;_(5),Mt(A)}}function _TA(t,e){if(t&1&&(S(0,"div"),ln(1,NTA,9,1,"div",7,Kn),R()),t&2){let A=P();_(),gn(A.evalsets)}}function GTA(t,e){if(t&1){let A=De();S(0,"th",29)(1,"mat-checkbox",30),mA("change",function(n){LA(A);let o=P(4);return xA(n?o.toggleAllRows():null)}),R()()}if(t&2){let A=P(4);_(),vA("checked",A.selection.hasValue()&&A.isAllSelected())("indeterminate",A.selection.hasValue()&&!A.isAllSelected())}}function UTA(t,e){if(t&1){let A=De();S(0,"td",31)(1,"mat-checkbox",32),mA("click",function(n){return LA(A),xA(n.stopPropagation())})("change",function(n){let o=LA(A).$implicit,r=P(4);return xA(n?r.selection.toggle(o):null)}),R()()}if(t&2){let A=e.$implicit,i=P(4);_(),vA("checked",i.selection.isSelected(A))}}function KTA(t,e){t&1&&(S(0,"th",29),tA(1," Case ID "),R())}function YTA(t,e){if(t&1){let A=De();S(0,"td",33),mA("click",function(){let n=LA(A).$implicit,o=P(4);return xA(o.getEvalCase(n))}),tA(1),R()}if(t&2){let A,i=e.$implicit,n=P(4);ue("selected-eval-case",i===((A=n.selectedEvalCase())==null?null:A.evalId)),_(),ot(" ",i," ")}}function JTA(t,e){t&1&&(S(0,"th",29),tA(1," Result "),R())}function TTA(t,e){if(t&1){let A=De();S(0,"button",35),mA("click",function(){LA(A);let n=P().$implicit,o=P(4);return xA(o.getSession(n))}),S(1,"span",36),tA(2),R(),S(3,"div",37),tA(4),R()()}if(t&2){let A=P().$implicit,i=P(4);vA("ngClass",i.getEvalResultForCase(A)==1?"result-btn pass":"result-btn fail"),_(2),ot(" ",i.getEvalResultForCase(A)==1?"check":"close"," "),_(2),ot("",i.getEvalResultForCase(A)==1?"Pass":"Fail"," ")}}function zTA(t,e){if(t&1&&(S(0,"td",31),NA(1,TTA,5,3,"button",34),R()),t&2){let A=e.$implicit,i=P(4);_(),FA(i.getEvalResultForCase(A)?1:-1)}}function HTA(t,e){t&1&&UA(0,"tr",38)}function OTA(t,e){t&1&&UA(0,"tr",39)}function PTA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",16)(2,"button",17),mA("click",function(){LA(A);let n=P(3);return xA(n.openEvalConfigDialog())}),tA(3,"Run Evaluation"),R(),S(4,"mat-icon",18),mA("click",function(){LA(A);let n=P(3);return xA(n.toggleEvalHistoryButton())}),tA(5,"history"),R()(),S(6,"div",19)(7,"table",20),f2(8,21),NA(9,GTA,2,2,"th",22)(10,UTA,2,1,"td",23),m2(),f2(11,24),NA(12,KTA,2,0,"th",22)(13,YTA,2,3,"td",25),m2(),f2(14,26),NA(15,JTA,2,0,"th",22)(16,zTA,2,1,"td",23),m2(),NA(17,HTA,1,0,"tr",27)(18,OTA,1,0,"tr",28),R()()()}if(t&2){let A=P(3);_(7),vA("dataSource",A.dataSource),_(10),vA("matHeaderRowDef",A.displayedColumns),_(),vA("matRowDefColumns",A.displayedColumns)}}function jTA(t,e){if(t&1&&(S(0,"div")(1,"span",50),tA(2,"|"),R(),S(3,"span",51),tA(4),R()()),t&2){let A=P().$implicit,i=P(4);_(4),ot("",i.getFailCountForCurrentResult(A.evaluationResults.evaluationResults)," Failed")}}function qTA(t,e){if(t&1&&(S(0,"span",52),tA(1),R()),t&2){let A=e.$implicit;_(),Mb(" ",A.metricName,": ",A.threshold," ")}}function VTA(t,e){if(t&1&&(S(0,"div",46),ln(1,qTA,2,2,"span",52,Kn),R()),t&2){let A=P().$implicit,i=P(4);_(),gn(i.getEvalMetrics(A))}}function ZTA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",53)(2,"span"),tA(3),R(),S(4,"button",54),mA("click",function(){let n=LA(A).$implicit,o=P(6);return xA(o.getHistorySession(n))}),S(5,"span",36),tA(6),R(),S(7,"div",37),tA(8),R()()()()}if(t&2){let A=e.$implicit;_(3),ot(" ",A.evalId," "),_(),vA("ngClass",A.finalEvalStatus==1?"result-btn pass":"result-btn fail"),_(2),ot(" ",A.finalEvalStatus==1?"check":"close"," "),_(2),ot("",A.finalEvalStatus==1?"PASS":"FAIL"," ")}}function WTA(t,e){if(t&1&&(S(0,"div",49),ln(1,ZTA,9,4,"div",null,Kn),R()),t&2){let A=P().$implicit,i=P(4);_(),gn(i.generateHistoryEvaluationDatasource(A.timestamp))}}function XTA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",40)(2,"div",41)(3,"div",42)(4,"div",43),tA(5),R(),S(6,"div",44)(7,"span",45),tA(8),R(),NA(9,jTA,5,1,"div"),R(),NA(10,VTA,3,0,"div",46),R(),S(11,"div",47)(12,"mat-icon",48),mA("click",function(){let n=LA(A).$implicit,o=P(4);return xA(o.toggleHistoryStatusCard(n.timestamp))}),tA(13),R()()(),NA(14,WTA,3,0,"div",49),R()()}if(t&2){let A=e.$implicit,i=P(4);_(5),Mt(i.formatTimestamp(A.timestamp)),_(3),ot("",i.getPassCountForCurrentResult(A.evaluationResults.evaluationResults)," Passed"),_(),FA(i.getFailCountForCurrentResult(A.evaluationResults.evaluationResults)>0?9:-1),_(),FA(i.getEvalMetrics(A)?10:-1),_(3),Mt(i.getEvaluationStatusCardActionButtonIcon(A.timestamp)),_(),FA(i.isEvaluationStatusCardToggled(A.timestamp)?14:-1)}}function $TA(t,e){if(t&1&&(S(0,"div"),ln(1,XTA,15,6,"div",null,Kn),R()),t&2){let A=P(3);_(),gn(A.getEvalHistoryOfCurrentSetSorted())}}function AzA(t,e){if(t&1&&(S(0,"div"),NA(1,PTA,19,3,"div")(2,$TA,3,0,"div"),R()),t&2){let A=P(2);_(),FA(A.showEvalHistory()?-1:1),_(),FA(A.showEvalHistory()?2:-1)}}function ezA(t,e){if(t&1){let A=De();S(0,"button",55),mA("click",function(){LA(A);let n=P(2);return xA(n.openNewEvalCaseDialog())}),S(1,"div",56)(2,"mat-icon"),tA(3,"add"),R(),S(4,"div",57),tA(5),R()()()}if(t&2){let A=P(2);_(5),ot(" Add current session to ",A.selectedEvalSet," ")}}function tzA(t,e){t&1&&(S(0,"div"),UA(1,"mat-spinner",58),R()),t&2&&(_(),vA("diameter",28)("strokeWidth",3))}function izA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",9)(2,"mat-icon",13),mA("click",function(){LA(A);let n=P();return xA(n.clearSelectedEvalSet())}),tA(3,"chevron_left"),R(),S(4,"div",14),mA("click",function(){LA(A);let n=P();return xA(n.clearSelectedEvalSet())}),tA(5),R()(),NA(6,AzA,3,2,"div")(7,ezA,6,1,"button",15)(8,tzA,2,2,"div"),R()}if(t&2){let A=P();_(5),ot(" ",A.selectedEvalSet," "),_(),FA(A.evalCases.length>0&&!A.evalRunning()?6:-1),_(),FA(!A.evalRunning()&&!A.showEvalHistory()?7:-1),_(),FA(A.evalRunning()?8:-1)}}var PC=class t{constructor(e,A){this.evalService=e;this.sessionService=A;this.evalCasesSubject.subscribe(i=>{!this.selectedEvalCase()&&this.deletedEvalCaseIndex>=0&&i.length>0?(this.selectNewEvalCase(i),this.deletedEvalCaseIndex=-1):i.length===0&&this.shouldReturnToSession.emit(!0)})}checkboxes;appName="";userId="";sessionId="";sessionSelected=new XA;shouldShowTab=new XA;evalNotInstalledMsg=new XA;evalCaseSelected=new XA;evalSetIdSelected=new XA;shouldReturnToSession=new XA;evalCasesSubject=new li([]);changeDetectorRef=m(lt);flagService=m(vB);displayedColumns=["select","evalId","finalEvalStatus"];evalsets=[];selectedEvalSet="";evalCases=[];selectedEvalCase=Ko(null);deletedEvalCaseIndex=-1;dataSource=new $3(this.evalCases);selection=new F2(!0,[]);showEvalHistory=Ko(!1);evalRunning=Ko(!1);evalMetrics=_aA;currentEvalResultBySet=new Map;dialog=m(Us);appEvaluationResults={};ngOnChanges(e){e.appName&&(this.selectedEvalSet="",this.evalCases=[],this.getEvalSet(),this.getEvaluationResult())}ngOnInit(){}selectNewEvalCase(e){let A=this.deletedEvalCaseIndex;this.deletedEvalCaseIndex===e.length&&(A=0),this.getEvalCase(e[A])}getEvalSet(){this.appName!=""&&this.evalService.getEvalSets(this.appName).pipe(dr(e=>e.status===404&&e.statusText==="Not Found"?(this.shouldShowTab.emit(!1),ve(null)):ve([]))).subscribe(e=>{e!==null&&(this.shouldShowTab.emit(!0),this.evalsets=e)})}openNewEvalSetDialog(){this.dialog.open(tf,{width:"600px",data:{appName:this.appName}}).afterClosed().subscribe(A=>{A&&this.getEvalSet()})}openNewEvalCaseDialog(){this.dialog.open(ef,{width:"600px",data:{appName:this.appName,userId:this.userId,sessionId:this.sessionId,evalSetId:this.selectedEvalSet}}).afterClosed().subscribe(A=>{A&&this.listEvalCases()})}listEvalCases(){this.evalCases=[],this.evalService.listEvalCases(this.appName,this.selectedEvalSet).subscribe(e=>{this.evalCases=e,this.dataSource=new $3(this.evalCases),this.evalCasesSubject.next(this.evalCases),this.changeDetectorRef.detectChanges()})}runEval(){if(this.evalRunning.set(!0),this.selection.selected.length==0){alert("No case selected!"),this.evalRunning.set(!1);return}this.evalService.runEval(this.appName,this.selectedEvalSet,this.selection.selected,this.evalMetrics).pipe(dr(e=>(e.error?.detail?.includes("not installed")&&this.evalNotInstalledMsg.emit(e.error.detail),ve([])))).subscribe(e=>{this.evalRunning.set(!1),this.currentEvalResultBySet.set(this.selectedEvalSet,e),this.getEvaluationResult()})}selectEvalSet(e){this.selectedEvalSet=e,this.listEvalCases()}clearSelectedEvalSet(){if(this.showEvalHistory()){this.toggleEvalHistoryButton();return}this.selectedEvalSet=""}isAllSelected(){let e=this.selection.selected.length,A=this.dataSource.data.length;return e===A}toggleAllRows(){if(this.isAllSelected()){this.selection.clear();return}this.selection.select(...this.dataSource.data)}getEvalResultForCase(e){let A=this.currentEvalResultBySet.get(this.selectedEvalSet)?.filter(i=>i.evalId==e);if(!(!A||A.length==0))return A[0].finalEvalStatus}formatToolUses(e){let A=[];for(let i of e)A.push({name:i.name,args:i.args});return A}addEvalCaseResultToEvents(e,A){let i=A.evalMetricResultPerInvocation,n=-1;if(i)for(let o=0;on.evalId==e)[0],i=A.sessionId;this.sessionService.getSession(this.userId,this.appName,i).subscribe(n=>{this.addEvalCaseResultToEvents(n,A);let o=this.fromApiResultToSession(n);this.sessionSelected.emit(o)})}toggleEvalHistoryButton(){this.showEvalHistory.set(!this.showEvalHistory())}getEvalHistoryOfCurrentSet(){return this.appEvaluationResults[this.appName][this.selectedEvalSet]}getEvalHistoryOfCurrentSetSorted(){let e=this.getEvalHistoryOfCurrentSet();return Object.keys(e).sort((n,o)=>o.localeCompare(n)).map(n=>({timestamp:n,evaluationResults:e[n]}))}getPassCountForCurrentResult(e){return e.filter(A=>A.finalEvalStatus==1).length}getFailCountForCurrentResult(e){return e.filter(A=>A.finalEvalStatus==2).length}formatTimestamp(e){let A=Number(e);if(isNaN(A))return"Invalid timestamp provided";let i=new Date(A*1e3);if(isNaN(i.getTime()))return"Invalid date created from timestamp";let n={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return new Intl.DateTimeFormat("en-US",n).format(i)}getEvaluationStatusCardActionButtonIcon(e){return this.getEvalHistoryOfCurrentSet()[e].isToggled?"keyboard_arrow_up":"keyboard_arrow_down"}toggleHistoryStatusCard(e){this.getEvalHistoryOfCurrentSet()[e].isToggled=!this.getEvalHistoryOfCurrentSet()[e].isToggled}isEvaluationStatusCardToggled(e){return this.getEvalHistoryOfCurrentSet()[e].isToggled}generateHistoryEvaluationDatasource(e){return this.getEvalHistoryOfCurrentSet()[e].evaluationResults}getHistorySession(e){this.addEvalCaseResultToEvents(e.sessionDetails,e);let A=this.fromApiResultToSession(e.sessionDetails);this.sessionSelected.emit(A)}getEvalCase(e){this.evalService.getEvalCase(this.appName,this.selectedEvalSet,e).subscribe(A=>{this.selectedEvalCase.set(A),this.evalCaseSelected.emit(A),this.evalSetIdSelected.emit(this.selectedEvalSet)})}resetEvalCase(){this.selectedEvalCase.set(null)}resetEvalResults(){this.currentEvalResultBySet.clear()}deleteEvalCase(e){this.evalService.deleteEvalCase(this.appName,this.selectedEvalSet,e).subscribe(A=>{this.deletedEvalCaseIndex=this.evalCases.indexOf(e),this.selectedEvalCase.set(null),this.listEvalCases()})}getEvaluationResult(){this.evalService.listEvalResults(this.appName).pipe(dr(e=>e.status===404&&e.statusText==="Not Found"?(this.shouldShowTab.emit(!1),ve(null)):ve([]))).subscribe(e=>{for(let A of e)this.evalService.getEvalResult(this.appName,A).subscribe(i=>{this.appEvaluationResults[this.appName]||(this.appEvaluationResults[this.appName]={}),this.appEvaluationResults[this.appName][i.evalSetId]||(this.appEvaluationResults[this.appName][i.evalSetId]={});let n=i.creationTimestamp;this.appEvaluationResults[this.appName][i.evalSetId][n]||(this.appEvaluationResults[this.appName][i.evalSetId][n]={isToggled:!1,evaluationResults:[]});let o={isToggled:!1,evaluationResults:i.evalCaseResults.map(r=>({setId:r.id,evalId:r.evalId,finalEvalStatus:r.finalEvalStatus,evalMetricResults:r.evalMetricResults,evalMetricResultPerInvocation:r.evalMetricResultPerInvocation,sessionId:r.sessionId,sessionDetails:r.sessionDetails,overallEvalMetricResults:r.overallEvalMetricResults??[]}))};this.appEvaluationResults[this.appName][i.evalSetId][n]=o})})}openEvalConfigDialog(){if(this.selection.selected.length==0){alert("No case selected!");return}this.dialog.open(nf,{maxWidth:"90vw",maxHeight:"90vh",data:{evalMetrics:this.evalMetrics}}).afterClosed().subscribe(A=>{A&&(this.evalMetrics=A,this.runEval())})}getEvalMetrics(e){if(!e||!e.evaluationResults||!e.evaluationResults.evaluationResults)return this.evalMetrics;let A=e.evaluationResults.evaluationResults;return A.length===0?this.evalMetrics:typeof A[0].overallEvalMetricResults>"u"||!A[0].overallEvalMetricResults||A[0].overallEvalMetricResults.length===0?this.evalMetrics:A[0].overallEvalMetricResults.map(n=>({metricName:n.metricName,threshold:n.threshold}))}static \u0275fac=function(A){return new(A||t)(zA(zc),zA(Jg))};static \u0275cmp=YA({type:t,selectors:[["app-eval-tab"]],viewQuery:function(A,i){if(A&1&&Ge(gh,5),A&2){let n;$A(n=Ae())&&(i.checkboxes=n)}},inputs:{appName:"appName",userId:"userId",sessionId:"sessionId"},outputs:{sessionSelected:"sessionSelected",shouldShowTab:"shouldShowTab",evalNotInstalledMsg:"evalNotInstalledMsg",evalCaseSelected:"evalCaseSelected",evalSetIdSelected:"evalSetIdSelected",shouldReturnToSession:"shouldReturnToSession"},standalone:!1,features:[Kt],decls:5,vars:4,consts:[[1,"eval-container"],[1,"eval-set-actions"],["matTooltip","Create new evaluation set",2,"cursor","pointer",3,"click"],[1,"empty-eval-info"],[1,"info-title"],[1,"info-detail"],[1,"info-create",3,"click"],[1,"eval-set-row"],[1,"eval-set-row",3,"click"],[2,"display","flex"],[1,"material-symbols-outlined",2,"margin-right","10px","padding-top","16px"],[2,"font-family","Roboto","font-size","14px","padding","16px","padding-top","20px"],[2,"padding-top","20px","color","#9AA0A6"],[2,"color","white","cursor","pointer",3,"click"],[2,"color","#9AA0A6","padding-top","2px","cursor","pointer",3,"click"],[1,"save-session-btn"],[1,"evaluation-tab-header"],[1,"run-eval-btn",3,"click"],["matTooltip","View eval run history",1,"evaluation-history-icon",3,"click"],[1,"mat-table-container",2,"margin-top","16px"],["mat-table","",3,"dataSource"],["matColumnDef","select"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","evalId"],["mat-cell","","class","eval-case-id",3,"selected-eval-case","click",4,"matCellDef"],["matColumnDef","finalEvalStatus"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["mat-header-cell",""],[3,"change","checked","indeterminate"],["mat-cell",""],[3,"click","change","checked"],["mat-cell","",1,"eval-case-id",3,"click"],["matTooltip","View eval run result",3,"ngClass"],["matTooltip","View eval run result",3,"click","ngClass"],[1,"material-symbols-outlined"],[2,"padding-top","4px"],["mat-header-row",""],["mat-row",""],[1,"status-card"],[1,"status-card__overview"],[1,"status-card__info"],[1,"status-card__timestamp"],[1,"status-card__summary"],[1,"status-card__passed"],[1,"status-card__metrics"],[1,"status-card__action"],[3,"click"],[1,"status-card__history-cases"],[1,"status-card__separator"],[1,"status-card__failed"],[1,"status-card__metric"],[1,"status-card__history-case"],[3,"click","ngClass"],[1,"save-session-btn",3,"click"],[1,"save-session-btn-detail"],[1,"save-session-btn-text"],[1,"eval-spinner",3,"diameter","strokeWidth"]],template:function(A,i){A&1&&(S(0,"div",0),NA(1,xTA,5,0,"div",1)(2,FTA,8,0,"div")(3,_TA,3,0,"div")(4,izA,9,4,"div"),R()),A&2&&(_(),FA(i.selectedEvalSet==""?1:-1),_(),FA(i.evalsets.length==0?2:-1),_(),FA(i.evalsets.length>0&&i.selectedEvalSet==""?3:-1),_(),FA(i.selectedEvalSet!=""?4:-1))},dependencies:[Ha,T2,gh,yaA,baA,RaA,MaA,vaA,LaA,kaA,SaA,xaA,FaA,wB,qaA],styles:[".eval-container[_ngcontent-%COMP%]{margin-top:20px;padding-left:25px;padding-right:25px}.eval-case-id[_ngcontent-%COMP%]{cursor:pointer}.eval-set-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;color:#9aa0a6;font-style:normal;font-weight:700;font-size:14px}.empty-eval-info[_ngcontent-%COMP%]{margin-top:12px;background-color:#202124;border-radius:8px;box-shadow:0 2px 6px 2px #00000026,0 1px 2px #0000004d}.info-title[_ngcontent-%COMP%]{color:#e8eaed;font-family:Roboto;font-size:14px;font-weight:500;padding-top:13px;padding-right:16px;padding-left:16px}.info-detail[_ngcontent-%COMP%]{color:#e8eaed;font-family:Roboto;font-size:14px;font-weight:400;padding-top:13px;padding-right:16px;padding-left:16px;letter-spacing:.2px}.info-create[_ngcontent-%COMP%]{color:var(--Blue-300, #8ab4f8);font-size:14px;font-style:normal;font-weight:500;padding-right:16px;padding-left:16px;margin-top:19px;padding-bottom:16px;cursor:pointer}.eval-set-row[_ngcontent-%COMP%]{display:flex;justify-content:space-between;cursor:pointer}.selected-eval-case[_ngcontent-%COMP%]{font-weight:900;color:#8ab4f8}.save-session-btn[_ngcontent-%COMP%]{width:100%;background:linear-gradient(0deg,#8ab4f83d 0% 100%),#202124;border:none;border-radius:4px;margin-top:12px;cursor:pointer}.save-session-btn-detail[_ngcontent-%COMP%]{display:flex;padding:8px 16px 8px 12px;justify-content:center}.save-session-btn-text[_ngcontent-%COMP%]{padding-top:2px;color:var(--Blue-100, #d2e3fc);font-family:Google Sans;font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:.25px}.run-eval-btn[_ngcontent-%COMP%]{border-radius:4px;border:1px solid var(--Grey-700, #5f6368);background-color:transparent;padding:8px 24px;margin-top:16px;color:#8ab4f8;cursor:pointer}.run-eval-btn[_ngcontent-%COMP%]:hover{background-color:#202124}.result-btn[_ngcontent-%COMP%]{display:flex;background-color:transparent;border-radius:4px;border:1px solid var(--Grey-700, #5f6368);margin-top:4px;cursor:pointer}.result-btn[_ngcontent-%COMP%]:hover{background-color:#202124}.result-btn.pass[_ngcontent-%COMP%]{color:#44c265}.result-btn.fail[_ngcontent-%COMP%]{color:#ff8983}.evaluation-tab-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%}.evaluation-history-icon[_ngcontent-%COMP%]{cursor:pointer;margin-top:4px}.status-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;border-radius:8px;background-color:#2d2d2d;padding:12px 16px;margin-top:12px}.status-card__overview[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%}.status-card__info[_ngcontent-%COMP%]{display:flex;flex-direction:column}.status-card__timestamp[_ngcontent-%COMP%]{font-size:.9em;color:#e0e0e0;margin-bottom:5px}.status-card__summary[_ngcontent-%COMP%]{display:flex;align-items:center;font-size:.95em;font-weight:500}.status-card__metrics[_ngcontent-%COMP%]{display:flex;align-items:center;font-size:.75em;font-weight:300;margin-top:3px}.status-card__metric[_ngcontent-%COMP%]{width:180px;color:#bbb}.status-card__failed[_ngcontent-%COMP%]{color:#ff6b6b}.status-card__separator[_ngcontent-%COMP%]{color:#666;margin:0 8px}.status-card__passed[_ngcontent-%COMP%]{color:#63e6be}.status-card__action[_ngcontent-%COMP%]{display:flex;align-items:center}.status-card__action[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#bdbdbd;cursor:pointer;transition:transform .2s ease-in-out}.status-card__action[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]:hover{opacity:.8}.status-card__action[_ngcontent-%COMP%] .status-card__icon[_ngcontent-%COMP%]{color:#bdbdbd;font-size:1.2em;cursor:pointer}.status-card__action[_ngcontent-%COMP%] .status-card__icon[_ngcontent-%COMP%]:hover{opacity:.8}.status-card__history-cases[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-top:3px;justify-content:flex-start;width:100%}.status-card__history-case[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:15px}.eval-spinner[_ngcontent-%COMP%]{margin-top:12px}"],changeDetection:0})};function ozA(t,e){t&1&&UA(0,"div",6)}function rzA(t,e){if(t&1&&(S(0,"div",3)(1,"div",5),ln(2,ozA,1,0,"div",6,Kd),R(),S(4,"span",7),tA(5),R(),S(6,"div",8),tA(7),S(8,"span",9),tA(9),R()(),S(10,"div",10)(11,"div",11),tA(12),R()()()),t&2){let A=e.$implicit,i=P();_(2),gn(i.getArray(A.level)),_(3),ot(" ",i.getSpanIcon(A.span.name)," "),_(),so("width",400-A.level*20,"px"),_(),ot(" ",A.span.name," "),_(2),ot(" (",(i.toMs(A.span.end_time)-i.toMs(A.span.start_time)).toFixed(2),"ms) "),_(2),so("left",i.getRelativeStart(A.span),"%")("width",i.getRelativeWidth(A.span),"%"),_(),ot(" ",(i.toMs(A.span.end_time)-i.toMs(A.span.start_time)).toFixed(2),"ms ")}}var of=class t{constructor(e,A){this.dialogRef=e;this.data=A}tree=[];baseStartTimeMs=0;totalDurationMs=1;flatTree=[];traceLabelIconMap=new Map([["Invocation","start"],["agent_run","directions_run"],["tool","build"],["call_llm","chat"]]);ngOnInit(){this.tree=this.buildSpanTree(this.data.spans),this.flatTree=this.flattenTree(this.tree);let e=this.getGlobalTimes(this.data.spans);this.baseStartTimeMs=e.start,this.totalDurationMs=e.duration}buildSpanTree(e){let A=e.map(o=>nA({},o)),i=new Map,n=[];return A.forEach(o=>i.set(o.span_id,o)),A.forEach(o=>{if(o.parent_span_id&&i.has(o.parent_span_id)){let r=i.get(o.parent_span_id);r.children=r.children||[],r.children.push(o)}else n.push(o)}),n}getGlobalTimes(e){let A=Math.min(...e.map(n=>this.toMs(n.start_time))),i=Math.max(...e.map(n=>this.toMs(n.end_time)));return{start:A,duration:i-A}}toMs(e){return e/1e6}getRelativeStart(e){return(this.toMs(e.start_time)-this.baseStartTimeMs)/this.totalDurationMs*100}getRelativeWidth(e){return(this.toMs(e.end_time)-this.toMs(e.start_time))/this.totalDurationMs*100}flattenTree(e,A=0){return e.flatMap(n=>[{span:n,level:A},...n.children?this.flattenTree(n.children,A+1):[]])}getSpanIcon(e){for(let[A,i]of this.traceLabelIconMap.entries())if(e.startsWith(A))return i;return"start"}getArray(e){return Array.from({length:e})}static \u0275fac=function(A){return new(A||t)(zA(cr),zA($r))};static \u0275cmp=YA({type:t,selectors:[["app-trace-chart"]],standalone:!1,decls:9,vars:1,consts:[["mat-dialog-title",""],[2,"margin-top","8px"],[1,"trace-container"],[1,"trace-row"],["mat-button","","mat-dialog-close",""],[1,"trace-indent"],[1,"indent-connector"],[1,"material-symbols-outlined",2,"margin-right","8px"],[1,"trace-label"],[1,"trace-duration"],[1,"trace-bar-container"],[1,"trace-bar"]],template:function(A,i){A&1&&(S(0,"h2",0),tA(1),R(),S(2,"mat-dialog-content",1)(3,"div",2),ln(4,rzA,13,10,"div",3,Kn),R()(),S(6,"mat-dialog-actions")(7,"button",4),tA(8,"Close"),R()()),A&2&&(_(),ot("Invocation ",i.data.invocId,""),_(3),gn(i.flatTree))},dependencies:[ur,hs,ga,Ia,gg],styles:[".trace-container[_ngcontent-%COMP%]{width:100%;white-space:nowrap;font-size:12px}.trace-label[_ngcontent-%COMP%]{width:400px;color:#e3e3e3;text-overflow:ellipsis;font-family:Google Sans Mono,monospace;font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:0px}.trace-bar-container[_ngcontent-%COMP%]{width:50vw;position:relative;height:16px}.trace-bar[_ngcontent-%COMP%]{position:absolute;height:18px;background-color:#2f4d65;border-radius:4px;padding-left:4px;overflow:hidden;font-size:11px;line-height:16px;color:#8dabbf;font-family:Google Sans}.trace-duration[_ngcontent-%COMP%]{color:#888;font-weight:400;margin-left:4px}.trace-row[_ngcontent-%COMP%]{display:flex;align-items:stretch;position:relative;height:32px}.trace-indent[_ngcontent-%COMP%]{display:flex;flex-shrink:0;height:100%}.indent-connector[_ngcontent-%COMP%]{width:20px;position:relative;height:100%}.vertical-line[_ngcontent-%COMP%]{position:absolute;top:0;bottom:0;left:9px;width:1px;background-color:#ccc}.horizontal-line[_ngcontent-%COMP%]{position:absolute;top:50%;left:9px;width:10px;height:1px;background-color:#ccc}"]})};var ZaA=(()=>{class t{get vertical(){return this._vertical}set vertical(A){this._vertical=Yo(A)}_vertical=!1;get inset(){return this._inset}set inset(A){this._inset=Yo(A)}_inset=!1;static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-divider"]],hostAttrs:["role","separator",1,"mat-divider"],hostVars:7,hostBindings:function(i,n){i&2&&(_e("aria-orientation",n.vertical?"vertical":"horizontal"),ue("mat-divider-vertical",n.vertical)("mat-divider-horizontal",!n.vertical)("mat-divider-inset",n.inset))},inputs:{vertical:"vertical",inset:"inset"},decls:0,vars:0,template:function(i,n){},styles:[".mat-divider{display:block;margin:0;border-top-style:solid;border-top-color:var(--mat-divider-color, var(--mat-sys-outline));border-top-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-vertical{border-top:0;border-right-style:solid;border-right-color:var(--mat-divider-color, var(--mat-sys-outline));border-right-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-inset{margin-left:80px}[dir=rtl] .mat-divider.mat-divider-inset{margin-left:auto;margin-right:80px}"],encapsulation:2,changeDetection:0})}return t})(),WaA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Ve]})}return t})();var azA=["*"],czA='.mdc-list{margin:0;padding:8px 0;list-style-type:none}.mdc-list:focus{outline:none}.mdc-list-item{display:flex;position:relative;justify-content:flex-start;overflow:hidden;padding:0;align-items:stretch;cursor:pointer;padding-left:16px;padding-right:16px;background-color:var(--mdc-list-list-item-container-color, transparent);border-radius:var(--mdc-list-list-item-container-shape, var(--mat-sys-corner-none))}.mdc-list-item.mdc-list-item--selected{background-color:var(--mdc-list-list-item-selected-container-color)}.mdc-list-item:focus{outline:0}.mdc-list-item.mdc-list-item--disabled{cursor:auto}.mdc-list-item.mdc-list-item--with-one-line{height:var(--mdc-list-list-item-one-line-container-height, 48px)}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-two-lines{height:var(--mdc-list-list-item-two-line-container-height, 64px)}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-two-lines .mdc-list-item__end{align-self:center;margin-top:0}.mdc-list-item.mdc-list-item--with-three-lines{height:var(--mdc-list-list-item-three-line-container-height, 88px)}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__start{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:16px}.mdc-list-item.mdc-list-item--selected::before,.mdc-list-item.mdc-list-item--selected:focus::before,.mdc-list-item:not(.mdc-list-item--selected):focus::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;content:"";pointer-events:none}a.mdc-list-item{color:inherit;text-decoration:none}.mdc-list-item__start{fill:currentColor;flex-shrink:0;pointer-events:none}.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mdc-list-list-item-leading-icon-color, var(--mat-sys-on-surface-variant));width:var(--mdc-list-list-item-leading-icon-size, 24px);height:var(--mdc-list-list-item-leading-icon-size, 24px);margin-left:16px;margin-right:32px}[dir=rtl] .mdc-list-item--with-leading-icon .mdc-list-item__start{margin-left:32px;margin-right:16px}.mdc-list-item--with-leading-icon:hover .mdc-list-item__start{color:var(--mdc-list-list-item-hover-leading-icon-color)}.mdc-list-item--with-leading-avatar .mdc-list-item__start{width:var(--mdc-list-list-item-leading-avatar-size, 40px);height:var(--mdc-list-list-item-leading-avatar-size, 40px);margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item--with-leading-avatar .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-avatar .mdc-list-item__start{margin-left:16px;margin-right:16px;border-radius:50%}.mdc-list-item__end{flex-shrink:0;pointer-events:none}.mdc-list-item--with-trailing-meta .mdc-list-item__end{font-family:var(--mdc-list-list-item-trailing-supporting-text-font, var(--mat-sys-label-small-font));line-height:var(--mdc-list-list-item-trailing-supporting-text-line-height, var(--mat-sys-label-small-line-height));font-size:var(--mdc-list-list-item-trailing-supporting-text-size, var(--mat-sys-label-small-size));font-weight:var(--mdc-list-list-item-trailing-supporting-text-weight, var(--mat-sys-label-small-weight));letter-spacing:var(--mdc-list-list-item-trailing-supporting-text-tracking, var(--mat-sys-label-small-tracking))}.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mdc-list-list-item-trailing-icon-color, var(--mat-sys-on-surface-variant));width:var(--mdc-list-list-item-trailing-icon-size, 24px);height:var(--mdc-list-list-item-trailing-icon-size, 24px)}.mdc-list-item--with-trailing-icon:hover .mdc-list-item__end{color:var(--mdc-list-list-item-hover-trailing-icon-color)}.mdc-list-item.mdc-list-item--with-trailing-meta .mdc-list-item__end{color:var(--mdc-list-list-item-trailing-supporting-text-color, var(--mat-sys-on-surface-variant))}.mdc-list-item--selected.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mdc-list-list-item-selected-trailing-icon-color, var(--mat-sys-primary))}.mdc-list-item__content{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;align-self:center;flex:1;pointer-events:none}.mdc-list-item--with-two-lines .mdc-list-item__content,.mdc-list-item--with-three-lines .mdc-list-item__content{align-self:stretch}.mdc-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;color:var(--mdc-list-list-item-label-text-color, var(--mat-sys-on-surface));font-family:var(--mdc-list-list-item-label-text-font, var(--mat-sys-body-large-font));line-height:var(--mdc-list-list-item-label-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mdc-list-list-item-label-text-size, var(--mat-sys-body-large-size));font-weight:var(--mdc-list-list-item-label-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mdc-list-list-item-label-text-tracking, var(--mat-sys-body-large-tracking))}.mdc-list-item:hover .mdc-list-item__primary-text{color:var(--mdc-list-list-item-hover-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:focus .mdc-list-item__primary-text{color:var(--mdc-list-list-item-focus-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-three-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-three-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item__secondary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;color:var(--mdc-list-list-item-supporting-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mdc-list-list-item-supporting-text-font, var(--mat-sys-body-medium-font));line-height:var(--mdc-list-list-item-supporting-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mdc-list-list-item-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mdc-list-list-item-supporting-text-weight, var(--mat-sys-body-medium-weight));letter-spacing:var(--mdc-list-list-item-supporting-text-tracking, var(--mat-sys-body-medium-tracking))}.mdc-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:"";vertical-align:0}.mdc-list-item--with-three-lines .mdc-list-item__secondary-text{white-space:normal;line-height:20px}.mdc-list-item--with-overline .mdc-list-item__secondary-text{white-space:nowrap;line-height:auto}.mdc-list-item--with-leading-radio.mdc-list-item,.mdc-list-item--with-leading-checkbox.mdc-list-item,.mdc-list-item--with-leading-icon.mdc-list-item,.mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:0;padding-right:16px}[dir=rtl] .mdc-list-item--with-leading-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-checkbox.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-leading-avatar.mdc-list-item{padding-left:16px;padding-right:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text{display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines .mdc-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end{display:block;margin-top:0;line-height:normal}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-icon.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before,.mdc-list-item--with-leading-avatar.mdc-list-item--with-two-lines.mdc-list-item--with-trailing-meta .mdc-list-item__end::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-list-item--with-trailing-icon.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-icon.mdc-list-item{padding-left:0;padding-right:0}.mdc-list-item--with-trailing-icon .mdc-list-item__end{margin-left:16px;margin-right:16px}.mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-meta.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-meta .mdc-list-item__end{-webkit-user-select:none;user-select:none;margin-left:28px;margin-right:16px}[dir=rtl] .mdc-list-item--with-trailing-meta .mdc-list-item__end{margin-left:16px;margin-right:28px}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end{display:block;line-height:normal;align-self:flex-start;margin-top:0}.mdc-list-item--with-trailing-meta.mdc-list-item--with-three-lines .mdc-list-item__end::before,.mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end::before{display:inline-block;width:0;height:28px;content:"";vertical-align:0}.mdc-list-item--with-leading-radio .mdc-list-item__start,.mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:8px;margin-right:24px}[dir=rtl] .mdc-list-item--with-leading-radio .mdc-list-item__start,[dir=rtl] .mdc-list-item--with-leading-checkbox .mdc-list-item__start{margin-left:24px;margin-right:8px}.mdc-list-item--with-leading-radio.mdc-list-item--with-two-lines .mdc-list-item__start,.mdc-list-item--with-leading-checkbox.mdc-list-item--with-two-lines .mdc-list-item__start{align-self:flex-start;margin-top:8px}.mdc-list-item--with-trailing-radio.mdc-list-item,.mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:16px;padding-right:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item{padding-left:0;padding-right:16px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-left:0}[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-radio.mdc-list-item--with-leading-avatar,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-icon,[dir=rtl] .mdc-list-item--with-trailing-checkbox.mdc-list-item--with-leading-avatar{padding-right:0}.mdc-list-item--with-trailing-radio .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:24px;margin-right:8px}[dir=rtl] .mdc-list-item--with-trailing-radio .mdc-list-item__end,[dir=rtl] .mdc-list-item--with-trailing-checkbox .mdc-list-item__end{margin-left:8px;margin-right:24px}.mdc-list-item--with-trailing-radio.mdc-list-item--with-three-lines .mdc-list-item__end,.mdc-list-item--with-trailing-checkbox.mdc-list-item--with-three-lines .mdc-list-item__end{align-self:flex-start;margin-top:8px}.mdc-list-group__subheader{margin:.75rem 16px}.mdc-list-item--disabled .mdc-list-item__start,.mdc-list-item--disabled .mdc-list-item__content,.mdc-list-item--disabled .mdc-list-item__end{opacity:1}.mdc-list-item--disabled .mdc-list-item__primary-text,.mdc-list-item--disabled .mdc-list-item__secondary-text{opacity:var(--mdc-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--disabled.mdc-list-item--with-leading-icon .mdc-list-item__start{color:var(--mdc-list-list-item-disabled-leading-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-disabled-leading-icon-opacity, 0.38)}.mdc-list-item--disabled.mdc-list-item--with-trailing-icon .mdc-list-item__end{color:var(--mdc-list-list-item-disabled-trailing-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-disabled-trailing-icon-opacity, 0.38)}.mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing,[dir=rtl] .mat-mdc-list-item.mat-mdc-list-item-both-leading-and-trailing{padding-left:0;padding-right:0}.mdc-list-item.mdc-list-item--disabled .mdc-list-item__primary-text{color:var(--mdc-list-list-item-disabled-label-text-color, var(--mat-sys-on-surface))}.mdc-list-item:hover::before{background-color:var(--mdc-list-list-item-hover-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mdc-list-item.mdc-list-item--disabled::before{background-color:var(--mdc-list-list-item-disabled-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-disabled-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item:focus::before{background-color:var(--mdc-list-list-item-focus-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mdc-list-list-item-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}.mdc-list-item--disabled .mdc-radio,.mdc-list-item--disabled .mdc-checkbox{opacity:var(--mdc-list-list-item-disabled-label-text-opacity, 0.3)}.mdc-list-item--with-leading-avatar .mat-mdc-list-item-avatar{border-radius:var(--mdc-list-list-item-leading-avatar-shape, var(--mat-sys-corner-full));background-color:var(--mdc-list-list-item-leading-avatar-color, var(--mat-sys-primary-container))}.mat-mdc-list-item-icon{font-size:var(--mdc-list-list-item-leading-icon-size, 24px)}@media(forced-colors: active){a.mdc-list-item--activated::after{content:"";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}a.mdc-list-item--activated [dir=rtl]::after{right:auto;left:16px}}.mat-mdc-list-base{display:block}.mat-mdc-list-base .mdc-list-item__start,.mat-mdc-list-base .mdc-list-item__end,.mat-mdc-list-base .mdc-list-item__content{pointer-events:auto}.mat-mdc-list-item,.mat-mdc-list-option{width:100%;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-list-item:not(.mat-mdc-list-item-interactive),.mat-mdc-list-option:not(.mat-mdc-list-item-interactive){cursor:default}.mat-mdc-list-item .mat-divider-inset,.mat-mdc-list-option .mat-divider-inset{position:absolute;left:0;right:0;bottom:0}.mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,.mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-left:72px}[dir=rtl] .mat-mdc-list-item .mat-mdc-list-item-avatar~.mat-divider-inset,[dir=rtl] .mat-mdc-list-option .mat-mdc-list-item-avatar~.mat-divider-inset{margin-right:72px}.mat-mdc-list-item-interactive::before{top:0;left:0;right:0;bottom:0;position:absolute;content:"";opacity:0;pointer-events:none;border-radius:inherit}.mat-mdc-list-item>.mat-focus-indicator{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-list-item:focus>.mat-focus-indicator::before{content:""}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-line.mdc-list-item__secondary-text{white-space:nowrap;line-height:normal}.mat-mdc-list-item.mdc-list-item--with-three-lines .mat-mdc-list-item-unscoped-content.mdc-list-item__secondary-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);text-align:start}mat-action-list button::-moz-focus-inner{border:0}.mdc-list-item--with-leading-icon .mdc-list-item__start{margin-inline-start:var(--mat-list-list-item-leading-icon-start-space, 16px);margin-inline-end:var(--mat-list-list-item-leading-icon-end-space, 16px)}.mat-mdc-nav-list .mat-mdc-list-item{border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full));--mat-focus-indicator-border-radius:var(--mat-list-active-indicator-shape, var(--mat-sys-corner-full))}.mat-mdc-nav-list .mat-mdc-list-item.mdc-list-item--activated{background-color:var(--mat-list-active-indicator-color, var(--mat-sys-secondary-container))}',lzA=["unscopedContent"],gzA=["text"],IzA=[[["","matListItemAvatar",""],["","matListItemIcon",""]],[["","matListItemTitle",""]],[["","matListItemLine",""]],"*",[["","matListItemMeta",""]],[["mat-divider"]]],CzA=["[matListItemAvatar],[matListItemIcon]","[matListItemTitle]","[matListItemLine]","*","[matListItemMeta]","mat-divider"];var dzA=new BA("ListOption"),BzA=(()=>{class t{_elementRef=m(te);constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matListItemTitle",""]],hostAttrs:[1,"mat-mdc-list-item-title","mdc-list-item__primary-text"]})}return t})(),EzA=(()=>{class t{_elementRef=m(te);constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matListItemLine",""]],hostAttrs:[1,"mat-mdc-list-item-line","mdc-list-item__secondary-text"]})}return t})(),hzA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matListItemMeta",""]],hostAttrs:[1,"mat-mdc-list-item-meta","mdc-list-item__end"]})}return t})(),XaA=(()=>{class t{_listOption=m(dzA,{optional:!0});constructor(){}_isAlignedAtStart(){return!this._listOption||this._listOption?._getTogglePosition()==="after"}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,hostVars:4,hostBindings:function(i,n){i&2&&ue("mdc-list-item__start",n._isAlignedAtStart())("mdc-list-item__end",!n._isAlignedAtStart())}})}return t})(),QzA=(()=>{class t extends XaA{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matListItemAvatar",""]],hostAttrs:[1,"mat-mdc-list-item-avatar"],features:[et]})}return t})(),uzA=(()=>{class t extends XaA{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matListItemIcon",""]],hostAttrs:[1,"mat-mdc-list-item-icon"],features:[et]})}return t})(),fzA=new BA("MAT_LIST_CONFIG"),yG=(()=>{class t{_isNonInteractive=!0;get disableRipple(){return this._disableRipple}set disableRipple(A){this._disableRipple=Yo(A)}_disableRipple=!1;get disabled(){return this._disabled}set disabled(A){this._disabled=Yo(A)}_disabled=!1;_defaultOptions=m(fzA,{optional:!0});static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,hostVars:1,hostBindings:function(i,n){i&2&&_e("aria-disabled",n.disabled)},inputs:{disableRipple:"disableRipple",disabled:"disabled"}})}return t})(),mzA=(()=>{class t{_elementRef=m(te);_ngZone=m(de);_listBase=m(yG,{optional:!0});_platform=m(Zt);_hostElement;_isButtonElement;_noopAnimations;_avatars;_icons;set lines(A){this._explicitLines=Ns(A,null),this._updateItemLines(!1)}_explicitLines=null;get disableRipple(){return this.disabled||this._disableRipple||this._noopAnimations||!!this._listBase?.disableRipple}set disableRipple(A){this._disableRipple=Yo(A)}_disableRipple=!1;get disabled(){return this._disabled||!!this._listBase?.disabled}set disabled(A){this._disabled=Yo(A)}_disabled=!1;_subscriptions=new _t;_rippleRenderer=null;_hasUnscopedTextContent=!1;rippleConfig;get rippleDisabled(){return this.disableRipple||!!this.rippleConfig.disabled}constructor(){m(Ln).load(Qr);let A=m(L2,{optional:!0}),i=m(mi,{optional:!0});this.rippleConfig=A||{},this._hostElement=this._elementRef.nativeElement,this._isButtonElement=this._hostElement.nodeName.toLowerCase()==="button",this._noopAnimations=i==="NoopAnimations",this._listBase&&!this._listBase._isNonInteractive&&this._initInteractiveListItem(),this._isButtonElement&&!this._hostElement.hasAttribute("type")&&this._hostElement.setAttribute("type","button")}ngAfterViewInit(){this._monitorProjectedLinesAndTitle(),this._updateItemLines(!0)}ngOnDestroy(){this._subscriptions.unsubscribe(),this._rippleRenderer!==null&&this._rippleRenderer._removeTriggerEvents()}_hasIconOrAvatar(){return!!(this._avatars.length||this._icons.length)}_initInteractiveListItem(){this._hostElement.classList.add("mat-mdc-list-item-interactive"),this._rippleRenderer=new CB(this,this._ngZone,this._hostElement,this._platform,m(Dt)),this._rippleRenderer.setupTriggerEvents(this._hostElement)}_monitorProjectedLinesAndTitle(){this._ngZone.runOutsideAngular(()=>{this._subscriptions.add(ho(this._lines.changes,this._titles.changes).subscribe(()=>this._updateItemLines(!1)))})}_updateItemLines(A){if(!this._lines||!this._titles||!this._unscopedContent)return;A&&this._checkDomForUnscopedTextContent();let i=this._explicitLines??this._inferLinesFromContent(),n=this._unscopedContent.nativeElement;if(this._hostElement.classList.toggle("mat-mdc-list-item-single-line",i<=1),this._hostElement.classList.toggle("mdc-list-item--with-one-line",i<=1),this._hostElement.classList.toggle("mdc-list-item--with-two-lines",i===2),this._hostElement.classList.toggle("mdc-list-item--with-three-lines",i===3),this._hasUnscopedTextContent){let o=this._titles.length===0&&i===1;n.classList.toggle("mdc-list-item__primary-text",o),n.classList.toggle("mdc-list-item__secondary-text",!o)}else n.classList.remove("mdc-list-item__primary-text"),n.classList.remove("mdc-list-item__secondary-text")}_inferLinesFromContent(){let A=this._titles.length+this._lines.length;return this._hasUnscopedTextContent&&(A+=1),A}_checkDomForUnscopedTextContent(){this._hasUnscopedTextContent=Array.from(this._unscopedContent.nativeElement.childNodes).filter(A=>A.nodeType!==A.COMMENT_NODE).some(A=>!!(A.textContent&&A.textContent.trim()))}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,contentQueries:function(i,n,o){if(i&1&&(Ii(o,QzA,4),Ii(o,uzA,4)),i&2){let r;$A(r=Ae())&&(n._avatars=r),$A(r=Ae())&&(n._icons=r)}},hostVars:4,hostBindings:function(i,n){i&2&&(_e("aria-disabled",n.disabled)("disabled",n._isButtonElement&&n.disabled||null),ue("mdc-list-item--disabled",n.disabled))},inputs:{lines:"lines",disableRipple:"disableRipple",disabled:"disabled"}})}return t})();var $aA=(()=>{class t extends yG{static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275cmp=YA({type:t,selectors:[["mat-list"]],hostAttrs:[1,"mat-mdc-list","mat-mdc-list-base","mdc-list"],exportAs:["matList"],features:[ct([{provide:yG,useExisting:t}]),et],ngContentSelectors:azA,decls:1,vars:0,template:function(i,n){i&1&&(Yt(),xe(0))},styles:[czA],encapsulation:2,changeDetection:0})}return t})(),AcA=(()=>{class t extends mzA{_lines;_titles;_meta;_unscopedContent;_itemText;get activated(){return this._activated}set activated(A){this._activated=Yo(A)}_activated=!1;_getAriaCurrent(){return this._hostElement.nodeName==="A"&&this._activated?"page":null}_hasBothLeadingAndTrailing(){return this._meta.length!==0&&(this._avatars.length!==0||this._icons.length!==0)}static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275cmp=YA({type:t,selectors:[["mat-list-item"],["a","mat-list-item",""],["button","mat-list-item",""]],contentQueries:function(i,n,o){if(i&1&&(Ii(o,EzA,5),Ii(o,BzA,5),Ii(o,hzA,5)),i&2){let r;$A(r=Ae())&&(n._lines=r),$A(r=Ae())&&(n._titles=r),$A(r=Ae())&&(n._meta=r)}},viewQuery:function(i,n){if(i&1&&(Ge(lzA,5),Ge(gzA,5)),i&2){let o;$A(o=Ae())&&(n._unscopedContent=o.first),$A(o=Ae())&&(n._itemText=o.first)}},hostAttrs:[1,"mat-mdc-list-item","mdc-list-item"],hostVars:13,hostBindings:function(i,n){i&2&&(_e("aria-current",n._getAriaCurrent()),ue("mdc-list-item--activated",n.activated)("mdc-list-item--with-leading-avatar",n._avatars.length!==0)("mdc-list-item--with-leading-icon",n._icons.length!==0)("mdc-list-item--with-trailing-meta",n._meta.length!==0)("mat-mdc-list-item-both-leading-and-trailing",n._hasBothLeadingAndTrailing())("_mat-animation-noopable",n._noopAnimations))},inputs:{activated:"activated"},exportAs:["matListItem"],features:[et],ngContentSelectors:CzA,decls:10,vars:0,consts:[["unscopedContent",""],[1,"mdc-list-item__content"],[1,"mat-mdc-list-item-unscoped-content",3,"cdkObserveContent"],[1,"mat-focus-indicator"]],template:function(i,n){if(i&1){let o=De();Yt(IzA),xe(0),S(1,"span",1),xe(2,1),xe(3,2),S(4,"span",2,0),mA("cdkObserveContent",function(){return LA(o),xA(n._updateItemLines(!0))}),xe(6,3),R()(),xe(7,4),xe(8,5),UA(9,"div",3)}},dependencies:[N6],encapsulation:2,changeDetection:0})}return t})();var ecA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[gB,Ve,Xa,ck,WaA]})}return t})();var wzA=["button"],DzA=["*"];function yzA(t,e){if(t&1&&(S(0,"div",2),UA(1,"mat-pseudo-checkbox",6),R()),t&2){let A=P();_(),vA("disabled",A.disabled)}}var tcA=new BA("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:vzA});function vzA(){return{hideSingleSelectionIndicator:!1,hideMultipleSelectionIndicator:!1,disabledInteractive:!1}}var icA=new BA("MatButtonToggleGroup"),bzA={provide:uc,useExisting:nr(()=>vG),multi:!0},Hy=class{source;value;constructor(e,A){this.source=e,this.value=A}},vG=(()=>{class t{_changeDetector=m(lt);_dir=m(bo,{optional:!0});_multiple=!1;_disabled=!1;_disabledInteractive=!1;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(A){this._name=A,this._markButtonsForCheck()}_name=m($i).getId("mat-button-toggle-group-");vertical;get value(){let A=this._selectionModel?this._selectionModel.selected:[];return this.multiple?A.map(i=>i.value):A[0]?A[0].value:void 0}set value(A){this._setSelectionByValue(A),this.valueChange.emit(this.value)}valueChange=new XA;get selected(){let A=this._selectionModel?this._selectionModel.selected:[];return this.multiple?A:A[0]||null}get multiple(){return this._multiple}set multiple(A){this._multiple=A,this._markButtonsForCheck()}get disabled(){return this._disabled}set disabled(A){this._disabled=A,this._markButtonsForCheck()}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(A){this._disabledInteractive=A,this._markButtonsForCheck()}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new XA;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(A){this._hideSingleSelectionIndicator=A,this._markButtonsForCheck()}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(A){this._hideMultipleSelectionIndicator=A,this._markButtonsForCheck()}_hideMultipleSelectionIndicator;constructor(){let A=m(tcA,{optional:!0});this.appearance=A&&A.appearance?A.appearance:"standard",this.hideSingleSelectionIndicator=A?.hideSingleSelectionIndicator??!1,this.hideMultipleSelectionIndicator=A?.hideMultipleSelectionIndicator??!1}ngOnInit(){this._selectionModel=new F2(this.multiple,void 0,!1)}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(A=>A.checked)),this.multiple||this._initializeTabIndex()}writeValue(A){this.value=A,this._changeDetector.markForCheck()}registerOnChange(A){this._controlValueAccessorChangeFn=A}registerOnTouched(A){this._onTouched=A}setDisabledState(A){this.disabled=A}_keydown(A){if(this.multiple||this.disabled)return;let n=A.target.id,o=this._buttonToggles.toArray().findIndex(s=>s.buttonId===n),r=null;switch(A.keyCode){case 32:case 13:r=this._buttonToggles.get(o)||null;break;case 38:r=this._getNextButton(o,-1);break;case 37:r=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:r=this._getNextButton(o,1);break;case 39:r=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}r&&(A.preventDefault(),r._onButtonClick(),r.focus())}_emitChangeEvent(A){let i=new Hy(A,this.value);this._rawValue=i.value,this._controlValueAccessorChangeFn(i.value),this.change.emit(i)}_syncButtonToggle(A,i,n=!1,o=!1){!this.multiple&&this.selected&&!A.checked&&(this.selected.checked=!1),this._selectionModel?i?this._selectionModel.select(A):this._selectionModel.deselect(A):o=!0,o?Promise.resolve().then(()=>this._updateModelValue(A,n)):this._updateModelValue(A,n)}_isSelected(A){return this._selectionModel&&this._selectionModel.isSelected(A)}_isPrechecked(A){return typeof this._rawValue>"u"?!1:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(i=>A.value!=null&&i===A.value):A.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(A=>{A.tabIndex=-1}),this.selected)this.selected.tabIndex=0;else for(let A=0;Athis._selectValue(n,i))):(this._clearSelection(),this._selectValue(A,i)),!this.multiple&&i.every(n=>n.tabIndex===-1)){for(let n of i)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(A=>{A.checked=!1,this.multiple||(A.tabIndex=-1)})}_selectValue(A,i){for(let n of i)if(n.value===A){n.checked=!0,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(A,i){i&&this._emitChangeEvent(A),this.valueChange.emit(this.value)}_markButtonsForCheck(){this._buttonToggles?.forEach(A=>A._markForCheck())}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["mat-button-toggle-group"]],contentQueries:function(i,n,o){if(i&1&&Ii(o,Oy,5),i&2){let r;$A(r=Ae())&&(n._buttonToggles=r)}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(i,n){i&1&&mA("keydown",function(r){return n._keydown(r)}),i&2&&(_e("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),ue("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"))},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",ae],value:"value",multiple:[2,"multiple","multiple",ae],disabled:[2,"disabled","disabled",ae],disabledInteractive:[2,"disabledInteractive","disabledInteractive",ae],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",ae],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",ae]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[ct([bzA,{provide:icA,useExisting:t}])]})}return t})(),Oy=(()=>{class t{_changeDetectorRef=m(lt);_elementRef=m(te);_focusMonitor=m(Jr);_idGenerator=m($i);_animationMode=m(mi,{optional:!0});_checked=!1;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return`${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex}set tabIndex(A){A!==this._tabIndex&&(this._tabIndex=A,this._markForCheck())}_tabIndex;disableRipple;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(A){this._appearance=A}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(A){A!==this._checked&&(this._checked=A,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck())}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(A){this._disabled=A}_disabled=!1;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(A){this._disabledInteractive=A}_disabledInteractive;change=new XA;constructor(){m(Ln).load(Qr);let A=m(icA,{optional:!0}),i=m(new Er("tabindex"),{optional:!0})||"",n=m(tcA,{optional:!0});this._tabIndex=parseInt(i)||0,this.buttonToggleGroup=A,this.appearance=n&&n.appearance?n.appearance:"standard",this.disabledInteractive=n?.disabledInteractive??!1}ngOnInit(){let A=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),A&&(A._isPrechecked(this)?this.checked=!0:A._isSelected(this)!==this._checked&&A._syncButtonToggle(this,this._checked))}ngAfterViewInit(){this._animationMode!=="NoopAnimations"&&this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,!0)}ngOnDestroy(){let A=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),A&&A._isSelected(this)&&A._syncButtonToggle(this,!1,!1,!0)}focus(A){this._buttonElement.nativeElement.focus(A)}_onButtonClick(){if(this.disabled)return;let A=this.isSingleSelector()?!0:!this._checked;if(A!==this._checked&&(this._checked=A,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,!0),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let i=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);i&&(i.tabIndex=-1),this.tabIndex=0}this.change.emit(new Hy(this,this.value))}_markForCheck(){this._changeDetectorRef.markForCheck()}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-button-toggle"]],viewQuery:function(i,n){if(i&1&&Ge(wzA,5),i&2){let o;$A(o=Ae())&&(n._buttonElement=o.first)}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(i,n){i&1&&mA("focus",function(){return n.focus()}),i&2&&(_e("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),ue("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"))},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",ae],appearance:"appearance",checked:[2,"checked","checked",ae],disabled:[2,"disabled","disabled",ae],disabledInteractive:[2,"disabledInteractive","disabledInteractive",ae]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:DzA,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"button",1,0),mA("click",function(){return LA(o),xA(n._onButtonClick())}),NA(2,yzA,2,1,"div",2),S(3,"span",3),xe(4),R()(),UA(5,"span",4)(6,"span",5)}if(i&2){let o=or(1);vA("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),_e("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),_(2),FA(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),_(4),vA("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled)}},dependencies:[Gs,ak],styles:[".mat-button-toggle-standalone,.mat-button-toggle-group{position:relative;display:inline-flex;flex-direction:row;white-space:nowrap;overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);transform:translateZ(0);border-radius:var(--mat-legacy-button-toggle-shape)}.mat-button-toggle-standalone:not([class*=mat-elevation-z]),.mat-button-toggle-group:not([class*=mat-elevation-z]){box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}@media(forced-colors: active){.mat-button-toggle-standalone,.mat-button-toggle-group{outline:solid 1px}}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border:solid 1px var(--mat-standard-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard .mat-pseudo-checkbox,.mat-button-toggle-group-appearance-standard .mat-pseudo-checkbox{--mat-minimal-pseudo-checkbox-selected-checkmark-color: var(--mat-standard-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard:not([class*=mat-elevation-z]),.mat-button-toggle-group-appearance-standard:not([class*=mat-elevation-z]){box-shadow:none}@media(forced-colors: active){.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{outline:0}}.mat-button-toggle-vertical{flex-direction:column}.mat-button-toggle-vertical .mat-button-toggle-label-content{display:block}.mat-button-toggle{white-space:nowrap;position:relative;color:var(--mat-legacy-button-toggle-text-color);font-family:var(--mat-legacy-button-toggle-label-text-font);font-size:var(--mat-legacy-button-toggle-label-text-size);line-height:var(--mat-legacy-button-toggle-label-text-line-height);font-weight:var(--mat-legacy-button-toggle-label-text-weight);letter-spacing:var(--mat-legacy-button-toggle-label-text-tracking);--mat-minimal-pseudo-checkbox-selected-checkmark-color: var(--mat-legacy-button-toggle-selected-state-text-color)}.mat-button-toggle.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-legacy-button-toggle-focus-state-layer-opacity)}.mat-button-toggle .mat-icon svg{vertical-align:top}.mat-button-toggle-checkbox-wrapper{display:inline-block;justify-content:flex-start;align-items:center;width:0;height:18px;line-height:18px;overflow:hidden;box-sizing:border-box;position:absolute;top:50%;left:16px;transform:translate3d(0, -50%, 0)}[dir=rtl] .mat-button-toggle-checkbox-wrapper{left:auto;right:16px}.mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:12px}[dir=rtl] .mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:auto;right:12px}.mat-button-toggle-checked .mat-button-toggle-checkbox-wrapper{width:18px}.mat-button-toggle-animations-enabled .mat-button-toggle-checkbox-wrapper{transition:width 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-checkbox-wrapper{transition:none}.mat-button-toggle-checked{color:var(--mat-legacy-button-toggle-selected-state-text-color);background-color:var(--mat-legacy-button-toggle-selected-state-background-color)}.mat-button-toggle-disabled{pointer-events:none;color:var(--mat-legacy-button-toggle-disabled-state-text-color);background-color:var(--mat-legacy-button-toggle-disabled-state-background-color);--mat-minimal-pseudo-checkbox-disabled-selected-checkmark-color: var(--mat-legacy-button-toggle-disabled-state-text-color)}.mat-button-toggle-disabled.mat-button-toggle-checked{background-color:var(--mat-legacy-button-toggle-disabled-selected-state-background-color)}.mat-button-toggle-disabled-interactive{pointer-events:auto}.mat-button-toggle-appearance-standard{color:var(--mat-standard-button-toggle-text-color, var(--mat-sys-on-surface));background-color:var(--mat-standard-button-toggle-background-color, transparent);font-family:var(--mat-standard-button-toggle-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-standard-button-toggle-label-text-size, var(--mat-sys-label-large-size));line-height:var(--mat-standard-button-toggle-label-text-line-height, var(--mat-sys-label-large-line-height));font-weight:var(--mat-standard-button-toggle-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-standard-button-toggle-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:solid 1px var(--mat-standard-button-toggle-divider-color, var(--mat-sys-outline))}[dir=rtl] .mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:solid 1px var(--mat-standard-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:none;border-top:solid 1px var(--mat-standard-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-appearance-standard.mat-button-toggle-checked{color:var(--mat-standard-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container));background-color:var(--mat-standard-button-toggle-selected-state-background-color, var(--mat-sys-secondary-container))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled{color:var(--mat-standard-button-toggle-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-standard-button-toggle-disabled-state-background-color, transparent)}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled .mat-pseudo-checkbox{--mat-minimal-pseudo-checkbox-disabled-selected-checkmark-color: var(--mat-standard-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled.mat-button-toggle-checked{color:var(--mat-standard-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-standard-button-toggle-disabled-selected-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{background-color:var(--mat-standard-button-toggle-state-layer-color, var(--mat-sys-on-surface))}.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{opacity:var(--mat-standard-button-toggle-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-button-toggle-appearance-standard.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-standard-button-toggle-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}@media(hover: none){.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{display:none}}.mat-button-toggle-label-content{-webkit-user-select:none;user-select:none;display:inline-block;padding:0 16px;line-height:var(--mat-legacy-button-toggle-height);position:relative}.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{padding:0 12px;line-height:var(--mat-standard-button-toggle-height, 40px)}.mat-button-toggle-label-content>*{vertical-align:middle}.mat-button-toggle-focus-overlay{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit;pointer-events:none;opacity:0;background-color:var(--mat-legacy-button-toggle-state-layer-color)}@media(forced-colors: active){.mat-button-toggle-checked .mat-button-toggle-focus-overlay{border-bottom:solid 500px;opacity:.5;height:0}.mat-button-toggle-checked:hover .mat-button-toggle-focus-overlay{opacity:.6}.mat-button-toggle-checked.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{border-bottom:solid 500px}}.mat-button-toggle .mat-button-toggle-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-button-toggle-button{border:0;background:none;color:inherit;padding:0;margin:0;font:inherit;outline:none;width:100%;cursor:pointer}.mat-button-toggle-animations-enabled .mat-button-toggle-button{transition:padding 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-button{transition:none}.mat-button-toggle-disabled .mat-button-toggle-button{cursor:default}.mat-button-toggle-button::-moz-focus-inner{border:0}.mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:30px}[dir=rtl] .mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:0;padding-right:30px}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard{--mat-focus-indicator-border-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border-bottom-right-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-left-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border-bottom-left-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-bottom-right-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border-bottom-left-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full));border-top-left-radius:var(--mat-standard-button-toggle-shape, var(--mat-sys-corner-full))}"],encapsulation:2,changeDetection:0})}return t})(),ncA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Xa,Oy,Ve]})}return t})();function kzA(t,e){t&1&&(S(0,"p"),tA(1,"Conversations"),R())}function SzA(t,e){t&1&&(S(0,"p"),tA(1,"Trace"),R())}function RzA(t,e){if(t&1){let A=De();S(0,"mat-button-toggle-group",5),ta("ngModelChange",function(n){LA(A);let o=P(2);return Ja(o.view,n)||(o.view=n),xA(n)}),S(1,"mat-button-toggle",6),tA(2,"Events"),R(),S(3,"mat-button-toggle",7),tA(4,"Trace"),R()()}if(t&2){let A=P(2);ea("ngModel",A.view)}}function LzA(t,e){if(t&1){let A=De();S(0,"mat-list-item",8),mA("click",function(){let n=LA(A).$implicit,o=P(3);return xA(o.selectEvent(n.key))}),S(1,"span",9),tA(2),R(),S(3,"span",10),tA(4),R()()}if(t&2){let A=e.$implicit,i=e.$index;_(2),Mt(i),_(2),Mt(A.value.title)}}function xzA(t,e){if(t&1&&(S(0,"mat-list",4),ln(1,LzA,5,2,"mat-list-item",null,Kn),Ta(3,"keyvalue"),R()),t&2){let A=P(2);_(),gn(uQ(3,0,A.eventsMap,A.mapOrderPreservingSort))}}function FzA(t,e){if(t&1){let A=De();S(0,"mat-list-item",8),mA("click",function(){let n=LA(A).$implicit,o=P(3);return xA(o.openDialog(n.key))}),S(1,"span",9),tA(2),R(),S(3,"span"),tA(4),R()()}if(t&2){let A=e.$implicit,i=e.$index,n=P(3);_(2),Mt(i),_(2),ot("Invocation ",n.findInvocIdFromTraceId(A.key),"")}}function NzA(t,e){if(t&1&&(S(0,"mat-list",4),ln(1,FzA,5,2,"mat-list-item",null,Kn),Ta(3,"keyvalue"),R()),t&2){let A=P(2);_(),gn(uQ(3,0,A.invocTraces,A.mapOrderPreservingSort))}}function _zA(t,e){if(t&1&&(S(0,"div",1)(1,"div",2),NA(2,kzA,2,0,"p")(3,SzA,2,0,"p")(4,RzA,5,1,"mat-button-toggle-group",3),R(),NA(5,xzA,4,3,"mat-list",4)(6,NzA,4,3,"mat-list",4),R()),t&2){let A=P();_(2),FA(A.isTraceView()?-1:2),_(),FA(A.isTraceView()?3:-1),_(),FA(A.traceData?4:-1),_(),FA(A.isTraceView()?-1:5),_(),FA(A.isTraceView()?6:-1)}}function GzA(t,e){t&1&&(S(0,"div")(1,"p"),tA(2,"No conversations"),R()())}var jC=class t{constructor(e){this.dialog=e}eventsMap=new Map;selectedEvent=new XA;traceData=[];llmRequest=void 0;llmResponse=void 0;llmRequestKey="gcp.vertex.agent.llm_request";llmResponseKey="gcp.vertex.agent.llm_response";isDetailsPanelOpen=!1;view="events";invocTraces=new Map;ngOnChanges(e){"traceData"in e&&this.prcessTraceDataToInvocTrace()}showJson=Array(this.eventsMap.size).fill(!1);toggleJson(e){this.showJson[e]=!this.showJson[e]}selectEvent(e){this.selectedEvent.emit(e)}isTraceView(){return this.view=="trace"}mapOrderPreservingSort=(e,A)=>0;prcessTraceDataToInvocTrace(){!this.traceData||this.traceData.length==0||(this.invocTraces=this.traceData.reduce((e,A)=>{let i=A.trace_id,n=e.get(i);return n?(n.push(A),n.sort((o,r)=>o.start_time-r.start_time)):e.set(i,[A]),e},new Map))}findInvocIdFromTraceId(e){return this.invocTraces.get(e)?.find(i=>i.attributes!==void 0&&"gcp.vertex.agent.invocation_id"in i.attributes).attributes["gcp.vertex.agent.invocation_id"]}openDialog(e){let A=this.dialog.open(of,{width:"auto",maxWidth:"90vw",data:{spans:this.invocTraces.get(e),invocId:this.findInvocIdFromTraceId(e)}})}static \u0275fac=function(A){return new(A||t)(zA(Us))};static \u0275cmp=YA({type:t,selectors:[["app-event-tab"]],inputs:{eventsMap:"eventsMap",traceData:"traceData"},outputs:{selectedEvent:"selectedEvent"},standalone:!1,features:[Kt],decls:3,vars:2,consts:[[1,"events-wrapper"],[1,"events-container"],[1,"event-header"],["name","fontStyle","aria-label","Font Style",2,"scale","0.8",3,"ngModel"],[1,"event-list"],["name","fontStyle","aria-label","Font Style",2,"scale","0.8",3,"ngModelChange","ngModel"],["value","events"],["value","trace"],[3,"click"],[1,"event-index"],[1,"event-title"]],template:function(A,i){A&1&&(S(0,"div",0),NA(1,_zA,7,5,"div",1)(2,GzA,3,0,"div"),R()),A&2&&(_(),FA(i.eventsMap.size>0?1:-1),_(),FA(i.eventsMap.size==0?2:-1))},dependencies:[na,ja,$aA,AcA,vG,Oy,MQ],styles:[".events-wrapper[_ngcontent-%COMP%]{padding-left:25px;padding-right:25px;color:#9aa0a6;font-size:14px;font-weight:700}.event-index[_ngcontent-%COMP%]{color:#80868b;font-family:Roboto;font-size:14px;font-style:normal;font-weight:400;margin-right:10px}.event-title[_ngcontent-%COMP%]{font-family:Google Sans Mono,monospace}.spacer[_ngcontent-%COMP%]{flex:1 1 auto}.events-container[_ngcontent-%COMP%]{margin-top:20px}.event-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;margin-top:20px}.function-event-button[_ngcontent-%COMP%]{margin-top:11px}.event-list[_ngcontent-%COMP%]{--mat-list-active-indicator-color: orange}.event-list[_ngcontent-%COMP%]{--mdc-list-list-item-container-color: #2b2b2f}.event-list[_ngcontent-%COMP%]{--mdc-list-list-item-label-text-size: 14px}.event-list[_ngcontent-%COMP%]{--mdc-list-list-item-label-text-weight: 400}.event-list[_ngcontent-%COMP%]{--mdc-list-list-item-one-line-container-height: 52px}[_nghost-%COMP%] .mdc-list-item{border:1px solid #5f6368;cursor:pointer}[_nghost-%COMP%] .mdc-list-item:hover{background-color:#1c1b1c}.event-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"]})};function KzA(t,e){t&1&&(S(0,"h2",0),tA(1,"Events List"),R())}function YzA(t,e){t&1&&(S(0,"h2",0),tA(1,"Send Response To Pending Event"),R())}function JzA(t,e){t&1&&(S(0,"h2",4),tA(1,"Events List"),R())}function TzA(t,e){t&1&&(S(0,"h2",4),tA(1,"Send Response To Pending Event"),R())}function zzA(t,e){if(t&1){let A=De();S(0,"div")(1,"p"),tA(2,"Name"),R(),S(3,"p"),tA(4),R(),S(5,"p"),tA(6,"Args"),R(),S(7,"p"),tA(8),R(),S(9,"mat-form-field",5)(10,"mat-label"),tA(11,"Response"),R(),S(12,"textarea",6),ta("ngModelChange",function(n){LA(A);let o=P();return Ja(o.selectedEvent.response,n)||(o.selectedEvent.response=n),xA(n)}),R()()()}if(t&2){let A=P();_(4),Mt(A.selectedEvent.name),_(4),Mt(A.argsToJson(A.selectedEvent.args)),_(4),ea("ngModel",A.selectedEvent.response)}}function HzA(t,e){if(t&1){let A=De();S(0,"button",7),mA("click",function(){LA(A);let n=P();return xA(n.sendResponse())}),tA(1),R()}if(t&2){let A=P();vA("disabled",A.sending),_(),ot(" ",A.sending?"Sending...":"Send"," ")}}var rf=class t{constructor(e,A,i){this.dialogRef=e;this.data=A;this.agentService=i;this.selectedEvent=A.event,this.appName=A.appName,this.userId=A.userId,this.sessionId=A.sessionId,this.functionCallEventId=A.functionCallEventId}selectedEvent=null;appName;userId;sessionId;functionCallEventId;sending=!1;response=[];argsToJson(e){return JSON.stringify(e)}sendResponse(){this.sending=!0;let e={appName:this.appName,userId:this.userId,sessionId:this.sessionId,newMessage:{role:"user",parts:[]}};this.selectedEvent.response&&(e.functionCallEventId=this.functionCallEventId,e.newMessage.parts.push({function_response:{id:this.selectedEvent.id,name:this.selectedEvent.name,response:{response:this.selectedEvent.response}}})),this.agentService.runSse(e).subscribe({next:A=>_n(this,null,function*(){let i=JSON.parse(A);this.response.push(i)}),error:A=>console.error("SSE error:",A),complete:()=>{this.sending=!1,this.dialogRef.close({response:this.response,events:[this.selectedEvent]})}})}static \u0275fac=function(A){return new(A||t)(zA(cr),zA($r),zA(K2))};static \u0275cmp=YA({type:t,selectors:[["app-pending-event-dialog"]],standalone:!1,decls:10,vars:6,consts:[["mat-dialog-title",""],["mat-dialog-title","","class","dialog-title",4,"ngIf"],["mat-button","",3,"disabled"],["mat-button","","mat-dialog-close",""],["mat-dialog-title","",1,"dialog-title"],["appearance","outline",1,"response-textarea"],["matInput","",3,"ngModelChange","ngModel"],["mat-button","",3,"click","disabled"]],template:function(A,i){A&1&&(NA(0,KzA,2,0,"h2",0)(1,YzA,2,0,"h2",0)(2,JzA,2,0,"h2",1)(3,TzA,2,0,"h2",1),S(4,"mat-dialog-content"),NA(5,zzA,13,3,"div"),R(),S(6,"mat-dialog-actions"),NA(7,HzA,2,2,"button",2),S(8,"button",3),tA(9,"Close"),R()()),A&2&&(FA(i.selectedEvent?-1:0),_(),FA(i.selectedEvent?1:-1),_(),vA("ngIf",!i.selectedEvent),_(),vA("ngIf",i.selectedEvent),_(2),FA(i.selectedEvent?5:-1),_(2),FA(i.selectedEvent&&i.selectedEvent.response?7:-1))},dependencies:[DQ,fc,na,ja,lg,r8,P1,ur,hs,ga,Ia,gg],styles:[".response-textarea[_ngcontent-%COMP%]{min-width:500px;margin-top:15px}.dialog-title[_ngcontent-%COMP%]{font-weight:700;font-size:large}"]})};var dh=class t{constructor(e,A){this.dialogRef=e;this.data=A}onConfirm(){this.dialogRef.close(!0)}onCancel(){this.dialogRef.close(!1)}static \u0275fac=function(A){return new(A||t)(zA(cr),zA($r))};static \u0275cmp=YA({type:t,selectors:[["app-delete-session-dialog"]],standalone:!1,decls:11,vars:4,consts:[[1,"confirm-delete-wrapper"],["mat-dialog-title",""],["align","end"],["mat-button","",3,"click"],["mat-button","","cdkFocusInitial","",3,"click"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"h2",1),tA(2),R(),S(3,"mat-dialog-content")(4,"p"),tA(5),R()(),S(6,"mat-dialog-actions",2)(7,"button",3),mA("click",function(){return i.onCancel()}),tA(8),R(),S(9,"button",4),mA("click",function(){return i.onConfirm()}),tA(10),R()()()),A&2&&(_(2),Mt(i.data.title),_(3),Mt(i.data.message),_(3),Mt(i.data.cancelButtonText),_(2),Mt(i.data.confirmButtonText))},dependencies:[ur,hs,ga,Ia],encapsulation:2})};function OzA(t,e){if(t&1){let A=De();S(0,"div",3),mA("click",function(){let n=LA(A).$implicit,o=P();return xA(o.getSession(n.id))}),S(1,"div",4)(2,"div",5),tA(3),R(),S(4,"div",6),tA(5),R()()()}if(t&2){let A=e.$implicit,i=P();vA("ngClass",A.id===i.sessionId?"session-item current":"session-item"),_(3),ot(" ",A.id," "),_(2),ot(" ",i.getDate(A)," ")}}var qC=class t{constructor(e,A){this.sessionService=e;this.dialog=A;this.refreshSessionsSubject.pipe(no(()=>this.sessionService.listSessions(this.userId,this.appName))).subscribe(i=>{i=i.sort((n,o)=>Number(o.lastUpdateTime)-Number(n.lastUpdateTime)),this.sessionList=i})}userId="";appName="";sessionId="";sessionSelected=new XA;sessionReloaded=new XA;sessionList=[];refreshSessionsSubject=new HA;ngOnInit(){setTimeout(()=>{this.refreshSessionsSubject.next()},500)}getSession(e){this.sessionService.getSession(this.userId,this.appName,e).subscribe(A=>{let i=this.fromApiResultToSession(A);this.sessionSelected.emit(i)})}getDate(e){let A=e.lastUpdateTime;return new Date(A*1e3).toLocaleString()}fromApiResultToSession(e){return{id:e?.id??"",appName:e?.appName??"",userId:e?.userId??"",state:e?.state??[],events:e?.events??[]}}reloadSession(e){this.sessionService.getSession(this.userId,this.appName,e).subscribe(A=>{let i=this.fromApiResultToSession(A);this.sessionReloaded.emit(i)})}refreshSession(e){if(this.refreshSessionsSubject.next(),!(this.sessionList.length<=1)){let A=this.sessionList.findIndex(i=>i.id==e);return A==this.sessionList.length-1&&(A=-1),this.sessionList[A+1]}}static \u0275fac=function(A){return new(A||t)(zA(Jg),zA(Us))};static \u0275cmp=YA({type:t,selectors:[["app-session-tab"]],inputs:{userId:"userId",appName:"appName",sessionId:"sessionId"},outputs:{sessionSelected:"sessionSelected",sessionReloaded:"sessionReloaded"},standalone:!1,decls:4,vars:0,consts:[[1,"session-wrapper"],[1,"session-tab-container",2,"margin-top","16px"],[3,"ngClass"],[3,"click","ngClass"],[1,"session-info"],[1,"session-id"],[1,"session-date"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"div",1),ln(2,OzA,6,3,"div",2,Kn),R()()),A&2&&(_(2),gn(i.sessionList))},dependencies:[Ha],styles:[".session-wrapper[_ngcontent-%COMP%]{padding-left:25px;padding-right:25px;color:#9aa0a6;font-size:14px;font-weight:700}.session-item[_ngcontent-%COMP%]{display:flex;justify-content:space-between;border:none;background-color:#303030;border-radius:8px;margin-bottom:4px;cursor:pointer}.session-item[_ngcontent-%COMP%]:hover{background-color:#141414}.session-item.current[_ngcontent-%COMP%]{background-color:#004a77}.session-id[_ngcontent-%COMP%]{color:#e8eaed;font-family:Google Sans Mono,monospace;font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:.25px}.session-date[_ngcontent-%COMP%]{color:#9aa0a6;font-family:Roboto;font-size:12px;font-style:normal;font-weight:400;line-height:16px;letter-spacing:.3px}.session-info[_ngcontent-%COMP%]{padding:11px}"]})};var Bh=class t{constructor(e){this.http=e}apiServerDomain=Es.getApiServerBaseUrl();getLatestArtifact(e,A,i,n){let o=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}/artifacts/${n}`;return this.http.get(o)}getArtifactVersion(e,A,i,n,o){let r=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}/artifacts/${n}/versions/${o}`;return this.http.get(r)}static \u0275fac=function(A){return new(A||t)(he(Bs))};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var qzA={url:"",deserializer:t=>JSON.parse(t.data),serializer:t=>JSON.stringify(t)},VzA="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",sf=class t extends cd{constructor(e,A){if(super(),this._socket=null,e instanceof Ze)this.destination=A,this.source=e;else{let i=this._config=Object.assign({},qzA);if(this._output=new HA,typeof e=="string")i.url=e;else for(let n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);if(!i.WebSocketCtor&&WebSocket)i.WebSocketCtor=WebSocket;else if(!i.WebSocketCtor)throw new Error("no WebSocket constructor can be found");this.destination=new qc}}lift(e){let A=new t(this._config,this.destination);return A.operator=e,A.source=this,A}_resetState(){this._socket=null,this.source||(this.destination=new qc),this._output=new HA}multiplex(e,A,i){let n=this;return new Ze(o=>{try{n.next(e())}catch(s){o.error(s)}let r=n.subscribe({next:s=>{try{i(s)&&o.next(s)}catch(a){o.error(a)}},error:s=>o.error(s),complete:()=>o.complete()});return()=>{try{n.next(A())}catch(s){o.error(s)}r.unsubscribe()}})}_connectSocket(){let{WebSocketCtor:e,protocol:A,url:i,binaryType:n}=this._config,o=this._output,r=null;try{r=A?new e(i,A):new e(i),this._socket=r,n&&(this._socket.binaryType=n)}catch(a){o.error(a);return}let s=new _t(()=>{this._socket=null,r&&r.readyState===1&&r.close()});r.onopen=a=>{let{_socket:c}=this;if(!c){r.close(),this._resetState();return}let{openObserver:l}=this._config;l&&l.next(a);let I=this.destination;this.destination=Zg.create(C=>{if(r.readyState===1)try{let{serializer:d}=this._config;r.send(d(C))}catch(d){this.destination.error(d)}},C=>{let{closingObserver:d}=this._config;d&&d.next(void 0),C&&C.code?r.close(C.code,C.reason):o.error(new TypeError(VzA)),this._resetState()},()=>{let{closingObserver:C}=this._config;C&&C.next(void 0),r.close(),this._resetState()}),I&&I instanceof qc&&s.add(I.subscribe(this.destination))},r.onerror=a=>{this._resetState(),o.error(a)},r.onclose=a=>{r===this._socket&&this._resetState();let{closeObserver:c}=this._config;c&&c.next(a),a.wasClean?o.complete():o.error(a)},r.onmessage=a=>{try{let{deserializer:c}=this._config;o.next(c(a))}catch(c){o.error(c)}}}_subscribe(e){let{source:A}=this;return A?A.subscribe(e):(this._socket||this._connectSocket(),this._output.subscribe(e),e.add(()=>{let{_socket:i}=this;this._output.observers.length===0&&(i&&(i.readyState===1||i.readyState===0)&&i.close(),this._resetState())}),e)}unsubscribe(){let{_socket:e}=this;e&&(e.readyState===1||e.readyState===0)&&e.close(),this._resetState(),super.unsubscribe()}};var Tg=class t{socket$;messages$=new li("");audioContext=new AudioContext({sampleRate:22e3});audioBuffer=[];audioIntervalId=null;lastAudioTime=0;closeReasonSubject=new HA;constructor(){}connect(e){this.socket$=new sf({url:e,serializer:A=>JSON.stringify(A),deserializer:A=>A.data,closeObserver:{next:A=>{this.emitWsCloseReason(A.reason)}}}),this.socket$.subscribe(A=>{this.handleIncomingAudio(A),this.messages$.next(A)},A=>{console.error("WebSocket error:",A)}),this.audioIntervalId=setInterval(()=>this.processBufferedAudio(),250)}sendMessage(e){if(e.blob.data=this.arrayBufferToBase64(e.blob.data.buffer),!this.socket$||this.socket$.closed){console.error("WebSocket is not open.");return}this.socket$.next(e)}closeConnection(){clearInterval(this.audioIntervalId),this.audioIntervalId=null,this.socket$&&this.socket$.complete()}getMessages(){return this.messages$.asObservable()}arrayBufferToBase64(e){let A="",i=new Uint8Array(e),n=i.byteLength;for(let o=0;on+o.length,0),A=new Uint8Array(e),i=0;for(let n of this.audioBuffer)A.set(n,i),i+=n.length;this.playPCM(A),this.audioBuffer=[]}base64ToUint8Array(e){let A=atob(this.urlSafeBase64ToBase64(e)),i=A.length,n=new Uint8Array(i);for(let o=0;o=32768&&(a-=65536),A[s]=a/32768}let i=this.audioContext.createBuffer(1,A.length,22e3);i.copyToChannel(A,0);let n=this.audioContext.createBufferSource();n.buffer=i,n.connect(this.audioContext.destination);let o=this.audioContext.currentTime,r=Math.max(this.lastAudioTime,o);n.start(r),this.lastAudioTime=r+i.duration}urlSafeBase64ToBase64(e){let A=e.replace(/_/g,"/").replace(/-/g,"+");for(;A.length%4!==0;)A+="=";return A}emitWsCloseReason(e){this.closeReasonSubject.next(e)}onCloseReason(){return this.closeReasonSubject.asObservable()}static \u0275fac=function(A){return new(A||t)};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var Eh=class t{constructor(e){this.wsService=e}mediaRecorder;stream;audioContext;source;processor;audioBuffer=[];audioIntervalId=null;startRecording(){return _n(this,null,function*(){try{this.stream=yield navigator.mediaDevices.getUserMedia({audio:!0}),this.audioContext=new AudioContext,yield this.audioContext.audioWorklet.addModule("./assets/audio-processor.js"),this.source=this.audioContext.createMediaStreamSource(this.stream);let e=new AudioWorkletNode(this.audioContext,"audio-processor");e.port.onmessage=A=>{let i=A.data,n=this.float32ToPCM(i);this.audioBuffer.push(n)},this.source.connect(e),e.connect(this.audioContext.destination),this.audioIntervalId=setInterval(()=>this.sendBufferedAudio(),250)}catch(e){console.error("Error accessing microphone:",e)}})}sendBufferedAudio(){if(this.audioBuffer.length===0)return;let e=this.audioBuffer.reduce((o,r)=>o+r.length,0),A=new Uint8Array(e),i=0;for(let o of this.audioBuffer)A.set(o,i),i+=o.length;let n={blob:{mime_type:"audio/pcm",data:A}};this.wsService.sendMessage(n),this.audioBuffer=[]}stopRecording(){this.processor&&this.processor.disconnect(),this.source&&this.source.disconnect(),this.audioContext&&this.audioContext.close(),this.stream&&this.stream.getTracks().forEach(e=>e.stop()),this.audioIntervalId&&(clearInterval(this.audioIntervalId),this.audioIntervalId=null)}float32ToPCM(e){let A=new ArrayBuffer(e.length*2),i=new DataView(A);for(let n=0;nthis.captureAndSendFrame(),1e3)}catch(A){console.error("Error accessing camera/microphone:",A)}})}captureAndSendFrame(){return _n(this,null,function*(){try{let e=yield this.captureFrame(),i={blob:{mime_type:"image/jpeg",data:yield this.blobToUint8Array(e)}};this.wsService.sendMessage(i)}catch(e){console.error("Error capturing frame:",e)}})}blobToUint8Array(e){return _n(this,null,function*(){let A=yield e.arrayBuffer();return new Uint8Array(A)})}captureFrame(){return _n(this,null,function*(){return new Promise((e,A)=>{try{let i=document.createElement("canvas");i.width=this.videoElement.videoWidth,i.height=this.videoElement.videoHeight;let n=i.getContext("2d");if(!n){A(new Error("Canvas context not supported"));return}n.drawImage(this.videoElement,0,0,i.width,i.height),i.toBlob(o=>{o?e(o):A(new Error("Failed to create image blob"))},"image/png")}catch(i){A(i)}})})}sendBufferedVideo(){if(this.videoBuffer.length===0)return;let e=this.videoBuffer.reduce((o,r)=>o+r.length,0),A=new Uint8Array(e),i=0;for(let o of this.videoBuffer)A.set(o,i),i+=o.length;let n={blob:{mime_type:"image/jpeg",data:A}};this.wsService.sendMessage(n),this.videoBuffer=[]}stopRecording(e){this.mediaRecorder&&this.mediaRecorder.stop(),this.stream&&this.stream.getTracks().forEach(A=>A.stop()),clearInterval(this.videoIntervalId),this.clearVideoElement(e)}clearVideoElement(e){let A=e.nativeElement.querySelector("video");A&&this.renderer.removeChild(e.nativeElement,A)}static \u0275fac=function(A){return new(A||t)(he(Tg),he(ds))};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var j1=class t{constructor(e){this.http=e}apiServerDomain=Es.getApiServerBaseUrl();getEventTrace(e){let A=this.apiServerDomain+`/debug/trace/${e}`;return this.http.get(A)}getTrace(e){let A=this.apiServerDomain+`/debug/trace/session/${e}`;return this.http.get(A)}getEvent(e,A,i,n){let o=this.apiServerDomain+`/apps/${A}/users/${e}/sessions/${i}/events/${n}/graph`;return this.http.get(o)}static \u0275fac=function(A){return new(A||t)(he(Bs))};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var zg=class t{selectedTraceRowSource=new li(void 0);selectedTraceRow$=this.selectedTraceRowSource.asObservable();eventDataSource=new li(void 0);eventData$=this.eventDataSource.asObservable();hoveredMessageIndiciesSource=new li([]);hoveredMessageIndicies$=this.hoveredMessageIndiciesSource.asObservable();messagesSource=new li([]);messages$=this.messagesSource.asObservable();selectedRow(e){this.selectedTraceRowSource.next(e)}setEventData(e){this.eventDataSource.next(e)}setMessages(e){this.messagesSource.next(e)}setHoveredMessages(e,A){if(!e){this.hoveredMessageIndiciesSource.next([]);return}let i=e.attributes,n=i&&i["gcp.vertex.agent.event_id"],o=0,r=[];for(let s of this.messagesSource.value){if(s.role=="user"){o++;continue}if(this.eventDataSource.value?.get(s.eventId).invocationId!=A){o++;continue}if(n)if(i["gcp.vertex.agent.event_id"]==s.eventId){r.push(o),o++;continue}else{o++;continue}else{r.push(o),o++;continue}}this.hoveredMessageIndiciesSource.next(r)}resetTraceService(){this.eventDataSource.next(void 0),this.messagesSource.next([]),this.hoveredMessageIndiciesSource.next([])}static \u0275fac=function(A){return new(A||t)};static \u0275prov=SA({token:t,factory:t.\u0275fac,providedIn:"root"})};var XzA=["*"];var $zA=new BA("MAT_CARD_CONFIG"),rcA=(()=>{class t{appearance;constructor(){let A=m($zA,{optional:!0});this.appearance=A?.appearance||"raised"}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-card"]],hostAttrs:[1,"mat-mdc-card","mdc-card"],hostVars:4,hostBindings:function(i,n){i&2&&ue("mat-mdc-card-outlined",n.appearance==="outlined")("mdc-card--outlined",n.appearance==="outlined")},inputs:{appearance:"appearance"},exportAs:["matCard"],ngContentSelectors:XzA,decls:1,vars:0,template:function(i,n){i&1&&(Yt(),xe(0))},styles:['.mat-mdc-card{display:flex;flex-direction:column;box-sizing:border-box;position:relative;border-style:solid;border-width:0;background-color:var(--mdc-elevated-card-container-color, var(--mat-sys-surface-container-low));border-color:var(--mdc-elevated-card-container-color, var(--mat-sys-surface-container-low));border-radius:var(--mdc-elevated-card-container-shape, var(--mat-sys-corner-medium));box-shadow:var(--mdc-elevated-card-container-elevation, var(--mat-sys-level1))}.mat-mdc-card::after{position:absolute;top:0;left:0;width:100%;height:100%;border:solid 1px rgba(0,0,0,0);content:"";display:block;pointer-events:none;box-sizing:border-box;border-radius:var(--mdc-elevated-card-container-shape, var(--mat-sys-corner-medium))}.mat-mdc-card-outlined{background-color:var(--mdc-outlined-card-container-color, var(--mat-sys-surface));border-radius:var(--mdc-outlined-card-container-shape, var(--mat-sys-corner-medium));border-width:var(--mdc-outlined-card-outline-width, 1px);border-color:var(--mdc-outlined-card-outline-color, var(--mat-sys-outline-variant));box-shadow:var(--mdc-outlined-card-container-elevation, var(--mat-sys-level0))}.mat-mdc-card-outlined::after{border:none}.mdc-card__media{position:relative;box-sizing:border-box;background-repeat:no-repeat;background-position:center;background-size:cover}.mdc-card__media::before{display:block;content:""}.mdc-card__media:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.mdc-card__media:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.mat-mdc-card-actions{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;min-height:52px;padding:8px}.mat-mdc-card-title{font-family:var(--mat-card-title-text-font, var(--mat-sys-title-large-font));line-height:var(--mat-card-title-text-line-height, var(--mat-sys-title-large-line-height));font-size:var(--mat-card-title-text-size, var(--mat-sys-title-large-size));letter-spacing:var(--mat-card-title-text-tracking, var(--mat-sys-title-large-tracking));font-weight:var(--mat-card-title-text-weight, var(--mat-sys-title-large-weight))}.mat-mdc-card-subtitle{color:var(--mat-card-subtitle-text-color, var(--mat-sys-on-surface));font-family:var(--mat-card-subtitle-text-font, var(--mat-sys-title-medium-font));line-height:var(--mat-card-subtitle-text-line-height, var(--mat-sys-title-medium-line-height));font-size:var(--mat-card-subtitle-text-size, var(--mat-sys-title-medium-size));letter-spacing:var(--mat-card-subtitle-text-tracking, var(--mat-sys-title-medium-tracking));font-weight:var(--mat-card-subtitle-text-weight, var(--mat-sys-title-medium-weight))}.mat-mdc-card-title,.mat-mdc-card-subtitle{display:block;margin:0}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle{padding:16px 16px 0}.mat-mdc-card-header{display:flex;padding:16px 16px 0}.mat-mdc-card-content{display:block;padding:0 16px}.mat-mdc-card-content:first-child{padding-top:16px}.mat-mdc-card-content:last-child{padding-bottom:16px}.mat-mdc-card-title-group{display:flex;justify-content:space-between;width:100%}.mat-mdc-card-avatar{height:40px;width:40px;border-radius:50%;flex-shrink:0;margin-bottom:16px;object-fit:cover}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title{line-height:normal}.mat-mdc-card-sm-image{width:80px;height:80px}.mat-mdc-card-md-image{width:112px;height:112px}.mat-mdc-card-lg-image{width:152px;height:152px}.mat-mdc-card-xl-image{width:240px;height:240px}.mat-mdc-card-subtitle~.mat-mdc-card-title,.mat-mdc-card-title~.mat-mdc-card-subtitle,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-title-group .mat-mdc-card-title,.mat-mdc-card-title-group .mat-mdc-card-subtitle{padding-top:0}.mat-mdc-card-content>:last-child:not(.mat-mdc-card-footer){margin-bottom:0}.mat-mdc-card-actions-align-end{justify-content:flex-end}'],encapsulation:2,changeDetection:0})}return t})();var scA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Ve]})}return t})();var eHA=t=>["segment",t],tHA=(t,e)=>({"segment-main":!0,expandable:t,expanded:e});function iHA(t,e){t&1&&UA(0,"div",9)}function nHA(t,e){if(t&1&&(S(0,"span",10),tA(1),R()),t&2){let A=P().$implicit;_(),Mt(A.description)}}function oHA(t,e){if(t&1&&(S(0,"section",11),UA(1,"ngx-json-viewer",12),R()),t&2){let A=P().$implicit,i=P();_(),vA("json",A.value)("expanded",i.expanded)("depth",i.depth)("_currentDepth",i._currentDepth+1)}}function rHA(t,e){if(t&1){let A=De();S(0,"section",2)(1,"section",3),mA("click",function(){let n=LA(A).$implicit,o=P();return xA(o.toggle(n))}),NA(2,iHA,1,0,"div",4),S(3,"span",5),tA(4),R(),S(5,"span",6),tA(6,": "),R(),NA(7,nHA,2,1,"span",7),R(),NA(8,oHA,2,4,"section",8),R()}if(t&2){let A=e.$implicit,i=P();vA("ngClass",Yr(6,eHA,"segment-type-"+A.type)),_(),vA("ngClass",p2(8,tHA,i.isExpandable(A),A.expanded)),_(),vA("ngIf",i.isExpandable(A)),_(2),Mt(A.key),_(3),vA("ngIf",!A.expanded||!i.isExpandable(A)),_(),vA("ngIf",A.expanded&&i.isExpandable(A))}}var Qh=(()=>{class t{constructor(){this.expanded=!0,this.depth=-1,this._currentDepth=0,this.segments=[]}ngOnChanges(){this.segments=[],this.json=this.decycle(this.json),typeof this.json=="object"?Object.keys(this.json).forEach(A=>{this.segments.push(this.parseKeyValue(A,this.json[A]))}):this.segments.push(this.parseKeyValue(`(${typeof this.json})`,this.json))}isExpandable(A){return A.type==="object"||A.type==="array"}toggle(A){this.isExpandable(A)&&(A.expanded=!A.expanded)}parseKeyValue(A,i){let n={key:A,value:i,type:void 0,description:""+i,expanded:this.isExpanded()};switch(typeof n.value){case"number":{n.type="number";break}case"boolean":{n.type="boolean";break}case"function":{n.type="function";break}case"string":{n.type="string",n.description='"'+n.value+'"';break}case"undefined":{n.type="undefined",n.description="undefined";break}case"object":{n.value===null?(n.type="null",n.description="null"):Array.isArray(n.value)?(n.type="array",n.description="Array["+n.value.length+"] "+JSON.stringify(n.value)):n.value instanceof Date?n.type="date":(n.type="object",n.description="Object "+JSON.stringify(n.value));break}}return n}isExpanded(){return this.expanded&&!(this.depth>-1&&this._currentDepth>=this.depth)}decycle(A){let i=new WeakMap;return function n(o,r){let s,a;return typeof o=="object"&&o!==null&&!(o instanceof Boolean)&&!(o instanceof Date)&&!(o instanceof Number)&&!(o instanceof RegExp)&&!(o instanceof String)?(s=i.get(o),s!==void 0?{$ref:s}:(i.set(o,r),Array.isArray(o)?(a=[],o.forEach(function(c,l){a[l]=n(c,r+"["+l+"]")})):(a={},Object.keys(o).forEach(function(c){a[c]=n(o[c],r+"["+JSON.stringify(c)+"]")})),a)):o}(A,"$")}}return t.\u0275fac=function(A){return new(A||t)},t.\u0275cmp=YA({type:t,selectors:[["ngx-json-viewer"]],inputs:{json:"json",expanded:"expanded",depth:"depth",_currentDepth:"_currentDepth"},standalone:!1,features:[Kt],decls:2,vars:1,consts:[[1,"ngx-json-viewer"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[3,"click","ngClass"],["class","toggler",4,"ngIf"],[1,"segment-key"],[1,"segment-separator"],["class","segment-value",4,"ngIf"],["class","children",4,"ngIf"],[1,"toggler"],[1,"segment-value"],[1,"children"],[3,"json","expanded","depth","_currentDepth"]],template:function(A,i){A&1&&(S(0,"section",0),NA(1,rHA,9,11,"section",1),R()),A&2&&(_(),vA("ngForOf",i.segments))},dependencies:[Ha,kp,DQ,t],styles:['@charset "UTF-8";.ngx-json-viewer[_ngcontent-%COMP%]{font-family:var(--ngx-json-font-family, monospace);font-size:var(--ngx-json-font-size, 1em);width:100%;height:100%;overflow:hidden;position:relative}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%]{padding:2px;margin:1px 1px 1px 12px}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%]{word-wrap:break-word}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .toggler[_ngcontent-%COMP%]{position:absolute;margin-left:-14px;margin-top:3px;font-size:.8em;line-height:1.2em;vertical-align:middle;color:var(--ngx-json-toggler, #787878)}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .toggler[_ngcontent-%COMP%]:after{display:inline-block;content:"\\25ba";transition:transform .1s ease-in}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .segment-key[_ngcontent-%COMP%]{color:var(--ngx-json-key, #4E187C)}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .segment-separator[_ngcontent-%COMP%]{color:var(--ngx-json-separator, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .segment-main[_ngcontent-%COMP%] .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-value, #000)}.ngx-json-viewer[_ngcontent-%COMP%] .segment[_ngcontent-%COMP%] .children[_ngcontent-%COMP%]{margin-left:12px}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-string[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-string, #FF6B6B)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-number[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-number, #009688)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-boolean[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-boolean, #B938A4)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-date[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-date, #05668D)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-array[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-array, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-object[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-object, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-function[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-function, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-null[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-null, #fff)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-undefined[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{color:var(--ngx-json-undefined, #fff)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-null[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{background-color:var(--ngx-json-null-bg, red)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-undefined[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-key[_ngcontent-%COMP%]{color:var(--ngx-json-undefined-key, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-undefined[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%] > .segment-value[_ngcontent-%COMP%]{background-color:var(--ngx-json-undefined-key, #999)}.ngx-json-viewer[_ngcontent-%COMP%] .segment-type-object[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%], .ngx-json-viewer[_ngcontent-%COMP%] .segment-type-array[_ngcontent-%COMP%] > .segment-main[_ngcontent-%COMP%]{white-space:nowrap}.ngx-json-viewer[_ngcontent-%COMP%] .expanded[_ngcontent-%COMP%] > .toggler[_ngcontent-%COMP%]:after{transform:rotate(90deg)}.ngx-json-viewer[_ngcontent-%COMP%] .expandable[_ngcontent-%COMP%], .ngx-json-viewer[_ngcontent-%COMP%] .expandable[_ngcontent-%COMP%] > .toggler[_ngcontent-%COMP%]{cursor:pointer}']}),t})(),acA=(()=>{class t{}return t.\u0275fac=function(A){return new(A||t)},t.\u0275mod=ge({type:t}),t.\u0275inj=le({imports:[g0]}),t})();var ccA=["*"],sHA=["content"],aHA=[[["mat-drawer"]],[["mat-drawer-content"]],"*"],cHA=["mat-drawer","mat-drawer-content","*"];function lHA(t,e){if(t&1){let A=De();S(0,"div",1),mA("click",function(){LA(A);let n=P();return xA(n._onBackdropClicked())}),R()}if(t&2){let A=P();ue("mat-drawer-shown",A._isShowingBackdrop())}}function gHA(t,e){t&1&&(S(0,"mat-drawer-content"),xe(1,2),R())}var IHA=new BA("MAT_DRAWER_DEFAULT_AUTOSIZE",{providedIn:"root",factory:CHA}),lcA=new BA("MAT_DRAWER_CONTAINER");function CHA(){return!1}var SG=(()=>{class t extends h0{_platform=m(Zt);_changeDetectorRef=m(lt);_container=m(LG);constructor(){let A=m(te),i=m(N2),n=m(de);super(A,i,n)}ngAfterContentInit(){this._container._contentMarginChanges.subscribe(()=>{this._changeDetectorRef.markForCheck()})}_shouldBeHidden(){if(this._platform.isBrowser)return!1;let{start:A,end:i}=this._container;return A!=null&&A.mode!=="over"&&A.opened||i!=null&&i.mode!=="over"&&i.opened}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-drawer-content"]],hostAttrs:[1,"mat-drawer-content"],hostVars:6,hostBindings:function(i,n){i&2&&(so("margin-left",n._container._contentMargins.left,"px")("margin-right",n._container._contentMargins.right,"px"),ue("mat-drawer-content-hidden",n._shouldBeHidden()))},features:[ct([{provide:h0,useExisting:t}]),et],ngContentSelectors:ccA,decls:1,vars:0,template:function(i,n){i&1&&(Yt(),xe(0))},encapsulation:2,changeDetection:0})}return t})(),RG=(()=>{class t{_elementRef=m(te);_focusTrapFactory=m(P6);_focusMonitor=m(Jr);_platform=m(Zt);_ngZone=m(de);_renderer=m(Gi);_interactivityChecker=m(hu);_doc=m(tt,{optional:!0});_container=m(lcA,{optional:!0});_focusTrap=null;_elementFocusedBeforeDrawerWasOpened=null;_eventCleanups;_isAttached;_anchor;get position(){return this._position}set position(A){A=A==="end"?"end":"start",A!==this._position&&(this._isAttached&&this._updatePositionInParent(A),this._position=A,this.onPositionChanged.emit())}_position="start";get mode(){return this._mode}set mode(A){this._mode=A,this._updateFocusTrapState(),this._modeChanged.next()}_mode="over";get disableClose(){return this._disableClose}set disableClose(A){this._disableClose=Yo(A)}_disableClose=!1;get autoFocus(){let A=this._autoFocus;return A??(this.mode==="side"?"dialog":"first-tabbable")}set autoFocus(A){(A==="true"||A==="false"||A==null)&&(A=Yo(A)),this._autoFocus=A}_autoFocus;get opened(){return this._opened}set opened(A){this.toggle(Yo(A))}_opened=!1;_openedVia;_animationStarted=new HA;_animationEnd=new HA;openedChange=new XA(!0);_openedStream=this.openedChange.pipe(pt(A=>A),Je(()=>{}));openedStart=this._animationStarted.pipe(pt(()=>this.opened),dd(void 0));_closedStream=this.openedChange.pipe(pt(A=>!A),Je(()=>{}));closedStart=this._animationStarted.pipe(pt(()=>!this.opened),dd(void 0));_destroyed=new HA;onPositionChanged=new XA;_content;_modeChanged=new HA;_injector=m(Dt);_changeDetectorRef=m(lt);constructor(){this.openedChange.pipe(wt(this._destroyed)).subscribe(A=>{A?(this._doc&&(this._elementFocusedBeforeDrawerWasOpened=this._doc.activeElement),this._takeFocus()):this._isFocusWithinDrawer()&&this._restoreFocus(this._openedVia||"program")}),this._ngZone.runOutsideAngular(()=>{let A=this._elementRef.nativeElement;Oh(A,"keydown").pipe(pt(i=>i.keyCode===27&&!this.disableClose&&!rr(i)),wt(this._destroyed)).subscribe(i=>this._ngZone.run(()=>{this.close(),i.stopPropagation(),i.preventDefault()})),this._eventCleanups=[this._renderer.listen(A,"transitionrun",this._handleTransitionEvent),this._renderer.listen(A,"transitionend",this._handleTransitionEvent),this._renderer.listen(A,"transitioncancel",this._handleTransitionEvent)]}),this._animationEnd.subscribe(()=>{this.openedChange.emit(this._opened)})}_forceFocus(A,i){this._interactivityChecker.isFocusable(A)||(A.tabIndex=-1,this._ngZone.runOutsideAngular(()=>{let n=()=>{o(),r(),A.removeAttribute("tabindex")},o=this._renderer.listen(A,"blur",n),r=this._renderer.listen(A,"mousedown",n)})),A.focus(i)}_focusByCssSelector(A,i){let n=this._elementRef.nativeElement.querySelector(A);n&&this._forceFocus(n,i)}_takeFocus(){if(!this._focusTrap)return;let A=this._elementRef.nativeElement;switch(this.autoFocus){case!1:case"dialog":return;case!0:case"first-tabbable":Vo(()=>{!this._focusTrap.focusInitialElement()&&typeof A.focus=="function"&&A.focus()},{injector:this._injector});break;case"first-heading":this._focusByCssSelector('h1, h2, h3, h4, h5, h6, [role="heading"]');break;default:this._focusByCssSelector(this.autoFocus);break}}_restoreFocus(A){this.autoFocus!=="dialog"&&(this._elementFocusedBeforeDrawerWasOpened?this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened,A):this._elementRef.nativeElement.blur(),this._elementFocusedBeforeDrawerWasOpened=null)}_isFocusWithinDrawer(){let A=this._doc.activeElement;return!!A&&this._elementRef.nativeElement.contains(A)}ngAfterViewInit(){this._isAttached=!0,this._position==="end"&&this._updatePositionInParent("end"),this._platform.isBrowser&&(this._focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement),this._updateFocusTrapState())}ngOnDestroy(){this._eventCleanups.forEach(A=>A()),this._focusTrap?.destroy(),this._anchor?.remove(),this._anchor=null,this._animationStarted.complete(),this._animationEnd.complete(),this._modeChanged.complete(),this._destroyed.next(),this._destroyed.complete()}open(A){return this.toggle(!0,A)}close(){return this.toggle(!1)}_closeViaBackdropClick(){return this._setOpen(!1,!0,"mouse")}toggle(A=!this.opened,i){A&&i&&(this._openedVia=i);let n=this._setOpen(A,!A&&this._isFocusWithinDrawer(),this._openedVia||"program");return A||(this._openedVia=null),n}_setOpen(A,i,n){return A===this._opened?Promise.resolve(A?"open":"close"):(this._opened=A,this._container?._transitionsEnabled?this._setIsAnimating(!0):setTimeout(()=>{this._animationStarted.next(),this._animationEnd.next()}),this._elementRef.nativeElement.classList.toggle("mat-drawer-opened",A),!A&&i&&this._restoreFocus(n),this._changeDetectorRef.markForCheck(),this._updateFocusTrapState(),new Promise(o=>{this.openedChange.pipe(Pn(1)).subscribe(r=>o(r?"open":"close"))}))}_setIsAnimating(A){this._elementRef.nativeElement.classList.toggle("mat-drawer-animating",A)}_getWidth(){return this._elementRef.nativeElement.offsetWidth||0}_updateFocusTrapState(){this._focusTrap&&(this._focusTrap.enabled=!!this._container?.hasBackdrop&&this.opened)}_updatePositionInParent(A){if(!this._platform.isBrowser)return;let i=this._elementRef.nativeElement,n=i.parentNode;A==="end"?(this._anchor||(this._anchor=this._doc.createComment("mat-drawer-anchor"),n.insertBefore(this._anchor,i)),n.appendChild(i)):this._anchor&&this._anchor.parentNode.insertBefore(i,this._anchor)}_handleTransitionEvent=A=>{let i=this._elementRef.nativeElement;A.target===i&&this._ngZone.run(()=>{A.type==="transitionrun"?this._animationStarted.next(A):(A.type==="transitionend"&&this._setIsAnimating(!1),this._animationEnd.next(A))})};static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-drawer"]],viewQuery:function(i,n){if(i&1&&Ge(sHA,5),i&2){let o;$A(o=Ae())&&(n._content=o.first)}},hostAttrs:["tabIndex","-1",1,"mat-drawer"],hostVars:11,hostBindings:function(i,n){i&2&&(_e("align",null),so("visibility",!n._container&&!n.opened?"hidden":null),ue("mat-drawer-end",n.position==="end")("mat-drawer-over",n.mode==="over")("mat-drawer-push",n.mode==="push")("mat-drawer-side",n.mode==="side"))},inputs:{position:"position",mode:"mode",disableClose:"disableClose",autoFocus:"autoFocus",opened:"opened"},outputs:{openedChange:"openedChange",_openedStream:"opened",openedStart:"openedStart",_closedStream:"closed",closedStart:"closedStart",onPositionChanged:"positionChanged"},exportAs:["matDrawer"],ngContentSelectors:ccA,decls:3,vars:0,consts:[["content",""],["cdkScrollable","",1,"mat-drawer-inner-container"]],template:function(i,n){i&1&&(Yt(),S(0,"div",1,0),xe(2),R())},dependencies:[h0],encapsulation:2,changeDetection:0})}return t})(),LG=(()=>{class t{_dir=m(bo,{optional:!0});_element=m(te);_ngZone=m(de);_changeDetectorRef=m(lt);_animationMode=m(mi,{optional:!0});_transitionsEnabled=!1;_allDrawers;_drawers=new Ec;_content;_userContent;get start(){return this._start}get end(){return this._end}get autosize(){return this._autosize}set autosize(A){this._autosize=Yo(A)}_autosize=m(IHA);get hasBackdrop(){return this._drawerHasBackdrop(this._start)||this._drawerHasBackdrop(this._end)}set hasBackdrop(A){this._backdropOverride=A==null?null:Yo(A)}_backdropOverride;backdropClick=new XA;_start;_end;_left;_right;_destroyed=new HA;_doCheckSubject=new HA;_contentMargins={left:null,right:null};_contentMarginChanges=new HA;get scrollable(){return this._userContent||this._content}_injector=m(Dt);constructor(){let A=m(Zt),i=m(mc);this._dir?.change.pipe(wt(this._destroyed)).subscribe(()=>{this._validateDrawers(),this.updateContentMargins()}),i.change().pipe(wt(this._destroyed)).subscribe(()=>this.updateContentMargins()),this._animationMode!=="NoopAnimations"&&A.isBrowser&&this._ngZone.runOutsideAngular(()=>{setTimeout(()=>{this._element.nativeElement.classList.add("mat-drawer-transition"),this._transitionsEnabled=!0},200)})}ngAfterContentInit(){this._allDrawers.changes.pipe(Qo(this._allDrawers),wt(this._destroyed)).subscribe(A=>{this._drawers.reset(A.filter(i=>!i._container||i._container===this)),this._drawers.notifyOnChanges()}),this._drawers.changes.pipe(Qo(null)).subscribe(()=>{this._validateDrawers(),this._drawers.forEach(A=>{this._watchDrawerToggle(A),this._watchDrawerPosition(A),this._watchDrawerMode(A)}),(!this._drawers.length||this._isDrawerOpen(this._start)||this._isDrawerOpen(this._end))&&this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),this._ngZone.runOutsideAngular(()=>{this._doCheckSubject.pipe(Vc(10),wt(this._destroyed)).subscribe(()=>this.updateContentMargins())})}ngOnDestroy(){this._contentMarginChanges.complete(),this._doCheckSubject.complete(),this._drawers.destroy(),this._destroyed.next(),this._destroyed.complete()}open(){this._drawers.forEach(A=>A.open())}close(){this._drawers.forEach(A=>A.close())}updateContentMargins(){let A=0,i=0;if(this._left&&this._left.opened){if(this._left.mode=="side")A+=this._left._getWidth();else if(this._left.mode=="push"){let n=this._left._getWidth();A+=n,i-=n}}if(this._right&&this._right.opened){if(this._right.mode=="side")i+=this._right._getWidth();else if(this._right.mode=="push"){let n=this._right._getWidth();i+=n,A-=n}}A=A||null,i=i||null,(A!==this._contentMargins.left||i!==this._contentMargins.right)&&(this._contentMargins={left:A,right:i},this._ngZone.run(()=>this._contentMarginChanges.next(this._contentMargins)))}ngDoCheck(){this._autosize&&this._isPushed()&&this._ngZone.runOutsideAngular(()=>this._doCheckSubject.next())}_watchDrawerToggle(A){A._animationStarted.pipe(wt(this._drawers.changes)).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),A.mode!=="side"&&A.openedChange.pipe(wt(this._drawers.changes)).subscribe(()=>this._setContainerClass(A.opened))}_watchDrawerPosition(A){A.onPositionChanged.pipe(wt(this._drawers.changes)).subscribe(()=>{Vo({read:()=>this._validateDrawers()},{injector:this._injector})})}_watchDrawerMode(A){A._modeChanged.pipe(wt(ho(this._drawers.changes,this._destroyed))).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()})}_setContainerClass(A){let i=this._element.nativeElement.classList,n="mat-drawer-container-has-open";A?i.add(n):i.remove(n)}_validateDrawers(){this._start=this._end=null,this._drawers.forEach(A=>{A.position=="end"?(this._end!=null,this._end=A):(this._start!=null,this._start=A)}),this._right=this._left=null,this._dir&&this._dir.value==="rtl"?(this._left=this._end,this._right=this._start):(this._left=this._start,this._right=this._end)}_isPushed(){return this._isDrawerOpen(this._start)&&this._start.mode!="over"||this._isDrawerOpen(this._end)&&this._end.mode!="over"}_onBackdropClicked(){this.backdropClick.emit(),this._closeModalDrawersViaBackdrop()}_closeModalDrawersViaBackdrop(){[this._start,this._end].filter(A=>A&&!A.disableClose&&this._drawerHasBackdrop(A)).forEach(A=>A._closeViaBackdropClick())}_isShowingBackdrop(){return this._isDrawerOpen(this._start)&&this._drawerHasBackdrop(this._start)||this._isDrawerOpen(this._end)&&this._drawerHasBackdrop(this._end)}_isDrawerOpen(A){return A!=null&&A.opened}_drawerHasBackdrop(A){return this._backdropOverride==null?!!A&&A.mode!=="side":this._backdropOverride}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-drawer-container"]],contentQueries:function(i,n,o){if(i&1&&(Ii(o,SG,5),Ii(o,RG,5)),i&2){let r;$A(r=Ae())&&(n._content=r.first),$A(r=Ae())&&(n._allDrawers=r)}},viewQuery:function(i,n){if(i&1&&Ge(SG,5),i&2){let o;$A(o=Ae())&&(n._userContent=o.first)}},hostAttrs:[1,"mat-drawer-container"],hostVars:2,hostBindings:function(i,n){i&2&&ue("mat-drawer-container-explicit-backdrop",n._backdropOverride)},inputs:{autosize:"autosize",hasBackdrop:"hasBackdrop"},outputs:{backdropClick:"backdropClick"},exportAs:["matDrawerContainer"],features:[ct([{provide:lcA,useExisting:t}])],ngContentSelectors:cHA,decls:4,vars:2,consts:[[1,"mat-drawer-backdrop",3,"mat-drawer-shown"],[1,"mat-drawer-backdrop",3,"click"]],template:function(i,n){i&1&&(Yt(aHA),NA(0,lHA,1,2,"div",0),xe(1),xe(2,1),NA(3,gHA,2,0,"mat-drawer-content")),i&2&&(FA(n.hasBackdrop?0:-1),_(3),FA(n._content?-1:3))},dependencies:[SG],styles:[".mat-drawer-container{position:relative;z-index:1;color:var(--mat-sidenav-content-text-color, var(--mat-sys-on-background));background-color:var(--mat-sidenav-content-background-color, var(--mat-sys-background));box-sizing:border-box;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible;background-color:var(--mat-sidenav-scrim-color, color-mix(in srgb, var(--mat-sys-neutral-variant20) 40%, transparent))}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:background-color,visibility}@media(forced-colors: active){.mat-drawer-backdrop{opacity:.5}}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-content.mat-drawer-content-hidden{opacity:0}.mat-drawer-transition .mat-drawer-content{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;color:var(--mat-sidenav-container-text-color, var(--mat-sys-on-surface-variant));box-shadow:var(--mat-sidenav-container-elevation-shadow, none);background-color:var(--mat-sidenav-container-background-color, var(--mat-sys-surface));border-top-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));width:var(--mat-sidenav-container-width, 360px);display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%, 0, 0)}@media(forced-colors: active){.mat-drawer,[dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}}@media(forced-colors: active){[dir=rtl] .mat-drawer,.mat-drawer.mat-drawer-end{border-left:solid 1px currentColor;border-right:none}}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%, 0, 0);border-top-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .mat-drawer{border-top-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-right-radius:0;border-bottom-right-radius:0;transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer.mat-drawer-end{border-top-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-left-radius:0;border-bottom-left-radius:0;left:0;right:auto;transform:translate3d(-100%, 0, 0)}.mat-drawer-transition .mat-drawer{transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-drawer:not(.mat-drawer-opened):not(.mat-drawer-animating){visibility:hidden;box-shadow:none}.mat-drawer:not(.mat-drawer-opened):not(.mat-drawer-animating) .mat-drawer-inner-container{display:none}.mat-drawer.mat-drawer-opened.mat-drawer-opened{transform:none}.mat-drawer-side{box-shadow:none;border-right-color:var(--mat-sidenav-container-divider-color, transparent);border-right-width:1px;border-right-style:solid}.mat-drawer-side.mat-drawer-end{border-left-color:var(--mat-sidenav-container-divider-color, transparent);border-left-width:1px;border-left-style:solid;border-right:none}[dir=rtl] .mat-drawer-side{border-left-color:var(--mat-sidenav-container-divider-color, transparent);border-left-width:1px;border-left-style:solid;border-right:none}[dir=rtl] .mat-drawer-side.mat-drawer-end{border-right-color:var(--mat-sidenav-container-divider-color, transparent);border-right-width:1px;border-right-style:solid;border-left:none}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto}.mat-sidenav-fixed{position:fixed}"],encapsulation:2,changeDetection:0})}return t})();var gcA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,E0,E0,Ve]})}return t})();var _G=["*"];function BHA(t,e){t&1&&xe(0)}var EHA=["tabListContainer"],hHA=["tabList"],QHA=["tabListInner"],uHA=["nextPaginator"],fHA=["previousPaginator"],mHA=t=>({animationDuration:t}),pHA=(t,e)=>({value:t,params:e});function wHA(t,e){}var DHA=["tabBodyWrapper"],yHA=["tabHeader"];function vHA(t,e){}function bHA(t,e){if(t&1&&NA(0,vHA,0,0,"ng-template",12),t&2){let A=P().$implicit;vA("cdkPortalOutlet",A.templateLabel)}}function MHA(t,e){if(t&1&&tA(0),t&2){let A=P().$implicit;Mt(A.textLabel)}}function kHA(t,e){if(t&1){let A=De();S(0,"div",7,2),mA("click",function(){let n=LA(A),o=n.$implicit,r=n.$index,s=P(),a=or(1);return xA(s._handleClick(o,a,r))})("cdkFocusChange",function(n){let o=LA(A).$index,r=P();return xA(r._tabFocusChanged(n,o))}),UA(2,"span",8)(3,"div",9),S(4,"span",10)(5,"span",11),NA(6,bHA,1,1,null,12)(7,MHA,1,1),R()()()}if(t&2){let A=e.$implicit,i=e.$index,n=or(1),o=P();vo(A.labelClass),ue("mdc-tab--active",o.selectedIndex===i),vA("id",o._getTabLabelId(i))("disabled",A.disabled)("fitInkBarToContent",o.fitInkBarToContent),_e("tabIndex",o._getTabIndex(i))("aria-posinset",i+1)("aria-setsize",o._tabs.length)("aria-controls",o._getTabContentId(i))("aria-selected",o.selectedIndex===i)("aria-label",A.ariaLabel||null)("aria-labelledby",!A.ariaLabel&&A.ariaLabelledby?A.ariaLabelledby:null),_(3),vA("matRippleTrigger",n)("matRippleDisabled",A.disabled||o.disableRipple),_(3),FA(A.templateLabel?6:7)}}function SHA(t,e){t&1&&xe(0)}function RHA(t,e){if(t&1){let A=De();S(0,"mat-tab-body",13),mA("_onCentered",function(){LA(A);let n=P();return xA(n._removeTabBodyWrapperHeight())})("_onCentering",function(n){LA(A);let o=P();return xA(o._setTabBodyWrapperHeight(n))}),R()}if(t&2){let A=e.$implicit,i=e.$index,n=P();vo(A.bodyClass),ue("mat-mdc-tab-body-active",n.selectedIndex===i),vA("id",n._getTabContentId(i))("content",A.content)("position",A.position)("origin",A.origin)("animationDuration",n.animationDuration)("preserveContent",n.preserveContent),_e("tabindex",n.contentTabIndex!=null&&n.selectedIndex===i?n.contentTabIndex:null)("aria-labelledby",n._getTabLabelId(i))("aria-hidden",n.selectedIndex!==i)}}var LHA=new BA("MatTabContent"),xHA=(()=>{class t{template=m(vn);constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matTabContent",""]],features:[ct([{provide:LHA,useExisting:t}])]})}return t})(),FHA=new BA("MatTabLabel"),dcA=new BA("MAT_TAB"),GG=(()=>{class t extends OO{_closestTab=m(dcA,{optional:!0});static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","mat-tab-label",""],["","matTabLabel",""]],features:[ct([{provide:FHA,useExisting:t}]),et]})}return t})(),BcA=new BA("MAT_TAB_GROUP"),af=(()=>{class t{_viewContainerRef=m(Un);_closestTabGroup=m(BcA,{optional:!0});disabled=!1;get templateLabel(){return this._templateLabel}set templateLabel(A){this._setTemplateLabelInput(A)}_templateLabel;_explicitContent=void 0;_implicitContent;textLabel="";ariaLabel;ariaLabelledby;labelClass;bodyClass;_contentPortal=null;get content(){return this._contentPortal}_stateChanges=new HA;position=null;origin=null;isActive=!1;constructor(){m(Ln).load(Qr)}ngOnChanges(A){(A.hasOwnProperty("textLabel")||A.hasOwnProperty("disabled"))&&this._stateChanges.next()}ngOnDestroy(){this._stateChanges.complete()}ngOnInit(){this._contentPortal=new aa(this._explicitContent||this._implicitContent,this._viewContainerRef)}_setTemplateLabelInput(A){A&&A._closestTab===this&&(this._templateLabel=A)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-tab"]],contentQueries:function(i,n,o){if(i&1&&(Ii(o,GG,5),Ii(o,xHA,7,vn)),i&2){let r;$A(r=Ae())&&(n.templateLabel=r.first),$A(r=Ae())&&(n._explicitContent=r.first)}},viewQuery:function(i,n){if(i&1&&Ge(vn,7),i&2){let o;$A(o=Ae())&&(n._implicitContent=o.first)}},hostAttrs:["hidden",""],inputs:{disabled:[2,"disabled","disabled",ae],textLabel:[0,"label","textLabel"],ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],labelClass:"labelClass",bodyClass:"bodyClass"},exportAs:["matTab"],features:[ct([{provide:dcA,useExisting:t}]),Kt],ngContentSelectors:_G,decls:1,vars:0,template:function(i,n){i&1&&(Yt(),NA(0,BHA,1,0,"ng-template"))},encapsulation:2})}return t})(),xG="mdc-tab-indicator--active",IcA="mdc-tab-indicator--no-transition",FG=class{_items;_currentItem;constructor(e){this._items=e}hide(){this._items.forEach(e=>e.deactivateInkBar()),this._currentItem=void 0}alignToElement(e){let A=this._items.find(n=>n.elementRef.nativeElement===e),i=this._currentItem;if(A!==i&&(i?.deactivateInkBar(),A)){let n=i?.elementRef.nativeElement.getBoundingClientRect?.();A.activateInkBar(n),this._currentItem=A}}},NHA=(()=>{class t{_elementRef=m(te);_inkBarElement;_inkBarContentElement;_fitToContent=!1;get fitInkBarToContent(){return this._fitToContent}set fitInkBarToContent(A){this._fitToContent!==A&&(this._fitToContent=A,this._inkBarElement&&this._appendInkBarElement())}activateInkBar(A){let i=this._elementRef.nativeElement;if(!A||!i.getBoundingClientRect||!this._inkBarContentElement){i.classList.add(xG);return}let n=i.getBoundingClientRect(),o=A.width/n.width,r=A.left-n.left;i.classList.add(IcA),this._inkBarContentElement.style.setProperty("transform",`translateX(${r}px) scaleX(${o})`),i.getBoundingClientRect(),i.classList.remove(IcA),i.classList.add(xG),this._inkBarContentElement.style.setProperty("transform","")}deactivateInkBar(){this._elementRef.nativeElement.classList.remove(xG)}ngOnInit(){this._createInkBarElement()}ngOnDestroy(){this._inkBarElement?.remove(),this._inkBarElement=this._inkBarContentElement=null}_createInkBarElement(){let A=this._elementRef.nativeElement.ownerDocument||document,i=this._inkBarElement=A.createElement("span"),n=this._inkBarContentElement=A.createElement("span");i.className="mdc-tab-indicator",n.className="mdc-tab-indicator__content mdc-tab-indicator__content--underline",i.appendChild(this._inkBarContentElement),this._appendInkBarElement()}_appendInkBarElement(){this._inkBarElement;let A=this._fitToContent?this._elementRef.nativeElement.querySelector(".mdc-tab__content"):this._elementRef.nativeElement;A.appendChild(this._inkBarElement)}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,inputs:{fitInkBarToContent:[2,"fitInkBarToContent","fitInkBarToContent",ae]}})}return t})();var EcA=(()=>{class t extends NHA{elementRef=m(te);disabled=!1;focus(){this.elementRef.nativeElement.focus()}getOffsetLeft(){return this.elementRef.nativeElement.offsetLeft}getOffsetWidth(){return this.elementRef.nativeElement.offsetWidth}static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275dir=OA({type:t,selectors:[["","matTabLabelWrapper",""]],hostVars:3,hostBindings:function(i,n){i&2&&(_e("aria-disabled",!!n.disabled),ue("mat-mdc-tab-disabled",n.disabled))},inputs:{disabled:[2,"disabled","disabled",ae]},features:[et]})}return t})(),CcA={passive:!0},_HA=650,GHA=100,UHA=(()=>{class t{_elementRef=m(te);_changeDetectorRef=m(lt);_viewportRuler=m(mc);_dir=m(bo,{optional:!0});_ngZone=m(de);_platform=m(Zt);_sharedResizeObserver=m(n8);_injector=m(Dt);_renderer=m(Gi);_animationMode=m(mi,{optional:!0});_eventCleanups;_scrollDistance=0;_selectedIndexChanged=!1;_destroyed=new HA;_showPaginationControls=!1;_disableScrollAfter=!0;_disableScrollBefore=!0;_tabLabelCount;_scrollDistanceChanged;_keyManager;_currentTextContent;_stopScrolling=new HA;disablePagination=!1;get selectedIndex(){return this._selectedIndex}set selectedIndex(A){let i=isNaN(A)?0:A;this._selectedIndex!=i&&(this._selectedIndexChanged=!0,this._selectedIndex=i,this._keyManager&&this._keyManager.updateActiveItem(i))}_selectedIndex=0;selectFocusedIndex=new XA;indexFocused=new XA;constructor(){this._eventCleanups=this._ngZone.runOutsideAngular(()=>[this._renderer.listen(this._elementRef.nativeElement,"mouseleave",()=>this._stopInterval())])}ngAfterViewInit(){this._eventCleanups.push(HM(this._renderer,this._previousPaginator.nativeElement,"touchstart",()=>this._handlePaginatorPress("before"),CcA),HM(this._renderer,this._nextPaginator.nativeElement,"touchstart",()=>this._handlePaginatorPress("after"),CcA))}ngAfterContentInit(){let A=this._dir?this._dir.change:ve("ltr"),i=this._sharedResizeObserver.observe(this._elementRef.nativeElement).pipe(Vc(32),wt(this._destroyed)),n=this._viewportRuler.change(150).pipe(wt(this._destroyed)),o=()=>{this.updatePagination(),this._alignInkBarToSelectedTab()};this._keyManager=new du(this._items).withHorizontalOrientation(this._getLayoutDirection()).withHomeAndEnd().withWrap().skipPredicate(()=>!1),this._keyManager.updateActiveItem(this._selectedIndex),Vo(o,{injector:this._injector}),ho(A,n,i,this._items.changes,this._itemsResized()).pipe(wt(this._destroyed)).subscribe(()=>{this._ngZone.run(()=>{Promise.resolve().then(()=>{this._scrollDistance=Math.max(0,Math.min(this._getMaxScrollDistance(),this._scrollDistance)),o()})}),this._keyManager.withHorizontalOrientation(this._getLayoutDirection())}),this._keyManager.change.subscribe(r=>{this.indexFocused.emit(r),this._setTabFocus(r)})}_itemsResized(){return typeof ResizeObserver!="function"?Ar:this._items.changes.pipe(Qo(this._items),no(A=>new Ze(i=>this._ngZone.runOutsideAngular(()=>{let n=new ResizeObserver(o=>i.next(o));return A.forEach(o=>n.observe(o.elementRef.nativeElement)),()=>{n.disconnect()}}))),eI(1),pt(A=>A.some(i=>i.contentRect.width>0&&i.contentRect.height>0)))}ngAfterContentChecked(){this._tabLabelCount!=this._items.length&&(this.updatePagination(),this._tabLabelCount=this._items.length,this._changeDetectorRef.markForCheck()),this._selectedIndexChanged&&(this._scrollToLabel(this._selectedIndex),this._checkScrollingControls(),this._alignInkBarToSelectedTab(),this._selectedIndexChanged=!1,this._changeDetectorRef.markForCheck()),this._scrollDistanceChanged&&(this._updateTabScrollPosition(),this._scrollDistanceChanged=!1,this._changeDetectorRef.markForCheck())}ngOnDestroy(){this._eventCleanups.forEach(A=>A()),this._keyManager?.destroy(),this._destroyed.next(),this._destroyed.complete(),this._stopScrolling.complete()}_handleKeydown(A){if(!rr(A))switch(A.keyCode){case 13:case 32:if(this.focusIndex!==this.selectedIndex){let i=this._items.get(this.focusIndex);i&&!i.disabled&&(this.selectFocusedIndex.emit(this.focusIndex),this._itemSelected(A))}break;default:this._keyManager.onKeydown(A)}}_onContentChanges(){let A=this._elementRef.nativeElement.textContent;A!==this._currentTextContent&&(this._currentTextContent=A||"",this._ngZone.run(()=>{this.updatePagination(),this._alignInkBarToSelectedTab(),this._changeDetectorRef.markForCheck()}))}updatePagination(){this._checkPaginationEnabled(),this._checkScrollingControls(),this._updateTabScrollPosition()}get focusIndex(){return this._keyManager?this._keyManager.activeItemIndex:0}set focusIndex(A){!this._isValidIndex(A)||this.focusIndex===A||!this._keyManager||this._keyManager.setActiveItem(A)}_isValidIndex(A){return this._items?!!this._items.toArray()[A]:!0}_setTabFocus(A){if(this._showPaginationControls&&this._scrollToLabel(A),this._items&&this._items.length){this._items.toArray()[A].focus();let i=this._tabListContainer.nativeElement;this._getLayoutDirection()=="ltr"?i.scrollLeft=0:i.scrollLeft=i.scrollWidth-i.offsetWidth}}_getLayoutDirection(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}_updateTabScrollPosition(){if(this.disablePagination)return;let A=this.scrollDistance,i=this._getLayoutDirection()==="ltr"?-A:A;this._tabList.nativeElement.style.transform=`translateX(${Math.round(i)}px)`,(this._platform.TRIDENT||this._platform.EDGE)&&(this._tabListContainer.nativeElement.scrollLeft=0)}get scrollDistance(){return this._scrollDistance}set scrollDistance(A){this._scrollTo(A)}_scrollHeader(A){let i=this._tabListContainer.nativeElement.offsetWidth,n=(A=="before"?-1:1)*i/3;return this._scrollTo(this._scrollDistance+n)}_handlePaginatorClick(A){this._stopInterval(),this._scrollHeader(A)}_scrollToLabel(A){if(this.disablePagination)return;let i=this._items?this._items.toArray()[A]:null;if(!i)return;let n=this._tabListContainer.nativeElement.offsetWidth,{offsetLeft:o,offsetWidth:r}=i.elementRef.nativeElement,s,a;this._getLayoutDirection()=="ltr"?(s=o,a=s+r):(a=this._tabListInner.nativeElement.offsetWidth-o,s=a-r);let c=this.scrollDistance,l=this.scrollDistance+n;sl&&(this.scrollDistance+=Math.min(a-l,s-c))}_checkPaginationEnabled(){if(this.disablePagination)this._showPaginationControls=!1;else{let A=this._tabListInner.nativeElement.scrollWidth,i=this._elementRef.nativeElement.offsetWidth,n=A-i>=5;n||(this.scrollDistance=0),n!==this._showPaginationControls&&(this._showPaginationControls=n,this._changeDetectorRef.markForCheck())}}_checkScrollingControls(){this.disablePagination?this._disableScrollAfter=this._disableScrollBefore=!0:(this._disableScrollBefore=this.scrollDistance==0,this._disableScrollAfter=this.scrollDistance==this._getMaxScrollDistance(),this._changeDetectorRef.markForCheck())}_getMaxScrollDistance(){let A=this._tabListInner.nativeElement.scrollWidth,i=this._tabListContainer.nativeElement.offsetWidth;return A-i||0}_alignInkBarToSelectedTab(){let A=this._items&&this._items.length?this._items.toArray()[this.selectedIndex]:null,i=A?A.elementRef.nativeElement:null;i?this._inkBar.alignToElement(i):this._inkBar.hide()}_stopInterval(){this._stopScrolling.next()}_handlePaginatorPress(A,i){i&&i.button!=null&&i.button!==0||(this._stopInterval(),AI(_HA,GHA).pipe(wt(ho(this._stopScrolling,this._destroyed))).subscribe(()=>{let{maxScrollDistance:n,distance:o}=this._scrollHeader(A);(o===0||o>=n)&&this._stopInterval()}))}_scrollTo(A){if(this.disablePagination)return{maxScrollDistance:0,distance:0};let i=this._getMaxScrollDistance();return this._scrollDistance=Math.max(0,Math.min(i,A)),this._scrollDistanceChanged=!0,this._checkScrollingControls(),{maxScrollDistance:i,distance:this._scrollDistance}}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,inputs:{disablePagination:[2,"disablePagination","disablePagination",ae],selectedIndex:[2,"selectedIndex","selectedIndex",Mi]},outputs:{selectFocusedIndex:"selectFocusedIndex",indexFocused:"indexFocused"}})}return t})(),KHA=(()=>{class t extends UHA{_items;_tabListContainer;_tabList;_tabListInner;_nextPaginator;_previousPaginator;_inkBar;ariaLabel;ariaLabelledby;disableRipple=!1;ngAfterContentInit(){this._inkBar=new FG(this._items),super.ngAfterContentInit()}_itemSelected(A){A.preventDefault()}static \u0275fac=(()=>{let A;return function(n){return(A||(A=bi(t)))(n||t)}})();static \u0275cmp=YA({type:t,selectors:[["mat-tab-header"]],contentQueries:function(i,n,o){if(i&1&&Ii(o,EcA,4),i&2){let r;$A(r=Ae())&&(n._items=r)}},viewQuery:function(i,n){if(i&1&&(Ge(EHA,7),Ge(hHA,7),Ge(QHA,7),Ge(uHA,5),Ge(fHA,5)),i&2){let o;$A(o=Ae())&&(n._tabListContainer=o.first),$A(o=Ae())&&(n._tabList=o.first),$A(o=Ae())&&(n._tabListInner=o.first),$A(o=Ae())&&(n._nextPaginator=o.first),$A(o=Ae())&&(n._previousPaginator=o.first)}},hostAttrs:[1,"mat-mdc-tab-header"],hostVars:4,hostBindings:function(i,n){i&2&&ue("mat-mdc-tab-header-pagination-controls-enabled",n._showPaginationControls)("mat-mdc-tab-header-rtl",n._getLayoutDirection()=="rtl")},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],disableRipple:[2,"disableRipple","disableRipple",ae]},features:[et],ngContentSelectors:_G,decls:13,vars:10,consts:[["previousPaginator",""],["tabListContainer",""],["tabList",""],["tabListInner",""],["nextPaginator",""],["mat-ripple","",1,"mat-mdc-tab-header-pagination","mat-mdc-tab-header-pagination-before",3,"click","mousedown","touchend","matRippleDisabled"],[1,"mat-mdc-tab-header-pagination-chevron"],[1,"mat-mdc-tab-label-container",3,"keydown"],["role","tablist",1,"mat-mdc-tab-list",3,"cdkObserveContent"],[1,"mat-mdc-tab-labels"],["mat-ripple","",1,"mat-mdc-tab-header-pagination","mat-mdc-tab-header-pagination-after",3,"mousedown","click","touchend","matRippleDisabled"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"div",5,0),mA("click",function(){return LA(o),xA(n._handlePaginatorClick("before"))})("mousedown",function(s){return LA(o),xA(n._handlePaginatorPress("before",s))})("touchend",function(){return LA(o),xA(n._stopInterval())}),UA(2,"div",6),R(),S(3,"div",7,1),mA("keydown",function(s){return LA(o),xA(n._handleKeydown(s))}),S(5,"div",8,2),mA("cdkObserveContent",function(){return LA(o),xA(n._onContentChanges())}),S(7,"div",9,3),xe(9),R()()(),S(10,"div",10,4),mA("mousedown",function(s){return LA(o),xA(n._handlePaginatorPress("after",s))})("click",function(){return LA(o),xA(n._handlePaginatorClick("after"))})("touchend",function(){return LA(o),xA(n._stopInterval())}),UA(12,"div",6),R()}i&2&&(ue("mat-mdc-tab-header-pagination-disabled",n._disableScrollBefore),vA("matRippleDisabled",n._disableScrollBefore||n.disableRipple),_(3),ue("_mat-animation-noopable",n._animationMode==="NoopAnimations"),_(2),_e("aria-label",n.ariaLabel||null)("aria-labelledby",n.ariaLabelledby||null),_(5),ue("mat-mdc-tab-header-pagination-disabled",n._disableScrollAfter),vA("matRippleDisabled",n._disableScrollAfter||n.disableRipple))},dependencies:[Gs,N6],styles:[".mat-mdc-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mdc-tab-indicator .mdc-tab-indicator__content{transition-duration:var(--mat-tab-animation-duration, 250ms)}.mat-mdc-tab-header-pagination{-webkit-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:rgba(0,0,0,0);touch-action:none;box-sizing:content-box;outline:0}.mat-mdc-tab-header-pagination::-moz-focus-inner{border:0}.mat-mdc-tab-header-pagination .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-controls-enabled .mat-mdc-tab-header-pagination{display:flex}.mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after{padding-left:4px}.mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before,.mat-mdc-tab-header-pagination-after{padding-right:4px}.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-mdc-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;height:8px;width:8px;border-color:var(--mat-tab-header-pagination-icon-color, var(--mat-sys-on-surface))}.mat-mdc-tab-header-pagination-disabled{box-shadow:none;cursor:default;pointer-events:none}.mat-mdc-tab-header-pagination-disabled .mat-mdc-tab-header-pagination-chevron{opacity:.4}.mat-mdc-tab-list{flex-grow:1;position:relative;transition:transform 500ms cubic-bezier(0.35, 0, 0.25, 1)}._mat-animation-noopable .mat-mdc-tab-list{transition:none}.mat-mdc-tab-label-container{display:flex;flex-grow:1;overflow:hidden;z-index:1;border-bottom-style:solid;border-bottom-width:var(--mat-tab-header-divider-height, 1px);border-bottom-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-group-inverted-header .mat-mdc-tab-label-container{border-bottom:none;border-top-style:solid;border-top-width:var(--mat-tab-header-divider-height, 1px);border-top-color:var(--mat-tab-header-divider-color, var(--mat-sys-surface-variant))}.mat-mdc-tab-labels{display:flex;flex:1 0 auto}[mat-align-tabs=center]>.mat-mdc-tab-header .mat-mdc-tab-labels{justify-content:center}[mat-align-tabs=end]>.mat-mdc-tab-header .mat-mdc-tab-labels{justify-content:flex-end}.cdk-drop-list .mat-mdc-tab-labels,.mat-mdc-tab-labels.cdk-drop-list{min-height:var(--mdc-secondary-navigation-tab-container-height, 48px)}.mat-mdc-tab::before{margin:5px}@media(forced-colors: active){.mat-mdc-tab[aria-disabled=true]{color:GrayText}}"],encapsulation:2})}return t})(),YHA=new BA("MAT_TABS_CONFIG"),JHA={translateTab:cg("translateTab",[wc("center, void, left-origin-center, right-origin-center",ar({transform:"none",visibility:"visible"})),wc("left",ar({transform:"translate3d(-100%, 0, 0)",minHeight:"1px",visibility:"hidden"})),wc("right",ar({transform:"translate3d(100%, 0, 0)",minHeight:"1px",visibility:"hidden"})),la("* => left, * => right, left => center, right => center",$a("{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)")),la("void => left-origin-center",[ar({transform:"translate3d(-100%, 0, 0)",visibility:"hidden"}),$a("{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)")]),la("void => right-origin-center",[ar({transform:"translate3d(100%, 0, 0)",visibility:"hidden"}),$a("{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)")])])},THA=(()=>{class t extends ca{_host=m(hcA);_centeringSub=_t.EMPTY;_leavingSub=_t.EMPTY;constructor(){super()}ngOnInit(){super.ngOnInit(),this._centeringSub=this._host._beforeCentering.pipe(Qo(this._host._isCenterPosition(this._host._position))).subscribe(A=>{this._host._content&&A&&!this.hasAttached()&&this.attach(this._host._content)}),this._leavingSub=this._host._afterLeavingCenter.subscribe(()=>{this._host.preserveContent||this.detach()})}ngOnDestroy(){super.ngOnDestroy(),this._centeringSub.unsubscribe(),this._leavingSub.unsubscribe()}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["","matTabBodyHost",""]],features:[et]})}return t})(),hcA=(()=>{class t{_elementRef=m(te);_dir=m(bo,{optional:!0});_positionIndex;_dirChangeSubscription=_t.EMPTY;_position;_translateTabComplete=new HA;_onCentering=new XA;_beforeCentering=new XA;_afterLeavingCenter=new XA;_onCentered=new XA(!0);_portalHost;_content;origin;animationDuration="500ms";preserveContent=!1;set position(A){this._positionIndex=A,this._computePositionAnimationState()}constructor(){if(this._dir){let A=m(lt);this._dirChangeSubscription=this._dir.change.subscribe(i=>{this._computePositionAnimationState(i),A.markForCheck()})}this._translateTabComplete.subscribe(A=>{this._isCenterPosition(A.toState)&&this._isCenterPosition(this._position)&&this._onCentered.emit(),this._isCenterPosition(A.fromState)&&!this._isCenterPosition(this._position)&&this._afterLeavingCenter.emit()})}ngOnInit(){this._position=="center"&&this.origin!=null&&(this._position=this._computePositionFromOrigin(this.origin))}ngOnDestroy(){this._dirChangeSubscription.unsubscribe(),this._translateTabComplete.complete()}_onTranslateTabStarted(A){let i=this._isCenterPosition(A.toState);this._beforeCentering.emit(i),i&&this._onCentering.emit(this._elementRef.nativeElement.clientHeight)}_getLayoutDirection(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}_isCenterPosition(A){return A=="center"||A=="left-origin-center"||A=="right-origin-center"}_computePositionAnimationState(A=this._getLayoutDirection()){this._positionIndex<0?this._position=A=="ltr"?"left":"right":this._positionIndex>0?this._position=A=="ltr"?"right":"left":this._position="center"}_computePositionFromOrigin(A){let i=this._getLayoutDirection();return i=="ltr"&&A<=0||i=="rtl"&&A>0?"left-origin-center":"right-origin-center"}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-tab-body"]],viewQuery:function(i,n){if(i&1&&Ge(ca,5),i&2){let o;$A(o=Ae())&&(n._portalHost=o.first)}},hostAttrs:[1,"mat-mdc-tab-body"],inputs:{_content:[0,"content","_content"],origin:"origin",animationDuration:"animationDuration",preserveContent:"preserveContent",position:"position"},outputs:{_onCentering:"_onCentering",_beforeCentering:"_beforeCentering",_afterLeavingCenter:"_afterLeavingCenter",_onCentered:"_onCentered"},decls:3,vars:6,consts:[["content",""],["cdkScrollable","",1,"mat-mdc-tab-body-content"],["matTabBodyHost",""]],template:function(i,n){if(i&1){let o=De();S(0,"div",1,0),mA("@translateTab.start",function(s){return LA(o),xA(n._onTranslateTabStarted(s))})("@translateTab.done",function(s){return LA(o),xA(n._translateTabComplete.next(s))}),NA(2,wHA,0,0,"ng-template",2),R()}i&2&&vA("@translateTab",p2(3,pHA,n._position,Yr(1,mHA,n.animationDuration)))},dependencies:[THA,h0],styles:['.mat-mdc-tab-body{top:0;left:0;right:0;bottom:0;position:absolute;display:block;overflow:hidden;outline:0;flex-basis:100%}.mat-mdc-tab-body.mat-mdc-tab-body-active{position:relative;overflow-x:hidden;overflow-y:auto;z-index:1;flex-grow:1}.mat-mdc-tab-group.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body.mat-mdc-tab-body-active{overflow-y:hidden}.mat-mdc-tab-body-content{height:100%;overflow:auto}.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body-content{overflow:hidden}.mat-mdc-tab-body-content[style*="visibility: hidden"]{display:none}'],encapsulation:2,data:{animation:[JHA.translateTab]}})}return t})(),zHA=!0,Py=(()=>{class t{_elementRef=m(te);_changeDetectorRef=m(lt);_animationMode=m(mi,{optional:!0});_allTabs;_tabBodyWrapper;_tabHeader;_tabs=new Ec;_indexToSelect=0;_lastFocusedTabIndex=null;_tabBodyWrapperHeight=0;_tabsSubscription=_t.EMPTY;_tabLabelSubscription=_t.EMPTY;color;get fitInkBarToContent(){return this._fitInkBarToContent}set fitInkBarToContent(A){this._fitInkBarToContent=A,this._changeDetectorRef.markForCheck()}_fitInkBarToContent=!1;stretchTabs=!0;alignTabs=null;dynamicHeight=!1;get selectedIndex(){return this._selectedIndex}set selectedIndex(A){this._indexToSelect=isNaN(A)?null:A}_selectedIndex=null;headerPosition="above";get animationDuration(){return this._animationDuration}set animationDuration(A){let i=A+"";this._animationDuration=/^\d+$/.test(i)?A+"ms":i}_animationDuration;get contentTabIndex(){return this._contentTabIndex}set contentTabIndex(A){this._contentTabIndex=isNaN(A)?null:A}_contentTabIndex;disablePagination=!1;disableRipple=!1;preserveContent=!1;get backgroundColor(){return this._backgroundColor}set backgroundColor(A){if(!zHA)throw new Error("mat-tab-group background color must be set through the Sass theming API");let i=this._elementRef.nativeElement.classList;i.remove("mat-tabs-with-background",`mat-background-${this.backgroundColor}`),A&&i.add("mat-tabs-with-background",`mat-background-${A}`),this._backgroundColor=A}_backgroundColor;ariaLabel;ariaLabelledby;selectedIndexChange=new XA;focusChange=new XA;animationDone=new XA;selectedTabChange=new XA(!0);_groupId;_isServer=!m(Zt).isBrowser;constructor(){let A=m(YHA,{optional:!0});this._groupId=m($i).getId("mat-tab-group-"),this.animationDuration=A&&A.animationDuration?A.animationDuration:"500ms",this.disablePagination=A&&A.disablePagination!=null?A.disablePagination:!1,this.dynamicHeight=A&&A.dynamicHeight!=null?A.dynamicHeight:!1,A?.contentTabIndex!=null&&(this.contentTabIndex=A.contentTabIndex),this.preserveContent=!!A?.preserveContent,this.fitInkBarToContent=A&&A.fitInkBarToContent!=null?A.fitInkBarToContent:!1,this.stretchTabs=A&&A.stretchTabs!=null?A.stretchTabs:!0,this.alignTabs=A&&A.alignTabs!=null?A.alignTabs:null}ngAfterContentChecked(){let A=this._indexToSelect=this._clampTabIndex(this._indexToSelect);if(this._selectedIndex!=A){let i=this._selectedIndex==null;if(!i){this.selectedTabChange.emit(this._createChangeEvent(A));let n=this._tabBodyWrapper.nativeElement;n.style.minHeight=n.clientHeight+"px"}Promise.resolve().then(()=>{this._tabs.forEach((n,o)=>n.isActive=o===A),i||(this.selectedIndexChange.emit(A),this._tabBodyWrapper.nativeElement.style.minHeight="")})}this._tabs.forEach((i,n)=>{i.position=n-A,this._selectedIndex!=null&&i.position==0&&!i.origin&&(i.origin=A-this._selectedIndex)}),this._selectedIndex!==A&&(this._selectedIndex=A,this._lastFocusedTabIndex=null,this._changeDetectorRef.markForCheck())}ngAfterContentInit(){this._subscribeToAllTabChanges(),this._subscribeToTabLabels(),this._tabsSubscription=this._tabs.changes.subscribe(()=>{let A=this._clampTabIndex(this._indexToSelect);if(A===this._selectedIndex){let i=this._tabs.toArray(),n;for(let o=0;o{i[A].isActive=!0,this.selectedTabChange.emit(this._createChangeEvent(A))})}this._changeDetectorRef.markForCheck()})}_subscribeToAllTabChanges(){this._allTabs.changes.pipe(Qo(this._allTabs)).subscribe(A=>{this._tabs.reset(A.filter(i=>i._closestTabGroup===this||!i._closestTabGroup)),this._tabs.notifyOnChanges()})}ngOnDestroy(){this._tabs.destroy(),this._tabsSubscription.unsubscribe(),this._tabLabelSubscription.unsubscribe()}realignInkBar(){this._tabHeader&&this._tabHeader._alignInkBarToSelectedTab()}updatePagination(){this._tabHeader&&this._tabHeader.updatePagination()}focusTab(A){let i=this._tabHeader;i&&(i.focusIndex=A)}_focusChanged(A){this._lastFocusedTabIndex=A,this.focusChange.emit(this._createChangeEvent(A))}_createChangeEvent(A){let i=new NG;return i.index=A,this._tabs&&this._tabs.length&&(i.tab=this._tabs.toArray()[A]),i}_subscribeToTabLabels(){this._tabLabelSubscription&&this._tabLabelSubscription.unsubscribe(),this._tabLabelSubscription=ho(...this._tabs.map(A=>A._stateChanges)).subscribe(()=>this._changeDetectorRef.markForCheck())}_clampTabIndex(A){return Math.min(this._tabs.length-1,Math.max(A||0,0))}_getTabLabelId(A){return`${this._groupId}-label-${A}`}_getTabContentId(A){return`${this._groupId}-content-${A}`}_setTabBodyWrapperHeight(A){if(!this.dynamicHeight||!this._tabBodyWrapperHeight)return;let i=this._tabBodyWrapper.nativeElement;i.style.height=this._tabBodyWrapperHeight+"px",this._tabBodyWrapper.nativeElement.offsetHeight&&(i.style.height=A+"px")}_removeTabBodyWrapperHeight(){let A=this._tabBodyWrapper.nativeElement;this._tabBodyWrapperHeight=A.clientHeight,A.style.height="",this.animationDone.emit()}_handleClick(A,i,n){i.focusIndex=n,A.disabled||(this.selectedIndex=n)}_getTabIndex(A){let i=this._lastFocusedTabIndex??this.selectedIndex;return A===i?0:-1}_tabFocusChanged(A,i){A&&A!=="mouse"&&A!=="touch"&&(this._tabHeader.focusIndex=i)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-tab-group"]],contentQueries:function(i,n,o){if(i&1&&Ii(o,af,5),i&2){let r;$A(r=Ae())&&(n._allTabs=r)}},viewQuery:function(i,n){if(i&1&&(Ge(DHA,5),Ge(yHA,5)),i&2){let o;$A(o=Ae())&&(n._tabBodyWrapper=o.first),$A(o=Ae())&&(n._tabHeader=o.first)}},hostAttrs:[1,"mat-mdc-tab-group"],hostVars:11,hostBindings:function(i,n){i&2&&(_e("mat-align-tabs",n.alignTabs),vo("mat-"+(n.color||"primary")),so("--mat-tab-animation-duration",n.animationDuration),ue("mat-mdc-tab-group-dynamic-height",n.dynamicHeight)("mat-mdc-tab-group-inverted-header",n.headerPosition==="below")("mat-mdc-tab-group-stretch-tabs",n.stretchTabs))},inputs:{color:"color",fitInkBarToContent:[2,"fitInkBarToContent","fitInkBarToContent",ae],stretchTabs:[2,"mat-stretch-tabs","stretchTabs",ae],alignTabs:[0,"mat-align-tabs","alignTabs"],dynamicHeight:[2,"dynamicHeight","dynamicHeight",ae],selectedIndex:[2,"selectedIndex","selectedIndex",Mi],headerPosition:"headerPosition",animationDuration:"animationDuration",contentTabIndex:[2,"contentTabIndex","contentTabIndex",Mi],disablePagination:[2,"disablePagination","disablePagination",ae],disableRipple:[2,"disableRipple","disableRipple",ae],preserveContent:[2,"preserveContent","preserveContent",ae],backgroundColor:"backgroundColor",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"]},outputs:{selectedIndexChange:"selectedIndexChange",focusChange:"focusChange",animationDone:"animationDone",selectedTabChange:"selectedTabChange"},exportAs:["matTabGroup"],features:[ct([{provide:BcA,useExisting:t}])],ngContentSelectors:_G,decls:9,vars:8,consts:[["tabHeader",""],["tabBodyWrapper",""],["tabNode",""],[3,"indexFocused","selectFocusedIndex","selectedIndex","disableRipple","disablePagination","aria-label","aria-labelledby"],["role","tab","matTabLabelWrapper","","cdkMonitorElementFocus","",1,"mdc-tab","mat-mdc-tab","mat-focus-indicator",3,"id","mdc-tab--active","class","disabled","fitInkBarToContent"],[1,"mat-mdc-tab-body-wrapper"],["role","tabpanel",3,"id","mat-mdc-tab-body-active","class","content","position","origin","animationDuration","preserveContent"],["role","tab","matTabLabelWrapper","","cdkMonitorElementFocus","",1,"mdc-tab","mat-mdc-tab","mat-focus-indicator",3,"click","cdkFocusChange","id","disabled","fitInkBarToContent"],[1,"mdc-tab__ripple"],["mat-ripple","",1,"mat-mdc-tab-ripple",3,"matRippleTrigger","matRippleDisabled"],[1,"mdc-tab__content"],[1,"mdc-tab__text-label"],[3,"cdkPortalOutlet"],["role","tabpanel",3,"_onCentered","_onCentering","id","content","position","origin","animationDuration","preserveContent"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"mat-tab-header",3,0),mA("indexFocused",function(s){return LA(o),xA(n._focusChanged(s))})("selectFocusedIndex",function(s){return LA(o),xA(n.selectedIndex=s)}),ln(2,kHA,8,17,"div",4,Kn),R(),NA(4,SHA,1,0),S(5,"div",5,1),ln(7,RHA,1,13,"mat-tab-body",6,Kn),R()}i&2&&(vA("selectedIndex",n.selectedIndex||0)("disableRipple",n.disableRipple)("disablePagination",n.disablePagination)("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby),_(2),gn(n._tabs),_(2),FA(n._isServer?4:-1),_(),ue("_mat-animation-noopable",n._animationMode==="NoopAnimations"),_(2),gn(n._tabs))},dependencies:[KHA,EcA,SO,Gs,ca,hcA],styles:['.mdc-tab{min-width:90px;padding:0 24px;display:flex;flex:1 0 auto;justify-content:center;box-sizing:border-box;border:none;outline:none;text-align:center;white-space:nowrap;cursor:pointer;z-index:1}.mdc-tab__content{display:flex;align-items:center;justify-content:center;height:inherit;pointer-events:none}.mdc-tab__text-label{transition:150ms color linear;display:inline-block;line-height:1;z-index:2}.mdc-tab--active .mdc-tab__text-label{transition-delay:100ms}._mat-animation-noopable .mdc-tab__text-label{transition:none}.mdc-tab-indicator{display:flex;position:absolute;top:0;left:0;justify-content:center;width:100%;height:100%;pointer-events:none;z-index:1}.mdc-tab-indicator__content{transition:var(--mat-tab-animation-duration, 250ms) transform cubic-bezier(0.4, 0, 0.2, 1);transform-origin:left;opacity:0}.mdc-tab-indicator__content--underline{align-self:flex-end;box-sizing:border-box;width:100%;border-top-style:solid}.mdc-tab-indicator--active .mdc-tab-indicator__content{opacity:1}._mat-animation-noopable .mdc-tab-indicator__content,.mdc-tab-indicator--no-transition .mdc-tab-indicator__content{transition:none}.mat-mdc-tab-ripple.mat-mdc-tab-ripple{position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none}.mat-mdc-tab{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;background:none;height:var(--mdc-secondary-navigation-tab-container-height, 48px);font-family:var(--mat-tab-header-label-text-font, var(--mat-sys-title-small-font));font-size:var(--mat-tab-header-label-text-size, var(--mat-sys-title-small-size));letter-spacing:var(--mat-tab-header-label-text-tracking, var(--mat-sys-title-small-tracking));line-height:var(--mat-tab-header-label-text-line-height, var(--mat-sys-title-small-line-height));font-weight:var(--mat-tab-header-label-text-weight, var(--mat-sys-title-small-weight))}.mat-mdc-tab.mdc-tab{flex-grow:0}.mat-mdc-tab .mdc-tab-indicator__content--underline{border-color:var(--mdc-tab-indicator-active-indicator-color, var(--mat-sys-primary));border-top-width:var(--mdc-tab-indicator-active-indicator-height, 2px);border-radius:var(--mdc-tab-indicator-active-indicator-shape, 0)}.mat-mdc-tab:hover .mdc-tab__text-label{color:var(--mat-tab-header-inactive-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab:focus .mdc-tab__text-label{color:var(--mat-tab-header-inactive-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active .mdc-tab__text-label{color:var(--mat-tab-header-active-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active .mdc-tab__ripple::before,.mat-mdc-tab.mdc-tab--active .mat-ripple-element{background-color:var(--mat-tab-header-active-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:hover .mdc-tab__text-label{color:var(--mat-tab-header-active-hover-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:hover .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-hover-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab.mdc-tab--active:focus .mdc-tab__text-label{color:var(--mat-tab-header-active-focus-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-tab.mdc-tab--active:focus .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-active-focus-indicator-color, var(--mat-sys-primary))}.mat-mdc-tab.mat-mdc-tab-disabled{opacity:.4;pointer-events:none}.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__content{pointer-events:none}.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__ripple::before,.mat-mdc-tab.mat-mdc-tab-disabled .mat-ripple-element{background-color:var(--mat-tab-header-disabled-ripple-color)}.mat-mdc-tab .mdc-tab__ripple::before{content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;opacity:0;pointer-events:none;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab .mdc-tab__text-label{color:var(--mat-tab-header-inactive-label-text-color, var(--mat-sys-on-surface));display:inline-flex;align-items:center}.mat-mdc-tab .mdc-tab__content{position:relative;pointer-events:auto}.mat-mdc-tab:hover .mdc-tab__ripple::before{opacity:.04}.mat-mdc-tab.cdk-program-focused .mdc-tab__ripple::before,.mat-mdc-tab.cdk-keyboard-focused .mdc-tab__ripple::before{opacity:.12}.mat-mdc-tab .mat-ripple-element{opacity:.12;background-color:var(--mat-tab-header-inactive-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-tab-group.mat-mdc-tab-group-stretch-tabs>.mat-mdc-tab-header .mat-mdc-tab{flex-grow:1}.mat-mdc-tab-group{display:flex;flex-direction:column;max-width:100%}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination{background-color:var(--mat-tab-header-with-background-background-color)}.mat-mdc-tab-group.mat-tabs-with-background.mat-primary>.mat-mdc-tab-header .mat-mdc-tab .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background.mat-primary>.mat-mdc-tab-header .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary)>.mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab-indicator__content--underline{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-focus-indicator::before,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-focus-indicator::before{border-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-ripple-element,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mdc-tab__ripple::before,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-ripple-element,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mdc-tab__ripple::before{background-color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron,.mat-mdc-tab-group.mat-tabs-with-background>.mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron{color:var(--mat-tab-header-with-background-foreground-color)}.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header{flex-direction:column-reverse}.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header .mdc-tab-indicator__content--underline{align-self:flex-start}.mat-mdc-tab-body-wrapper{position:relative;overflow:hidden;display:flex;transition:height 500ms cubic-bezier(0.35, 0, 0.25, 1)}.mat-mdc-tab-body-wrapper._mat-animation-noopable{transition:none !important;animation:none !important}'],encapsulation:2})}return t})(),NG=class{index;tab};var QcA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Ve]})}return t})();function HHA(t,e){t&1&&UA(0,"div",2)}var OHA=new BA("MAT_PROGRESS_BAR_DEFAULT_OPTIONS");var mcA=(()=>{class t{_elementRef=m(te);_ngZone=m(de);_changeDetectorRef=m(lt);_renderer=m(Gi);_cleanupTransitionEnd;_animationMode=m(mi,{optional:!0});constructor(){let A=m(OHA,{optional:!0});this._isNoopAnimation=this._animationMode==="NoopAnimations",A&&(A.color&&(this.color=this._defaultColor=A.color),this.mode=A.mode||this.mode)}_isNoopAnimation=!1;get color(){return this._color||this._defaultColor}set color(A){this._color=A}_color;_defaultColor="primary";get value(){return this._value}set value(A){this._value=fcA(A||0),this._changeDetectorRef.markForCheck()}_value=0;get bufferValue(){return this._bufferValue||0}set bufferValue(A){this._bufferValue=fcA(A||0),this._changeDetectorRef.markForCheck()}_bufferValue=0;animationEnd=new XA;get mode(){return this._mode}set mode(A){this._mode=A,this._changeDetectorRef.markForCheck()}_mode="determinate";ngAfterViewInit(){this._ngZone.runOutsideAngular(()=>{this._cleanupTransitionEnd=this._renderer.listen(this._elementRef.nativeElement,"transitionend",this._transitionendHandler)})}ngOnDestroy(){this._cleanupTransitionEnd?.()}_getPrimaryBarTransform(){return`scaleX(${this._isIndeterminate()?1:this.value/100})`}_getBufferBarFlexBasis(){return`${this.mode==="buffer"?this.bufferValue:100}%`}_isIndeterminate(){return this.mode==="indeterminate"||this.mode==="query"}_transitionendHandler=A=>{this.animationEnd.observers.length===0||!A.target||!A.target.classList.contains("mdc-linear-progress__primary-bar")||(this.mode==="determinate"||this.mode==="buffer")&&this._ngZone.run(()=>this.animationEnd.next({value:this.value}))};static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-progress-bar"]],hostAttrs:["role","progressbar","aria-valuemin","0","aria-valuemax","100","tabindex","-1",1,"mat-mdc-progress-bar","mdc-linear-progress"],hostVars:10,hostBindings:function(i,n){i&2&&(_e("aria-valuenow",n._isIndeterminate()?null:n.value)("mode",n.mode),vo("mat-"+n.color),ue("_mat-animation-noopable",n._isNoopAnimation)("mdc-linear-progress--animation-ready",!n._isNoopAnimation)("mdc-linear-progress--indeterminate",n._isIndeterminate()))},inputs:{color:"color",value:[2,"value","value",Mi],bufferValue:[2,"bufferValue","bufferValue",Mi],mode:"mode"},outputs:{animationEnd:"animationEnd"},exportAs:["matProgressBar"],decls:7,vars:5,consts:[["aria-hidden","true",1,"mdc-linear-progress__buffer"],[1,"mdc-linear-progress__buffer-bar"],[1,"mdc-linear-progress__buffer-dots"],["aria-hidden","true",1,"mdc-linear-progress__bar","mdc-linear-progress__primary-bar"],[1,"mdc-linear-progress__bar-inner"],["aria-hidden","true",1,"mdc-linear-progress__bar","mdc-linear-progress__secondary-bar"]],template:function(i,n){i&1&&(S(0,"div",0),UA(1,"div",1),NA(2,HHA,1,0,"div",2),R(),S(3,"div",3),UA(4,"span",4),R(),S(5,"div",5),UA(6,"span",4),R()),i&2&&(_(),so("flex-basis",n._getBufferBarFlexBasis()),_(),FA(n.mode==="buffer"?2:-1),_(),so("transform",n._getPrimaryBarTransform()))},styles:[`.mat-mdc-progress-bar{display:block;text-align:start}.mat-mdc-progress-bar[mode=query]{transform:scaleX(-1)}.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__buffer-dots,.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__primary-bar,.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__secondary-bar,.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__bar-inner.mdc-linear-progress__bar-inner{animation:none}.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__primary-bar,.mat-mdc-progress-bar._mat-animation-noopable .mdc-linear-progress__buffer-bar{transition:transform 1ms}.mdc-linear-progress{position:relative;width:100%;transform:translateZ(0);outline:1px solid rgba(0,0,0,0);overflow-x:hidden;transition:opacity 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);height:max(var(--mdc-linear-progress-track-height, 4px),var(--mdc-linear-progress-active-indicator-height, 4px))}@media(forced-colors: active){.mdc-linear-progress{outline-color:CanvasText}}.mdc-linear-progress__bar{position:absolute;top:0;bottom:0;margin:auto 0;width:100%;animation:none;transform-origin:top left;transition:transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);height:var(--mdc-linear-progress-active-indicator-height, 4px)}.mdc-linear-progress--indeterminate .mdc-linear-progress__bar{transition:none}[dir=rtl] .mdc-linear-progress__bar{right:0;transform-origin:center right}.mdc-linear-progress__bar-inner{display:inline-block;position:absolute;width:100%;animation:none;border-top-style:solid;border-color:var(--mdc-linear-progress-active-indicator-color, var(--mat-sys-primary));border-top-width:var(--mdc-linear-progress-active-indicator-height, 4px)}.mdc-linear-progress__buffer{display:flex;position:absolute;top:0;bottom:0;margin:auto 0;width:100%;overflow:hidden;height:var(--mdc-linear-progress-track-height, 4px);border-radius:var(--mdc-linear-progress-track-shape, var(--mat-sys-corner-none))}.mdc-linear-progress__buffer-dots{-webkit-mask-image:url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='xMinYMin slice'%3E%3Ccircle cx='1' cy='1' r='1'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='xMinYMin slice'%3E%3Ccircle cx='1' cy='1' r='1'/%3E%3C/svg%3E");background-repeat:repeat-x;flex:auto;transform:rotate(180deg);animation:mdc-linear-progress-buffering 250ms infinite linear;background-color:var(--mdc-linear-progress-track-color, var(--mat-sys-surface-variant))}@media(forced-colors: active){.mdc-linear-progress__buffer-dots{background-color:ButtonBorder}}[dir=rtl] .mdc-linear-progress__buffer-dots{animation:mdc-linear-progress-buffering-reverse 250ms infinite linear;transform:rotate(0)}.mdc-linear-progress__buffer-bar{flex:0 1 100%;transition:flex-basis 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);background-color:var(--mdc-linear-progress-track-color, var(--mat-sys-surface-variant))}.mdc-linear-progress__primary-bar{transform:scaleX(0)}.mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar{left:-145.166611%}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar{animation:mdc-linear-progress-primary-indeterminate-translate 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar>.mdc-linear-progress__bar-inner{animation:mdc-linear-progress-primary-indeterminate-scale 2s infinite linear}[dir=rtl] .mdc-linear-progress.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar{animation-name:mdc-linear-progress-primary-indeterminate-translate-reverse}[dir=rtl] .mdc-linear-progress.mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar{right:-145.166611%;left:auto}.mdc-linear-progress__secondary-bar{display:none}.mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar{left:-54.888891%;display:block}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar{animation:mdc-linear-progress-secondary-indeterminate-translate 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar>.mdc-linear-progress__bar-inner{animation:mdc-linear-progress-secondary-indeterminate-scale 2s infinite linear}[dir=rtl] .mdc-linear-progress.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar{animation-name:mdc-linear-progress-secondary-indeterminate-translate-reverse}[dir=rtl] .mdc-linear-progress.mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar{right:-54.888891%;left:auto}@keyframes mdc-linear-progress-buffering{from{transform:rotate(180deg) translateX(calc(var(--mdc-linear-progress-track-height, 4px) * -2.5))}}@keyframes mdc-linear-progress-primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes mdc-linear-progress-primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes mdc-linear-progress-secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes mdc-linear-progress-secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes mdc-linear-progress-primary-indeterminate-translate-reverse{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(-83.67142%)}100%{transform:translateX(-200.611057%)}}@keyframes mdc-linear-progress-secondary-indeterminate-translate-reverse{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(-37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(-84.386165%)}100%{transform:translateX(-160.277782%)}}@keyframes mdc-linear-progress-buffering-reverse{from{transform:translateX(-10px)}}`],encapsulation:2,changeDetection:0})}return t})();function fcA(t,e=0,A=100){return Math.max(e,Math.min(A,t))}var pcA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve]})}return t})();function YG(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ZC=YG();function McA(t){ZC=t}var gf={exec:()=>null};function xn(t,e=""){let A=typeof t=="string"?t:t.source,i={replace:(n,o)=>{let r=typeof o=="string"?o:o.source;return r=r.replace(Ps.caret,"$1"),A=A.replace(n,r),i},getRegex:()=>new RegExp(A,e)};return i}var Ps={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},jHA=/^(?:[ \t]*(?:\n|$))+/,qHA=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,VHA=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Cf=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ZHA=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,JG=/(?:[*+-]|\d{1,9}[.)])/,kcA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ScA=xn(kcA).replace(/bull/g,JG).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),WHA=xn(kcA).replace(/bull/g,JG).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),TG=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,XHA=/^[^\n]+/,zG=/(?!\s*\])(?:\\.|[^\[\]\\])+/,$HA=xn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",zG).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),AOA=xn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,JG).getRegex(),Vy="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",HG=/|$))/,eOA=xn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",HG).replace("tag",Vy).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),RcA=xn(TG).replace("hr",Cf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Vy).getRegex(),tOA=xn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",RcA).getRegex(),OG={blockquote:tOA,code:qHA,def:$HA,fences:VHA,heading:ZHA,hr:Cf,html:eOA,lheading:ScA,list:AOA,newline:jHA,paragraph:RcA,table:gf,text:XHA},wcA=xn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Cf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Vy).getRegex(),iOA=Ne(nA({},OG),{lheading:WHA,table:wcA,paragraph:xn(TG).replace("hr",Cf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",wcA).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Vy).getRegex()}),nOA=Ne(nA({},OG),{html:xn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",HG).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:gf,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:xn(TG).replace("hr",Cf).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",ScA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),oOA=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rOA=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,LcA=/^( {2,}|\\)\n(?!\s*$)/,sOA=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,NcA=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,IOA=xn(NcA,"u").replace(/punct/g,Zy).getRegex(),COA=xn(NcA,"u").replace(/punct/g,FcA).getRegex(),_cA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",dOA=xn(_cA,"gu").replace(/notPunctSpace/g,xcA).replace(/punctSpace/g,PG).replace(/punct/g,Zy).getRegex(),BOA=xn(_cA,"gu").replace(/notPunctSpace/g,lOA).replace(/punctSpace/g,cOA).replace(/punct/g,FcA).getRegex(),EOA=xn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,xcA).replace(/punctSpace/g,PG).replace(/punct/g,Zy).getRegex(),hOA=xn(/\\(punct)/,"gu").replace(/punct/g,Zy).getRegex(),QOA=xn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),uOA=xn(HG).replace("(?:-->|$)","-->").getRegex(),fOA=xn("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",uOA).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qy=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,mOA=xn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",qy).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),GcA=xn(/^!?\[(label)\]\[(ref)\]/).replace("label",qy).replace("ref",zG).getRegex(),UcA=xn(/^!?\[(ref)\](?:\[\])?/).replace("ref",zG).getRegex(),pOA=xn("reflink|nolink(?!\\()","g").replace("reflink",GcA).replace("nolink",UcA).getRegex(),jG={_backpedal:gf,anyPunctuation:hOA,autolink:QOA,blockSkip:gOA,br:LcA,code:rOA,del:gf,emStrongLDelim:IOA,emStrongRDelimAst:dOA,emStrongRDelimUnd:EOA,escape:oOA,link:mOA,nolink:UcA,punctuation:aOA,reflink:GcA,reflinkSearch:pOA,tag:fOA,text:sOA,url:gf},wOA=Ne(nA({},jG),{link:xn(/^!?\[(label)\]\((.*?)\)/).replace("label",qy).getRegex(),reflink:xn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qy).getRegex()}),UG=Ne(nA({},jG),{emStrongRDelimAst:BOA,emStrongLDelim:COA,url:xn(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},DcA=t=>yOA[t];function Hg(t,e){if(e){if(Ps.escapeTest.test(t))return t.replace(Ps.escapeReplace,DcA)}else if(Ps.escapeTestNoEncode.test(t))return t.replace(Ps.escapeReplaceNoEncode,DcA);return t}function ycA(t){try{t=encodeURI(t).replace(Ps.percentDecode,"%")}catch{return null}return t}function vcA(t,e){let A=t.replace(Ps.findPipe,(o,r,s)=>{let a=!1,c=r;for(;--c>=0&&s[c]==="\\";)a=!a;return a?"|":" |"}),i=A.split(Ps.splitPipe),n=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length0?-2:-1}function bcA(t,e,A,i,n){let o=e.href,r=e.title||null,s=t[1].replace(n.other.outputLinkReplace,"$1");i.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:A,href:o,title:r,text:s,tokens:i.inlineTokens(s)};return i.state.inLink=!1,a}function bOA(t,e,A){let i=t.match(A.other.indentCodeCompensation);if(i===null)return e;let n=i[1];return e.split(` `).map(o=>{let r=o.match(A.other.beginningSpace);if(r===null)return o;let[s]=r;return s.length>=n.length?o.slice(n.length):o}).join(` `)}var fh=class{options;rules;lexer;constructor(e){this.options=e||ZC}space(e){let A=this.rules.block.newline.exec(e);if(A&&A[0].length>0)return{type:"space",raw:A[0]}}code(e){let A=this.rules.block.code.exec(e);if(A){let i=A[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:A[0],codeBlockStyle:"indented",text:this.options.pedantic?i:lf(i,` @@ -3906,9 +3906,9 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="

An error `+i+"\n```":i}parseMarked(A,i,n=!1){if(i.renderer){let o=nA({},i.renderer);delete o.\u0275NgxMarkdownRendererExtendedForExtensions,delete o.\u0275NgxMarkdownRendererExtendedForMermaid,delete i.renderer,En.use({renderer:o})}return n?En.parseInline(A,i):En.parse(A,i)}parseEmoji(A){if(!$l(this.platform))return A;if(typeof joypixels>"u"||typeof joypixels.shortnameToUnicode>"u")throw new Error(NOA);return joypixels.shortnameToUnicode(A)}renderKatex(A,i){if($l(this.platform)){if(typeof katex>"u"||typeof renderMathInElement>"u")throw new Error(_OA);renderMathInElement(A,i)}}renderClipboard(A,i,n){if(!$l(this.platform))return;if(typeof ClipboardJS>"u")throw new Error(UOA);if(!i)throw new Error(KOA);let{buttonComponent:o,buttonTemplate:r}=n,s=A.querySelectorAll("pre");for(let a=0;aI.classList.add("hover"),l.onmouseleave=()=>I.classList.remove("hover");let C;if(o){let B=i.createComponent(o);C=B.hostView,B.changeDetectorRef.markForCheck()}else if(r)C=i.createEmbeddedView(r);else{let B=i.createComponent(ROA);C=B.hostView,B.changeDetectorRef.markForCheck()}let d;C.rootNodes.forEach(B=>{I.appendChild(B),d=new ClipboardJS(B,{text:()=>c.innerText})}),C.onDestroy(()=>d.destroy())}}renderMermaid(A,i=this.DEFAULT_MERMAID_OPTIONS){if(!$l(this.platform))return;if(typeof mermaid>"u"||typeof mermaid.initialize>"u")throw new Error(GOA);let n=A.querySelectorAll(".mermaid");n.length!==0&&(mermaid.initialize(i),mermaid.run({nodes:n}))}trimIndentation(A){if(!A)return"";let i;return A.split(` `).map(n=>{let o=i;return n.length>0&&(o=isNaN(o)?n.search(/\S|$/):Math.min(n.search(/\S|$/),o)),isNaN(i)&&(i=o),o?n.substring(o):n}).join(` `)}static{this.\u0275fac=function(i){return new(i||t)(he(LOA,8),he(KcA,8),he(xOA,8),he(FOA,8),he(hc),he(YcA),he(Bs,8),he(il))}}static{this.\u0275prov=SA({token:t,factory:t.\u0275fac})}}return t})(),TcA=(()=>{class t{get disableSanitizer(){return this._disableSanitizer}set disableSanitizer(A){this._disableSanitizer=this.coerceBooleanProperty(A)}get inline(){return this._inline}set inline(A){this._inline=this.coerceBooleanProperty(A)}get clipboard(){return this._clipboard}set clipboard(A){this._clipboard=this.coerceBooleanProperty(A)}get emoji(){return this._emoji}set emoji(A){this._emoji=this.coerceBooleanProperty(A)}get katex(){return this._katex}set katex(A){this._katex=this.coerceBooleanProperty(A)}get mermaid(){return this._mermaid}set mermaid(A){this._mermaid=this.coerceBooleanProperty(A)}get lineHighlight(){return this._lineHighlight}set lineHighlight(A){this._lineHighlight=this.coerceBooleanProperty(A)}get lineNumbers(){return this._lineNumbers}set lineNumbers(A){this._lineNumbers=this.coerceBooleanProperty(A)}get commandLine(){return this._commandLine}set commandLine(A){this._commandLine=this.coerceBooleanProperty(A)}constructor(A,i,n){this.element=A,this.markdownService=i,this.viewContainerRef=n,this.error=new XA,this.load=new XA,this.ready=new XA,this._clipboard=!1,this._commandLine=!1,this._disableSanitizer=!1,this._emoji=!1,this._inline=!1,this._katex=!1,this._lineHighlight=!1,this._lineNumbers=!1,this._mermaid=!1,this.destroyed$=new HA}ngOnChanges(){this.loadContent()}loadContent(){if(this.data!=null){this.handleData();return}if(this.src!=null){this.handleSrc();return}}ngAfterViewInit(){!this.data&&!this.src&&this.handleTransclusion(),this.markdownService.reload$.pipe(wt(this.destroyed$)).subscribe(()=>this.loadContent())}ngOnDestroy(){this.destroyed$.next(),this.destroyed$.complete()}render(A,i=!1){return _n(this,null,function*(){let n={decodeHtml:i,inline:this.inline,emoji:this.emoji,mermaid:this.mermaid,disableSanitizer:this.disableSanitizer},o={clipboard:this.clipboard,clipboardOptions:this.getClipboardOptions(),katex:this.katex,katexOptions:this.katexOptions,mermaid:this.mermaid,mermaidOptions:this.mermaidOptions},r=yield this.markdownService.parse(A,n);this.element.nativeElement.innerHTML=r,this.handlePlugins(),this.markdownService.render(this.element.nativeElement,o,this.viewContainerRef),this.ready.emit()})}coerceBooleanProperty(A){return A!=null&&`${String(A)}`!="false"}getClipboardOptions(){if(this.clipboardButtonComponent||this.clipboardButtonTemplate)return{buttonComponent:this.clipboardButtonComponent,buttonTemplate:this.clipboardButtonTemplate}}handleData(){this.render(this.data)}handleSrc(){this.markdownService.getSource(this.src).subscribe({next:A=>{this.render(A).then(()=>{this.load.emit(A)})},error:A=>this.error.emit(A)})}handleTransclusion(){this.render(this.element.nativeElement.innerHTML,!0)}handlePlugins(){this.commandLine&&(this.setPluginClass(this.element.nativeElement,qG.CommandLine),this.setPluginOptions(this.element.nativeElement,{dataFilterOutput:this.filterOutput,dataHost:this.host,dataPrompt:this.prompt,dataOutput:this.output,dataUser:this.user})),this.lineHighlight&&this.setPluginOptions(this.element.nativeElement,{dataLine:this.line,dataLineOffset:this.lineOffset}),this.lineNumbers&&(this.setPluginClass(this.element.nativeElement,qG.LineNumbers),this.setPluginOptions(this.element.nativeElement,{dataStart:this.start}))}setPluginClass(A,i){let n=A.querySelectorAll("pre");for(let o=0;o{let s=i[r];if(s){let a=this.toLispCase(r);n.item(o).setAttribute(a,s.toString())}})}toLispCase(A){let i=A.match(/([A-Z])/g);if(!i)return A;let n=A.toString();for(let o=0,r=i.length;o{let i=TOA(A)?Ne(nA({},A),{multi:!0}):{provide:KcA,useValue:A,multi:!0};return[...e,i]},[])}var zcA=(()=>{class t{static forRoot(A){return{ngModule:t,providers:[JOA(A)]}}static forChild(){return{ngModule:t}}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=ge({type:t})}static{this.\u0275inj=le({imports:[g0]})}}return t})();var OOA=["switch"],POA=["*"];function jOA(t,e){t&1&&(S(0,"span",10),hr(),S(1,"svg",12),UA(2,"path",13),R(),S(3,"svg",14),UA(4,"path",15),R()())}var qOA=new BA("mat-slide-toggle-default-options",{providedIn:"root",factory:()=>({disableToggleValue:!1,hideIcon:!1,disabledInteractive:!1})}),VOA={provide:uc,useExisting:nr(()=>Xy),multi:!0},Wy=class{source;checked;constructor(e,A){this.source=e,this.checked=A}},Xy=(()=>{class t{_elementRef=m(te);_focusMonitor=m(Jr);_changeDetectorRef=m(lt);defaults=m(qOA);_onChange=A=>{};_onTouched=()=>{};_validatorOnChange=()=>{};_uniqueId;_checked=!1;_createChangeEvent(A){return new Wy(this,A)}_labelId;get buttonId(){return`${this.id||this._uniqueId}-button`}_switchElement;focus(){this._switchElement.nativeElement.focus()}_noopAnimations;_focused;name=null;id;labelPosition="after";ariaLabel=null;ariaLabelledby=null;ariaDescribedby;required;color;disabled=!1;disableRipple=!1;tabIndex=0;get checked(){return this._checked}set checked(A){this._checked=A,this._changeDetectorRef.markForCheck()}hideIcon;disabledInteractive;change=new XA;toggleChange=new XA;get inputId(){return`${this.id||this._uniqueId}-input`}constructor(){m(Ln).load(Qr);let A=m(new Er("tabindex"),{optional:!0}),i=this.defaults,n=m(mi,{optional:!0});this.tabIndex=A==null?0:parseInt(A)||0,this.color=i.color||"accent",this._noopAnimations=n==="NoopAnimations",this.id=this._uniqueId=m($i).getId("mat-mdc-slide-toggle-"),this.hideIcon=i.hideIcon??!1,this.disabledInteractive=i.disabledInteractive??!1,this._labelId=this._uniqueId+"-label"}ngAfterContentInit(){this._focusMonitor.monitor(this._elementRef,!0).subscribe(A=>{A==="keyboard"||A==="program"?(this._focused=!0,this._changeDetectorRef.markForCheck()):A||Promise.resolve().then(()=>{this._focused=!1,this._onTouched(),this._changeDetectorRef.markForCheck()})})}ngOnChanges(A){A.required&&this._validatorOnChange()}ngOnDestroy(){this._focusMonitor.stopMonitoring(this._elementRef)}writeValue(A){this.checked=!!A}registerOnChange(A){this._onChange=A}registerOnTouched(A){this._onTouched=A}validate(A){return this.required&&A.value!==!0?{required:!0}:null}registerOnValidatorChange(A){this._validatorOnChange=A}setDisabledState(A){this.disabled=A,this._changeDetectorRef.markForCheck()}toggle(){this.checked=!this.checked,this._onChange(this.checked)}_emitChangeEvent(){this._onChange(this.checked),this.change.emit(this._createChangeEvent(this.checked))}_handleClick(){this.disabled||(this.toggleChange.emit(),this.defaults.disableToggleValue||(this.checked=!this.checked,this._onChange(this.checked),this.change.emit(new Wy(this,this.checked))))}_getAriaLabelledBy(){return this.ariaLabelledby?this.ariaLabelledby:this.ariaLabel?null:this._labelId}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-slide-toggle"]],viewQuery:function(i,n){if(i&1&&Ge(OOA,5),i&2){let o;$A(o=Ae())&&(n._switchElement=o.first)}},hostAttrs:[1,"mat-mdc-slide-toggle"],hostVars:13,hostBindings:function(i,n){i&2&&(Fs("id",n.id),_e("tabindex",null)("aria-label",null)("name",null)("aria-labelledby",null),vo(n.color?"mat-"+n.color:""),ue("mat-mdc-slide-toggle-focused",n._focused)("mat-mdc-slide-toggle-checked",n.checked)("_mat-animation-noopable",n._noopAnimations))},inputs:{name:"name",id:"id",labelPosition:"labelPosition",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],required:[2,"required","required",ae],color:"color",disabled:[2,"disabled","disabled",ae],disableRipple:[2,"disableRipple","disableRipple",ae],tabIndex:[2,"tabIndex","tabIndex",A=>A==null?0:Mi(A)],checked:[2,"checked","checked",ae],hideIcon:[2,"hideIcon","hideIcon",ae],disabledInteractive:[2,"disabledInteractive","disabledInteractive",ae]},outputs:{change:"change",toggleChange:"toggleChange"},exportAs:["matSlideToggle"],features:[ct([VOA,{provide:d0,useExisting:t,multi:!0}]),Kt],ngContentSelectors:POA,decls:13,vars:27,consts:[["switch",""],["mat-internal-form-field","",3,"labelPosition"],["role","switch","type","button",1,"mdc-switch",3,"click","tabIndex","disabled"],[1,"mdc-switch__track"],[1,"mdc-switch__handle-track"],[1,"mdc-switch__handle"],[1,"mdc-switch__shadow"],[1,"mdc-elevation-overlay"],[1,"mdc-switch__ripple"],["mat-ripple","",1,"mat-mdc-slide-toggle-ripple","mat-focus-indicator",3,"matRippleTrigger","matRippleDisabled","matRippleCentered"],[1,"mdc-switch__icons"],[1,"mdc-label",3,"click","for"],["viewBox","0 0 24 24","aria-hidden","true",1,"mdc-switch__icon","mdc-switch__icon--on"],["d","M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z"],["viewBox","0 0 24 24","aria-hidden","true",1,"mdc-switch__icon","mdc-switch__icon--off"],["d","M20 13H4v-2h16v2z"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"div",1)(1,"button",2,0),mA("click",function(){return LA(o),xA(n._handleClick())}),UA(3,"span",3),S(4,"span",4)(5,"span",5)(6,"span",6),UA(7,"span",7),R(),S(8,"span",8),UA(9,"span",9),R(),NA(10,jOA,5,0,"span",10),R()()(),S(11,"label",11),mA("click",function(s){return LA(o),xA(s.stopPropagation())}),xe(12),R()()}if(i&2){let o=or(2);vA("labelPosition",n.labelPosition),_(),ue("mdc-switch--selected",n.checked)("mdc-switch--unselected",!n.checked)("mdc-switch--checked",n.checked)("mdc-switch--disabled",n.disabled)("mat-mdc-slide-toggle-disabled-interactive",n.disabledInteractive),vA("tabIndex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("disabled",n.disabled&&!n.disabledInteractive),_e("id",n.buttonId)("name",n.name)("aria-label",n.ariaLabel)("aria-labelledby",n._getAriaLabelledBy())("aria-describedby",n.ariaDescribedby)("aria-required",n.required||null)("aria-checked",n.checked)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),_(8),vA("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled)("matRippleCentered",!0),_(),FA(n.hideIcon?-1:10),_(),vA("for",n.buttonId),_e("id",n._labelId)}},dependencies:[Gs,BB],styles:['.mdc-switch{align-items:center;background:none;border:none;cursor:pointer;display:inline-flex;flex-shrink:0;margin:0;outline:none;overflow:visible;padding:0;position:relative;width:var(--mdc-switch-track-width, 52px)}.mdc-switch.mdc-switch--disabled{cursor:default;pointer-events:none}.mdc-switch.mat-mdc-slide-toggle-disabled-interactive{pointer-events:auto}.mdc-switch__track{overflow:hidden;position:relative;width:100%;height:var(--mdc-switch-track-height, 32px);border-radius:var(--mdc-switch-track-shape, var(--mat-sys-corner-full))}.mdc-switch--disabled.mdc-switch .mdc-switch__track{opacity:var(--mdc-switch-disabled-track-opacity, 0.12)}.mdc-switch__track::before,.mdc-switch__track::after{border:1px solid rgba(0,0,0,0);border-radius:inherit;box-sizing:border-box;content:"";height:100%;left:0;position:absolute;width:100%;border-width:var(--mat-switch-track-outline-width, 2px);border-color:var(--mat-switch-track-outline-color, var(--mat-sys-outline))}.mdc-switch--selected .mdc-switch__track::before,.mdc-switch--selected .mdc-switch__track::after{border-width:var(--mat-switch-selected-track-outline-width, 2px);border-color:var(--mat-switch-selected-track-outline-color, transparent)}.mdc-switch--disabled .mdc-switch__track::before,.mdc-switch--disabled .mdc-switch__track::after{border-width:var(--mat-switch-disabled-unselected-track-outline-width, 2px);border-color:var(--mat-switch-disabled-unselected-track-outline-color, var(--mat-sys-on-surface))}@media(forced-colors: active){.mdc-switch__track{border-color:currentColor}}.mdc-switch__track::before{transition:transform 75ms 0ms cubic-bezier(0, 0, 0.2, 1);transform:translateX(0);background:var(--mdc-switch-unselected-track-color, var(--mat-sys-surface-variant))}.mdc-switch--selected .mdc-switch__track::before{transition:transform 75ms 0ms cubic-bezier(0.4, 0, 0.6, 1);transform:translateX(100%)}[dir=rtl] .mdc-switch--selected .mdc-switch--selected .mdc-switch__track::before{transform:translateX(-100%)}.mdc-switch--selected .mdc-switch__track::before{opacity:var(--mat-switch-hidden-track-opacity, 0);transition:var(--mat-switch-hidden-track-transition, opacity 75ms)}.mdc-switch--unselected .mdc-switch__track::before{opacity:var(--mat-switch-visible-track-opacity, 1);transition:var(--mat-switch-visible-track-transition, opacity 75ms)}.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::before{background:var(--mdc-switch-unselected-hover-track-color, var(--mat-sys-surface-variant))}.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::before{background:var(--mdc-switch-unselected-focus-track-color, var(--mat-sys-surface-variant))}.mdc-switch:enabled:active .mdc-switch__track::before{background:var(--mdc-switch-unselected-pressed-track-color, var(--mat-sys-surface-variant))}.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:hover:not(:focus):not(:active) .mdc-switch__track::before,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:focus:not(:active) .mdc-switch__track::before,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:active .mdc-switch__track::before,.mdc-switch.mdc-switch--disabled .mdc-switch__track::before{background:var(--mdc-switch-disabled-unselected-track-color, var(--mat-sys-surface-variant))}.mdc-switch__track::after{transform:translateX(-100%);background:var(--mdc-switch-selected-track-color, var(--mat-sys-primary))}[dir=rtl] .mdc-switch__track::after{transform:translateX(100%)}.mdc-switch--selected .mdc-switch__track::after{transform:translateX(0)}.mdc-switch--selected .mdc-switch__track::after{opacity:var(--mat-switch-visible-track-opacity, 1);transition:var(--mat-switch-visible-track-transition, opacity 75ms)}.mdc-switch--unselected .mdc-switch__track::after{opacity:var(--mat-switch-hidden-track-opacity, 0);transition:var(--mat-switch-hidden-track-transition, opacity 75ms)}.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::after{background:var(--mdc-switch-selected-hover-track-color, var(--mat-sys-primary))}.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::after{background:var(--mdc-switch-selected-focus-track-color, var(--mat-sys-primary))}.mdc-switch:enabled:active .mdc-switch__track::after{background:var(--mdc-switch-selected-pressed-track-color, var(--mat-sys-primary))}.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:hover:not(:focus):not(:active) .mdc-switch__track::after,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:focus:not(:active) .mdc-switch__track::after,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:active .mdc-switch__track::after,.mdc-switch.mdc-switch--disabled .mdc-switch__track::after{background:var(--mdc-switch-disabled-selected-track-color, var(--mat-sys-on-surface))}.mdc-switch__handle-track{height:100%;pointer-events:none;position:absolute;top:0;transition:transform 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1);left:0;right:auto;transform:translateX(0);width:calc(100% - var(--mdc-switch-handle-width))}[dir=rtl] .mdc-switch__handle-track{left:auto;right:0}.mdc-switch--selected .mdc-switch__handle-track{transform:translateX(100%)}[dir=rtl] .mdc-switch--selected .mdc-switch__handle-track{transform:translateX(-100%)}.mdc-switch__handle{display:flex;pointer-events:auto;position:absolute;top:50%;transform:translateY(-50%);left:0;right:auto;transition:width 75ms cubic-bezier(0.4, 0, 0.2, 1),height 75ms cubic-bezier(0.4, 0, 0.2, 1),margin 75ms cubic-bezier(0.4, 0, 0.2, 1);width:var(--mdc-switch-handle-width);height:var(--mdc-switch-handle-height);border-radius:var(--mdc-switch-handle-shape, var(--mat-sys-corner-full))}[dir=rtl] .mdc-switch__handle{left:auto;right:0}.mat-mdc-slide-toggle .mdc-switch--unselected .mdc-switch__handle{width:var(--mat-switch-unselected-handle-size, 16px);height:var(--mat-switch-unselected-handle-size, 16px);margin:var(--mat-switch-unselected-handle-horizontal-margin, 0 8px)}.mat-mdc-slide-toggle .mdc-switch--unselected .mdc-switch__handle:has(.mdc-switch__icons){margin:var(--mat-switch-unselected-with-icon-handle-horizontal-margin, 0 4px)}.mat-mdc-slide-toggle .mdc-switch--selected .mdc-switch__handle{width:var(--mat-switch-selected-handle-size, 24px);height:var(--mat-switch-selected-handle-size, 24px);margin:var(--mat-switch-selected-handle-horizontal-margin, 0 24px)}.mat-mdc-slide-toggle .mdc-switch--selected .mdc-switch__handle:has(.mdc-switch__icons){margin:var(--mat-switch-selected-with-icon-handle-horizontal-margin, 0 24px)}.mat-mdc-slide-toggle .mdc-switch__handle:has(.mdc-switch__icons){width:var(--mat-switch-with-icon-handle-size, 24px);height:var(--mat-switch-with-icon-handle-size, 24px)}.mat-mdc-slide-toggle .mdc-switch:active:not(.mdc-switch--disabled) .mdc-switch__handle{width:var(--mat-switch-pressed-handle-size, 28px);height:var(--mat-switch-pressed-handle-size, 28px)}.mat-mdc-slide-toggle .mdc-switch--selected:active:not(.mdc-switch--disabled) .mdc-switch__handle{margin:var(--mat-switch-selected-pressed-handle-horizontal-margin, 0 22px)}.mat-mdc-slide-toggle .mdc-switch--unselected:active:not(.mdc-switch--disabled) .mdc-switch__handle{margin:var(--mat-switch-unselected-pressed-handle-horizontal-margin, 0 2px)}.mdc-switch--disabled.mdc-switch--selected .mdc-switch__handle::after{opacity:var(--mat-switch-disabled-selected-handle-opacity, 1)}.mdc-switch--disabled.mdc-switch--unselected .mdc-switch__handle::after{opacity:var(--mat-switch-disabled-unselected-handle-opacity, 0.38)}.mdc-switch__handle::before,.mdc-switch__handle::after{border:1px solid rgba(0,0,0,0);border-radius:inherit;box-sizing:border-box;content:"";width:100%;height:100%;left:0;position:absolute;top:0;transition:background-color 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1),border-color 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1);z-index:-1}@media(forced-colors: active){.mdc-switch__handle::before,.mdc-switch__handle::after{border-color:currentColor}}.mdc-switch--selected:enabled .mdc-switch__handle::after{background:var(--mdc-switch-selected-handle-color, var(--mat-sys-on-primary))}.mdc-switch--selected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after{background:var(--mdc-switch-selected-hover-handle-color, var(--mat-sys-primary-container))}.mdc-switch--selected:enabled:focus:not(:active) .mdc-switch__handle::after{background:var(--mdc-switch-selected-focus-handle-color, var(--mat-sys-primary-container))}.mdc-switch--selected:enabled:active .mdc-switch__handle::after{background:var(--mdc-switch-selected-pressed-handle-color, var(--mat-sys-primary-container))}.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled.mdc-switch--selected:hover:not(:focus):not(:active) .mdc-switch__handle::after,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled.mdc-switch--selected:focus:not(:active) .mdc-switch__handle::after,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled.mdc-switch--selected:active .mdc-switch__handle::after,.mdc-switch--selected.mdc-switch--disabled .mdc-switch__handle::after{background:var(--mdc-switch-disabled-selected-handle-color, var(--mat-sys-surface))}.mdc-switch--unselected:enabled .mdc-switch__handle::after{background:var(--mdc-switch-unselected-handle-color, var(--mat-sys-outline))}.mdc-switch--unselected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after{background:var(--mdc-switch-unselected-hover-handle-color, var(--mat-sys-on-surface-variant))}.mdc-switch--unselected:enabled:focus:not(:active) .mdc-switch__handle::after{background:var(--mdc-switch-unselected-focus-handle-color, var(--mat-sys-on-surface-variant))}.mdc-switch--unselected:enabled:active .mdc-switch__handle::after{background:var(--mdc-switch-unselected-pressed-handle-color, var(--mat-sys-on-surface-variant))}.mdc-switch--unselected.mdc-switch--disabled .mdc-switch__handle::after{background:var(--mdc-switch-disabled-unselected-handle-color, var(--mat-sys-on-surface))}.mdc-switch__handle::before{background:var(--mdc-switch-handle-surface-color)}.mdc-switch__shadow{border-radius:inherit;bottom:0;left:0;position:absolute;right:0;top:0}.mdc-switch:enabled .mdc-switch__shadow{box-shadow:var(--mdc-switch-handle-elevation-shadow)}.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:hover:not(:focus):not(:active) .mdc-switch__shadow,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:focus:not(:active) .mdc-switch__shadow,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:active .mdc-switch__shadow,.mdc-switch.mdc-switch--disabled .mdc-switch__shadow{box-shadow:var(--mdc-switch-disabled-handle-elevation-shadow)}.mdc-switch__ripple{left:50%;position:absolute;top:50%;transform:translate(-50%, -50%);z-index:-1;width:var(--mdc-switch-state-layer-size, 40px);height:var(--mdc-switch-state-layer-size, 40px)}.mdc-switch__ripple::after{content:"";opacity:0}.mdc-switch--disabled .mdc-switch__ripple::after{display:none}.mat-mdc-slide-toggle-disabled-interactive .mdc-switch__ripple::after{display:block}.mdc-switch:hover .mdc-switch__ripple::after{opacity:.04;transition:75ms opacity cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-slide-toggle.mat-mdc-slide-toggle-focused .mdc-switch .mdc-switch__ripple::after{opacity:.12}.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:enabled:focus .mdc-switch__ripple::after,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:enabled:active .mdc-switch__ripple::after,.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled:enabled:hover:not(:focus) .mdc-switch__ripple::after,.mdc-switch--unselected:enabled:hover:not(:focus) .mdc-switch__ripple::after{background:var(--mdc-switch-unselected-hover-state-layer-color, var(--mat-sys-on-surface))}.mdc-switch--unselected:enabled:focus .mdc-switch__ripple::after{background:var(--mdc-switch-unselected-focus-state-layer-color, var(--mat-sys-on-surface))}.mdc-switch--unselected:enabled:active .mdc-switch__ripple::after{background:var(--mdc-switch-unselected-pressed-state-layer-color, var(--mat-sys-on-surface));opacity:var(--mdc-switch-unselected-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity));transition:opacity 75ms linear}.mdc-switch--selected:enabled:hover:not(:focus) .mdc-switch__ripple::after{background:var(--mdc-switch-selected-hover-state-layer-color, var(--mat-sys-primary))}.mdc-switch--selected:enabled:focus .mdc-switch__ripple::after{background:var(--mdc-switch-selected-focus-state-layer-color, var(--mat-sys-primary))}.mdc-switch--selected:enabled:active .mdc-switch__ripple::after{background:var(--mdc-switch-selected-pressed-state-layer-color, var(--mat-sys-primary));opacity:var(--mdc-switch-selected-pressed-state-layer-opacity, var(--mat-sys-pressed-state-layer-opacity));transition:opacity 75ms linear}.mdc-switch__icons{position:relative;height:100%;width:100%;z-index:1}.mdc-switch--disabled.mdc-switch--unselected .mdc-switch__icons{opacity:var(--mdc-switch-disabled-unselected-icon-opacity, 0.38)}.mdc-switch--disabled.mdc-switch--selected .mdc-switch__icons{opacity:var(--mdc-switch-disabled-selected-icon-opacity, 0.38)}.mdc-switch__icon{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0;opacity:0;transition:opacity 30ms 0ms cubic-bezier(0.4, 0, 1, 1)}.mdc-switch--unselected .mdc-switch__icon{width:var(--mdc-switch-unselected-icon-size, 16px);height:var(--mdc-switch-unselected-icon-size, 16px);fill:var(--mdc-switch-unselected-icon-color, var(--mat-sys-surface-variant))}.mdc-switch--unselected.mdc-switch--disabled .mdc-switch__icon{fill:var(--mdc-switch-disabled-unselected-icon-color, var(--mat-sys-surface-variant))}.mdc-switch--selected .mdc-switch__icon{width:var(--mdc-switch-selected-icon-size, 16px);height:var(--mdc-switch-selected-icon-size, 16px);fill:var(--mdc-switch-selected-icon-color, var(--mat-sys-on-primary-container))}.mdc-switch--selected.mdc-switch--disabled .mdc-switch__icon{fill:var(--mdc-switch-disabled-selected-icon-color, var(--mat-sys-on-surface))}.mdc-switch--selected .mdc-switch__icon--on,.mdc-switch--unselected .mdc-switch__icon--off{opacity:1;transition:opacity 45ms 30ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-slide-toggle{-webkit-user-select:none;user-select:none;display:inline-block;-webkit-tap-highlight-color:rgba(0,0,0,0);outline:0}.mat-mdc-slide-toggle .mat-mdc-slide-toggle-ripple,.mat-mdc-slide-toggle .mdc-switch__ripple::after{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:50%;pointer-events:none}.mat-mdc-slide-toggle .mat-mdc-slide-toggle-ripple:not(:empty),.mat-mdc-slide-toggle .mdc-switch__ripple::after:not(:empty){transform:translateZ(0)}.mat-mdc-slide-toggle.mat-mdc-slide-toggle-focused .mat-focus-indicator::before{content:""}.mat-mdc-slide-toggle .mat-internal-form-field{color:var(--mat-switch-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-switch-label-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-switch-label-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-switch-label-text-size, var(--mat-sys-body-medium-size));letter-spacing:var(--mat-switch-label-text-tracking, var(--mat-sys-body-medium-tracking));font-weight:var(--mat-switch-label-text-weight, var(--mat-sys-body-medium-weight))}.mat-mdc-slide-toggle .mat-ripple-element{opacity:.12}.mat-mdc-slide-toggle .mat-focus-indicator::before{border-radius:50%}.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__handle-track,.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__icon,.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__handle::before,.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__handle::after,.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__track::before,.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__track::after{transition:none}.mat-mdc-slide-toggle .mdc-switch:enabled+.mdc-label{cursor:pointer}.mat-mdc-slide-toggle .mdc-switch--disabled+label{color:var(--mdc-switch-disabled-label-text-color)}'],encapsulation:2,changeDetection:0})}return t})();var HcA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Xy,Ve,Ve]})}return t})();var df=class t{sessionState={};constructor(){}static \u0275fac=function(A){return new(A||t)};static \u0275cmp=YA({type:t,selectors:[["app-state-tab"]],inputs:{sessionState:"sessionState"},standalone:!1,decls:3,vars:1,consts:[[1,"state-wrapper"],[3,"json"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"div"),UA(2,"ngx-json-viewer",1),R()()),A&2&&(_(2),vA("json",i.sessionState))},dependencies:[Qh],styles:[".state-wrapper[_ngcontent-%COMP%]{padding-left:25px;padding-right:25px;margin-top:16px}"]})};var Bf=class t{constructor(e,A){this.el=e;this.renderer=A;this.sideDrawerMaxWidth=window.innerWidth/2}sideDrawerMinWidth=310;sideDrawerMaxWidth;resizeHandle=null;resizingEvent={isResizing:!1,startingCursorX:0,startingWidth:0};ngAfterViewInit(){this.resizeHandle=document.getElementsByClassName("resize-handler")[0],this.renderer.listen(this.resizeHandle,"mousedown",e=>this.onResizeHandleMouseDown(e)),document.documentElement.style.setProperty("--side-drawer-width","570px"),this.renderer.setStyle(this.el.nativeElement,"width","var(--side-drawer-width)")}onResizeHandleMouseDown(e){this.resizingEvent={isResizing:!0,startingCursorX:e.clientX,startingWidth:this.sideDrawerWidth},e.preventDefault()}onMouseMove(e){if(!this.resizingEvent.isResizing)return;let A=e.clientX-this.resizingEvent.startingCursorX,i=this.resizingEvent.startingWidth+A;this.sideDrawerWidth=i,this.renderer.addClass(document.body,"resizing")}onMouseUp(){this.resizingEvent.isResizing=!1,this.renderer.removeClass(document.body,"resizing")}onResize(){this.sideDrawerMaxWidth=window.innerWidth/2,this.sideDrawerWidth=this.sideDrawerWidth}set sideDrawerWidth(e){let A=Math.min(Math.max(e,this.sideDrawerMinWidth),this.sideDrawerMaxWidth);document.body.style.setProperty("--side-drawer-width",`${A}px`)}get sideDrawerWidth(){let e=getComputedStyle(document.body).getPropertyValue("--side-drawer-width"),A=parseInt(e,10);return isNaN(A)?500:A}static \u0275fac=function(A){return new(A||t)(zA(te),zA(Gi))};static \u0275dir=OA({type:t,selectors:[["","appResizableDrawer",""]],hostBindings:function(A,i){A&1&&mA("mousemove",function(o){return i.onMouseMove(o)},!1,Ud)("mouseup",function(){return i.onMouseUp()},!1,Ud)("resize",function(){return i.onResize()},!1,cp)},standalone:!1})};var Ef=class t{constructor(e,A){this.el=e;this.renderer=A;this.bottomMaxHeight=window.innerHeight}bottomMinHeight=310;bottomMaxHeight;resizeHandle=null;resizingEvent={isResizing:!1,startingCursorY:0,startingHeight:0};ngAfterViewInit(){this.resizeHandle=document.getElementsByClassName("bottom-resize-handler")[0],this.renderer.listen(this.resizeHandle,"mousedown",e=>this.onResizeHandleMouseDown(e)),document.documentElement.style.setProperty("--bottom-panel-height","310px"),this.renderer.setStyle(this.el.nativeElement,"height","var(--bottom-panel-height)")}onResizeHandleMouseDown(e){this.resizingEvent={isResizing:!0,startingCursorY:e.clientY,startingHeight:this.bottomPanelHeight},e.preventDefault()}onMouseMove(e){if(!this.resizingEvent.isResizing)return;let A=this.resizingEvent.startingCursorY-e.clientY,i=this.resizingEvent.startingHeight+A;this.bottomPanelHeight=i,this.renderer.addClass(document.body,"resizing")}onMouseUp(){this.resizingEvent.isResizing=!1,this.renderer.removeClass(document.body,"resizing")}onResize(){this.bottomMaxHeight=window.innerHeight/2,this.bottomPanelHeight=this.bottomPanelHeight}set bottomPanelHeight(e){let A=Math.min(Math.max(e,this.bottomMinHeight),this.bottomMaxHeight);document.body.style.setProperty("--bottom-panel-height",`${A}px`)}get bottomPanelHeight(){let e=getComputedStyle(document.body).getPropertyValue("--bottom-panel-height"),A=parseInt(e,10);return isNaN(A)?500:A}static \u0275fac=function(A){return new(A||t)(zA(te),zA(Gi))};static \u0275dir=OA({type:t,selectors:[["","appResizableBottomPanel",""]],hostBindings:function(A,i){A&1&&mA("mousemove",function(o){return i.onMouseMove(o)},!1,Ud)("mouseup",function(){return i.onMouseUp()},!1,Ud)("resize",function(){return i.onResize()},!1,cp)},standalone:!1})};var OcA=new BA("CdkAccordion");var PcA=(()=>{class t{accordion=m(OcA,{optional:!0,skipSelf:!0});_changeDetectorRef=m(lt);_expansionDispatcher=m(uB);_openCloseAllSubscription=_t.EMPTY;closed=new XA;opened=new XA;destroyed=new XA;expandedChange=new XA;id=m($i).getId("cdk-accordion-child-");get expanded(){return this._expanded}set expanded(A){if(this._expanded!==A){if(this._expanded=A,this.expandedChange.emit(A),A){this.opened.emit();let i=this.accordion?this.accordion.id:this.id;this._expansionDispatcher.notify(this.id,i)}else this.closed.emit();this._changeDetectorRef.markForCheck()}}_expanded=!1;disabled=!1;_removeUniqueSelectionListener=()=>{};constructor(){}ngOnInit(){this._removeUniqueSelectionListener=this._expansionDispatcher.listen((A,i)=>{this.accordion&&!this.accordion.multi&&this.accordion.id===i&&this.id!==A&&(this.expanded=!1)}),this.accordion&&(this._openCloseAllSubscription=this._subscribeToOpenCloseAllActions())}ngOnDestroy(){this.opened.complete(),this.closed.complete(),this.destroyed.emit(),this.destroyed.complete(),this._removeUniqueSelectionListener(),this._openCloseAllSubscription.unsubscribe()}toggle(){this.disabled||(this.expanded=!this.expanded)}close(){this.disabled||(this.expanded=!1)}open(){this.disabled||(this.expanded=!0)}_subscribeToOpenCloseAllActions(){return this.accordion._openCloseAllActions.subscribe(A=>{this.disabled||(this.expanded=A)})}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["cdk-accordion-item"],["","cdkAccordionItem",""]],inputs:{expanded:[2,"expanded","expanded",ae],disabled:[2,"disabled","disabled",ae]},outputs:{closed:"closed",opened:"opened",destroyed:"destroyed",expandedChange:"expandedChange"},exportAs:["cdkAccordionItem"],features:[ct([{provide:OcA,useValue:void 0}])]})}return t})(),jcA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({})}return t})();var APA=["body"],ePA=["bodyWrapper"],tPA=[[["mat-expansion-panel-header"]],"*",[["mat-action-row"]]],iPA=["mat-expansion-panel-header","*","mat-action-row"];function nPA(t,e){}var oPA=[[["mat-panel-title"]],[["mat-panel-description"]],"*"],rPA=["mat-panel-title","mat-panel-description","*"];function sPA(t,e){t&1&&(S(0,"span",1),hr(),S(1,"svg",2),UA(2,"path",3),R()())}var qcA=new BA("MAT_ACCORDION"),VcA=new BA("MAT_EXPANSION_PANEL"),aPA=(()=>{class t{_template=m(vn);_expansionPanel=m(VcA,{optional:!0});constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["ng-template","matExpansionPanelContent",""]]})}return t})(),ZcA=new BA("MAT_EXPANSION_PANEL_DEFAULT_OPTIONS"),VG=(()=>{class t extends PcA{_viewContainerRef=m(Un);_animationsDisabled=m(mi,{optional:!0})==="NoopAnimations";_document=m(tt);_ngZone=m(de);_elementRef=m(te);_renderer=m(Gi);_cleanupTransitionEnd;get hideToggle(){return this._hideToggle||this.accordion&&this.accordion.hideToggle}set hideToggle(A){this._hideToggle=A}_hideToggle=!1;get togglePosition(){return this._togglePosition||this.accordion&&this.accordion.togglePosition}set togglePosition(A){this._togglePosition=A}_togglePosition;afterExpand=new XA;afterCollapse=new XA;_inputChanges=new HA;accordion=m(qcA,{optional:!0,skipSelf:!0});_lazyContent;_body;_bodyWrapper;_portal;_headerId=m($i).getId("mat-expansion-panel-header-");constructor(){super();let A=m(ZcA,{optional:!0});this._expansionDispatcher=m(uB),A&&(this.hideToggle=A.hideToggle)}_hasSpacing(){return this.accordion?this.expanded&&this.accordion.displayMode==="default":!1}_getExpandedState(){return this.expanded?"expanded":"collapsed"}toggle(){this.expanded=!this.expanded}close(){this.expanded=!1}open(){this.expanded=!0}ngAfterContentInit(){this._lazyContent&&this._lazyContent._expansionPanel===this&&this.opened.pipe(Qo(null),pt(()=>this.expanded&&!this._portal),Pn(1)).subscribe(()=>{this._portal=new aa(this._lazyContent._template,this._viewContainerRef)}),this._setupAnimationEvents()}ngOnChanges(A){this._inputChanges.next(A)}ngOnDestroy(){super.ngOnDestroy(),this._cleanupTransitionEnd?.(),this._inputChanges.complete()}_containsFocus(){if(this._body){let A=this._document.activeElement,i=this._body.nativeElement;return A===i||i.contains(A)}return!1}_transitionEndListener=({target:A,propertyName:i})=>{A===this._bodyWrapper?.nativeElement&&i==="grid-template-rows"&&this._ngZone.run(()=>{this.expanded?this.afterExpand.emit():this.afterCollapse.emit()})};_setupAnimationEvents(){this._ngZone.runOutsideAngular(()=>{this._animationsDisabled?(this.opened.subscribe(()=>this._ngZone.run(()=>this.afterExpand.emit())),this.closed.subscribe(()=>this._ngZone.run(()=>this.afterCollapse.emit()))):setTimeout(()=>{let A=this._elementRef.nativeElement;this._cleanupTransitionEnd=this._renderer.listen(A,"transitionend",this._transitionEndListener),A.classList.add("mat-expansion-panel-animations-enabled")},200)})}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-expansion-panel"]],contentQueries:function(i,n,o){if(i&1&&Ii(o,aPA,5),i&2){let r;$A(r=Ae())&&(n._lazyContent=r.first)}},viewQuery:function(i,n){if(i&1&&(Ge(APA,5),Ge(ePA,5)),i&2){let o;$A(o=Ae())&&(n._body=o.first),$A(o=Ae())&&(n._bodyWrapper=o.first)}},hostAttrs:[1,"mat-expansion-panel"],hostVars:4,hostBindings:function(i,n){i&2&&ue("mat-expanded",n.expanded)("mat-expansion-panel-spacing",n._hasSpacing())},inputs:{hideToggle:[2,"hideToggle","hideToggle",ae],togglePosition:"togglePosition"},outputs:{afterExpand:"afterExpand",afterCollapse:"afterCollapse"},exportAs:["matExpansionPanel"],features:[ct([{provide:qcA,useValue:void 0},{provide:VcA,useExisting:t}]),et,Kt],ngContentSelectors:iPA,decls:9,vars:4,consts:[["bodyWrapper",""],["body",""],[1,"mat-expansion-panel-content-wrapper"],["role","region",1,"mat-expansion-panel-content",3,"id"],[1,"mat-expansion-panel-body"],[3,"cdkPortalOutlet"]],template:function(i,n){i&1&&(Yt(tPA),xe(0),S(1,"div",2,0)(3,"div",3,1)(5,"div",4),xe(6,1),NA(7,nPA,0,0,"ng-template",5),R(),xe(8,2),R()()),i&2&&(_(),_e("inert",n.expanded?null:""),_(2),vA("id",n.id),_e("aria-labelledby",n._headerId),_(4),vA("cdkPortalOutlet",n._portal))},dependencies:[ca],styles:[".mat-expansion-panel{box-sizing:content-box;display:block;margin:0;overflow:hidden;position:relative;background:var(--mat-expansion-container-background-color, var(--mat-sys-surface));color:var(--mat-expansion-container-text-color, var(--mat-sys-on-surface));border-radius:var(--mat-expansion-container-shape, 12px)}.mat-expansion-panel.mat-expansion-panel-animations-enabled{transition:margin 225ms cubic-bezier(0.4, 0, 0.2, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}.mat-accordion .mat-expansion-panel:not(.mat-expanded),.mat-accordion .mat-expansion-panel:not(.mat-expansion-panel-spacing){border-radius:0}.mat-accordion .mat-expansion-panel:first-of-type{border-top-right-radius:var(--mat-expansion-container-shape, 12px);border-top-left-radius:var(--mat-expansion-container-shape, 12px)}.mat-accordion .mat-expansion-panel:last-of-type{border-bottom-right-radius:var(--mat-expansion-container-shape, 12px);border-bottom-left-radius:var(--mat-expansion-container-shape, 12px)}@media(forced-colors: active){.mat-expansion-panel{outline:solid 1px}}.mat-expansion-panel-content-wrapper{display:grid;grid-template-rows:0fr;grid-template-columns:100%}.mat-expansion-panel-animations-enabled .mat-expansion-panel-content-wrapper{transition:grid-template-rows 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel.mat-expanded>.mat-expansion-panel-content-wrapper{grid-template-rows:1fr}@supports not (grid-template-rows: 0fr){.mat-expansion-panel-content-wrapper{height:0}.mat-expansion-panel.mat-expanded>.mat-expansion-panel-content-wrapper{height:auto}}.mat-expansion-panel-content{display:flex;flex-direction:column;overflow:visible;min-height:0;visibility:hidden;font-family:var(--mat-expansion-container-text-font, var(--mat-sys-body-large-font));font-size:var(--mat-expansion-container-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-expansion-container-text-weight, var(--mat-sys-body-large-weight));line-height:var(--mat-expansion-container-text-line-height, var(--mat-sys-body-large-line-height));letter-spacing:var(--mat-expansion-container-text-tracking, var(--mat-sys-body-large-tracking))}.mat-expansion-panel-animations-enabled .mat-expansion-panel-content{transition:visibility 190ms linear}.mat-expansion-panel.mat-expanded>.mat-expansion-panel-content-wrapper>.mat-expansion-panel-content{visibility:visible}.mat-expansion-panel-body{padding:0 24px 16px}.mat-expansion-panel-spacing{margin:16px 0}.mat-accordion>.mat-expansion-panel-spacing:first-child,.mat-accordion>*:first-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-top:0}.mat-accordion>.mat-expansion-panel-spacing:last-child,.mat-accordion>*:last-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-bottom:0}.mat-action-row{border-top-style:solid;border-top-width:1px;display:flex;flex-direction:row;justify-content:flex-end;padding:16px 8px 16px 24px;border-top-color:var(--mat-expansion-actions-divider-color, var(--mat-sys-outline))}.mat-action-row .mat-button-base,.mat-action-row .mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-action-row .mat-button-base,[dir=rtl] .mat-action-row .mat-mdc-button-base{margin-left:0;margin-right:8px}"],encapsulation:2,changeDetection:0})}return t})();var WcA=(()=>{class t{panel=m(VG,{host:!0});_element=m(te);_focusMonitor=m(Jr);_changeDetectorRef=m(lt);_parentChangeSubscription=_t.EMPTY;constructor(){m(Ln).load(Qr);let A=this.panel,i=m(ZcA,{optional:!0}),n=m(new Er("tabindex"),{optional:!0}),o=A.accordion?A.accordion._stateChanges.pipe(pt(r=>!!(r.hideToggle||r.togglePosition))):Ar;this.tabIndex=parseInt(n||"")||0,this._parentChangeSubscription=ho(A.opened,A.closed,o,A._inputChanges.pipe(pt(r=>!!(r.hideToggle||r.disabled||r.togglePosition)))).subscribe(()=>this._changeDetectorRef.markForCheck()),A.closed.pipe(pt(()=>A._containsFocus())).subscribe(()=>this._focusMonitor.focusVia(this._element,"program")),i&&(this.expandedHeight=i.expandedHeight,this.collapsedHeight=i.collapsedHeight)}expandedHeight;collapsedHeight;tabIndex=0;get disabled(){return this.panel.disabled}_toggle(){this.disabled||this.panel.toggle()}_isExpanded(){return this.panel.expanded}_getExpandedState(){return this.panel._getExpandedState()}_getPanelId(){return this.panel.id}_getTogglePosition(){return this.panel.togglePosition}_showToggle(){return!this.panel.hideToggle&&!this.panel.disabled}_getHeaderHeight(){let A=this._isExpanded();return A&&this.expandedHeight?this.expandedHeight:!A&&this.collapsedHeight?this.collapsedHeight:null}_keydown(A){switch(A.keyCode){case 32:case 13:rr(A)||(A.preventDefault(),this._toggle());break;default:this.panel.accordion&&this.panel.accordion._handleHeaderKeydown(A);return}}focus(A,i){A?this._focusMonitor.focusVia(this._element,A,i):this._element.nativeElement.focus(i)}ngAfterViewInit(){this._focusMonitor.monitor(this._element).subscribe(A=>{A&&this.panel.accordion&&this.panel.accordion._handleHeaderFocus(this)})}ngOnDestroy(){this._parentChangeSubscription.unsubscribe(),this._focusMonitor.stopMonitoring(this._element)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-expansion-panel-header"]],hostAttrs:["role","button",1,"mat-expansion-panel-header","mat-focus-indicator"],hostVars:13,hostBindings:function(i,n){i&1&&mA("click",function(){return n._toggle()})("keydown",function(r){return n._keydown(r)}),i&2&&(_e("id",n.panel._headerId)("tabindex",n.disabled?-1:n.tabIndex)("aria-controls",n._getPanelId())("aria-expanded",n._isExpanded())("aria-disabled",n.panel.disabled),so("height",n._getHeaderHeight()),ue("mat-expanded",n._isExpanded())("mat-expansion-toggle-indicator-after",n._getTogglePosition()==="after")("mat-expansion-toggle-indicator-before",n._getTogglePosition()==="before"))},inputs:{expandedHeight:"expandedHeight",collapsedHeight:"collapsedHeight",tabIndex:[2,"tabIndex","tabIndex",A=>A==null?0:Mi(A)]},ngContentSelectors:rPA,decls:5,vars:3,consts:[[1,"mat-content"],[1,"mat-expansion-indicator"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 -960 960 960","aria-hidden","true","focusable","false"],["d","M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"]],template:function(i,n){i&1&&(Yt(oPA),S(0,"span",0),xe(1),xe(2,1),xe(3,2),R(),NA(4,sPA,3,0,"span",1)),i&2&&(ue("mat-content-hide-toggle",!n._showToggle()),_(4),FA(n._showToggle()?4:-1))},styles:['.mat-expansion-panel-header{display:flex;flex-direction:row;align-items:center;padding:0 24px;border-radius:inherit;height:var(--mat-expansion-header-collapsed-state-height, 48px);font-family:var(--mat-expansion-header-text-font, var(--mat-sys-title-medium-font));font-size:var(--mat-expansion-header-text-size, var(--mat-sys-title-medium-size));font-weight:var(--mat-expansion-header-text-weight, var(--mat-sys-title-medium-weight));line-height:var(--mat-expansion-header-text-line-height, var(--mat-sys-title-medium-line-height));letter-spacing:var(--mat-expansion-header-text-tracking, var(--mat-sys-title-medium-tracking))}.mat-expansion-panel-animations-enabled .mat-expansion-panel-header{transition:height 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel-header::before{border-radius:inherit}.mat-expansion-panel-header.mat-expanded{height:var(--mat-expansion-header-expanded-state-height, 64px)}.mat-expansion-panel-header[aria-disabled=true]{color:var(--mat-expansion-header-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-expansion-panel-header:not([aria-disabled=true]){cursor:pointer}.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover{background:var(--mat-expansion-header-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}@media(hover: none){.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover{background:var(--mat-expansion-container-background-color, var(--mat-sys-surface))}}.mat-expansion-panel .mat-expansion-panel-header:not([aria-disabled=true]).cdk-keyboard-focused,.mat-expansion-panel .mat-expansion-panel-header:not([aria-disabled=true]).cdk-program-focused{background:var(--mat-expansion-header-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}.mat-expansion-panel-header._mat-animation-noopable{transition:none}.mat-expansion-panel-header:focus,.mat-expansion-panel-header:hover{outline:none}.mat-expansion-panel-header.mat-expanded:focus,.mat-expansion-panel-header.mat-expanded:hover{background:inherit}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before{flex-direction:row-reverse}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 16px 0 0}[dir=rtl] .mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 0 0 16px}.mat-content{display:flex;flex:1;flex-direction:row;overflow:hidden}.mat-content.mat-content-hide-toggle{margin-right:8px}[dir=rtl] .mat-content.mat-content-hide-toggle{margin-right:0;margin-left:8px}.mat-expansion-toggle-indicator-before .mat-content.mat-content-hide-toggle{margin-left:24px;margin-right:0}[dir=rtl] .mat-expansion-toggle-indicator-before .mat-content.mat-content-hide-toggle{margin-right:24px;margin-left:0}.mat-expansion-panel-header-title{color:var(--mat-expansion-header-text-color, var(--mat-sys-on-surface))}.mat-expansion-panel-header-title,.mat-expansion-panel-header-description{display:flex;flex-grow:1;flex-basis:0;margin-right:16px;align-items:center}[dir=rtl] .mat-expansion-panel-header-title,[dir=rtl] .mat-expansion-panel-header-description{margin-right:0;margin-left:16px}.mat-expansion-panel-header[aria-disabled=true] .mat-expansion-panel-header-title,.mat-expansion-panel-header[aria-disabled=true] .mat-expansion-panel-header-description{color:inherit}.mat-expansion-panel-header-description{flex-grow:2;color:var(--mat-expansion-header-description-color, var(--mat-sys-on-surface-variant))}.mat-expansion-panel-animations-enabled .mat-expansion-indicator{transition:transform 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel-header.mat-expanded .mat-expansion-indicator{transform:rotate(180deg)}.mat-expansion-indicator::after{border-style:solid;border-width:0 2px 2px 0;content:"";display:inline-block;padding:3px;transform:rotate(45deg);vertical-align:middle;color:var(--mat-expansion-header-indicator-color, var(--mat-sys-on-surface-variant));display:var(--mat-expansion-legacy-header-indicator-display, none)}.mat-expansion-indicator svg{width:24px;height:24px;margin:0 -8px;vertical-align:middle;fill:var(--mat-expansion-header-indicator-color, var(--mat-sys-on-surface-variant));display:var(--mat-expansion-header-indicator-display, inline-block)}@media(forced-colors: active){.mat-expansion-panel-content{border-top:1px solid;border-top-left-radius:0;border-top-right-radius:0}}'],encapsulation:2,changeDetection:0})}return t})();var XcA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275dir=OA({type:t,selectors:[["mat-panel-title"]],hostAttrs:[1,"mat-expansion-panel-header-title"]})}return t})();var $cA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,jcA,sg]})}return t})();var AlA=t=>({color:t});function lPA(t,e){t&1&&UA(0,"div",8)}function gPA(t,e){if(t&1&&(S(0,"span",14),tA(1),R()),t&2){let A=P().$implicit,i=P();so("left",i.getRelativeStart(A.span)+5,"%"),_(),ot("",(i.toMs(A.span.end_time)-i.toMs(A.span.start_time)).toFixed(2),"ms")}}function IPA(t,e){if(t&1){let A=De();S(0,"div",5),mA("click",function(){let n=LA(A).$implicit,o=P();return xA(o.selectRow(n))})("mouseenter",function(){let n=LA(A).$implicit,o=P();return xA(o.onHover(n))})("mouseleave",function(){LA(A);let n=P();return xA(n.onHoverOut())}),S(1,"div",6)(2,"div",7),ln(3,lPA,1,0,"div",8,Kd),R(),S(5,"span",9),tA(6),R(),S(7,"div",10),tA(8),R()(),S(9,"div",11)(10,"div",12),tA(11),R(),NA(12,gPA,2,3,"span",13),R()()}if(t&2){let A=e.$implicit,i=P();ue("selected",i.rowSelected(A)),_(3),gn(i.getArray(A.level)),_(2),vA("ngStyle",Yr(14,AlA,i.isEventRow(A)?"#8AB4F8":"white")),_(),ot(" ",i.getSpanIcon(A.span.name)," "),_(),so("width",400-A.level*20,"px"),vA("ngStyle",Yr(16,AlA,i.isEventRow(A)?"#8AB4F8":"white")),_(),ot(" ",A.span.name," "),_(2),so("left",i.getRelativeStart(A.span),"%")("width",i.getRelativeWidth(A.span),"%"),_(),ot(" ",(i.toMs(A.span.end_time)-i.toMs(A.span.start_time)).toFixed(2),"ms "),_(),FA(i.getRelativeWidth(A.span)<10?12:-1)}}var hf=class t{constructor(e){this.traceService=e}spans=[];invocationId="";tree=[];eventData;baseStartTimeMs=0;totalDurationMs=1;flatTree=[];traceLabelIconMap=new Map([["Invocation","start"],["agent_run","directions_run"],["tool","build"],["call_llm","chat"]]);selectedRow=void 0;ngOnInit(){this.tree=this.buildSpanTree(this.spans),this.flatTree=this.flattenTree(this.tree);let e=this.getGlobalTimes(this.spans);this.baseStartTimeMs=e.start,this.totalDurationMs=e.duration,this.traceService.selectedTraceRow$.subscribe(A=>this.selectedRow=A),this.traceService.eventData$.subscribe(A=>this.eventData=A)}buildSpanTree(e){let A=e.map(o=>nA({},o)),i=new Map,n=[];return A.forEach(o=>i.set(o.span_id,o)),A.forEach(o=>{if(o.parent_span_id&&i.has(o.parent_span_id)){let r=i.get(o.parent_span_id);r.children=r.children||[],r.children.push(o)}else n.push(o)}),n}getGlobalTimes(e){let A=Math.min(...e.map(n=>this.toMs(n.start_time))),i=Math.max(...e.map(n=>this.toMs(n.end_time)));return{start:A,duration:i-A}}toMs(e){return e/1e6}getRelativeStart(e){return(this.toMs(e.start_time)-this.baseStartTimeMs)/this.totalDurationMs*100}getRelativeWidth(e){return(this.toMs(e.end_time)-this.toMs(e.start_time))/this.totalDurationMs*100}flattenTree(e,A=0){return e.flatMap(n=>[{span:n,level:A},...n.children?this.flattenTree(n.children,A+1):[]])}getSpanIcon(e){for(let[A,i]of this.traceLabelIconMap.entries())if(e.startsWith(A))return i;return"start"}getArray(e){return Array.from({length:e})}selectRow(e){if(this.selectedRow&&this.selectedRow.span_id==e.span.span_id){this.traceService.selectedRow(void 0),this.traceService.setHoveredMessages(void 0,this.invocationId);return}this.traceService.selectedRow(e.span),this.traceService.setHoveredMessages(e.span,this.invocationId)}rowSelected(e){return this.selectedRow==e.span}isEventRow(e){if(!e.span.attributes)return!1;let A=e?.span.attributes["gcp.vertex.agent.event_id"];return!!(A&&this.eventData&&this.eventData.has(A))}onHover(e){this.traceService.setHoveredMessages(e.span,this.invocationId)}onHoverOut(){this.traceService.setHoveredMessages(void 0,this.invocationId),this.selectedRow&&this.traceService.setHoveredMessages(this.selectedRow,this.invocationId)}static \u0275fac=function(A){return new(A||t)(zA(zg))};static \u0275cmp=YA({type:t,selectors:[["app-trace-tree"]],inputs:{spans:"spans",invocationId:"invocationId"},standalone:!1,decls:8,vars:1,consts:[[2,"margin-top","15px"],[1,"invocation-id-container"],[1,"invocation-id"],[1,"trace-container"],[1,"trace-row",3,"selected"],[1,"trace-row",3,"click","mouseenter","mouseleave"],[1,"trace-row-left"],[1,"trace-indent"],[1,"indent-connector"],[1,"material-symbols-outlined",2,"margin-right","8px",3,"ngStyle"],[1,"trace-label",3,"ngStyle"],[1,"trace-bar-container"],[1,"trace-bar"],[2,"position","absolute","color","#8dabbf",3,"left"],[2,"position","absolute","color","#8dabbf"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"div",1),tA(2,"Invocation ID: "),S(3,"div",2),tA(4),R()(),S(5,"div",3),ln(6,IPA,13,18,"div",4,Kn),R()()),A&2&&(_(4),Mt(i.invocationId),_(2),gn(i.flatTree))},dependencies:[yQ],styles:[".trace-container[_ngcontent-%COMP%]{width:100%;white-space:nowrap;font-size:12px}.trace-label[_ngcontent-%COMP%]{width:400px;color:#e3e3e3;font-family:Google Sans Mono,monospace;font-size:13px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:0px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.trace-bar-container[_ngcontent-%COMP%]{width:100%;position:relative;height:16px}.trace-bar[_ngcontent-%COMP%]{position:absolute;height:18px;background-color:#2f4d65;border-radius:4px;padding-left:4px;overflow:hidden;font-size:11px;line-height:16px;color:#8dabbf;font-family:Google Sans}.trace-duration[_ngcontent-%COMP%]{color:#888;font-weight:400;margin-left:4px}.trace-row[_ngcontent-%COMP%]{display:flex;align-items:stretch;position:relative;height:32px;align-items:center;cursor:pointer}.trace-row[_ngcontent-%COMP%]:hover, .trace-row.selected[_ngcontent-%COMP%]{background-color:#3b3d3c}.trace-indent[_ngcontent-%COMP%]{display:flex;flex-shrink:0;height:100%}.indent-connector[_ngcontent-%COMP%]{width:20px;position:relative;height:100%}.vertical-line[_ngcontent-%COMP%]{position:absolute;top:0;bottom:0;left:9px;width:1px;background-color:#ccc}.horizontal-line[_ngcontent-%COMP%]{position:absolute;top:50%;left:9px;width:10px;height:1px;background-color:#ccc}.trace-row-left[_ngcontent-%COMP%]{display:flex;width:50%}.invocation-id-container[_ngcontent-%COMP%]{color:#9aa0a6;font-size:14px;font-style:normal;font-weight:700;line-height:20px;letter-spacing:0px;margin-bottom:5px}.invocation-id[_ngcontent-%COMP%]{font-family:Google Sans Mono,monospace}"]})};function dPA(t,e){if(t&1&&(S(0,"div",3)(1,"mat-expansion-panel")(2,"mat-expansion-panel-header")(3,"mat-panel-title"),tA(4),R()(),UA(5,"app-trace-tree",4),R()()),t&2){let A=e.$implicit,i=P();_(4),ot(" ",i.invocToUserMsg.get(A.key)," "),_(),vA("spans",A.value)("invocationId",i.findInvocIdFromTraceId(A.key))}}var Qf=class t{traceData=[];invocTraces=new Map;invocToUserMsg=new Map;constructor(){}ngOnInit(){}ngOnChanges(e){"traceData"in e&&this.rebuildTrace()}rebuildTrace(){this.invocTraces=this.traceData.reduce((e,A)=>{let i=A.trace_id,n=e.get(i);return n?(n.push(A),n.sort((o,r)=>o.start_time-r.start_time)):e.set(i,[A]),e},new Map);for(let[e,A]of this.invocTraces)this.invocToUserMsg.set(e,this.findUserMsgFromInvocGroup(A))}getArray(e){return Array.from({length:e})}findUserMsgFromInvocGroup(e){let A=e?.find(o=>o.attributes!==void 0&&"gcp.vertex.agent.invocation_id"in o.attributes);return JSON.parse(A.attributes["gcp.vertex.agent.llm_request"]).contents.filter(o=>o.role=="user").at(-1).parts[0]?.text??"[attachment]"}findInvocIdFromTraceId(e){return this.invocTraces.get(e)?.find(i=>i.attributes!==void 0&&"gcp.vertex.agent.invocation_id"in i.attributes).attributes["gcp.vertex.agent.invocation_id"]}mapOrderPreservingSort=(e,A)=>0;static \u0275fac=function(A){return new(A||t)};static \u0275cmp=YA({type:t,selectors:[["app-trace-tab"]],inputs:{traceData:"traceData"},standalone:!1,features:[Kt],decls:7,vars:3,consts:[[2,"padding-left","25px","padding-right","25px"],["mat-dialog-title","",1,"trace-title"],[1,"trace-list-wrapper"],[1,"trace-item"],[3,"spans","invocationId"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"h2",1),tA(2,"Invocations"),R(),S(3,"div",2),ln(4,dPA,6,3,"div",3,Kn),Ta(6,"keyvalue"),R()()),A&2&&(_(4),gn(uQ(6,0,i.invocTraces,i.mapOrderPreservingSort)))},dependencies:[hs,VG,WcA,XcA,hf,MQ],styles:[".trace-container[_ngcontent-%COMP%]{width:100%;white-space:nowrap;font-size:12px}.trace-title[_ngcontent-%COMP%]{color:#9aa0a6;font-size:14px;font-style:normal;font-weight:700;line-height:20px;letter-spacing:0px}.trace-label[_ngcontent-%COMP%]{width:400px;color:#e3e3e3;text-overflow:ellipsis;font-family:Google Sans Mono,monospace;font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:0px}.trace-bar-container[_ngcontent-%COMP%]{width:50vw;position:relative;height:16px}.trace-bar[_ngcontent-%COMP%]{position:absolute;height:18px;background-color:#2f4d65;border-radius:4px;padding-left:4px;overflow:hidden;font-size:11px;line-height:16px;color:#8dabbf;font-family:Google Sans}.trace-duration[_ngcontent-%COMP%]{color:#888;font-weight:400;margin-left:4px}.trace-row[_ngcontent-%COMP%]{display:flex;align-items:stretch;position:relative;height:32px}.trace-indent[_ngcontent-%COMP%]{display:flex;flex-shrink:0;height:100%}.indent-connector[_ngcontent-%COMP%]{width:20px;position:relative;height:100%}.vertical-line[_ngcontent-%COMP%]{position:absolute;top:0;bottom:0;left:9px;width:1px;background-color:#ccc}.horizontal-line[_ngcontent-%COMP%]{position:absolute;top:50%;left:9px;width:10px;height:1px;background-color:#ccc}.trace-item[_ngcontent-%COMP%]{margin-top:5px}.trace-item[_ngcontent-%COMP%]{--mat-expansion-container-background-color: #333537}.trace-item[_ngcontent-%COMP%]{--mat-expansion-header-focus-state-layer-color: red}.trace-item[_ngcontent-%COMP%]{--mat-expansion-header-description-color: #8e918f}.trace-item[_ngcontent-%COMP%]{--mat-expansion-header-text-size: 15} .mat-expansion-panel-header.mat-expanded:focus{background-color:#444746!important} .mat-expansion-panel-header.mat-expanded{background-color:#444746!important} .mat-expansion-panel-header.mat-expanded:hover{background-color:#444746!important} .mat-expansion-panel-header-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden} .mat-expansion-panel-header-description{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}"]})};function EPA(t,e){if(t&1){let A=De();S(0,"div",11),mA("click",function(){LA(A);let n=P();return xA(n.openViewImageDialog(n.rawSvgString))}),R()}if(t&2){let A=P();vA("innerHtml",A.renderedEventGraph,mI)}}var uf=class t{constructor(e,A,i,n){this.dialog=e;this.traceService=A;this.eventService=i;this.sanitizer=n}userId="";sessionId="";appName="";panelClosed=new XA;renderedEventGraph;eventData;selectedRow=void 0;rawSvgString=null;llmRequest=void 0;llmResponse=void 0;llmRequestKey="gcp.vertex.agent.llm_request";llmResponseKey="gcp.vertex.agent.llm_response";ngOnInit(){this.traceService.selectedTraceRow$.subscribe(e=>{this.selectedRow=e;let A=this.getEventIdFromSpan();A&&(this.eventService.getEventTrace(A).subscribe(i=>{this.llmRequest=JSON.parse(i[this.llmRequestKey]),this.llmResponse=JSON.parse(i[this.llmResponseKey])}),this.getEventGraph(A))}),this.traceService.eventData$.subscribe(e=>this.eventData=e)}openViewImageDialog(e){let A=this.dialog.open(m0,{maxWidth:"90vw",maxHeight:"90vh",data:{imageData:e}})}getEventDetails(){if(this.eventData&&this.selectedRow)return this.eventData.get(this.getEventIdFromSpan())}getEventIdFromSpan(){if(this.selectedRow)return this.selectedRow.attributes["gcp.vertex.agent.event_id"]}getEventGraph(e){this.eventService.getEvent(this.userId,this.appName,this.sessionId,e).subscribe(A=>_n(this,null,function*(){if(!A.dotSrc){this.renderedEventGraph=void 0;return}let i=A.dotSrc,o=(yield vu()).renderString(i,{format:"svg",engine:"dot"});this.rawSvgString=o,this.renderedEventGraph=this.sanitizer.bypassSecurityTrustHtml(o)}))}closePanel(){this.panelClosed.emit(!0)}static \u0275fac=function(A){return new(A||t)(zA(Us),zA(zg),zA(j1),zA(il))};static \u0275cmp=YA({type:t,selectors:[["app-trace-event"]],inputs:{userId:"userId",sessionId:"sessionId",appName:"appName"},outputs:{panelClosed:"panelClosed"},standalone:!1,decls:17,vars:4,consts:[[1,"wrapper"],["mat-stretch-tabs","false","mat-align-tabs","start"],["label","Event"],[1,"json-viewer-container"],[3,"json"],["label","Request"],["label","Response"],["label","Graph"],[1,"event-graph-container"],[3,"innerHtml"],["mat-icon-button","",1,"tab-header-action",3,"click"],[3,"click","innerHtml"]],template:function(A,i){A&1&&(S(0,"div",0)(1,"mat-tab-group",1)(2,"mat-tab",2)(3,"div",3),UA(4,"ngx-json-viewer",4),R()(),S(5,"mat-tab",5)(6,"div",3),UA(7,"ngx-json-viewer",4),R()(),S(8,"mat-tab",6)(9,"div",3),UA(10,"ngx-json-viewer",4),R()(),S(11,"mat-tab",7)(12,"div",8),NA(13,EPA,1,1,"div",9),R()()(),S(14,"button",10),mA("click",function(){return i.closePanel()}),S(15,"mat-icon"),tA(16,"close"),R()()()),A&2&&(_(4),vA("json",i.getEventDetails()),_(3),vA("json",i.llmRequest),_(3),vA("json",i.llmResponse),_(3),FA(i.renderedEventGraph?13:-1))},dependencies:[T2,EB,Qh,af,Py],styles:[".json-viewer-container[_ngcontent-%COMP%]{padding-top:8px;padding-left:12px;padding-right:12px;background-color:#1b1b1b}.event-graph-container[_ngcontent-%COMP%]{text-align:center;padding-top:20px}.event-graph-container[_ngcontent-%COMP%] svg text{font-family:Google Sans Mono,monospace;font-size:11px}.wrapper[_ngcontent-%COMP%]{position:relative}.tab-header-action[_ngcontent-%COMP%]{position:absolute;top:0;right:0;height:48px;z-index:2;margin-right:10px}"]})};var QPA=["videoContainer"],uPA=["sideDrawer"],fPA=["autoScroll"],mPA=["messageTextarea"],pPA=["bottomPanel"],wPA=t=>({"edit-mode":t}),DPA=()=>[],yPA=(t,e)=>({"user-message":t,"bot-message":e}),vPA=(t,e)=>({"eval-pass":t,"eval-fail":e}),bPA=t=>({"eval-fail":t}),WG=t=>({"background-color":t}),MPA=(t,e)=>({"font-style":t,color:e}),tlA=t=>({"function-event-button-highlight":t}),XG=t=>({hidden:t});function kPA(t,e){if(t&1){let A=De();S(0,"span",28),mA("click",function(){LA(A);let n=P();return xA(n.toggleSidePanel())}),tA(1,"left_panel_open"),R()}}function SPA(t,e){if(t&1&&(S(0,"mat-option",17),tA(1),R()),t&2){let A=e.$implicit;vA("value",A),_(),Mt(A)}}function RPA(t,e){t&1&&ln(0,SPA,2,2,"mat-option",17,Kn),t&2&&gn(e)}function LPA(t,e){if(t&1&&(S(0,"mat-option",17),tA(1),R()),t&2){let A=P();vA("value",A.selectedAppControl.value),_(),Mt(A.selectedAppControl.value)}}function xPA(t,e){t&1&&(S(0,"span",37),tA(1,"Trace"),R())}function FPA(t,e){t&1&&(S(0,"span",37),tA(1,"Events"),R())}function NPA(t,e){t&1&&(S(0,"span",37),tA(1,"State"),R())}function _PA(t,e){t&1&&(S(0,"span",37),tA(1,"Artifacts"),R())}function GPA(t,e){t&1&&(S(0,"span",37),tA(1,"Sessions"),R())}function UPA(t,e){t&1&&(S(0,"span",37),tA(1,"Eval"),R())}function KPA(t,e){if(t&1){let A=De();S(0,"mat-tab"),NA(1,UPA,2,0,"ng-template",31),S(2,"app-eval-tab",38),mA("shouldShowTab",function(n){LA(A);let o=P(2);return xA(o.handleShouldShowEvalTab(n))})("sessionSelected",function(n){LA(A);let o=P(2);return xA(o.updateWithSelectedSession(n))})("evalCaseSelected",function(n){LA(A);let o=P(2);return xA(o.updateWithSelectedEvalCase(n))})("evalSetIdSelected",function(n){LA(A);let o=P(2);return xA(o.updateSelectedEvalSetId(n))})("shouldReturnToSession",function(n){LA(A);let o=P(2);return xA(o.handleReturnToSession(n))})("evalNotInstalledMsg",function(n){LA(A);let o=P(2);return xA(o.handleEvalNotInstalled(n))}),R()()}if(t&2){let A=P(2);_(2),vA("appName",A.appName)("userId",A.userId)("sessionId",A.sessionId)}}function YPA(t,e){if(t&1){let A=De();S(0,"div",18)(1,"mat-tab-group",29),mA("selectedTabChange",function(n){LA(A);let o=P();return xA(o.handleTabChange(n))}),S(2,"mat-tab",30),NA(3,xPA,2,0,"ng-template",31),UA(4,"app-trace-tab",32),R(),S(5,"mat-tab",30),NA(6,FPA,2,0,"ng-template",31),S(7,"app-event-tab",33),mA("selectedEvent",function(n){LA(A);let o=P();return xA(o.selectEvent(n))}),R()(),S(8,"mat-tab"),NA(9,NPA,2,0,"ng-template",31),UA(10,"app-state-tab",34),R(),S(11,"mat-tab"),NA(12,_PA,2,0,"ng-template",31),UA(13,"app-artifact-tab",35),R(),S(14,"mat-tab"),NA(15,GPA,2,0,"ng-template",31),S(16,"app-session-tab",36),mA("sessionSelected",function(n){LA(A);let o=P();return xA(o.updateWithSelectedSession(n))})("sessionReloaded",function(n){LA(A);let o=P();return xA(o.updateSessionState(n))}),R()(),NA(17,KPA,3,3,"mat-tab"),R()()}if(t&2){let A=P();_(4),vA("traceData",A.traceData),_(3),vA("eventsMap",A.eventData)("traceData",A.traceData),_(3),vA("sessionState",A.currentSessionState),_(3),vA("artifacts",A.artifacts),_(3),vA("userId",A.userId)("appName",A.appName)("sessionId",A.sessionId),_(),FA(A.shouldShowEvalTab()?17:-1)}}function JPA(t,e){if(t&1){let A=De();S(0,"div",51),mA("click",function(){LA(A);let n=P(2);return xA(n.openViewImageDialog(n.rawSvgString))}),R()}if(t&2){let A=P(2);vA("innerHtml",A.renderedEventGraph,mI)}}function TPA(t,e){if(t&1){let A=De();S(0,"div",19)(1,"div",39)(2,"div",40)(3,"mat-paginator",41),mA("page",function(n){LA(A);let o=P();return xA(o.handlePageEvent(n))}),R(),S(4,"button",42)(5,"mat-icon",43),mA("click",function(){LA(A);let n=P();return xA(n.closeSelectedEvent())}),tA(6,"close"),R()()()(),S(7,"div")(8,"mat-tab-group")(9,"mat-tab",44)(10,"div",45),NA(11,JPA,1,1,"div",46),R(),S(12,"div",47),UA(13,"ngx-json-viewer",48),R()(),S(14,"mat-tab",49)(15,"div",47),UA(16,"ngx-json-viewer",48),R()(),S(17,"mat-tab",50)(18,"div",47),UA(19,"ngx-json-viewer",48),R()()()()()}if(t&2){let A=P();_(3),vA("length",A.eventData.size)("pageSize",1)("pageIndex",A.selectedEventIndex),_(8),FA(A.renderedEventGraph?11:-1),_(2),vA("json",A.selectedEvent),_(3),vA("json",A.llmRequest),_(3),vA("json",A.llmResponse)}}function zPA(t,e){if(t&1){let A=De();S(0,"span",53),mA("click",function(){LA(A);let n=P(2);return xA(n.toggleSidePanel())}),tA(1,"left_panel_open"),R()}}function HPA(t,e){if(t&1){let A=De();S(0,"button",58),mA("click",function(){LA(A);let n=P(3);return xA(n.cancelEditEvalCase())}),tA(1,"Cancel"),R(),S(2,"button",59),mA("click",function(){LA(A);let n=P(3);return xA(n.saveEvalCase())}),tA(3," Save "),R()}if(t&2){let A=P(3);_(2),vA("disabled",!A.hasEvalCaseChanged()||A.isEvalCaseEditing())}}function OPA(t,e){if(t&1){let A=De();S(0,"span",60),mA("click",function(){LA(A);let n=P(3);return xA(n.editEvalCase())}),tA(1," edit "),R(),S(2,"span",61),mA("click",function(){LA(A);let n=P(3);return xA(n.deleteEvalCase())}),tA(3," delete "),R()}}function PPA(t,e){if(t&1&&(S(0,"div",54)(1,"div",55),tA(2,"Eval Case ID"),R(),S(3,"div",56),tA(4),R()(),S(5,"div",57),NA(6,HPA,4,1)(7,OPA,4,0),R()),t&2){let A=P(2);_(4),Mt(A.evalCase.evalId),_(2),FA(A.isEvalEditMode()?6:7)}}function jPA(t,e){if(t&1){let A=De();S(0,"span",70),mA("click",function(){LA(A);let n=P(3);return xA(n.importSession())}),tA(1," upload "),R()}}function qPA(t,e){if(t&1){let A=De();S(0,"div",54)(1,"div",55),tA(2,"Session ID"),R(),S(3,"div",56),tA(4),R()(),S(5,"div",57)(6,"div",62)(7,"mat-slide-toggle",63),mA("change",function(){LA(A);let n=P(2);return xA(n.toggleSse())}),tA(8," Token Streaming "),R()(),UA(9,"mat-divider",64),S(10,"div",65)(11,"div",66),mA("click",function(){LA(A);let n=P(2);return xA(n.onNewSessionClick())}),S(12,"mat-icon"),tA(13,"add"),R(),tA(14," New Session "),R(),S(15,"span",67),mA("click",function(){LA(A);let n=P(2);return xA(n.deleteSession(n.sessionId))}),tA(16," delete "),R(),S(17,"span",68),mA("click",function(){LA(A);let n=P(2);return xA(n.exportSession())}),tA(18," download "),R(),NA(19,jPA,2,0,"span",69),Ta(20,"async"),R()()}if(t&2){let A=P(2);_(4),Mt(A.sessionId),_(3),vA("checked",A.enableSseIndicator()),_(2),vA("vertical",!0),_(10),FA(w2(20,4,A.importSessionEnabledObs)?19:-1)}}function VPA(t,e){if(t&1&&(S(0,"div",22),NA(1,zPA,2,0,"span",52)(2,PPA,8,2)(3,qPA,21,6),R()),t&2){let A=P();vA("ngClass",Yr(3,wPA,A.isEvalEditMode())),_(),FA(A.showSidePanel?-1:1),_(),FA(A.evalCase?2:3)}}function ZPA(t,e){t&1&&(S(0,"div",71)(1,"span"),tA(2,"Loading agents, please wait..."),R()())}function WPA(t,e){t&1&&(S(0,"span"),tA(1,"Welcome to ADK!"),UA(2,"br"),tA(3," Select an agent on the left to begin with."),R())}function XPA(t,e){if(t&1&&(tA(0," Error message: "),UA(1,"br"),S(2,"pre",73),tA(3),R()),t&2){let A=P(4);_(3),Mt(A.loadingError())}}function $PA(t,e){t&1&&(S(0,"pre",72),tA(1,"Warning: No agents found in current folder."),R())}function AjA(t,e){if(t&1&&(S(0,"div"),tA(1," Failed to load agents. To get started, run "),S(2,"pre"),tA(3,"adk web"),R(),tA(4," in the folder that contains the agents."),UA(5,"br"),NA(6,XPA,4,1)(7,$PA,2,0,"pre",72),R()),t&2){let A=P(3);_(6),FA(A.loadingError()?6:7)}}function ejA(t,e){if(t&1&&(S(0,"div",71),NA(1,WPA,4,0,"span"),Ta(2,"async"),NA(3,AjA,8,1,"div"),R()),t&2){let A=P(2);_(),FA((w2(2,1,A.apps$)||jT(3,DPA)).length>0?1:3)}}function tjA(t,e){if(t&1&&NA(0,ZPA,3,0,"div",71)(1,ejA,4,4,"div",71),t&2){let A=P();FA(A.isLoadingApps()?0:1)}}function ijA(t,e){if(t&1){let A=De();S(0,"button",74),mA("click",function(){LA(A);let n=P();return xA(n.openDialog())}),S(1,"mat-icon"),tA(2,"priority_high"),R()()}}function njA(t,e){if(t&1){let A=De();S(0,"button",80),mA("click",function(){LA(A);let n=P().$index,o=P(2);return xA(o.clickEvent(n))}),S(1,"mat-icon",81),tA(2,"robot_2"),R()()}if(t&2){let A=P().$index,i=P(2);vo(i.customIconColorClass(A)),vA("matTooltip",i.getAgentNameFromEvent(A))}}function ojA(t,e){t&1&&UA(0,"mat-progress-bar",82)}function rjA(t,e){if(t&1&&UA(0,"img",87),t&2){let A=P().$implicit;vA("src",A.url,Ka)}}function sjA(t,e){if(t&1&&(S(0,"mat-icon"),tA(1,"insert_drive_file"),R(),S(2,"a",88),tA(3),R()),t&2){let A=P().$implicit;_(2),vA("href",A.url,Ka),_(),Mt(A.file.name)}}function ajA(t,e){if(t&1&&(S(0,"div",86),NA(1,rjA,1,1,"img",87)(2,sjA,4,2),R()),t&2){let A=e.$implicit;_(),FA(A.file.type.startsWith("image/")?1:-1),_(),FA(A.file.type.startsWith("image/")?-1:2)}}function cjA(t,e){if(t&1&&(S(0,"div",83),ln(1,ajA,3,2,"div",86,Kn),R()),t&2){let A=P(2).$implicit;_(),gn(A.attachments)}}function ljA(t,e){t&1&&(S(0,"div",84),tA(1,"Thought"),R())}function gjA(t,e){if(t&1){let A=De();S(0,"div",89)(1,"textarea",91,3),ta("ngModelChange",function(n){LA(A);let o=P(5);return Ja(o.userEditEvalCaseMessage,n)||(o.userEditEvalCaseMessage=n),xA(n)}),mA("keydown",function(n){LA(A);let o=P(3).$implicit,r=P(2);return xA(r.handleKeydown(n,o))}),R(),S(3,"div",92)(4,"span",93),mA("click",function(){LA(A);let n=P(3).$implicit,o=P(2);return xA(o.cancelEditMessage(n))}),tA(5," close "),R(),S(6,"span",94),mA("click",function(){LA(A);let n=P(3).$implicit,o=P(2);return xA(o.saveEditMessage(n))}),tA(7," check "),R()()()}if(t&2){let A=P(5);_(),ea("ngModel",A.userEditEvalCaseMessage)}}function IjA(t,e){if(t&1&&UA(0,"markdown",90),t&2){let A=P(3).$implicit;vA("data",A.text)("ngStyle",p2(2,MPA,A.thought?"italic":"normal",A.thought?"#9aa0a6":"white"))}}function CjA(t,e){if(t&1&&NA(0,gjA,8,1,"div",89)(1,IjA,1,5,"markdown",90),t&2){let A=P(2).$implicit;FA(A.isEditing?0:1)}}function djA(t,e){if(t&1&&(S(0,"div"),UA(1,"div",95),R()),t&2){let A=P(2).$implicit,i=P(2);_(),vA("innerHTML",i.renderGooglerSearch(A.renderedContent),mI)}}function BjA(t,e){if(t&1&&(S(0,"code"),tA(1),R()),t&2){let A=P(2).$implicit;_(),ot(" ",A.executableCode.code," ")}}function EjA(t,e){if(t&1&&(S(0,"div")(1,"div"),tA(2),R(),S(3,"div"),tA(4),R()()),t&2){let A=P(2).$implicit;_(2),ot("Outcome: ",A.codeExecutionResult.outcome,""),_(2),ot("Output: ",A.codeExecutionResult.output,"")}}function hjA(t,e){if(t&1){let A=De();S(0,"div",96)(1,"img",97),mA("click",function(){LA(A);let n=P(4).$implicit,o=P(2);return xA(o.openViewImageDialog(n.inlineData.data))}),R()()}if(t&2){let A=P(4).$implicit;_(),vA("src",A.inlineData.data,Ka)}}function QjA(t,e){if(t&1&&(S(0,"div"),UA(1,"app-audio-player",98),R()),t&2){let A=P(4).$implicit;_(),vA("base64data",A.inlineData.data)}}function ujA(t,e){if(t&1){let A=De();S(0,"div")(1,"div",99)(2,"mat-icon"),tA(3,"description"),R(),S(4,"button",100),mA("click",function(){LA(A);let n=P(4).$implicit,o=P(2);return xA(o.openBase64InNewTab(n.inlineData.data,n.inlineData.mimeType))}),tA(5),R()()()}if(t&2){let A=P(4).$implicit;_(5),ot(" ",A.inlineData.name," ")}}function fjA(t,e){if(t&1){let A=De();S(0,"div")(1,"button",100),mA("click",function(){LA(A);let n=P(4).$implicit,o=P(2);return xA(o.openBase64InNewTab(n.inlineData.data,n.inlineData.mimeType))}),tA(2),R()()}if(t&2){let A=P(4).$implicit;_(2),ot(" ",A.inlineData.name," ")}}function mjA(t,e){if(t&1&&(S(0,"div")(1,"div"),NA(2,hjA,2,1,"div",96)(3,QjA,2,1,"div")(4,ujA,6,1,"div")(5,fjA,3,1,"div"),R()()),t&2){let A,i=P(3).$implicit,n=P(2);_(2),FA((A=i.inlineData.mediaType)===n.MediaType.IMAGE?2:A===n.MediaType.AUDIO?3:A===n.MediaType.TEXT?4:5)}}function pjA(t,e){if(t&1){let A=De();S(0,"div")(1,"img",101),mA("click",function(){LA(A);let n=P(4).$implicit,o=P(2);return xA(o.openViewImageDialog(n.inlineData.data))}),R()()}if(t&2){let A=P(4).$implicit;_(),vA("src",A.inlineData.data,Ka)}}function wjA(t,e){if(t&1&&(S(0,"div",86)(1,"mat-icon"),tA(2,"insert_drive_file"),R(),S(3,"a",88),tA(4),R()()),t&2){let A=P(4).$implicit;_(3),vA("href",A.inlineData.data,Ka),_(),Mt(A.inlineData.displayName)}}function DjA(t,e){if(t&1&&(S(0,"div"),NA(1,pjA,2,1,"div")(2,wjA,5,2,"div",86),R()),t&2){let A=P(3).$implicit;_(),FA(A.inlineData.mimeType.startsWith("image/")?1:2)}}function yjA(t,e){if(t&1&&NA(0,mjA,6,1,"div")(1,DjA,3,1,"div"),t&2){let A=P(2).$implicit;FA(A.role==="bot"?0:1)}}function vjA(t,e){if(t&1&&(S(0,"div",104)(1,"div",105),tA(2,"Actual tool uses:"),R(),UA(3,"ngx-json-viewer",48),R(),S(4,"div",106)(5,"div",107),tA(6," Expected tool uses: "),R(),UA(7,"ngx-json-viewer",48),R()),t&2){let A=P(3).$implicit;_(3),vA("json",A.actualInvocationToolUses),_(4),vA("json",A.expectedInvocationToolUses)}}function bjA(t,e){if(t&1&&(S(0,"div",104)(1,"div",105),tA(2,"Actual response:"),R(),S(3,"div"),tA(4),R()(),S(5,"div",106)(6,"div",107),tA(7,"Expected response:"),R(),S(8,"div"),tA(9),R()()),t&2){let A=P(3).$implicit;_(4),Mt(A.actualFinalResponse),_(5),Mt(A.expectedFinalResponse)}}function MjA(t,e){if(t&1&&(S(0,"div",103)(1,"span",108),tA(2),R(),S(3,"span",109),tA(4),R()()),t&2){let A=P(3).$implicit;_(2),ot("Match score: ",A.evalScore,""),_(2),ot("Threshold: ",A.evalThreshold,"")}}function kjA(t,e){if(t&1&&(S(0,"div",85)(1,"div",102),NA(2,vjA,8,2)(3,bjA,10,2),R(),NA(4,MjA,5,2,"div",103),R()),t&2){let A=P(2).$implicit;_(2),FA(A.actualInvocationToolUses?2:A.actualFinalResponse?3:-1),_(2),FA(A.evalScore!==void 0&&A.evalThreshold!==void 0?4:-1)}}function SjA(t,e){if(t&1&&(S(0,"mat-card",77),NA(1,ojA,1,0,"mat-progress-bar",82)(2,cjA,3,0,"div",83),S(3,"div"),NA(4,ljA,2,0,"div",84),S(5,"div"),NA(6,CjA,2,1),R(),NA(7,djA,2,1,"div"),R(),NA(8,BjA,2,1,"code")(9,EjA,5,2,"div")(10,yjA,2,1)(11,kjA,5,2,"div",85),R()),t&2){let A=P(),i=A.$implicit,n=A.$index,o=P(2);vA("ngClass",Yr(11,bPA,i.evalStatus===2))("ngStyle",Yr(13,WG,o.shouldMessageHighlighted(n)?"rgb(15, 82, 35)":"")),_(),FA(i.isLoading?1:-1),_(),FA(i.attachments?2:-1),_(2),FA(i.thought?4:-1),_(2),FA(i.text?6:-1),_(),FA(i.renderedContent?7:-1),_(),FA(i.executableCode?8:-1),_(),FA(i.codeExecutionResult?9:-1),_(),FA(i.inlineData?10:-1),_(),FA(i.failedMetric&&i.evalStatus===2?11:-1)}}function RjA(t,e){if(t&1){let A=De();S(0,"button",110),mA("click",function(){LA(A);let n=P().$index,o=P(2);return xA(o.clickEvent(n))}),S(1,"mat-icon"),tA(2,"bolt"),R(),tA(3),R()}if(t&2){let A=P(),i=A.$implicit,n=A.$index,o=P(2);vA("ngClass",Yr(2,tlA,o.shouldMessageHighlighted(n))),_(3),ot(" ",i.functionCall.name," ")}}function LjA(t,e){if(t&1){let A=De();S(0,"button",110),mA("click",function(){LA(A);let n=P().$index,o=P(2);return xA(o.clickEvent(n))}),S(1,"mat-icon"),tA(2,"check"),R(),tA(3),R()}if(t&2){let A=P(),i=A.$implicit,n=A.$index,o=P(2);vA("ngClass",Yr(2,tlA,o.shouldMessageHighlighted(n))),_(3),ot(" ",i.functionResponse.name," ")}}function xjA(t,e){if(t&1){let A=De();S(0,"div")(1,"span",111),mA("click",function(){LA(A);let n=P(2).$implicit,o=P(2);return xA(o.editEvalCaseMessage(n))}),tA(2," edit "),R(),S(3,"span",112),mA("click",function(){LA(A);let n=P(2),o=n.$implicit,r=n.$index,s=P(2);return xA(s.deleteEvalCaseMessage(o,r))}),tA(4," delete "),R()()}if(t&2){let A=P(4);_(),vA("ngClass",Yr(2,XG,A.isEvalCaseEditing())),_(2),vA("ngClass",Yr(4,XG,A.isEvalCaseEditing()))}}function FjA(t,e){if(t&1){let A=De();S(0,"div")(1,"span",113),mA("click",function(){LA(A);let n=P(2).$implicit,o=P(2);return xA(o.editFunctionArgs(n))}),tA(2," edit "),R()()}if(t&2){let A=P(4);_(),vA("ngClass",Yr(1,XG,A.isEvalCaseEditing()))}}function NjA(t,e){if(t&1&&(NA(0,xjA,5,6,"div"),Ta(1,"async"),NA(2,FjA,3,3,"div")),t&2){let A=P().$implicit,i=P(2);FA(A.text?0:w2(1,1,i.isEditFunctionArgsEnabledObs)&&A.functionCall?2:-1)}}function _jA(t,e){t&1&&(S(0,"button",42)(1,"mat-icon"),tA(2,"person"),R()())}function GjA(t,e){if(t&1&&(S(0,"div",75),NA(1,njA,3,3,"button",76)(2,SjA,12,15,"mat-card",77)(3,RjA,4,4,"button",78)(4,LjA,4,4,"button",78),S(5,"div",75)(6,"span",79),tA(7),R(),S(8,"span"),tA(9),R()(),NA(10,NjA,3,3)(11,_jA,3,0,"button",42),R()),t&2){let A=e.$implicit,i=P(2);vA("ngClass",p2(10,yPA,A.role==="user",A.role==="bot")),_(),FA(A.role==="bot"?1:-1),_(),FA(!A.functionCall&&!A.functionResponse?2:-1),_(),FA(A.functionCall?3:-1),_(),FA(A.functionResponse?4:-1),_(),vA("ngClass",p2(13,vPA,A.evalStatus===1,A.evalStatus===2)),_(2),Mt(A.evalStatus===1?"check":A.evalStatus===2?"close":""),_(2),Mt(A.evalStatus===1?"Pass":A.evalStatus===2?"Fail":""),_(),FA(i.evalCase&&A.role==="bot"&&i.isEvalEditMode()?10:-1),_(),FA(A.role==="user"?11:-1)}}function UjA(t,e){if(t&1&&(S(0,"div",25,1),UA(2,"div",null,2),ln(4,GjA,12,16,"div",75,Kn),R()),t&2){let A=P();_(4),gn(A.messages)}}function KjA(t,e){if(t&1){let A=De();S(0,"div",121),UA(1,"img",123),S(2,"button",124),mA("click",function(){LA(A);let n=P().$index,o=P(3);return xA(o.removeFile(n))}),S(3,"mat-icon",125),tA(4,"close"),R()()()}if(t&2){let A=P().$implicit;_(),vA("src",A.url,Ka)}}function YjA(t,e){if(t&1){let A=De();S(0,"div",122)(1,"button",124),mA("click",function(){LA(A);let n=P().$index,o=P(3);return xA(o.removeFile(n))}),S(2,"mat-icon",125),tA(3,"close"),R()(),S(4,"div",126)(5,"mat-icon"),tA(6,"insert_drive_file"),R(),S(7,"span"),tA(8),R()()()}if(t&2){let A=P().$implicit;_(8),Mt(A.file.name)}}function JjA(t,e){if(t&1&&(S(0,"div"),NA(1,KjA,5,1,"div",121)(2,YjA,9,1,"div",122),R()),t&2){let A=e.$implicit;_(),FA(A.file.type.startsWith("image/")?1:-1),_(),FA(A.file.type.startsWith("image/")?-1:2)}}function TjA(t,e){if(t&1&&(S(0,"div",116),ln(1,JjA,3,2,"div",null,Kn),R()),t&2){let A=P(2);_(),gn(A.selectedFiles)}}function zjA(t,e){if(t&1){let A=De();S(0,"div",26)(1,"input",114,4),mA("change",function(n){LA(A);let o=P();return xA(o.onFileSelect(n))}),R(),S(3,"mat-form-field",115),NA(4,TjA,3,0,"div",116),S(5,"textarea",117),ta("ngModelChange",function(n){LA(A);let o=P();return Ja(o.userInput,n)||(o.userInput=n),xA(n)}),mA("keydown.enter",function(n){LA(A);let o=P();return xA(o.sendMessage(n))}),R(),S(6,"div",118)(7,"button",119),mA("click",function(){LA(A);let n=or(2);return xA(n.click())}),S(8,"mat-icon"),tA(9,"attach_file"),R()(),S(10,"div")(11,"button",120),mA("click",function(){LA(A);let n=P();return xA(n.toggleAudioRecording())}),S(12,"mat-icon"),tA(13,"mic"),R()(),S(14,"button",120),mA("click",function(){LA(A);let n=P();return xA(n.toggleVideoRecording())}),S(15,"mat-icon"),tA(16,"videocam"),R()()()()()()}if(t&2){let A=P();_(4),FA(A.selectedFiles.length&&A.appName!=""?4:-1),_(),ea("ngModel",A.userInput),_(6),vA("ngStyle",Yr(6,WG,A.isAudioRecording?"rgb(234, 67, 53)":"rgb(51, 53, 55)"))("matTooltip",A.isAudioRecording?"Turn off microphone":"Use microphone"),_(3),vA("ngStyle",Yr(8,WG,A.isVideoRecording?"rgb(234, 67, 53)":"rgb(51, 53, 55)"))("matTooltip",A.isVideoRecording?"Turn off camera":"Use camera")}}function HjA(t,e){if(t&1){let A=De();S(0,"div",27,5),UA(2,"div",127),S(3,"app-trace-event",128),mA("panelClosed",function(){LA(A);let n=P();return xA(n.closeTraceEventDetailPanel())}),R()()}if(t&2){let A=P();_(3),vA("userId",A.userId)("appName",A.appName)("sessionId",A.sessionId)}}function OjA(t){for(t=t.replace(/-/g,"+").replace(/_/g,"/");t.length%4!==0;)t+="=";return t}var $G=class extends TI{nextPageLabel="Next Event";previousPageLabel="Previous Event";firstPageLabel="First Event";lastPageLabel="Last Event";getRangeLabel=(e,A,i)=>i===0?`Event 0 of ${i}`:(i=Math.max(i,0),`Event ${e*A+1} of ${i}`)},elA="Restarting bidirectional streaming is not currently supported. Please refresh the page or start a new session.",ff=class t{constructor(e,A,i,n,o,r,s,a,c,l,I,C,d,B,E){this.sanitizer=e;this.sessionService=A;this.artifactService=i;this.audioService=n;this.webSocketService=o;this.videoService=r;this.dialog=s;this.eventService=a;this.route=c;this.downloadService=l;this.evalService=I;this.traceService=C;this.location=d;this.renderer=B;this.document=E}videoContainer;sideDrawer;eventTabComponent;sessionTab;evalTab;scrollContainer;textarea;bottomPanelRef;_snackBar=m(pP);shouldShowEvalTab=Ko(!0);enableSseIndicator=Ko(!1);isChatMode=Ko(!0);isEvalCaseEditing=Ko(!1);hasEvalCaseChanged=Ko(!1);isEvalEditMode=Ko(!1);videoElement;currentMessage="";messages=[];lastTextChunk="";streamingTextMessage=null;latestThought="";artifacts=[];userInput="";userEditEvalCaseMessage="";userId="user";appName="";sessionId="";evalCase=null;updatedEvalCase=null;evalSetId="";isAudioRecording=!1;isVideoRecording=!1;longRunningEvents=[];functionCallEventId="";redirectUri=Es.getBaseUrlWithoutPath();showSidePanel=!0;useSse=!1;currentSessionState={};messagesSubject=new li([]);streamingTextMessageSubject=new li(null);scrollInterruptedSubject=new li(!0);isModelThinkingSubject=new li(!1);sessionHasUsedBidi=new Set;eventData=new Map;traceData=[];eventMessageIndexArray=[];renderedEventGraph;rawSvgString=null;selectedEvent=void 0;selectedEventIndex=void 0;llmRequest=void 0;llmResponse=void 0;llmRequestKey="gcp.vertex.agent.llm_request";llmResponseKey="gcp.vertex.agent.llm_response";getMediaTypeFromMimetype=h8;selectedFiles=[];previousMessageCount=0;openBase64InNewTab=qk;MediaType=Ru;router=m(ng);activatedRoute=m(ra);selectedAppControl=new vI("",{nonNullable:!0});changeDetectorRef=m(lt);agentService=m(K2);isLoadingApps=Ko(!1);loadingError=Ko("");apps$=ve([]).pipe(oo(()=>{this.isLoadingApps.set(!0),this.selectedAppControl.disable()}),no(()=>this.agentService.listApps().pipe(dr(e=>(this.loadingError.set(e.message),ve(void 0))))),Pn(1),oo(e=>{this.isLoadingApps.set(!1),this.selectedAppControl.enable(),e?.length==1&&this.router.navigate([],{relativeTo:this.route,queryParams:{app:e[0]}})}),$g());featureFlagService=m(vB);importSessionEnabledObs=this.featureFlagService.isImportSessionEnabled();isEditFunctionArgsEnabledObs=this.featureFlagService.isEditFunctionArgsEnabled();isSessionUrlEnabledObs=this.featureFlagService.isSessionUrlEnabled();bottomPanelVisible=!1;hoveredEventMessageIndices=[];ngOnInit(){if(this.syncSelectedAppFromUrl(),this.updateSelectedAppUrl(),this.webSocketService.onCloseReason().subscribe(i=>{let n=`Please check server log for full details: -`+i;this.openSnackBar(n,"OK")}),new URL(window.location.href).searchParams.has("code")){let i=window.location.href;window.opener?.postMessage({authResponseUrl:i},window.origin),window.close()}this.agentService.getApp().subscribe(i=>{this.appName=i}),Ls([this.agentService.getLoadingState(),this.isModelThinkingSubject]).subscribe(([i,n])=>{let o=this.messages[this.messages.length-1];i?!o?.isLoading&&!this.streamingTextMessage&&(this.messages.push({role:"bot",isLoading:!0}),this.messagesSubject.next(this.messages)):o?.isLoading&&!n&&(this.messages.pop(),this.messagesSubject.next(this.messages),this.changeDetectorRef.detectChanges())}),Ls([this.messagesSubject,this.scrollInterruptedSubject,this.streamingTextMessageSubject]).subscribe(([i,n,o])=>{n||setTimeout(()=>{this.scrollToBottom()},100)}),this.traceService.selectedTraceRow$.subscribe(i=>{let n=i?.attributes["gcp.vertex.agent.event_id"];n&&this.eventData.has(n)?this.bottomPanelVisible=!0:this.bottomPanelVisible=!1}),this.traceService.hoveredMessageIndicies$.subscribe(i=>this.hoveredEventMessageIndices=i)}ngAfterViewInit(){this.showSidePanel=!0,this.sideDrawer.open()}scrollToBottom(){setTimeout(()=>{this.scrollContainer.nativeElement.scrollTo({top:this.scrollContainer.nativeElement.scrollHeight,behavior:"smooth"})})}selectApp(e){e!=this.appName&&(this.agentService.setApp(e),this.isSessionUrlEnabledObs.subscribe(A=>{let i=this.activatedRoute.snapshot.queryParams.session;if(!A||!i){this.createSessionAndReset();return}i&&this.sessionService.getSession(this.userId,this.appName,i).pipe(Pn(1),dr(n=>(this.openSnackBar("Cannot find specified session. Creating a new one.","OK"),this.createSessionAndReset(),ve(null)))).subscribe(n=>{n&&this.updateWithSelectedSession(n)})}))}createSessionAndReset(){this.createSession(),this.eventData=new Map,this.eventMessageIndexArray=[],this.messages=[],this.artifacts=[],this.userInput="",this.longRunningEvents=[]}createSession(){this.sessionService.createSession(this.userId,this.appName).subscribe(e=>{this.currentSessionState=e.state,this.sessionId=e.id,this.sessionTab.refreshSession(),this.isSessionUrlEnabledObs.subscribe(A=>{A&&this.updateSelectedSessionUrl()})})}sendMessage(e){return _n(this,null,function*(){if(this.messages.length===0&&(this.scrollContainer.nativeElement.addEventListener("wheel",()=>{this.scrollInterruptedSubject.next(!0)}),this.scrollContainer.nativeElement.addEventListener("touchmove",()=>{this.scrollInterruptedSubject.next(!0)})),this.scrollInterruptedSubject.next(!1),e.preventDefault(),!this.userInput.trim()&&this.selectedFiles.length<=0||e instanceof KeyboardEvent&&e.isComposing)return;if(this.userInput.trim()&&(this.messages.push({role:"user",text:this.userInput}),this.messagesSubject.next(this.messages)),this.selectedFiles.length>0){let n=this.selectedFiles.map(o=>({file:o.file,url:o.url}));this.messages.push({role:"user",attachments:n}),this.messagesSubject.next(this.messages)}let A={appName:this.appName,userId:this.userId,sessionId:this.sessionId,newMessage:{role:"user",parts:yield this.getUserMessageParts()},streaming:this.useSse};this.selectedFiles=[];let i=this.eventMessageIndexArray.length-1;this.streamingTextMessage=null,this.agentService.runSse(A).subscribe({next:n=>_n(this,null,function*(){if(n.startsWith('{"error"')){this.openSnackBar(n,"OK");return}let o=JSON.parse(n);if(o.error){this.openSnackBar(o.error,"OK");return}if(o.content)for(let r of o.content.parts)i+=1,this.processPart(o,r,i),this.traceService.setEventData(this.eventData);this.changeDetectorRef.detectChanges()}),error:n=>console.error("SSE error:",n),complete:()=>{this.streamingTextMessage=null,this.sessionTab.reloadSession(this.sessionId),this.eventService.getTrace(this.sessionId).pipe(dr(n=>n.status===404?ve(null):ve([]))).subscribe(n=>{this.traceData=n,this.changeDetectorRef.detectChanges()}),this.traceService.setMessages(this.messages)}}),this.userInput="",this.changeDetectorRef.detectChanges()})}processPart(e,A,i){let n=e.groundingMetadata?.searchEntryPoint?.renderedContent;if(A.text){this.isModelThinkingSubject.next(!1);let o=A.text;if(A.thought){if(o!==this.latestThought){this.storeEvents(A,e,i);let r={role:"bot",text:this.processThoughtText(o),thought:!0,eventId:e.id};this.insertMessageBeforeLoadingMessage(r)}this.latestThought=o}else if(this.streamingTextMessage){if(n&&(this.streamingTextMessage.renderedContent=e.groundingMetadata.searchEntryPoint.renderedContent),o==this.streamingTextMessage.text){this.storeEvents(A,e,i),this.eventMessageIndexArray[i]=o,this.streamingTextMessage=null;return}this.streamingTextMessage.text+=o,this.streamingTextMessageSubject.next(this.streamingTextMessage)}else if(this.streamingTextMessage={role:"bot",text:this.processThoughtText(o),thought:!!A.thought,eventId:e.id},n&&(this.streamingTextMessage.renderedContent=e.groundingMetadata.searchEntryPoint.renderedContent),this.insertMessageBeforeLoadingMessage(this.streamingTextMessage),!this.useSse){this.storeEvents(A,e,i),this.eventMessageIndexArray[i]=o,this.streamingTextMessage=null;return}}else A.thought?this.isModelThinkingSubject.next(!0):(this.isModelThinkingSubject.next(!1),this.storeEvents(A,e,i),this.storeMessage(A,e,i,e.author==="user"?"user":"bot"))}getUserMessageParts(){return _n(this,null,function*(){let e=[];if(this.userInput.trim()&&e.push({text:`${this.userInput}`}),this.selectedFiles.length>0)for(let A of this.selectedFiles)e.push({inlineData:{displayName:A.file.name,data:yield this.readFileAsBytes(A.file),mimeType:A.file.type}});return e})}readFileAsBytes(e){return new Promise((A,i)=>{let n=new FileReader;n.onload=o=>{let r=o.target.result.split(",")[1];A(r)},n.onerror=i,n.readAsDataURL(e)})}updateRedirectUri(e,A){try{let i=new URL(e);return i.searchParams.set("redirect_uri",A),i.toString()}catch(i){return console.warn("Failed to update redirect URI: ",i),e}}storeMessage(e,A,i,n,o,r){if(A.author&&this.createAgentIconColorClass(A.author),A?.longRunningToolIds&&A.longRunningToolIds.length>0){this.getAsyncFunctionsFromParts(A.longRunningToolIds,A.content.parts);let a=this.longRunningEvents[0];if(a.args.authConfig&&a.args.authConfig.exchangedAuthCredential&&a.args.authConfig.exchangedAuthCredential.oauth2){let c=a.args.authConfig.exchangedAuthCredential.oauth2.authUri,l=this.updateRedirectUri(c,this.redirectUri);this.openOAuthPopup(l).then(I=>{this.functionCallEventId=A.id,this.sendOAuthResponse(a,I,this.redirectUri)}).catch(I=>{console.error("OAuth Error:",I)})}else this.functionCallEventId=A.id}if(A?.actions&&A.actions.artifactDelta)for(let a in A.actions.artifactDelta)A.actions.artifactDelta.hasOwnProperty(a)&&this.renderArtifact(a,A.actions.artifactDelta[a]);A?.evalStatus&&this.isChatMode.set(!1);let s={role:n,evalStatus:A?.evalStatus,failedMetric:A?.failedMetric,evalScore:A?.evalScore,evalThreshold:A?.evalThreshold,actualInvocationToolUses:A?.actualInvocationToolUses,expectedInvocationToolUses:A?.expectedInvocationToolUses,actualFinalResponse:A?.actualFinalResponse,expectedFinalResponse:A?.expectedFinalResponse,invocationIndex:o!==void 0?o:void 0,finalResponsePartIndex:r?.finalResponsePartIndex!==void 0?r.finalResponsePartIndex:void 0,toolUseIndex:r?.toolUseIndex!==void 0?r.toolUseIndex:void 0};if(e.inlineData){let a=this.formatBase64Data(e.inlineData.data,e.inlineData.mimeType);s.inlineData={displayName:e.inlineData.displayName,data:a,mimeType:e.inlineData.mimeType},this.eventMessageIndexArray[i]=e.inlineData}else if(e.text)s.text=e.text,s.thought=!!e.thought,A?.groundingMetadata&&A.groundingMetadata.searchEntryPoint&&A.groundingMetadata.searchEntryPoint.renderedContent&&(s.renderedContent=A.groundingMetadata.searchEntryPoint.renderedContent),s.eventId=A?.id,this.eventMessageIndexArray[i]=e.text;else if(e.functionCall)s.functionCall=e.functionCall,s.eventId=A?.id,this.eventMessageIndexArray[i]=e.functionCall;else if(e.functionResponse)s.functionResponse=e.functionResponse,s.eventId=A?.id,this.eventMessageIndexArray[i]=e.functionResponse;else if(e.executableCode)s.executableCode=e.executableCode,this.eventMessageIndexArray[i]=e.executableCode;else if(e.codeExecutionResult&&(s.codeExecutionResult=e.codeExecutionResult,this.eventMessageIndexArray[i]=e.codeExecutionResult,A.actions&&A.actions.artifact_delta))for(let a in A.actions.artifact_delta)A.actions.artifact_delta.hasOwnProperty(a)&&this.renderArtifact(a,A.actions.artifact_delta[a]);Object.keys(e).length>0&&this.insertMessageBeforeLoadingMessage(s)}insertMessageBeforeLoadingMessage(e){this.messages[this.messages.length-1]?.isLoading?this.messages.splice(this.messages.length-1,0,e):this.messages.push(e),this.messagesSubject.next(this.messages)}formatBase64Data(e,A){let i=OjA(e);return`data:${A};base64,${i}`}renderArtifact(e,A){let i={role:"bot",inlineData:{data:"",mimeType:"image/png"}};this.insertMessageBeforeLoadingMessage(i);let n=this.messages.length-2;this.artifactService.getArtifactVersion(this.userId,this.appName,this.sessionId,e,A).subscribe(o=>{let r=o.inlineData.mimeType,s=this.formatBase64Data(o.inlineData.data,r),a=h8(r),c={name:this.createDefaultArtifactName(r),data:s,mimeType:r,mediaType:a};this.messages[n]={role:"bot",inlineData:c},this.artifacts=[...this.artifacts,{id:e,data:s,mimeType:r,versionId:A,mediaType:h8(r)}]})}storeEvents(e,A,i){let n="";e.text?n+="text:"+e.text:e.functionCall?n+="functionCall:"+e.functionCall.name:e.functionResponse?n+="functionResponse:"+e.functionResponse.name:e.executableCode?n+="executableCode:"+e.executableCode.code.slice(0,10):e.codeExecutionResult&&(n+="codeExecutionResult:"+e.codeExecutionResult.outcome),A.title=n,this.eventData.set(A.id,A),this.eventData=new Map(this.eventData)}sendOAuthResponse(e,A,i){this.longRunningEvents.pop();let n={appName:this.appName,userId:this.userId,sessionId:this.sessionId,newMessage:{role:"user",parts:[]}};var o=structuredClone(e.args.authConfig);o.exchangedAuthCredential.oauth2.authResponseUri=A,o.exchangedAuthCredential.oauth2.redirectUri=i,n.functionCallEventId=this.functionCallEventId,n.newMessage.parts.push({function_response:{id:e.id,name:e.name,response:o}});let r=[];this.agentService.runSse(n).subscribe({next:s=>_n(this,null,function*(){let a=JSON.parse(s);r.push(a)}),error:s=>console.error("SSE error:",s),complete:()=>{this.processRunSseResponse(r)}})}processRunSseResponse(e){let A=this.eventMessageIndexArray.length-1;for(let i of e)if(i.content)for(let n of i.content.parts)A+=1,this.processPart(i,n,A)}openDialog(){this.dialog.open(rf,{width:"600px",data:{event:this.longRunningEvents[0],appName:this.appName,userId:this.userId,sessionId:this.sessionId,functionCallEventId:this.functionCallEventId}}).afterClosed().subscribe(A=>{A&&(this.removeFinishedLongRunningEvents(A.events),this.processRunSseResponse(A.response))})}removeFinishedLongRunningEvents(e){let A=new Set(e.map(i=>i.id));this.longRunningEvents=this.longRunningEvents.filter(i=>!A.has(i.id))}getAgentNameFromEvent(e){let A=this.messages[e].eventId;return this.eventData.get(A)?.author??this.selectedAppControl.value}customIconColorClass(e){let A=this.getAgentNameFromEvent(e);return`custom-icon-color-${(0,ZG.default)(A).replace("#","")}`}createAgentIconColorClass(e){let A=(0,ZG.default)(e),i=`custom-icon-color-${A.replace("#","")}`;this.injectCustomIconColorStyle(i,A)}clickEvent(e){let A=this.messages[e].eventId;this.sideDrawer.open(),this.showSidePanel=!0,this.selectedEvent=this.eventData.get(A),this.selectedEventIndex=this.getIndexOfKeyInMap(A),this.eventService.getEventTrace(this.selectedEvent.id).subscribe(i=>{this.llmRequest=JSON.parse(i[this.llmRequestKey]),this.llmResponse=JSON.parse(i[this.llmResponseKey])}),this.eventService.getEvent(this.userId,this.appName,this.sessionId,this.selectedEvent.id).subscribe(i=>_n(this,null,function*(){if(!i.dotSrc){this.renderedEventGraph=void 0;return}let n=i.dotSrc,r=(yield vu()).renderString(n,{format:"svg",engine:"dot"});this.rawSvgString=r,this.renderedEventGraph=this.sanitizer.bypassSecurityTrustHtml(r)}))}userMessagesLength(e){return this.messages.slice(0,e).filter(A=>A.role=="user").length}ngOnDestroy(){this.webSocketService.closeConnection()}onAppSelection(e){this.isAudioRecording&&(this.stopAudioRecording(),this.isAudioRecording=!1),this.isVideoRecording&&(this.stopVideoRecording(),this.isVideoRecording=!1),this.evalTab?.resetEvalResults(),this.traceData=[],this.bottomPanelVisible=!1}toggleAudioRecording(){this.isAudioRecording?this.stopAudioRecording():this.startAudioRecording()}startAudioRecording(){if(this.sessionHasUsedBidi.has(this.sessionId)){this.openSnackBar(elA,"OK");return}this.isAudioRecording=!0;let e=window.location.protocol==="https:"?"wss":"ws";this.webSocketService.connect(`${e}://${Es.getWSServerUrl()}/run_live?app_name=${this.appName}&user_id=${this.userId}&session_id=${this.sessionId}`),this.audioService.startRecording(),this.messages.push({role:"user",text:"Speaking..."}),this.messages.push({role:"bot",text:"Speaking..."}),this.messagesSubject.next(this.messages),this.sessionHasUsedBidi.add(this.sessionId)}stopAudioRecording(){this.audioService.stopRecording(),this.webSocketService.closeConnection(),this.isAudioRecording=!1}toggleVideoRecording(){this.isVideoRecording?this.stopVideoRecording():this.startVideoRecording()}startVideoRecording(){if(this.sessionHasUsedBidi.has(this.sessionId)){this.openSnackBar(elA,"OK");return}this.isVideoRecording=!0;let e=window.location.protocol==="https:"?"wss":"ws";this.webSocketService.connect(`${e}://${Es.getWSServerUrl()}/run_live?app_name=${this.appName}&user_id=${this.userId}&session_id=${this.sessionId}`),this.videoService.startRecording(this.videoContainer),this.audioService.startRecording(),this.messages.push({role:"user",text:"Speaking..."}),this.messagesSubject.next(this.messages),this.sessionHasUsedBidi.add(this.sessionId)}stopVideoRecording(){this.audioService.stopRecording(),this.videoService.stopRecording(this.videoContainer),this.webSocketService.closeConnection(),this.isVideoRecording=!1}getAsyncFunctionsFromParts(e,A){for(let i of A)i.functionCall&&e.includes(i.functionCall.id)&&this.longRunningEvents.push(i.functionCall)}openOAuthPopup(e){return new Promise((A,i)=>{if(!window.open(e,"oauthPopup","width=600,height=700")){i("Popup blocked!");return}window.addEventListener("message",o=>{if(o.origin!==window.location.origin)return;let{authResponseUrl:r}=o.data;r?A(r):i("OAuth failed")},{once:!0})})}toggleSidePanel(){this.showSidePanel?this.sideDrawer.close():this.sideDrawer.open(),this.showSidePanel=!this.showSidePanel}handleTabChange(e){this.isChatMode()||(this.resetEditEvalCaseVars(),this.handleReturnToSession(!0))}handleShouldShowEvalTab(e){this.shouldShowEvalTab.set(e)}handleReturnToSession(e){this.sessionTab.getSession(this.sessionId),this.evalTab.resetEvalCase(),this.isChatMode.set(!0)}handleEvalNotInstalled(e){e&&this.openSnackBar(e,"OK")}resetEventsAndMessages(){this.eventData.clear(),this.eventMessageIndexArray=[],this.messages=[],this.messagesSubject.next(this.messages),this.artifacts=[]}updateWithSelectedSession(e){if(!e||!e.id||!e.events||!e.state)return;this.traceService.resetTraceService(),this.sessionId=e.id,this.currentSessionState=e.state,this.evalCase=null,this.isChatMode.set(!0),this.isSessionUrlEnabledObs.subscribe(i=>{i&&this.updateSelectedSessionUrl()}),this.resetEventsAndMessages();let A=0;e.events.forEach(i=>{i.content?.parts?.forEach(n=>{this.storeMessage(n,i,A,i.author==="user"?"user":"bot"),A+=1,i.author&&i.author!=="user"&&this.storeEvents(n,i,A)})}),this.eventService.getTrace(this.sessionId).subscribe(i=>{this.traceData=i,this.traceService.setEventData(this.eventData),this.traceService.setMessages(this.messages)}),this.bottomPanelVisible=!1}updateWithSelectedEvalCase(e){this.evalCase=e,this.isChatMode.set(!1),this.resetEventsAndMessages();let A=0,i=0;for(let n of e.conversation){if(n.userContent?.parts)for(let o of n.userContent.parts)this.storeMessage(o,null,A,"user"),A++;if(n.intermediateData?.toolUses){let o=0;for(let r of n.intermediateData.toolUses){let s={functionCall:{name:r.name,args:r.args}};this.storeMessage(s,null,A,"bot",i,{toolUseIndex:o}),A++,o++;let a={functionResponse:{name:r.name}};this.storeMessage(a,null,A,"bot"),A++}}if(n.finalResponse?.parts){let o=0;for(let r of n.finalResponse.parts)this.storeMessage(r,null,A,"bot",i,{finalResponsePartIndex:o}),A++,o++}i++}}updateSelectedEvalSetId(e){this.evalSetId=e}editEvalCaseMessage(e){this.isEvalCaseEditing.set(!0),this.userEditEvalCaseMessage=e.text,e.isEditing=!0,setTimeout(()=>{this.textarea?.nativeElement.focus();let A=this.textarea?.nativeElement.value.length;e.text.charAt(A-1)===` +`+i;this.openSnackBar(n,"OK")}),new URL(window.location.href).searchParams.has("code")){let i=window.location.href;window.opener?.postMessage({authResponseUrl:i},window.origin),window.close()}this.agentService.getApp().subscribe(i=>{this.appName=i}),Ls([this.agentService.getLoadingState(),this.isModelThinkingSubject]).subscribe(([i,n])=>{let o=this.messages[this.messages.length-1];i?!o?.isLoading&&!this.streamingTextMessage&&(this.messages.push({role:"bot",isLoading:!0}),this.messagesSubject.next(this.messages)):o?.isLoading&&!n&&(this.messages.pop(),this.messagesSubject.next(this.messages),this.changeDetectorRef.detectChanges())}),Ls([this.messagesSubject,this.scrollInterruptedSubject,this.streamingTextMessageSubject]).subscribe(([i,n,o])=>{n||setTimeout(()=>{this.scrollToBottom()},100)}),this.traceService.selectedTraceRow$.subscribe(i=>{let n=i?.attributes["gcp.vertex.agent.event_id"];n&&this.eventData.has(n)?this.bottomPanelVisible=!0:this.bottomPanelVisible=!1}),this.traceService.hoveredMessageIndicies$.subscribe(i=>this.hoveredEventMessageIndices=i)}ngAfterViewInit(){this.showSidePanel=!0,this.sideDrawer.open()}scrollToBottom(){setTimeout(()=>{this.scrollContainer.nativeElement.scrollTo({top:this.scrollContainer.nativeElement.scrollHeight,behavior:"smooth"})})}selectApp(e){e!=this.appName&&(this.agentService.setApp(e),this.isSessionUrlEnabledObs.subscribe(A=>{let i=this.activatedRoute.snapshot.queryParams.session;if(!A||!i){this.createSessionAndReset();return}i&&this.sessionService.getSession(this.userId,this.appName,i).pipe(Pn(1),dr(n=>(this.openSnackBar("Cannot find specified session. Creating a new one.","OK"),this.createSessionAndReset(),ve(null)))).subscribe(n=>{n&&this.updateWithSelectedSession(n)})}))}createSessionAndReset(){this.createSession(),this.eventData=new Map,this.eventMessageIndexArray=[],this.messages=[],this.artifacts=[],this.userInput="",this.longRunningEvents=[]}createSession(){this.sessionService.createSession(this.userId,this.appName).subscribe(e=>{this.currentSessionState=e.state,this.sessionId=e.id,this.sessionTab.refreshSession(),this.isSessionUrlEnabledObs.subscribe(A=>{A&&this.updateSelectedSessionUrl()})})}sendMessage(e){return _n(this,null,function*(){if(this.messages.length===0&&(this.scrollContainer.nativeElement.addEventListener("wheel",()=>{this.scrollInterruptedSubject.next(!0)}),this.scrollContainer.nativeElement.addEventListener("touchmove",()=>{this.scrollInterruptedSubject.next(!0)})),this.scrollInterruptedSubject.next(!1),e.preventDefault(),!this.userInput.trim()&&this.selectedFiles.length<=0||e instanceof KeyboardEvent&&e.isComposing)return;if(this.userInput.trim()&&(this.messages.push({role:"user",text:this.userInput}),this.messagesSubject.next(this.messages)),this.selectedFiles.length>0){let n=this.selectedFiles.map(o=>({file:o.file,url:o.url}));this.messages.push({role:"user",attachments:n}),this.messagesSubject.next(this.messages)}let A={appName:this.appName,userId:this.userId,sessionId:this.sessionId,newMessage:{role:"user",parts:yield this.getUserMessageParts()},streaming:this.useSse};this.selectedFiles=[];let i=this.eventMessageIndexArray.length-1;this.streamingTextMessage=null,this.agentService.runSse(A).subscribe({next:n=>_n(this,null,function*(){if(n.startsWith('{"error"')){this.openSnackBar(n,"OK");return}let o=JSON.parse(n);if(o.error){this.openSnackBar(o.error,"OK");return}if(o.content)for(let r of o.content.parts)i+=1,this.processPart(o,r,i),this.traceService.setEventData(this.eventData);this.changeDetectorRef.detectChanges()}),error:n=>console.error("SSE error:",n),complete:()=>{this.streamingTextMessage=null,this.sessionTab.reloadSession(this.sessionId),this.eventService.getTrace(this.sessionId).pipe(dr(n=>n.status===404?ve(null):ve([]))).subscribe(n=>{this.traceData=n,this.changeDetectorRef.detectChanges()}),this.traceService.setMessages(this.messages)}}),this.userInput="",this.changeDetectorRef.detectChanges()})}processPart(e,A,i){let n=e.groundingMetadata?.searchEntryPoint?.renderedContent;if(A.text){this.isModelThinkingSubject.next(!1);let o=A.text;if(A.thought){if(o!==this.latestThought){this.storeEvents(A,e,i);let r={role:"bot",text:this.processThoughtText(o),thought:!0,eventId:e.id};this.insertMessageBeforeLoadingMessage(r)}this.latestThought=o}else if(this.streamingTextMessage){if(n&&(this.streamingTextMessage.renderedContent=e.groundingMetadata.searchEntryPoint.renderedContent),o==this.streamingTextMessage.text){this.storeEvents(A,e,i),this.eventMessageIndexArray[i]=o,this.streamingTextMessage=null;return}this.streamingTextMessage.text+=o,this.streamingTextMessageSubject.next(this.streamingTextMessage)}else if(this.streamingTextMessage={role:"bot",text:this.processThoughtText(o),thought:!!A.thought,eventId:e.id},n&&(this.streamingTextMessage.renderedContent=e.groundingMetadata.searchEntryPoint.renderedContent),this.insertMessageBeforeLoadingMessage(this.streamingTextMessage),!this.useSse){this.storeEvents(A,e,i),this.eventMessageIndexArray[i]=o,this.streamingTextMessage=null;return}}else A.thought?this.isModelThinkingSubject.next(!0):(this.isModelThinkingSubject.next(!1),this.storeEvents(A,e,i),this.storeMessage(A,e,i,e.author==="user"?"user":"bot"))}getUserMessageParts(){return _n(this,null,function*(){let e=[];if(this.userInput.trim()&&e.push({text:`${this.userInput}`}),this.selectedFiles.length>0)for(let A of this.selectedFiles)e.push({inlineData:{displayName:A.file.name,data:yield this.readFileAsBytes(A.file),mimeType:A.file.type}});return e})}readFileAsBytes(e){return new Promise((A,i)=>{let n=new FileReader;n.onload=o=>{let r=o.target.result.split(",")[1];A(r)},n.onerror=i,n.readAsDataURL(e)})}updateRedirectUri(e,A){try{let i=new URL(e);return i.searchParams.set("redirect_uri",A),i.toString()}catch(i){return console.warn("Failed to update redirect URI: ",i),e}}storeMessage(e,A,i,n,o,r){if(A?.author&&this.createAgentIconColorClass(A.author),A?.longRunningToolIds&&A.longRunningToolIds.length>0){this.getAsyncFunctionsFromParts(A.longRunningToolIds,A.content.parts);let a=this.longRunningEvents[0];if(a.args.authConfig&&a.args.authConfig.exchangedAuthCredential&&a.args.authConfig.exchangedAuthCredential.oauth2){let c=a.args.authConfig.exchangedAuthCredential.oauth2.authUri,l=this.updateRedirectUri(c,this.redirectUri);this.openOAuthPopup(l).then(I=>{this.functionCallEventId=A.id,this.sendOAuthResponse(a,I,this.redirectUri)}).catch(I=>{console.error("OAuth Error:",I)})}else this.functionCallEventId=A.id}if(A?.actions&&A.actions.artifactDelta)for(let a in A.actions.artifactDelta)A.actions.artifactDelta.hasOwnProperty(a)&&this.renderArtifact(a,A.actions.artifactDelta[a]);A?.evalStatus&&this.isChatMode.set(!1);let s={role:n,evalStatus:A?.evalStatus,failedMetric:A?.failedMetric,evalScore:A?.evalScore,evalThreshold:A?.evalThreshold,actualInvocationToolUses:A?.actualInvocationToolUses,expectedInvocationToolUses:A?.expectedInvocationToolUses,actualFinalResponse:A?.actualFinalResponse,expectedFinalResponse:A?.expectedFinalResponse,invocationIndex:o!==void 0?o:void 0,finalResponsePartIndex:r?.finalResponsePartIndex!==void 0?r.finalResponsePartIndex:void 0,toolUseIndex:r?.toolUseIndex!==void 0?r.toolUseIndex:void 0};if(e.inlineData){let a=this.formatBase64Data(e.inlineData.data,e.inlineData.mimeType);s.inlineData={displayName:e.inlineData.displayName,data:a,mimeType:e.inlineData.mimeType},this.eventMessageIndexArray[i]=e.inlineData}else if(e.text)s.text=e.text,s.thought=!!e.thought,A?.groundingMetadata&&A.groundingMetadata.searchEntryPoint&&A.groundingMetadata.searchEntryPoint.renderedContent&&(s.renderedContent=A.groundingMetadata.searchEntryPoint.renderedContent),s.eventId=A?.id,this.eventMessageIndexArray[i]=e.text;else if(e.functionCall)s.functionCall=e.functionCall,s.eventId=A?.id,this.eventMessageIndexArray[i]=e.functionCall;else if(e.functionResponse)s.functionResponse=e.functionResponse,s.eventId=A?.id,this.eventMessageIndexArray[i]=e.functionResponse;else if(e.executableCode)s.executableCode=e.executableCode,this.eventMessageIndexArray[i]=e.executableCode;else if(e.codeExecutionResult&&(s.codeExecutionResult=e.codeExecutionResult,this.eventMessageIndexArray[i]=e.codeExecutionResult,A.actions&&A.actions.artifact_delta))for(let a in A.actions.artifact_delta)A.actions.artifact_delta.hasOwnProperty(a)&&this.renderArtifact(a,A.actions.artifact_delta[a]);Object.keys(e).length>0&&this.insertMessageBeforeLoadingMessage(s)}insertMessageBeforeLoadingMessage(e){this.messages[this.messages.length-1]?.isLoading?this.messages.splice(this.messages.length-1,0,e):this.messages.push(e),this.messagesSubject.next(this.messages)}formatBase64Data(e,A){let i=OjA(e);return`data:${A};base64,${i}`}renderArtifact(e,A){let i={role:"bot",inlineData:{data:"",mimeType:"image/png"}};this.insertMessageBeforeLoadingMessage(i);let n=this.messages.length-2;this.artifactService.getArtifactVersion(this.userId,this.appName,this.sessionId,e,A).subscribe(o=>{let r=o.inlineData.mimeType,s=this.formatBase64Data(o.inlineData.data,r),a=h8(r),c={name:this.createDefaultArtifactName(r),data:s,mimeType:r,mediaType:a};this.messages[n]={role:"bot",inlineData:c},this.artifacts=[...this.artifacts,{id:e,data:s,mimeType:r,versionId:A,mediaType:h8(r)}]})}storeEvents(e,A,i){let n="";e.text?n+="text:"+e.text:e.functionCall?n+="functionCall:"+e.functionCall.name:e.functionResponse?n+="functionResponse:"+e.functionResponse.name:e.executableCode?n+="executableCode:"+e.executableCode.code.slice(0,10):e.codeExecutionResult&&(n+="codeExecutionResult:"+e.codeExecutionResult.outcome),A.title=n,this.eventData.set(A.id,A),this.eventData=new Map(this.eventData)}sendOAuthResponse(e,A,i){this.longRunningEvents.pop();let n={appName:this.appName,userId:this.userId,sessionId:this.sessionId,newMessage:{role:"user",parts:[]}};var o=structuredClone(e.args.authConfig);o.exchangedAuthCredential.oauth2.authResponseUri=A,o.exchangedAuthCredential.oauth2.redirectUri=i,n.functionCallEventId=this.functionCallEventId,n.newMessage.parts.push({function_response:{id:e.id,name:e.name,response:o}});let r=[];this.agentService.runSse(n).subscribe({next:s=>_n(this,null,function*(){let a=JSON.parse(s);r.push(a)}),error:s=>console.error("SSE error:",s),complete:()=>{this.processRunSseResponse(r)}})}processRunSseResponse(e){let A=this.eventMessageIndexArray.length-1;for(let i of e)if(i.content)for(let n of i.content.parts)A+=1,this.processPart(i,n,A)}openDialog(){this.dialog.open(rf,{width:"600px",data:{event:this.longRunningEvents[0],appName:this.appName,userId:this.userId,sessionId:this.sessionId,functionCallEventId:this.functionCallEventId}}).afterClosed().subscribe(A=>{A&&(this.removeFinishedLongRunningEvents(A.events),this.processRunSseResponse(A.response))})}removeFinishedLongRunningEvents(e){let A=new Set(e.map(i=>i.id));this.longRunningEvents=this.longRunningEvents.filter(i=>!A.has(i.id))}getAgentNameFromEvent(e){let A=this.messages[e].eventId;return this.eventData.get(A)?.author??this.selectedAppControl.value}customIconColorClass(e){let A=this.getAgentNameFromEvent(e);return`custom-icon-color-${(0,ZG.default)(A).replace("#","")}`}createAgentIconColorClass(e){let A=(0,ZG.default)(e),i=`custom-icon-color-${A.replace("#","")}`;this.injectCustomIconColorStyle(i,A)}clickEvent(e){let A=this.messages[e].eventId;this.sideDrawer.open(),this.showSidePanel=!0,this.selectedEvent=this.eventData.get(A),this.selectedEventIndex=this.getIndexOfKeyInMap(A),this.eventService.getEventTrace(this.selectedEvent.id).subscribe(i=>{this.llmRequest=JSON.parse(i[this.llmRequestKey]),this.llmResponse=JSON.parse(i[this.llmResponseKey])}),this.eventService.getEvent(this.userId,this.appName,this.sessionId,this.selectedEvent.id).subscribe(i=>_n(this,null,function*(){if(!i.dotSrc){this.renderedEventGraph=void 0;return}let n=i.dotSrc,r=(yield vu()).renderString(n,{format:"svg",engine:"dot"});this.rawSvgString=r,this.renderedEventGraph=this.sanitizer.bypassSecurityTrustHtml(r)}))}userMessagesLength(e){return this.messages.slice(0,e).filter(A=>A.role=="user").length}ngOnDestroy(){this.webSocketService.closeConnection()}onAppSelection(e){this.isAudioRecording&&(this.stopAudioRecording(),this.isAudioRecording=!1),this.isVideoRecording&&(this.stopVideoRecording(),this.isVideoRecording=!1),this.evalTab?.resetEvalResults(),this.traceData=[],this.bottomPanelVisible=!1}toggleAudioRecording(){this.isAudioRecording?this.stopAudioRecording():this.startAudioRecording()}startAudioRecording(){if(this.sessionHasUsedBidi.has(this.sessionId)){this.openSnackBar(elA,"OK");return}this.isAudioRecording=!0;let e=window.location.protocol==="https:"?"wss":"ws";this.webSocketService.connect(`${e}://${Es.getWSServerUrl()}/run_live?app_name=${this.appName}&user_id=${this.userId}&session_id=${this.sessionId}`),this.audioService.startRecording(),this.messages.push({role:"user",text:"Speaking..."}),this.messages.push({role:"bot",text:"Speaking..."}),this.messagesSubject.next(this.messages),this.sessionHasUsedBidi.add(this.sessionId)}stopAudioRecording(){this.audioService.stopRecording(),this.webSocketService.closeConnection(),this.isAudioRecording=!1}toggleVideoRecording(){this.isVideoRecording?this.stopVideoRecording():this.startVideoRecording()}startVideoRecording(){if(this.sessionHasUsedBidi.has(this.sessionId)){this.openSnackBar(elA,"OK");return}this.isVideoRecording=!0;let e=window.location.protocol==="https:"?"wss":"ws";this.webSocketService.connect(`${e}://${Es.getWSServerUrl()}/run_live?app_name=${this.appName}&user_id=${this.userId}&session_id=${this.sessionId}`),this.videoService.startRecording(this.videoContainer),this.audioService.startRecording(),this.messages.push({role:"user",text:"Speaking..."}),this.messagesSubject.next(this.messages),this.sessionHasUsedBidi.add(this.sessionId)}stopVideoRecording(){this.audioService.stopRecording(),this.videoService.stopRecording(this.videoContainer),this.webSocketService.closeConnection(),this.isVideoRecording=!1}getAsyncFunctionsFromParts(e,A){for(let i of A)i.functionCall&&e.includes(i.functionCall.id)&&this.longRunningEvents.push(i.functionCall)}openOAuthPopup(e){return new Promise((A,i)=>{if(!window.open(e,"oauthPopup","width=600,height=700")){i("Popup blocked!");return}let o=r=>{if(r.origin!==window.location.origin)return;let{authResponseUrl:s}=r.data;s?(A(s),window.removeEventListener("message",o)):console.log("OAuth failed",r)};window.addEventListener("message",o)})}toggleSidePanel(){this.showSidePanel?this.sideDrawer.close():this.sideDrawer.open(),this.showSidePanel=!this.showSidePanel}handleTabChange(e){this.isChatMode()||(this.resetEditEvalCaseVars(),this.handleReturnToSession(!0))}handleShouldShowEvalTab(e){this.shouldShowEvalTab.set(e)}handleReturnToSession(e){this.sessionTab.getSession(this.sessionId),this.evalTab.resetEvalCase(),this.isChatMode.set(!0)}handleEvalNotInstalled(e){e&&this.openSnackBar(e,"OK")}resetEventsAndMessages(){this.eventData.clear(),this.eventMessageIndexArray=[],this.messages=[],this.messagesSubject.next(this.messages),this.artifacts=[]}updateWithSelectedSession(e){if(!e||!e.id||!e.events||!e.state)return;this.traceService.resetTraceService(),this.sessionId=e.id,this.currentSessionState=e.state,this.evalCase=null,this.isChatMode.set(!0),this.isSessionUrlEnabledObs.subscribe(i=>{i&&this.updateSelectedSessionUrl()}),this.resetEventsAndMessages();let A=0;e.events.forEach(i=>{i.content?.parts?.forEach(n=>{this.storeMessage(n,i,A,i.author==="user"?"user":"bot"),A+=1,i.author&&i.author!=="user"&&this.storeEvents(n,i,A)})}),this.eventService.getTrace(this.sessionId).subscribe(i=>{this.traceData=i,this.traceService.setEventData(this.eventData),this.traceService.setMessages(this.messages)}),this.bottomPanelVisible=!1}updateWithSelectedEvalCase(e){this.evalCase=e,this.isChatMode.set(!1),this.resetEventsAndMessages();let A=0,i=0;for(let n of e.conversation){if(n.userContent?.parts)for(let o of n.userContent.parts)this.storeMessage(o,null,A,"user"),A++;if(n.intermediateData?.toolUses){let o=0;for(let r of n.intermediateData.toolUses){let s={functionCall:{name:r.name,args:r.args}};this.storeMessage(s,null,A,"bot",i,{toolUseIndex:o}),A++,o++;let a={functionResponse:{name:r.name}};this.storeMessage(a,null,A,"bot"),A++}}if(n.finalResponse?.parts){let o=0;for(let r of n.finalResponse.parts)this.storeMessage(r,null,A,"bot",i,{finalResponsePartIndex:o}),A++,o++}i++}}updateSelectedEvalSetId(e){this.evalSetId=e}editEvalCaseMessage(e){this.isEvalCaseEditing.set(!0),this.userEditEvalCaseMessage=e.text,e.isEditing=!0,setTimeout(()=>{this.textarea?.nativeElement.focus();let A=this.textarea?.nativeElement.value.length;e.text.charAt(A-1)===` `&&A--,this.textarea?.nativeElement.setSelectionRange(A,A)},0)}editFunctionArgs(e){this.isEvalCaseEditing.set(!0),this.dialog.open(W3,{maxWidth:"90vw",maxHeight:"90vh",data:{functionName:e.functionCall.name,args:e.functionCall.args}}).afterClosed().subscribe(i=>{this.isEvalCaseEditing.set(!1),i&&(this.hasEvalCaseChanged.set(!0),e.functionCall.args=i,this.updatedEvalCase=structuredClone(this.evalCase),this.updatedEvalCase.conversation[e.invocationIndex].intermediateData.toolUses[e.toolUseIndex].args=i)})}saveEvalCase(){this.evalService.updateEvalCase(this.appName,this.evalSetId,this.updatedEvalCase.evalId,this.updatedEvalCase).subscribe(e=>{this.openSnackBar("Eval case updated","OK"),this.resetEditEvalCaseVars()})}cancelEditEvalCase(){this.resetEditEvalCaseVars(),this.updateWithSelectedEvalCase(this.evalCase)}resetEditEvalCaseVars(){this.hasEvalCaseChanged.set(!1),this.isEvalCaseEditing.set(!1),this.isEvalEditMode.set(!1),this.updatedEvalCase=null}cancelEditMessage(e){e.isEditing=!1,this.isEvalCaseEditing.set(!1)}saveEditMessage(e){this.hasEvalCaseChanged.set(!0),this.isEvalCaseEditing.set(!1),e.isEditing=!1,e.text=this.userEditEvalCaseMessage?this.userEditEvalCaseMessage:" ",this.updatedEvalCase=structuredClone(this.evalCase),this.updatedEvalCase.conversation[e.invocationIndex].finalResponse.parts[e.finalResponsePartIndex]={text:this.userEditEvalCaseMessage},this.userEditEvalCaseMessage=""}handleKeydown(e,A){e.key==="Enter"&&!e.shiftKey?(e.preventDefault(),this.saveEditMessage(A)):e.key==="Escape"&&this.cancelEditMessage(A)}deleteEvalCaseMessage(e,A){this.hasEvalCaseChanged.set(!0),this.messages.splice(A,1),this.messagesSubject.next(this.messages),this.updatedEvalCase=structuredClone(this.evalCase),this.updatedEvalCase.conversation[e.invocationIndex].finalResponse.parts.splice(e.finalResponsePartIndex,1)}editEvalCase(){this.isEvalEditMode.set(!0)}deleteEvalCase(){let e={title:"Confirm delete",message:`Are you sure you want to delete ${this.evalCase.evalId}?`,confirmButtonText:"Delete",cancelButtonText:"Cancel"};this.dialog.open(dh,{width:"600px",data:e}).afterClosed().subscribe(i=>{i&&(this.evalTab.deleteEvalCase(this.evalCase.evalId),this.openSnackBar("Eval case deleted","OK"))})}updateSessionState(e){this.currentSessionState=e.state}onNewSessionClick(){this.createSession(),this.eventData.clear(),this.eventMessageIndexArray=[],this.messages=[],this.artifacts=[],this.traceData=[],this.bottomPanelVisible=!1,this.evalTab.showEvalHistory&&this.evalTab.toggleEvalHistoryButton()}onFileSelect(e){let A=e.target;if(A.files)for(let i=0;i{this.llmRequest=JSON.parse(A[this.llmRequestKey]),this.llmResponse=JSON.parse(A[this.llmResponseKey])}),this.eventService.getEvent(this.userId,this.appName,this.sessionId,this.selectedEvent.id).subscribe(A=>_n(this,null,function*(){if(!A.dotSrc){this.renderedEventGraph=void 0;return}let i=A.dotSrc,o=(yield vu()).renderString(i,{format:"svg",engine:"dot"});this.rawSvgString=o,this.renderedEventGraph=this.sanitizer.bypassSecurityTrustHtml(o)}))}deleteSession(e){let A={title:"Confirm delete",message:`Are you sure you want to delete this session ${this.sessionId}?`,confirmButtonText:"Delete",cancelButtonText:"Cancel"};this.dialog.open(dh,{width:"600px",data:A}).afterClosed().subscribe(n=>{n&&this.sessionService.deleteSession(this.userId,this.appName,e).subscribe(o=>{let r=this.sessionTab.refreshSession(e);r?this.sessionTab.getSession(r.id):window.location.reload()})})}syncSelectedAppFromUrl(){Ls([this.router.events.pipe(pt(e=>e instanceof Za),Je(()=>this.activatedRoute.snapshot.queryParams)),this.apps$]).subscribe(([e,A])=>{if(A&&A.length){let i=e.app;i&&A.includes(i)?this.selectedAppControl.setValue(i):i&&this.openSnackBar(`Agent '${i}' not found`,"OK")}})}updateSelectedAppUrl(){this.selectedAppControl.valueChanges.pipe(Zc(),pt(Boolean)).subscribe(e=>{this.selectApp(e);let A=this.activatedRoute.snapshot.queryParams.app;e!==A&&this.router.navigate([],{queryParams:{app:e},queryParamsHandling:"merge"})})}updateSelectedSessionUrl(){let e=this.router.createUrlTree([],{queryParams:{session:this.sessionId},queryParamsHandling:"merge"}).toString();this.location.replaceState(e)}handlePageEvent(e){if(e.pageIndex>=0){let A=this.getKeyAtIndexInMap(e.pageIndex);A&&this.selectEvent(A)}}closeSelectedEvent(){this.selectedEvent=void 0,this.selectedEventIndex=void 0}getIndexOfKeyInMap(e){let A=0,i=(o,r)=>0,n=Array.from(this.eventData.keys()).sort(i);for(let o of n){if(o===e)return A;A++}}getKeyAtIndexInMap(e){let A=(n,o)=>0,i=Array.from(this.eventData.keys()).sort(A);if(e>=0&&e{console.log(e),this.downloadService.downloadObjectAsJson(e,`session-${this.sessionId}.json`)})}closeTraceEventDetailPanel(){this.bottomPanelVisible=!1,this.traceService.selectedRow(void 0),this.traceService.setHoveredMessages(void 0,"")}shouldMessageHighlighted(e){return this.hoveredEventMessageIndices.includes(e)}importSession(){let e=document.createElement("input");e.type="file",e.accept="application/json",e.onchange=()=>{if(!e.files||e.files.length===0)return;let A=e.files[0],i=new FileReader;i.onload=n=>{if(n.target?.result)try{let o=JSON.parse(n.target.result);if(!o.userId||!o.appName||!o.events){this.openSnackBar("Invalid session file format","OK");return}this.sessionService.importSession(o.userId,o.appName,o.events).subscribe(r=>{this.openSnackBar("Session imported","OK"),this.sessionTab.refreshSession()})}catch{this.openSnackBar("Error parsing session file","OK")}},i.readAsText(A)},e.click()}injectCustomIconColorStyle(e,A){if(this.document.getElementById(e))return;let i=this.renderer.createElement("style");this.renderer.setAttribute(i,"id",e),this.renderer.setAttribute(i,"type","text/css");let n=` .${e} { background-color: ${A} !important; } - `;this.renderer.appendChild(i,this.renderer.createText(n)),this.renderer.appendChild(this.document.head,i)}static \u0275fac=function(A){return new(A||t)(zA(il),zA(Jg),zA(Bh),zA(Eh),zA(Tg),zA(hh),zA(Us),zA(j1),zA(ra),zA(J2),zA(zc),zA(zg),zA(Qc),zA(Gi),zA(tt))};static \u0275cmp=YA({type:t,selectors:[["app-chat"]],viewQuery:function(A,i){if(A&1&&(Ge(QPA,5,te),Ge(uPA,5),Ge(jC,5),Ge(qC,5),Ge(PC,5),Ge(fPA,5),Ge(mPA,5),Ge(pPA,5)),A&2){let n;$A(n=Ae())&&(i.videoContainer=n.first),$A(n=Ae())&&(i.sideDrawer=n.first),$A(n=Ae())&&(i.eventTabComponent=n.first),$A(n=Ae())&&(i.sessionTab=n.first),$A(n=Ae())&&(i.evalTab=n.first),$A(n=Ae())&&(i.scrollContainer=n.first),$A(n=Ae())&&(i.textarea=n.first),$A(n=Ae())&&(i.bottomPanelRef=n.first)}},standalone:!1,features:[ct([{provide:TI,useClass:$G}])],decls:28,vars:15,consts:[["sideDrawer",""],["autoScroll",""],["videoContainer",""],["messageTextarea",""],["fileInput",""],["bottomPanel",""],["autosize","",1,"drawer-container"],["matTooltip","Open panel",1,"material-symbols-outlined",2,"position","absolute","width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-left","20px","margin-top","20px","z-index","9999"],["mode","side","appResizableDrawer","",1,"side-drawer"],[2,"margin-top","20px","margin-left","20px","display","flex"],[2,"width","100%"],[1,"drawer-header"],[1,"drawer-logo"],["src","assets/ADK-512-color.svg","width","32px","height","32px"],["matTooltip","Collapse panel",1,"material-symbols-outlined",2,"color","#c4c7c5","cursor","pointer","margin-right","15px",3,"click"],[1,"app-select-container"],[1,"app-select",3,"selectionChange","placeholder","formControl"],[1,"app-name-option",3,"value"],[1,"tabs-container"],[1,"details-panel-container"],[1,"resize-handler"],[1,"chat-container"],[1,"chat-toolbar",3,"ngClass"],[1,"chat-card"],["mat-fab","","color","primary",1,"fab-button"],[1,"chat-messages"],[1,"chat-input"],["appResizableBottomPanel","",1,"trace-detail-container"],["matTooltip","Open panel",1,"material-symbols-outlined",2,"position","absolute","width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-left","20px","margin-top","20px","z-index","9999",3,"click"],[3,"selectedTabChange"],[1,"tabs-header"],["mat-tab-label",""],[3,"traceData"],[3,"selectedEvent","eventsMap","traceData"],[3,"sessionState"],[3,"artifacts"],[3,"sessionSelected","sessionReloaded","userId","appName","sessionId"],[1,"tab-label"],[3,"shouldShowTab","sessionSelected","evalCaseSelected","evalSetIdSelected","shouldReturnToSession","evalNotInstalledMsg","appName","userId","sessionId"],[1,"details-content"],[2,"display","flex","justify-content","flex-end","margin-top","10px"],["aria-label","Select event",1,"event-paginator",3,"page","length","pageSize","pageIndex"],["mat-mini-fab",""],[3,"click"],["label","Event"],[1,"event-graph-container"],[3,"innerHtml"],[1,"json-viewer-container"],[3,"json"],["label","Request"],["label","Response"],[3,"click","innerHtml"],["matTooltip","Open panel",1,"material-symbols-outlined",2,"width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-left","20px","margin-top","-2px","z-index","9999"],["matTooltip","Open panel",1,"material-symbols-outlined",2,"width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-left","20px","margin-top","-2px","z-index","9999",3,"click"],[2,"display","flex"],[1,"toolbar-session-text"],[1,"toolbar-session-id"],[1,"toolbar-actions"],["mat-button","",2,"height","30px",3,"click"],["mat-flat-button","",2,"height","30px",3,"click","disabled"],["matTooltip","Edit current eval case",1,"material-symbols-outlined","toolbar-icon",3,"click"],["matTooltip","Delete current eval case",1,"material-symbols-outlined","toolbar-icon",3,"click"],[1,"toolbar-sse-toggle"],[1,"example-margin",3,"change","checked"],[2,"margin-left","8px","margin-right","8px","height","22px",3,"vertical"],[2,"display","flex","align-items","center"],[1,"toolbar-new-sesison",3,"click"],["matTooltip","Delete current session",1,"material-symbols-outlined","toolbar-icon",3,"click"],["matTooltip","Export current session",1,"material-symbols-outlined","toolbar-icon",3,"click"],["matTooltip","Import session",1,"material-symbols-outlined","toolbar-icon"],["matTooltip","Import session",1,"material-symbols-outlined","toolbar-icon",3,"click"],[1,"empty-state-container"],[1,"warning"],[1,"error"],["mat-fab","","color","primary",1,"fab-button",3,"click"],[3,"ngClass"],["mat-mini-fab","",3,"matTooltip","class"],[1,"message-card",3,"ngClass","ngStyle"],["mat-stroked-button","",1,"function-event-button",3,"ngClass"],[1,"material-symbols-outlined"],["mat-mini-fab","",3,"click","matTooltip"],["fontSet","material-symbols-outlined"],["mode","buffer",1,"loading-bar"],[1,"attachments"],[1,"thought-chip"],[1,"eval-compare-container"],[1,"attachment"],["alt","attachment",1,"image-preview-chat",3,"src"],["download","",3,"href"],[1,"edit-message-container"],[1,"message-text",3,"data","ngStyle"],["rows","4","cols","80",1,"message-textarea",3,"ngModelChange","keydown","ngModel"],[1,"edit-message-buttons-container"],["matTooltip","Cancel editing",1,"material-symbols-outlined",2,"width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-right","16px",3,"click"],["matTooltip","Save eval case message",1,"material-symbols-outlined",2,"width","24px","height","24px","color","rgb(97, 151, 202)","cursor","pointer","margin-right","16px",3,"click"],[3,"innerHTML"],[1,"generated-image-container"],["alt","image",1,"generated-image",3,"click","src"],[3,"base64data"],[1,"html-artifact-container"],[1,"link-style-button",3,"click"],["alt","image",1,"image-preview-chat",3,"click","src"],[1,"actual-expected-compare-container"],[1,"score-threshold-container"],[1,"actual-result"],[1,"eval-response-header","header-actual"],[1,"expected-result"],[1,"eval-response-header","header-expected"],[1,"header-actual"],[1,"header-expected"],["mat-stroked-button","",1,"function-event-button",3,"click","ngClass"],["matTooltip","Edit eval case message",1,"material-symbols-outlined","eval-case-edit-button",3,"click","ngClass"],["matTooltip","Delete eval case message",1,"material-symbols-outlined","eval-case-edit-button",3,"click","ngClass"],["matTooltip","Edit function arguments",1,"material-symbols-outlined","eval-case-edit-button",3,"click","ngClass"],["type","file","multiple","","hidden","",3,"change"],["appearance","outline",1,"input-field"],[1,"file-preview"],["matInput","","cdkTextareaAutosize","","cdkAutosizeMinRows","1","cdkAutosizeMaxRows","10","placeholder","Type a Message...",1,"chat-input-box",2,"caret-color","white",3,"ngModelChange","keydown.enter","ngModel"],[1,"chat-input-actions"],["mat-icon-button","","matTooltip","Upload local file",1,"function-event-button",3,"click"],["mat-icon-button","","matSuffix","",3,"click","ngStyle","matTooltip"],[1,"image-container"],[1,"file-container"],["alt","preview",1,"image-preview",3,"src"],["mat-icon-button","",1,"delete-button",3,"click"],["color","warn"],[1,"file-info"],[1,"bottom-resize-handler"],[3,"panelClosed","userId","appName","sessionId"]],template:function(A,i){if(A&1){let n=De();S(0,"mat-drawer-container",6),NA(1,kPA,2,0,"span",7),S(2,"mat-drawer",8,0)(4,"div",9)(5,"div",10)(6,"div",11)(7,"div",12),UA(8,"img",13),tA(9," Agent Development Kit "),R(),S(10,"span",14),mA("click",function(){return LA(n),xA(i.toggleSidePanel())}),tA(11,"left_panel_close"),R()()()(),S(12,"div",15)(13,"mat-select",16),mA("selectionChange",function(r){return LA(n),xA(i.onAppSelection(r))}),NA(14,RPA,2,0),Ta(15,"async"),NA(16,LPA,2,2,"mat-option",17),R()(),NA(17,YPA,18,9,"div",18)(18,TPA,20,7,"div",19),UA(19,"div",20),R(),S(20,"div",21),NA(21,VPA,4,5,"div",22),S(22,"mat-card",23),NA(23,tjA,2,1)(24,ijA,3,0,"button",24)(25,UjA,6,0,"div",25)(26,zjA,17,10,"div",26),R(),NA(27,HjA,4,3,"div",27),R()()}if(A&2){let n;_(),FA(!i.showSidePanel&&i.appName===""?1:-1),_(12),vA("placeholder",i.isLoadingApps()?"Loading...":"Select an agent")("formControl",i.selectedAppControl),_(),FA((n=w2(15,13,i.apps$))?14:-1,n),_(2),FA(i.selectedAppControl.value&&i.isLoadingApps()?16:-1),_(),FA(i.appName!=""&&i.showSidePanel?17:-1),_(),FA(i.selectedEvent&&i.showSidePanel?18:-1),_(3),FA(i.appName!=""?21:-1),_(2),FA(i.selectedAppControl.value?-1:23),_(),FA(i.longRunningEvents.length>0?24:-1),_(),FA(i.appName!=""?25:-1),_(),FA(i.appName!=""&&i.isChatMode()?26:-1),_(),FA(i.bottomPanelVisible?27:-1)}},dependencies:[Ha,yQ,fc,na,ja,rcA,T2,lg,gP,P1,JaA,ur,EB,HO,zO,Sk,ZaA,Qh,RG,LG,GG,af,Py,pB,x2,wB,mcA,TcA,Xy,cM,jC,qC,PC,Su,df,zI,Bf,Ef,Qf,uf,bQ],styles:[".expand-side-drawer[_ngcontent-%COMP%]{position:relative;top:4%;left:1%}.drawer-container[_ngcontent-%COMP%]{height:100%;background-color:#131314}.generated-image-container[_ngcontent-%COMP%]{max-width:400px}.generated-image[_ngcontent-%COMP%]{max-width:100%;min-width:40px;border-radius:8px}.chat-container[_ngcontent-%COMP%]{width:100%;height:100%;max-width:100%;margin:auto;display:flex;flex-direction:column;flex:1}.event-container[_ngcontent-%COMP%]{color:#fff}.html-artifact-container[_ngcontent-%COMP%], .drawer-header[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:flex-start;align-items:center}.drawer-header[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{width:36px;height:36px;color:#bdc1c6;cursor:pointer;display:flex;align-items:center;justify-content:center}.chat-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;overflow:hidden;flex:1;min-height:12%;box-shadow:none;background-color:#131314}.loading-bar[_ngcontent-%COMP%]{width:100px;margin:15px}.chat-messages[_ngcontent-%COMP%]{flex-grow:1;overflow-y:auto;padding:20px;margin-top:16px}.message-card[_ngcontent-%COMP%]{padding:5px 20px;margin:5px;border-radius:20px;max-width:80%;font-size:14px;font-weight:400;position:relative;display:inline-block}.function-event-button[_ngcontent-%COMP%]{background-color:#fff;margin:5px 5px 10px}.function-event-button-highlight[_ngcontent-%COMP%]{background-color:#0f5223;border-color:#0f5223!important;color:#fff!important}.user-message[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center}.user-message[_ngcontent-%COMP%] .message-card[_ngcontent-%COMP%]{background-color:#004a77;align-self:flex-end;color:#fff;box-shadow:none}.bot-message[_ngcontent-%COMP%]{display:flex;align-items:center}.bot-message[_ngcontent-%COMP%] .message-card[_ngcontent-%COMP%]{background-color:#303030;align-self:flex-start;color:#fff;box-shadow:none}.bot-message[_ngcontent-%COMP%]:focus-within .message-card[_ngcontent-%COMP%]{background-color:#131314;border:1px solid #8ab4f8}.message-textarea[_ngcontent-%COMP%]{background-color:#303030;max-width:100%;border:none;font-family:Google Sans,Helvetica Neue,sans-serif}.message-textarea[_ngcontent-%COMP%]:focus{background-color:#131314;outline:none}.edit-message-buttons-container[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.message-card[_ngcontent-%COMP%] .eval-compare-container[_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:10px;z-index:10;background-color:#484848;overflow:hidden;border-radius:20px;padding:5px 20px;margin-bottom:10px;font-size:16px}.message-card[_ngcontent-%COMP%] .eval-compare-container[_ngcontent-%COMP%] .actual-result[_ngcontent-%COMP%]{border-right:2px solid #8a8686;padding-right:8px;min-width:350px;max-width:350px}.message-card[_ngcontent-%COMP%] .eval-compare-container[_ngcontent-%COMP%] .expected-result[_ngcontent-%COMP%]{padding-left:12px;min-width:350px;max-width:350px}.message-card[_ngcontent-%COMP%]:hover .eval-compare-container[_ngcontent-%COMP%]{visibility:visible}.actual-expected-compare-container[_ngcontent-%COMP%]{display:flex}.score-threshold-container[_ngcontent-%COMP%]{display:flex;justify-content:center;gap:10px;align-items:center;margin-top:15px;font-size:14px;font-weight:600}.eval-response-header[_ngcontent-%COMP%]{padding-bottom:5px;border-bottom:2px solid #8a8686;font-style:italic;font-weight:700}.header-expected[_ngcontent-%COMP%]{color:#44c265}.header-actual[_ngcontent-%COMP%]{color:#ff8983}.eval-case-edit-button[_ngcontent-%COMP%]{cursor:pointer;margin-left:4px;margin-right:4px}.eval-pass[_ngcontent-%COMP%]{display:flex;color:#44c265}.eval-fail[_ngcontent-%COMP%]{display:flex;color:#ff8983}.navigation-button-sidepanel[_ngcontent-%COMP%]{margin-left:auto;margin-right:20px}.chat-input[_ngcontent-%COMP%]{display:flex;padding:10px;width:60%;margin:0 auto}.hidden[_ngcontent-%COMP%]{visibility:hidden}.input-field[_ngcontent-%COMP%]{flex-grow:1}.input-field[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{color:#fff;border:none;padding:10px;box-sizing:content-box}.input-field[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]::placeholder{color:#8e918f}.input-field[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:#fff;background-color:#333537}.chat-input-actions[_ngcontent-%COMP%]{width:106%;margin-top:10px;display:flex;justify-content:space-between}.chat-input-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin-left:10px;margin-right:10px}.fab-button[_ngcontent-%COMP%]{position:fixed;bottom:200px;right:100px;z-index:1000}.sidepanel-toggle[_ngcontent-%COMP%]{position:relative;top:100px;z-index:1000}.side-drawer[_ngcontent-%COMP%]{background-color:#1b1b1b;color:#fff;border-radius:0}.tabs-container[_ngcontent-%COMP%]{width:100%;margin-top:20px}.tab-label[_ngcontent-%COMP%]{font-size:14px}.file-preview[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:5px;margin-top:2px;margin-bottom:8px}.file-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:5px;background:#eee;padding:5px;border-radius:4px}.image-preview[_ngcontent-%COMP%]{width:40px;height:40px;object-fit:cover;border-radius:4px}.image-preview-chat[_ngcontent-%COMP%]{max-width:90%;max-height:70vh;width:auto;height:auto;border-radius:8px;cursor:pointer;transition:transform .2s ease-in-out}button[_ngcontent-%COMP%]{margin-left:20px;margin-right:20px}.app-select[_ngcontent-%COMP%]{width:100%}.empty-state-container[_ngcontent-%COMP%]{color:#eee;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;font-family:Google Sans,sans-serif;font-weight:400;letter-spacing:normal;line-height:24px;font-size:18px}.empty-state-container[_ngcontent-%COMP%] pre.warning[_ngcontent-%COMP%]{color:#ffc185}.empty-state-container[_ngcontent-%COMP%] pre.error[_ngcontent-%COMP%]{color:#ff4545}[_nghost-%COMP%] .mat-mdc-unelevated-button:not(:disabled){color:#202124;background-color:#8ab4f8}[_nghost-%COMP%] .message-text p{white-space:pre-line;word-break:break-word;overflow-wrap:break-word}[_nghost-%COMP%] .mdc-linear-progress__buffer-dots{background:#fff}[_nghost-%COMP%] .mat-mdc-select-arrow-wrapper{margin-left:4px}[_nghost-%COMP%] .mat-mdc-text-field-wrapper{border:1px solid #8e918f}[_nghost-%COMP%] .input-field .mat-mdc-text-field-wrapper{border:1px solid #8e918f;border-radius:16px}[_nghost-%COMP%] .mdc-notched-outline__leading, [_nghost-%COMP%] .mdc-notched-outline__notch, [_nghost-%COMP%] .mdc-notched-outline__trailing{border:none}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{padding:0 10px 0 40px}[_nghost-%COMP%] .segment-key{color:#d3d3d3!important}[_nghost-%COMP%] .mat-mdc-mini-fab{background-color:#fff}[_nghost-%COMP%] .mat-mdc-mini-fab mat-icon{color:#000}.mat-mdc-select-placeholder[_ngcontent-%COMP%]{margin-left:20px}.resize-handler[_ngcontent-%COMP%]{background:#5f6368;width:4px;border-radius:4px;position:absolute;display:block;height:20%;top:40%;right:0;z-index:9999;cursor:ew-resize}.bottom-resize-handler[_ngcontent-%COMP%]{background:#5f6368;height:5px;border-radius:4px;position:absolute;display:block;width:20%;left:40%;top:0;right:0;z-index:9999;cursor:ns-resize}.trace-detail-container[_ngcontent-%COMP%]{position:relative;background-color:#1b1b1b}.trace-detail-container[_ngcontent-%COMP%] app-trace-event[_ngcontent-%COMP%]{padding-top:8px}.new-session-button[_ngcontent-%COMP%]{margin-top:0;margin-left:50px;width:130px;height:28px;font-size:14px}.app-select-container[_ngcontent-%COMP%]{width:30%;margin-top:12px;background-color:#212123;margin-left:20px;height:30px;display:flex;justify-content:space-between;padding-left:20px;padding-right:20px;border-radius:10px;padding-top:5px}.app-select-container[_ngcontent-%COMP%]{--mat-select-placeholder-text-color: #8ab4f8}.app-select-container[_ngcontent-%COMP%]{--mat-select-enabled-trigger-text-color: #8ab4f8}.app-select-container[_ngcontent-%COMP%]{--mat-select-enabled-arrow-color: #8ab4f8}.json-viewer-container[_ngcontent-%COMP%]{margin:10px}.event-paginator[_ngcontent-%COMP%]{margin-top:-8px;margin-right:auto;background-color:inherit;display:flex;justify-content:center}[_nghost-%COMP%] .mat-mdc-paginator-page-size{display:none!important}.details-panel-container[_ngcontent-%COMP%]{position:absolute;width:100%;height:98%;left:0;right:0;bottom:0;background:#242424;display:inline-block;justify-content:center;align-items:center;z-index:10}.details-content[_ngcontent-%COMP%]{color:#fff;font-size:14px}.adk-checkbox[_ngcontent-%COMP%]{position:fixed;bottom:0;left:0;right:0;margin-bottom:20px;margin-left:20px}.drawer-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.drawer-header[_ngcontent-%COMP%]{--mdc-filled-button-container-color: #89b4f8}.drawer-header[_ngcontent-%COMP%]{--mdc-filled-button-label-text-color: black}.chat-toolbar[_ngcontent-%COMP%]{position:sticky;top:0;height:48px;background:#1b1b1b;display:flex;align-items:center;z-index:10}.chat-toolbar.edit-mode[_ngcontent-%COMP%]{background:#44c2651a}.attachment[_ngcontent-%COMP%]{display:flex;align-items:center}.toolbar-actions[_ngcontent-%COMP%]{margin-left:auto;display:flex;align-items:center}.toolbar-session-text[_ngcontent-%COMP%]{color:#fdfdfd;font-family:Roboto;font-size:12px;font-style:normal;font-weight:500;line-height:12px;letter-spacing:.8px;text-transform:uppercase;margin-left:20px;padding-top:4px}.toolbar-session-id[_ngcontent-%COMP%]{color:#9aa0a6;font-family:Google Sans Mono,monospace;font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:.25px;margin-left:5px}.toolbar-icon[_ngcontent-%COMP%]{width:24px;height:24px;color:#c4c7c5;cursor:pointer;margin-right:16px}.toolbar-new-sesison[_ngcontent-%COMP%]{font-size:14px;margin-right:16px;color:#9aa0a6;cursor:pointer;display:flex;align-items:center}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mat-switch-label-text-size: 14px}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mat-switch-label-text-color: #9aa0a6}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-track-color: #8ab4f9}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-focus-track-color: #8ab4f9}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-hover-track-color: #8ab4f9}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-handle-color: #1b73e8}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-focus-handle-color: #1b73e8}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-hover-handle-color: #1b73e8}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-track-height: 24px}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-track-width: 46px}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mat-switch-track-outline-color: #1b73e8}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mat-switch-with-icon-handle-size: 20px}.image-container[_ngcontent-%COMP%]{position:relative;display:inline-block;border-radius:12px;overflow:hidden}.image-preview[_ngcontent-%COMP%]{display:block;width:100%;height:auto;border-radius:12px;width:80px;height:80px}.delete-button[_ngcontent-%COMP%]{position:absolute;top:1px;right:1px;background-color:#000000b3;border:none;border-radius:50%;padding:8px;cursor:pointer;color:#fff;display:flex;align-items:center;justify-content:center;margin-right:0;scale:.7}.delete-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px}.file-container[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;gap:8px;height:80px;background-color:#1e1e1e;border-radius:12px}.file-info[_ngcontent-%COMP%]{margin-right:60px;padding-top:20px;padding-left:16px}.thought-chip[_ngcontent-%COMP%]{border-radius:5px;background-color:#8ab4f8;width:80px;text-align:center;margin-top:5px}.event-graph-container[_ngcontent-%COMP%]{margin-top:16px;margin-bottom:16px;display:flex;justify-content:center;max-height:33%;cursor:pointer}.event-graph-container[_ngcontent-%COMP%] svg{width:100%;height:100%;display:block;object-fit:contain}.event-graph-container[_ngcontent-%COMP%] svg text{font-family:Google Sans Mono,monospace;font-size:11px}[_nghost-%COMP%] pre{white-space:pre-wrap;word-break:break-word;overflow-x:auto;max-width:100%}.link-style-button[_ngcontent-%COMP%]{background:none;border:none;padding:0;font:inherit;color:#007bff!important;text-decoration:underline;cursor:pointer;outline:none;font-size:14px}.drawer-logo[_ngcontent-%COMP%]{margin-left:9px;display:flex;align-items:center;font-size:16px;font-style:normal;font-weight:500;line-height:24px;letter-spacing:.1px}.drawer-logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{margin-right:9px} .mat-drawer-content{display:flex!important} .mat-drawer{border-right:1px solid #444746!important}.app-name-option[_ngcontent-%COMP%], .app-select[_ngcontent-%COMP%]{color:#9aa0a6;font-family:Google Sans Mono,monospace;font-style:normal;font-weight:400}"],changeDetection:0})};var mh=class t{title="agent_framework_web";userId="";appName="";sessionId="";constructor(){}static \u0275fac=function(A){return new(A||t)};static \u0275cmp=YA({type:t,selectors:[["app-root"]],standalone:!1,decls:1,vars:0,template:function(A,i){A&1&&UA(0,"app-chat")},dependencies:[ff],encapsulation:2})};var jjA=[{path:"",component:mh}],$y=class t{static \u0275fac=function(A){return new(A||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[R6.forRoot(jjA),R6]})};function ilA(t){return new ZA(3e3,!1)}function qjA(){return new ZA(3100,!1)}function VjA(){return new ZA(3101,!1)}function ZjA(t){return new ZA(3001,!1)}function WjA(t){return new ZA(3003,!1)}function XjA(t){return new ZA(3004,!1)}function olA(t,e){return new ZA(3005,!1)}function rlA(){return new ZA(3006,!1)}function slA(){return new ZA(3007,!1)}function alA(t,e){return new ZA(3008,!1)}function clA(t){return new ZA(3002,!1)}function llA(t,e,A,i,n){return new ZA(3010,!1)}function glA(){return new ZA(3011,!1)}function IlA(){return new ZA(3012,!1)}function ClA(){return new ZA(3200,!1)}function dlA(){return new ZA(3202,!1)}function BlA(){return new ZA(3013,!1)}function ElA(t){return new ZA(3014,!1)}function hlA(t){return new ZA(3015,!1)}function QlA(t){return new ZA(3016,!1)}function ulA(t,e){return new ZA(3404,!1)}function $jA(t){return new ZA(3502,!1)}function flA(t){return new ZA(3503,!1)}function mlA(){return new ZA(3300,!1)}function plA(t){return new ZA(3504,!1)}function wlA(t){return new ZA(3301,!1)}function DlA(t,e){return new ZA(3302,!1)}function ylA(t){return new ZA(3303,!1)}function vlA(t,e){return new ZA(3400,!1)}function blA(t){return new ZA(3401,!1)}function MlA(t){return new ZA(3402,!1)}function klA(t,e){return new ZA(3505,!1)}function n2(t){switch(t.length){case 0:return new ag;case 1:return t[0];default:return new JI(t)}}function iU(t,e,A=new Map,i=new Map){let n=[],o=[],r=-1,s=null;if(e.forEach(a=>{let c=a.get("offset"),l=c==r,I=l&&s||new Map;a.forEach((C,d)=>{let B=d,E=C;if(d!=="offset")switch(B=t.normalizePropertyName(B,n),E){case mB:E=A.get(d);break;case pc:E=i.get(d);break;default:E=t.normalizeStyleValue(d,B,E,n);break}I.set(B,E)}),l||o.push(I),s=I,r=c}),n.length)throw $jA(n);return o}function A7(t,e,A,i){switch(e){case"start":t.onStart(()=>i(A&&AU(A,"start",t)));break;case"done":t.onDone(()=>i(A&&AU(A,"done",t)));break;case"destroy":t.onDestroy(()=>i(A&&AU(A,"destroy",t)));break}}function AU(t,e,A){let i=A.totalTime,n=!!A.disabled,o=e7(t.element,t.triggerName,t.fromState,t.toState,e||t.phaseName,i??t.totalTime,n),r=t._data;return r!=null&&(o._data=r),o}function e7(t,e,A,i,n="",o=0,r){return{element:t,triggerName:e,fromState:A,toState:i,phaseName:n,totalTime:o,disabled:!!r}}function Sa(t,e,A){let i=t.get(e);return i||t.set(e,i=A),i}function nU(t){let e=t.indexOf(":"),A=t.substring(1,e),i=t.slice(e+1);return[A,i]}var AqA=typeof document>"u"?null:document.documentElement;function t7(t){let e=t.parentNode||t.host||null;return e===AqA?null:e}function eqA(t){return t.substring(1,6)=="ebkit"}var WC=null,nlA=!1;function SlA(t){WC||(WC=tqA()||{},nlA=WC.style?"WebkitAppearance"in WC.style:!1);let e=!0;return WC.style&&!eqA(t)&&(e=t in WC.style,!e&&nlA&&(e="Webkit"+t.charAt(0).toUpperCase()+t.slice(1)in WC.style)),e}function tqA(){return typeof document<"u"?document.body:null}function oU(t,e){for(;e;){if(e===t)return!0;e=t7(e)}return!1}function rU(t,e,A){if(A)return Array.from(t.querySelectorAll(e));let i=t.querySelector(e);return i?[i]:[]}var iqA=1e3,sU="{{",nqA="}}",aU="ng-enter",i7="ng-leave",mf="ng-trigger",pf=".ng-trigger",cU="ng-animating",n7=".ng-animating";function Pg(t){if(typeof t=="number")return t;let e=t.match(/^(-?[\.\d]+)(m?s)/);return!e||e.length<2?0:eU(parseFloat(e[1]),e[2])}function eU(t,e){switch(e){case"s":return t*iqA;default:return t}}function wf(t,e,A){return t.hasOwnProperty("duration")?t:oqA(t,e,A)}function oqA(t,e,A){let i=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i,n,o=0,r="";if(typeof t=="string"){let s=t.match(i);if(s===null)return e.push(ilA(t)),{duration:0,delay:0,easing:""};n=eU(parseFloat(s[1]),s[2]);let a=s[3];a!=null&&(o=eU(parseFloat(a),s[4]));let c=s[5];c&&(r=c)}else n=t;if(!A){let s=!1,a=e.length;n<0&&(e.push(qjA()),s=!0),o<0&&(e.push(VjA()),s=!0),s&&e.splice(a,0,ilA(t))}return{duration:n,delay:o,easing:r}}function RlA(t){return t.length?t[0]instanceof Map?t:t.map(e=>new Map(Object.entries(e))):[]}function Nl(t,e,A){e.forEach((i,n)=>{let o=o7(n);A&&!A.has(n)&&A.set(n,t.style[o]),t.style[o]=i})}function q1(t,e){e.forEach((A,i)=>{let n=o7(i);t.style[n]=""})}function ph(t){return Array.isArray(t)?t.length==1?t[0]:tP(t):t}function LlA(t,e,A){let i=e.params||{},n=lU(t);n.length&&n.forEach(o=>{i.hasOwnProperty(o)||A.push(ZjA(o))})}var tU=new RegExp(`${sU}\\s*(.+?)\\s*${nqA}`,"g");function lU(t){let e=[];if(typeof t=="string"){let A;for(;A=tU.exec(t);)e.push(A[1]);tU.lastIndex=0}return e}function wh(t,e,A){let i=`${t}`,n=i.replace(tU,(o,r)=>{let s=e[r];return s==null&&(A.push(WjA(r)),s=""),s.toString()});return n==i?t:n}var rqA=/-+([a-z0-9])/g;function o7(t){return t.replace(rqA,(...e)=>e[1].toUpperCase())}function xlA(t,e){return t===0||e===0}function FlA(t,e,A){if(A.size&&e.length){let i=e[0],n=[];if(A.forEach((o,r)=>{i.has(r)||n.push(r),i.set(r,o)}),n.length)for(let o=1;or.set(s,r7(t,s)))}}return e}function Ra(t,e,A){switch(e.type){case Wt.Trigger:return t.visitTrigger(e,A);case Wt.State:return t.visitState(e,A);case Wt.Transition:return t.visitTransition(e,A);case Wt.Sequence:return t.visitSequence(e,A);case Wt.Group:return t.visitGroup(e,A);case Wt.Animate:return t.visitAnimate(e,A);case Wt.Keyframes:return t.visitKeyframes(e,A);case Wt.Style:return t.visitStyle(e,A);case Wt.Reference:return t.visitReference(e,A);case Wt.AnimateChild:return t.visitAnimateChild(e,A);case Wt.AnimateRef:return t.visitAnimateRef(e,A);case Wt.Query:return t.visitQuery(e,A);case Wt.Stagger:return t.visitStagger(e,A);default:throw XjA(e.type)}}function r7(t,e){return window.getComputedStyle(t)[e]}var bU=(()=>{class t{validateStyleProperty(A){return SlA(A)}containsElement(A,i){return oU(A,i)}getParentElement(A){return t7(A)}query(A,i,n){return rU(A,i,n)}computeStyle(A,i,n){return n||""}animate(A,i,n,o,r,s=[],a){return new ag(n,o)}static \u0275fac=function(i){return new(i||t)};static \u0275prov=SA({token:t,factory:t.\u0275fac})}return t})(),$C=class{static NOOP=new bU},Ad=class{};var sqA=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),g7=class extends Ad{normalizePropertyName(e,A){return o7(e)}normalizeStyleValue(e,A,i,n){let o="",r=i.toString().trim();if(sqA.has(A)&&i!==0&&i!=="0")if(typeof i=="number")o="px";else{let s=i.match(/^[+-]?[\d\.]+([a-z]*)$/);s&&s[1].length==0&&n.push(olA(e,i))}return r+o}};var I7="*";function aqA(t,e){let A=[];return typeof t=="string"?t.split(/\s*,\s*/).forEach(i=>cqA(i,A,e)):A.push(t),A}function cqA(t,e,A){if(t[0]==":"){let a=lqA(t,A);if(typeof a=="function"){e.push(a);return}t=a}let i=t.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/);if(i==null||i.length<4)return A.push(hlA(t)),e;let n=i[1],o=i[2],r=i[3];e.push(NlA(n,r));let s=n==I7&&r==I7;o[0]=="<"&&!s&&e.push(NlA(r,n))}function lqA(t,e){switch(t){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(A,i)=>parseFloat(i)>parseFloat(A);case":decrement":return(A,i)=>parseFloat(i) *"}}var s7=new Set(["true","1"]),a7=new Set(["false","0"]);function NlA(t,e){let A=s7.has(t)||a7.has(t),i=s7.has(e)||a7.has(e);return(n,o)=>{let r=t==I7||t==n,s=e==I7||e==o;return!r&&A&&typeof n=="boolean"&&(r=n?s7.has(t):a7.has(t)),!s&&i&&typeof o=="boolean"&&(s=o?s7.has(e):a7.has(e)),r&&s}}var OlA=":self",gqA=new RegExp(`s*${OlA}s*,?`,"g");function PlA(t,e,A,i){return new EU(t).build(e,A,i)}var _lA="",EU=class{_driver;constructor(e){this._driver=e}build(e,A,i){let n=new hU(A);return this._resetContextStyleTimingState(n),Ra(this,ph(e),n)}_resetContextStyleTimingState(e){e.currentQuerySelector=_lA,e.collectedStyles=new Map,e.collectedStyles.set(_lA,new Map),e.currentTime=0}visitTrigger(e,A){let i=A.queryCount=0,n=A.depCount=0,o=[],r=[];return e.name.charAt(0)=="@"&&A.errors.push(rlA()),e.definitions.forEach(s=>{if(this._resetContextStyleTimingState(A),s.type==Wt.State){let a=s,c=a.name;c.toString().split(/\s*,\s*/).forEach(l=>{a.name=l,o.push(this.visitState(a,A))}),a.name=c}else if(s.type==Wt.Transition){let a=this.visitTransition(s,A);i+=a.queryCount,n+=a.depCount,r.push(a)}else A.errors.push(slA())}),{type:Wt.Trigger,name:e.name,states:o,transitions:r,queryCount:i,depCount:n,options:null}}visitState(e,A){let i=this.visitStyle(e.styles,A),n=e.options&&e.options.params||null;if(i.containsDynamicStyles){let o=new Set,r=n||{};i.styles.forEach(s=>{s instanceof Map&&s.forEach(a=>{lU(a).forEach(c=>{r.hasOwnProperty(c)||o.add(c)})})}),o.size&&A.errors.push(alA(e.name,[...o.values()]))}return{type:Wt.State,name:e.name,style:i,options:n?{params:n}:null}}visitTransition(e,A){A.queryCount=0,A.depCount=0;let i=Ra(this,ph(e.animation),A),n=aqA(e.expr,A.errors);return{type:Wt.Transition,matchers:n,animation:i,queryCount:A.queryCount,depCount:A.depCount,options:XC(e.options)}}visitSequence(e,A){return{type:Wt.Sequence,steps:e.steps.map(i=>Ra(this,i,A)),options:XC(e.options)}}visitGroup(e,A){let i=A.currentTime,n=0,o=e.steps.map(r=>{A.currentTime=i;let s=Ra(this,r,A);return n=Math.max(n,A.currentTime),s});return A.currentTime=n,{type:Wt.Group,steps:o,options:XC(e.options)}}visitAnimate(e,A){let i=BqA(e.timings,A.errors);A.currentAnimateTimings=i;let n,o=e.styles?e.styles:ar({});if(o.type==Wt.Keyframes)n=this.visitKeyframes(o,A);else{let r=e.styles,s=!1;if(!r){s=!0;let c={};i.easing&&(c.easing=i.easing),r=ar(c)}A.currentTime+=i.duration+i.delay;let a=this.visitStyle(r,A);a.isEmptyStep=s,n=a}return A.currentAnimateTimings=null,{type:Wt.Animate,timings:i,style:n,options:null}}visitStyle(e,A){let i=this._makeStyleAst(e,A);return this._validateStyleAst(i,A),i}_makeStyleAst(e,A){let i=[],n=Array.isArray(e.styles)?e.styles:[e.styles];for(let s of n)typeof s=="string"?s===pc?i.push(s):A.errors.push(clA(s)):i.push(new Map(Object.entries(s)));let o=!1,r=null;return i.forEach(s=>{if(s instanceof Map&&(s.has("easing")&&(r=s.get("easing"),s.delete("easing")),!o)){for(let a of s.values())if(a.toString().indexOf(sU)>=0){o=!0;break}}}),{type:Wt.Style,styles:i,easing:r,offset:e.offset,containsDynamicStyles:o,options:null}}_validateStyleAst(e,A){let i=A.currentAnimateTimings,n=A.currentTime,o=A.currentTime;i&&o>0&&(o-=i.duration+i.delay),e.styles.forEach(r=>{typeof r!="string"&&r.forEach((s,a)=>{let c=A.collectedStyles.get(A.currentQuerySelector),l=c.get(a),I=!0;l&&(o!=n&&o>=l.startTime&&n<=l.endTime&&(A.errors.push(llA(a,l.startTime,l.endTime,o,n)),I=!1),o=l.startTime),I&&c.set(a,{startTime:o,endTime:n}),A.options&&LlA(s,A.options,A.errors)})})}visitKeyframes(e,A){let i={type:Wt.Keyframes,styles:[],options:null};if(!A.currentAnimateTimings)return A.errors.push(glA()),i;let n=1,o=0,r=[],s=!1,a=!1,c=0,l=e.steps.map(u=>{let v=this._makeStyleAst(u,A),L=v.offset!=null?v.offset:dqA(v.styles),x=0;return L!=null&&(o++,x=v.offset=L),a=a||x<0||x>1,s=s||x0&&o{let L=C>0?v==d?1:C*v:r[v],x=L*Q;A.currentTime=B+E.delay+x,E.duration=x,this._validateStyleAst(u,A),u.offset=L,i.styles.push(u)}),i}visitReference(e,A){return{type:Wt.Reference,animation:Ra(this,ph(e.animation),A),options:XC(e.options)}}visitAnimateChild(e,A){return A.depCount++,{type:Wt.AnimateChild,options:XC(e.options)}}visitAnimateRef(e,A){return{type:Wt.AnimateRef,animation:this.visitReference(e.animation,A),options:XC(e.options)}}visitQuery(e,A){let i=A.currentQuerySelector,n=e.options||{};A.queryCount++,A.currentQuery=e;let[o,r]=IqA(e.selector);A.currentQuerySelector=i.length?i+" "+o:o,Sa(A.collectedStyles,A.currentQuerySelector,new Map);let s=Ra(this,ph(e.animation),A);return A.currentQuery=null,A.currentQuerySelector=i,{type:Wt.Query,selector:o,limit:n.limit||0,optional:!!n.optional,includeSelf:r,animation:s,originalSelector:e.selector,options:XC(e.options)}}visitStagger(e,A){A.currentQuery||A.errors.push(BlA());let i=e.timings==="full"?{duration:0,delay:0,easing:"full"}:wf(e.timings,A.errors,!0);return{type:Wt.Stagger,animation:Ra(this,ph(e.animation),A),timings:i,options:null}}};function IqA(t){let e=!!t.split(/\s*,\s*/).find(A=>A==OlA);return e&&(t=t.replace(gqA,"")),t=t.replace(/@\*/g,pf).replace(/@\w+/g,A=>pf+"-"+A.slice(1)).replace(/:animating/g,n7),[t,e]}function CqA(t){return t?nA({},t):null}var hU=class{errors;queryCount=0;depCount=0;currentTransition=null;currentQuery=null;currentQuerySelector=null;currentAnimateTimings=null;currentTime=0;collectedStyles=new Map;options=null;unsupportedCSSPropertiesFound=new Set;constructor(e){this.errors=e}};function dqA(t){if(typeof t=="string")return null;let e=null;if(Array.isArray(t))t.forEach(A=>{if(A instanceof Map&&A.has("offset")){let i=A;e=parseFloat(i.get("offset")),i.delete("offset")}});else if(t instanceof Map&&t.has("offset")){let A=t;e=parseFloat(A.get("offset")),A.delete("offset")}return e}function BqA(t,e){if(t.hasOwnProperty("duration"))return t;if(typeof t=="number"){let o=wf(t,e).duration;return gU(o,0,"")}let A=t;if(A.split(/\s+/).some(o=>o.charAt(0)=="{"&&o.charAt(1)=="{")){let o=gU(0,0,"");return o.dynamic=!0,o.strValue=A,o}let n=wf(A,e);return gU(n.duration,n.delay,n.easing)}function XC(t){return t?(t=nA({},t),t.params&&(t.params=CqA(t.params))):t={},t}function gU(t,e,A){return{duration:t,delay:e,easing:A}}function MU(t,e,A,i,n,o,r=null,s=!1){return{type:1,element:t,keyframes:e,preStyleProps:A,postStyleProps:i,duration:n,delay:o,totalTime:n+o,easing:r,subTimeline:s}}var yf=class{_map=new Map;get(e){return this._map.get(e)||[]}append(e,A){let i=this._map.get(e);i||this._map.set(e,i=[]),i.push(...A)}has(e){return this._map.has(e)}clear(){this._map.clear()}},EqA=1,hqA=":enter",QqA=new RegExp(hqA,"g"),uqA=":leave",fqA=new RegExp(uqA,"g");function jlA(t,e,A,i,n,o=new Map,r=new Map,s,a,c=[]){return new QU().buildKeyframes(t,e,A,i,n,o,r,s,a,c)}var QU=class{buildKeyframes(e,A,i,n,o,r,s,a,c,l=[]){c=c||new yf;let I=new uU(e,A,c,n,o,l,[]);I.options=a;let C=a.delay?Pg(a.delay):0;I.currentTimeline.delayNextStep(C),I.currentTimeline.setStyles([r],null,I.errors,a),Ra(this,i,I);let d=I.timelines.filter(B=>B.containsAnimation());if(d.length&&s.size){let B;for(let E=d.length-1;E>=0;E--){let Q=d[E];if(Q.element===A){B=Q;break}}B&&!B.allowOnlyTimelineStyles()&&B.setStyles([s],null,I.errors,a)}return d.length?d.map(B=>B.buildKeyframes()):[MU(A,[],[],[],0,C,"",!1)]}visitTrigger(e,A){}visitState(e,A){}visitTransition(e,A){}visitAnimateChild(e,A){let i=A.subInstructions.get(A.element);if(i){let n=A.createSubContext(e.options),o=A.currentTimeline.currentTime,r=this._visitSubInstructions(i,n,n.options);o!=r&&A.transformIntoNewTimeline(r)}A.previousNode=e}visitAnimateRef(e,A){let i=A.createSubContext(e.options);i.transformIntoNewTimeline(),this._applyAnimationRefDelays([e.options,e.animation.options],A,i),this.visitReference(e.animation,i),A.transformIntoNewTimeline(i.currentTimeline.currentTime),A.previousNode=e}_applyAnimationRefDelays(e,A,i){for(let n of e){let o=n?.delay;if(o){let r=typeof o=="number"?o:Pg(wh(o,n?.params??{},A.errors));i.delayNextStep(r)}}}_visitSubInstructions(e,A,i){let o=A.currentTimeline.currentTime,r=i.duration!=null?Pg(i.duration):null,s=i.delay!=null?Pg(i.delay):null;return r!==0&&e.forEach(a=>{let c=A.appendInstructionToTimeline(a,r,s);o=Math.max(o,c.duration+c.delay)}),o}visitReference(e,A){A.updateOptions(e.options,!0),Ra(this,e.animation,A),A.previousNode=e}visitSequence(e,A){let i=A.subContextCount,n=A,o=e.options;if(o&&(o.params||o.delay)&&(n=A.createSubContext(o),n.transformIntoNewTimeline(),o.delay!=null)){n.previousNode.type==Wt.Style&&(n.currentTimeline.snapshotCurrentStyles(),n.previousNode=C7);let r=Pg(o.delay);n.delayNextStep(r)}e.steps.length&&(e.steps.forEach(r=>Ra(this,r,n)),n.currentTimeline.applyStylesToKeyframe(),n.subContextCount>i&&n.transformIntoNewTimeline()),A.previousNode=e}visitGroup(e,A){let i=[],n=A.currentTimeline.currentTime,o=e.options&&e.options.delay?Pg(e.options.delay):0;e.steps.forEach(r=>{let s=A.createSubContext(e.options);o&&s.delayNextStep(o),Ra(this,r,s),n=Math.max(n,s.currentTimeline.currentTime),i.push(s.currentTimeline)}),i.forEach(r=>A.currentTimeline.mergeTimelineCollectedStyles(r)),A.transformIntoNewTimeline(n),A.previousNode=e}_visitTiming(e,A){if(e.dynamic){let i=e.strValue,n=A.params?wh(i,A.params,A.errors):i;return wf(n,A.errors)}else return{duration:e.duration,delay:e.delay,easing:e.easing}}visitAnimate(e,A){let i=A.currentAnimateTimings=this._visitTiming(e.timings,A),n=A.currentTimeline;i.delay&&(A.incrementTime(i.delay),n.snapshotCurrentStyles());let o=e.style;o.type==Wt.Keyframes?this.visitKeyframes(o,A):(A.incrementTime(i.duration),this.visitStyle(o,A),n.applyStylesToKeyframe()),A.currentAnimateTimings=null,A.previousNode=e}visitStyle(e,A){let i=A.currentTimeline,n=A.currentAnimateTimings;!n&&i.hasCurrentStyleProperties()&&i.forwardFrame();let o=n&&n.easing||e.easing;e.isEmptyStep?i.applyEmptyStep(o):i.setStyles(e.styles,o,A.errors,A.options),A.previousNode=e}visitKeyframes(e,A){let i=A.currentAnimateTimings,n=A.currentTimeline.duration,o=i.duration,s=A.createSubContext().currentTimeline;s.easing=i.easing,e.styles.forEach(a=>{let c=a.offset||0;s.forwardTime(c*o),s.setStyles(a.styles,a.easing,A.errors,A.options),s.applyStylesToKeyframe()}),A.currentTimeline.mergeTimelineCollectedStyles(s),A.transformIntoNewTimeline(n+o),A.previousNode=e}visitQuery(e,A){let i=A.currentTimeline.currentTime,n=e.options||{},o=n.delay?Pg(n.delay):0;o&&(A.previousNode.type===Wt.Style||i==0&&A.currentTimeline.hasCurrentStyleProperties())&&(A.currentTimeline.snapshotCurrentStyles(),A.previousNode=C7);let r=i,s=A.invokeQuery(e.selector,e.originalSelector,e.limit,e.includeSelf,!!n.optional,A.errors);A.currentQueryTotal=s.length;let a=null;s.forEach((c,l)=>{A.currentQueryIndex=l;let I=A.createSubContext(e.options,c);o&&I.delayNextStep(o),c===A.element&&(a=I.currentTimeline),Ra(this,e.animation,I),I.currentTimeline.applyStylesToKeyframe();let C=I.currentTimeline.currentTime;r=Math.max(r,C)}),A.currentQueryIndex=0,A.currentQueryTotal=0,A.transformIntoNewTimeline(r),a&&(A.currentTimeline.mergeTimelineCollectedStyles(a),A.currentTimeline.snapshotCurrentStyles()),A.previousNode=e}visitStagger(e,A){let i=A.parentContext,n=A.currentTimeline,o=e.timings,r=Math.abs(o.duration),s=r*(A.currentQueryTotal-1),a=r*A.currentQueryIndex;switch(o.duration<0?"reverse":o.easing){case"reverse":a=s-a;break;case"full":a=i.currentStaggerTime;break}let l=A.currentTimeline;a&&l.delayNextStep(a);let I=l.currentTime;Ra(this,e.animation,A),A.previousNode=e,i.currentStaggerTime=n.currentTime-I+(n.startTime-i.currentTimeline.startTime)}},C7={},uU=class t{_driver;element;subInstructions;_enterClassName;_leaveClassName;errors;timelines;parentContext=null;currentTimeline;currentAnimateTimings=null;previousNode=C7;subContextCount=0;options={};currentQueryIndex=0;currentQueryTotal=0;currentStaggerTime=0;constructor(e,A,i,n,o,r,s,a){this._driver=e,this.element=A,this.subInstructions=i,this._enterClassName=n,this._leaveClassName=o,this.errors=r,this.timelines=s,this.currentTimeline=a||new d7(this._driver,A,0),s.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(e,A){if(!e)return;let i=e,n=this.options;i.duration!=null&&(n.duration=Pg(i.duration)),i.delay!=null&&(n.delay=Pg(i.delay));let o=i.params;if(o){let r=n.params;r||(r=this.options.params={}),Object.keys(o).forEach(s=>{(!A||!r.hasOwnProperty(s))&&(r[s]=wh(o[s],r,this.errors))})}}_copyOptions(){let e={};if(this.options){let A=this.options.params;if(A){let i=e.params={};Object.keys(A).forEach(n=>{i[n]=A[n]})}}return e}createSubContext(e=null,A,i){let n=A||this.element,o=new t(this._driver,n,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(n,i||0));return o.previousNode=this.previousNode,o.currentAnimateTimings=this.currentAnimateTimings,o.options=this._copyOptions(),o.updateOptions(e),o.currentQueryIndex=this.currentQueryIndex,o.currentQueryTotal=this.currentQueryTotal,o.parentContext=this,this.subContextCount++,o}transformIntoNewTimeline(e){return this.previousNode=C7,this.currentTimeline=this.currentTimeline.fork(this.element,e),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(e,A,i){let n={duration:A??e.duration,delay:this.currentTimeline.currentTime+(i??0)+e.delay,easing:""},o=new fU(this._driver,e.element,e.keyframes,e.preStyleProps,e.postStyleProps,n,e.stretchStartingKeyframe);return this.timelines.push(o),n}incrementTime(e){this.currentTimeline.forwardTime(this.currentTimeline.duration+e)}delayNextStep(e){e>0&&this.currentTimeline.delayNextStep(e)}invokeQuery(e,A,i,n,o,r){let s=[];if(n&&s.push(this.element),e.length>0){e=e.replace(QqA,"."+this._enterClassName),e=e.replace(fqA,"."+this._leaveClassName);let a=i!=1,c=this._driver.query(this.element,e,a);i!==0&&(c=i<0?c.slice(c.length+i,c.length):c.slice(0,i)),s.push(...c)}return!o&&s.length==0&&r.push(ElA(A)),s}},d7=class t{_driver;element;startTime;_elementTimelineStylesLookup;duration=0;easing=null;_previousKeyframe=new Map;_currentKeyframe=new Map;_keyframes=new Map;_styleSummary=new Map;_localTimelineStyles=new Map;_globalTimelineStyles;_pendingStyles=new Map;_backFill=new Map;_currentEmptyStepKeyframe=null;constructor(e,A,i,n){this._driver=e,this.element=A,this.startTime=i,this._elementTimelineStylesLookup=n,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(A),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(A,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(e){let A=this._keyframes.size===1&&this._pendingStyles.size;this.duration||A?(this.forwardTime(this.currentTime+e),A&&this.snapshotCurrentStyles()):this.startTime+=e}fork(e,A){return this.applyStylesToKeyframe(),new t(this._driver,e,A||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=EqA,this._loadKeyframe()}forwardTime(e){this.applyStylesToKeyframe(),this.duration=e,this._loadKeyframe()}_updateStyle(e,A){this._localTimelineStyles.set(e,A),this._globalTimelineStyles.set(e,A),this._styleSummary.set(e,{time:this.currentTime,value:A})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(e){e&&this._previousKeyframe.set("easing",e);for(let[A,i]of this._globalTimelineStyles)this._backFill.set(A,i||pc),this._currentKeyframe.set(A,pc);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(e,A,i,n){A&&this._previousKeyframe.set("easing",A);let o=n&&n.params||{},r=mqA(e,this._globalTimelineStyles);for(let[s,a]of r){let c=wh(a,o,i);this._pendingStyles.set(s,c),this._localTimelineStyles.has(s)||this._backFill.set(s,this._globalTimelineStyles.get(s)??pc),this._updateStyle(s,c)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((e,A)=>{this._currentKeyframe.set(A,e)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((e,A)=>{this._currentKeyframe.has(A)||this._currentKeyframe.set(A,e)}))}snapshotCurrentStyles(){for(let[e,A]of this._localTimelineStyles)this._pendingStyles.set(e,A),this._updateStyle(e,A)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let e=[];for(let A in this._currentKeyframe)e.push(A);return e}mergeTimelineCollectedStyles(e){e._styleSummary.forEach((A,i)=>{let n=this._styleSummary.get(i);(!n||A.time>n.time)&&this._updateStyle(i,A.value)})}buildKeyframes(){this.applyStylesToKeyframe();let e=new Set,A=new Set,i=this._keyframes.size===1&&this.duration===0,n=[];this._keyframes.forEach((s,a)=>{let c=new Map([...this._backFill,...s]);c.forEach((l,I)=>{l===mB?e.add(I):l===pc&&A.add(I)}),i||c.set("offset",a/this.duration),n.push(c)});let o=[...e.values()],r=[...A.values()];if(i){let s=n[0],a=new Map(s);s.set("offset",0),a.set("offset",1),n=[s,a]}return MU(this.element,n,o,r,this.duration,this.startTime,this.easing,!1)}},fU=class extends d7{keyframes;preStyleProps;postStyleProps;_stretchStartingKeyframe;timings;constructor(e,A,i,n,o,r,s=!1){super(e,A,r.delay),this.keyframes=i,this.preStyleProps=n,this.postStyleProps=o,this._stretchStartingKeyframe=s,this.timings={duration:r.duration,delay:r.delay,easing:r.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let e=this.keyframes,{delay:A,duration:i,easing:n}=this.timings;if(this._stretchStartingKeyframe&&A){let o=[],r=i+A,s=A/r,a=new Map(e[0]);a.set("offset",0),o.push(a);let c=new Map(e[0]);c.set("offset",GlA(s)),o.push(c);let l=e.length-1;for(let I=1;I<=l;I++){let C=new Map(e[I]),d=C.get("offset"),B=A+d*i;C.set("offset",GlA(B/r)),o.push(C)}i=r,A=0,n="",e=o}return MU(this.element,e,this.preStyleProps,this.postStyleProps,i,A,n,!0)}};function GlA(t,e=3){let A=Math.pow(10,e-1);return Math.round(t*A)/A}function mqA(t,e){let A=new Map,i;return t.forEach(n=>{if(n==="*"){i??=e.keys();for(let o of i)A.set(o,pc)}else for(let[o,r]of n)A.set(o,r)}),A}function UlA(t,e,A,i,n,o,r,s,a,c,l,I,C){return{type:0,element:t,triggerName:e,isRemovalTransition:n,fromState:A,fromStyles:o,toState:i,toStyles:r,timelines:s,queriedElements:a,preStyleProps:c,postStyleProps:l,totalTime:I,errors:C}}var IU={},B7=class{_triggerName;ast;_stateStyles;constructor(e,A,i){this._triggerName=e,this.ast=A,this._stateStyles=i}match(e,A,i,n){return pqA(this.ast.matchers,e,A,i,n)}buildStyles(e,A,i){let n=this._stateStyles.get("*");return e!==void 0&&(n=this._stateStyles.get(e?.toString())||n),n?n.buildStyles(A,i):new Map}build(e,A,i,n,o,r,s,a,c,l){let I=[],C=this.ast.options&&this.ast.options.params||IU,d=s&&s.params||IU,B=this.buildStyles(i,d,I),E=a&&a.params||IU,Q=this.buildStyles(n,E,I),u=new Set,v=new Map,L=new Map,x=n==="void",y={params:qlA(E,C),delay:this.ast.options?.delay},F=l?[]:jlA(e,A,this.ast.animation,o,r,B,Q,y,c,I),U=0;return F.forEach(T=>{U=Math.max(T.duration+T.delay,U)}),I.length?UlA(A,this._triggerName,i,n,x,B,Q,[],[],v,L,U,I):(F.forEach(T=>{let N=T.element,K=Sa(v,N,new Set);T.preStyleProps.forEach(j=>K.add(j));let H=Sa(L,N,new Set);T.postStyleProps.forEach(j=>H.add(j)),N!==A&&u.add(N)}),UlA(A,this._triggerName,i,n,x,B,Q,F,[...u.values()],v,L,U))}};function pqA(t,e,A,i,n){return t.some(o=>o(e,A,i,n))}function qlA(t,e){let A=nA({},e);return Object.entries(t).forEach(([i,n])=>{n!=null&&(A[i]=n)}),A}var mU=class{styles;defaultParams;normalizer;constructor(e,A,i){this.styles=e,this.defaultParams=A,this.normalizer=i}buildStyles(e,A){let i=new Map,n=qlA(e,this.defaultParams);return this.styles.styles.forEach(o=>{typeof o!="string"&&o.forEach((r,s)=>{r&&(r=wh(r,n,A));let a=this.normalizer.normalizePropertyName(s,A);r=this.normalizer.normalizeStyleValue(s,a,r,A),i.set(s,r)})}),i}};function wqA(t,e,A){return new pU(t,e,A)}var pU=class{name;ast;_normalizer;transitionFactories=[];fallbackTransition;states=new Map;constructor(e,A,i){this.name=e,this.ast=A,this._normalizer=i,A.states.forEach(n=>{let o=n.options&&n.options.params||{};this.states.set(n.name,new mU(n.style,o,i))}),KlA(this.states,"true","1"),KlA(this.states,"false","0"),A.transitions.forEach(n=>{this.transitionFactories.push(new B7(e,n,this.states))}),this.fallbackTransition=DqA(e,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(e,A,i,n){return this.transitionFactories.find(r=>r.match(e,A,i,n))||null}matchStyles(e,A,i){return this.fallbackTransition.buildStyles(e,A,i)}};function DqA(t,e,A){let i=[(r,s)=>!0],n={type:Wt.Sequence,steps:[],options:null},o={type:Wt.Transition,animation:n,matchers:i,options:null,queryCount:0,depCount:0};return new B7(t,o,e)}function KlA(t,e,A){t.has(e)?t.has(A)||t.set(A,t.get(e)):t.has(A)&&t.set(e,t.get(A))}var yqA=new yf,wU=class{bodyNode;_driver;_normalizer;_animations=new Map;_playersById=new Map;players=[];constructor(e,A,i){this.bodyNode=e,this._driver=A,this._normalizer=i}register(e,A){let i=[],n=[],o=PlA(this._driver,A,i,n);if(i.length)throw flA(i);this._animations.set(e,o)}_buildPlayer(e,A,i){let n=e.element,o=iU(this._normalizer,e.keyframes,A,i);return this._driver.animate(n,o,e.duration,e.delay,e.easing,[],!0)}create(e,A,i={}){let n=[],o=this._animations.get(e),r,s=new Map;if(o?(r=jlA(this._driver,A,o,aU,i7,new Map,new Map,i,yqA,n),r.forEach(l=>{let I=Sa(s,l.element,new Map);l.postStyleProps.forEach(C=>I.set(C,null))})):(n.push(mlA()),r=[]),n.length)throw plA(n);s.forEach((l,I)=>{l.forEach((C,d)=>{l.set(d,this._driver.computeStyle(I,d,pc))})});let a=r.map(l=>{let I=s.get(l.element);return this._buildPlayer(l,new Map,I)}),c=n2(a);return this._playersById.set(e,c),c.onDestroy(()=>this.destroy(e)),this.players.push(c),c}destroy(e){let A=this._getPlayer(e);A.destroy(),this._playersById.delete(e);let i=this.players.indexOf(A);i>=0&&this.players.splice(i,1)}_getPlayer(e){let A=this._playersById.get(e);if(!A)throw wlA(e);return A}listen(e,A,i,n){let o=e7(A,"","","");return A7(this._getPlayer(e),i,o,n),()=>{}}command(e,A,i,n){if(i=="register"){this.register(e,n[0]);return}if(i=="create"){let r=n[0]||{};this.create(e,A,r);return}let o=this._getPlayer(e);switch(i){case"play":o.play();break;case"pause":o.pause();break;case"reset":o.reset();break;case"restart":o.restart();break;case"finish":o.finish();break;case"init":o.init();break;case"setPosition":o.setPosition(parseFloat(n[0]));break;case"destroy":this.destroy(e);break}}},YlA="ng-animate-queued",vqA=".ng-animate-queued",CU="ng-animate-disabled",bqA=".ng-animate-disabled",MqA="ng-star-inserted",kqA=".ng-star-inserted",SqA=[],VlA={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},RqA={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},_l="__ng_removed",vf=class{namespaceId;value;options;get params(){return this.options.params}constructor(e,A=""){this.namespaceId=A;let i=e&&e.hasOwnProperty("value"),n=i?e.value:e;if(this.value=xqA(n),i){let o=e,{value:r}=o,s=y7(o,["value"]);this.options=s}else this.options={};this.options.params||(this.options.params={})}absorbOptions(e){let A=e.params;if(A){let i=this.options.params;Object.keys(A).forEach(n=>{i[n]==null&&(i[n]=A[n])})}}},Df="void",dU=new vf(Df),DU=class{id;hostElement;_engine;players=[];_triggers=new Map;_queue=[];_elementListeners=new Map;_hostClassName;constructor(e,A,i){this.id=e,this.hostElement=A,this._engine=i,this._hostClassName="ng-tns-"+e,Hc(A,this._hostClassName)}listen(e,A,i,n){if(!this._triggers.has(A))throw DlA(i,A);if(i==null||i.length==0)throw ylA(A);if(!FqA(i))throw vlA(i,A);let o=Sa(this._elementListeners,e,[]),r={name:A,phase:i,callback:n};o.push(r);let s=Sa(this._engine.statesByElement,e,new Map);return s.has(A)||(Hc(e,mf),Hc(e,mf+"-"+A),s.set(A,dU)),()=>{this._engine.afterFlush(()=>{let a=o.indexOf(r);a>=0&&o.splice(a,1),this._triggers.has(A)||s.delete(A)})}}register(e,A){return this._triggers.has(e)?!1:(this._triggers.set(e,A),!0)}_getTrigger(e){let A=this._triggers.get(e);if(!A)throw blA(e);return A}trigger(e,A,i,n=!0){let o=this._getTrigger(A),r=new bf(this.id,A,e),s=this._engine.statesByElement.get(e);s||(Hc(e,mf),Hc(e,mf+"-"+A),this._engine.statesByElement.set(e,s=new Map));let a=s.get(A),c=new vf(i,this.id);if(!(i&&i.hasOwnProperty("value"))&&a&&c.absorbOptions(a.options),s.set(A,c),a||(a=dU),!(c.value===Df)&&a.value===c.value){if(!GqA(a.params,c.params)){let E=[],Q=o.matchStyles(a.value,a.params,E),u=o.matchStyles(c.value,c.params,E);E.length?this._engine.reportError(E):this._engine.afterFlush(()=>{q1(e,Q),Nl(e,u)})}return}let C=Sa(this._engine.playersByElement,e,[]);C.forEach(E=>{E.namespaceId==this.id&&E.triggerName==A&&E.queued&&E.destroy()});let d=o.matchTransition(a.value,c.value,e,c.params),B=!1;if(!d){if(!n)return;d=o.fallbackTransition,B=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:A,transition:d,fromState:a,toState:c,player:r,isFallbackTransition:B}),B||(Hc(e,YlA),r.onStart(()=>{Dh(e,YlA)})),r.onDone(()=>{let E=this.players.indexOf(r);E>=0&&this.players.splice(E,1);let Q=this._engine.playersByElement.get(e);if(Q){let u=Q.indexOf(r);u>=0&&Q.splice(u,1)}}),this.players.push(r),C.push(r),r}deregister(e){this._triggers.delete(e),this._engine.statesByElement.forEach(A=>A.delete(e)),this._elementListeners.forEach((A,i)=>{this._elementListeners.set(i,A.filter(n=>n.name!=e))})}clearElementCache(e){this._engine.statesByElement.delete(e),this._elementListeners.delete(e);let A=this._engine.playersByElement.get(e);A&&(A.forEach(i=>i.destroy()),this._engine.playersByElement.delete(e))}_signalRemovalForInnerTriggers(e,A){let i=this._engine.driver.query(e,pf,!0);i.forEach(n=>{if(n[_l])return;let o=this._engine.fetchNamespacesByElement(n);o.size?o.forEach(r=>r.triggerLeaveAnimation(n,A,!1,!0)):this.clearElementCache(n)}),this._engine.afterFlushAnimationsDone(()=>i.forEach(n=>this.clearElementCache(n)))}triggerLeaveAnimation(e,A,i,n){let o=this._engine.statesByElement.get(e),r=new Map;if(o){let s=[];if(o.forEach((a,c)=>{if(r.set(c,a.value),this._triggers.has(c)){let l=this.trigger(e,c,Df,n);l&&s.push(l)}}),s.length)return this._engine.markElementAsRemoved(this.id,e,!0,A,r),i&&n2(s).onDone(()=>this._engine.processLeaveNode(e)),!0}return!1}prepareLeaveAnimationListeners(e){let A=this._elementListeners.get(e),i=this._engine.statesByElement.get(e);if(A&&i){let n=new Set;A.forEach(o=>{let r=o.name;if(n.has(r))return;n.add(r);let a=this._triggers.get(r).fallbackTransition,c=i.get(r)||dU,l=new vf(Df),I=new bf(this.id,r,e);this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:r,transition:a,fromState:c,toState:l,player:I,isFallbackTransition:!0})})}}removeNode(e,A){let i=this._engine;if(e.childElementCount&&this._signalRemovalForInnerTriggers(e,A),this.triggerLeaveAnimation(e,A,!0))return;let n=!1;if(i.totalAnimations){let o=i.players.length?i.playersByQueriedElement.get(e):[];if(o&&o.length)n=!0;else{let r=e;for(;r=r.parentNode;)if(i.statesByElement.get(r)){n=!0;break}}}if(this.prepareLeaveAnimationListeners(e),n)i.markElementAsRemoved(this.id,e,!1,A);else{let o=e[_l];(!o||o===VlA)&&(i.afterFlush(()=>this.clearElementCache(e)),i.destroyInnerAnimations(e),i._onRemovalComplete(e,A))}}insertNode(e,A){Hc(e,this._hostClassName)}drainQueuedTransitions(e){let A=[];return this._queue.forEach(i=>{let n=i.player;if(n.destroyed)return;let o=i.element,r=this._elementListeners.get(o);r&&r.forEach(s=>{if(s.name==i.triggerName){let a=e7(o,i.triggerName,i.fromState.value,i.toState.value);a._data=e,A7(i.player,s.phase,a,s.callback)}}),n.markedForDestroy?this._engine.afterFlush(()=>{n.destroy()}):A.push(i)}),this._queue=[],A.sort((i,n)=>{let o=i.transition.ast.depCount,r=n.transition.ast.depCount;return o==0||r==0?o-r:this._engine.driver.containsElement(i.element,n.element)?1:-1})}destroy(e){this.players.forEach(A=>A.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,e)}},yU=class{bodyNode;driver;_normalizer;players=[];newHostElements=new Map;playersByElement=new Map;playersByQueriedElement=new Map;statesByElement=new Map;disabledNodes=new Set;totalAnimations=0;totalQueuedPlayers=0;_namespaceLookup={};_namespaceList=[];_flushFns=[];_whenQuietFns=[];namespacesByHostElement=new Map;collectedEnterElements=[];collectedLeaveElements=[];onRemovalComplete=(e,A)=>{};_onRemovalComplete(e,A){this.onRemovalComplete(e,A)}constructor(e,A,i){this.bodyNode=e,this.driver=A,this._normalizer=i}get queuedPlayers(){let e=[];return this._namespaceList.forEach(A=>{A.players.forEach(i=>{i.queued&&e.push(i)})}),e}createNamespace(e,A){let i=new DU(e,A,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,A)?this._balanceNamespaceList(i,A):(this.newHostElements.set(A,i),this.collectEnterElement(A)),this._namespaceLookup[e]=i}_balanceNamespaceList(e,A){let i=this._namespaceList,n=this.namespacesByHostElement;if(i.length-1>=0){let r=!1,s=this.driver.getParentElement(A);for(;s;){let a=n.get(s);if(a){let c=i.indexOf(a);i.splice(c+1,0,e),r=!0;break}s=this.driver.getParentElement(s)}r||i.unshift(e)}else i.push(e);return n.set(A,e),e}register(e,A){let i=this._namespaceLookup[e];return i||(i=this.createNamespace(e,A)),i}registerTrigger(e,A,i){let n=this._namespaceLookup[e];n&&n.register(A,i)&&this.totalAnimations++}destroy(e,A){e&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let i=this._fetchNamespace(e);this.namespacesByHostElement.delete(i.hostElement);let n=this._namespaceList.indexOf(i);n>=0&&this._namespaceList.splice(n,1),i.destroy(A),delete this._namespaceLookup[e]}))}_fetchNamespace(e){return this._namespaceLookup[e]}fetchNamespacesByElement(e){let A=new Set,i=this.statesByElement.get(e);if(i){for(let n of i.values())if(n.namespaceId){let o=this._fetchNamespace(n.namespaceId);o&&A.add(o)}}return A}trigger(e,A,i,n){if(c7(A)){let o=this._fetchNamespace(e);if(o)return o.trigger(A,i,n),!0}return!1}insertNode(e,A,i,n){if(!c7(A))return;let o=A[_l];if(o&&o.setForRemoval){o.setForRemoval=!1,o.setForMove=!0;let r=this.collectedLeaveElements.indexOf(A);r>=0&&this.collectedLeaveElements.splice(r,1)}if(e){let r=this._fetchNamespace(e);r&&r.insertNode(A,i)}n&&this.collectEnterElement(A)}collectEnterElement(e){this.collectedEnterElements.push(e)}markElementAsDisabled(e,A){A?this.disabledNodes.has(e)||(this.disabledNodes.add(e),Hc(e,CU)):this.disabledNodes.has(e)&&(this.disabledNodes.delete(e),Dh(e,CU))}removeNode(e,A,i){if(c7(A)){let n=e?this._fetchNamespace(e):null;n?n.removeNode(A,i):this.markElementAsRemoved(e,A,!1,i);let o=this.namespacesByHostElement.get(A);o&&o.id!==e&&o.removeNode(A,i)}else this._onRemovalComplete(A,i)}markElementAsRemoved(e,A,i,n,o){this.collectedLeaveElements.push(A),A[_l]={namespaceId:e,setForRemoval:n,hasAnimation:i,removedBeforeQueried:!1,previousTriggersValues:o}}listen(e,A,i,n,o){return c7(A)?this._fetchNamespace(e).listen(A,i,n,o):()=>{}}_buildInstruction(e,A,i,n,o){return e.transition.build(this.driver,e.element,e.fromState.value,e.toState.value,i,n,e.fromState.options,e.toState.options,A,o)}destroyInnerAnimations(e){let A=this.driver.query(e,pf,!0);A.forEach(i=>this.destroyActiveAnimationsForElement(i)),this.playersByQueriedElement.size!=0&&(A=this.driver.query(e,n7,!0),A.forEach(i=>this.finishActiveQueriedAnimationOnElement(i)))}destroyActiveAnimationsForElement(e){let A=this.playersByElement.get(e);A&&A.forEach(i=>{i.queued?i.markedForDestroy=!0:i.destroy()})}finishActiveQueriedAnimationOnElement(e){let A=this.playersByQueriedElement.get(e);A&&A.forEach(i=>i.finish())}whenRenderingDone(){return new Promise(e=>{if(this.players.length)return n2(this.players).onDone(()=>e());e()})}processLeaveNode(e){let A=e[_l];if(A&&A.setForRemoval){if(e[_l]=VlA,A.namespaceId){this.destroyInnerAnimations(e);let i=this._fetchNamespace(A.namespaceId);i&&i.clearElementCache(e)}this._onRemovalComplete(e,A.setForRemoval)}e.classList?.contains(CU)&&this.markElementAsDisabled(e,!1),this.driver.query(e,bqA,!0).forEach(i=>{this.markElementAsDisabled(i,!1)})}flush(e=-1){let A=[];if(this.newHostElements.size&&(this.newHostElements.forEach((i,n)=>this._balanceNamespaceList(i,n)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let i=0;ii()),this._flushFns=[],this._whenQuietFns.length){let i=this._whenQuietFns;this._whenQuietFns=[],A.length?n2(A).onDone(()=>{i.forEach(n=>n())}):i.forEach(n=>n())}}reportError(e){throw MlA(e)}_flushAnimations(e,A){let i=new yf,n=[],o=new Map,r=[],s=new Map,a=new Map,c=new Map,l=new Set;this.disabledNodes.forEach(p=>{l.add(p);let V=this.driver.query(p,vqA,!0);for(let cA=0;cA{let cA=aU+E++;B.set(V,cA),p.forEach(aA=>Hc(aA,cA))});let Q=[],u=new Set,v=new Set;for(let p=0;pu.add(aA)):v.add(V))}let L=new Map,x=zlA(C,Array.from(u));x.forEach((p,V)=>{let cA=i7+E++;L.set(V,cA),p.forEach(aA=>Hc(aA,cA))}),e.push(()=>{d.forEach((p,V)=>{let cA=B.get(V);p.forEach(aA=>Dh(aA,cA))}),x.forEach((p,V)=>{let cA=L.get(V);p.forEach(aA=>Dh(aA,cA))}),Q.forEach(p=>{this.processLeaveNode(p)})});let y=[],F=[];for(let p=this._namespaceList.length-1;p>=0;p--)this._namespaceList[p].drainQueuedTransitions(A).forEach(cA=>{let aA=cA.player,jA=cA.element;if(y.push(aA),this.collectedEnterElements.length){let Re=jA[_l];if(Re&&Re.setForMove){if(Re.previousTriggersValues&&Re.previousTriggersValues.has(cA.triggerName)){let hA=Re.previousTriggersValues.get(cA.triggerName),eA=this.statesByElement.get(cA.element);if(eA&&eA.has(cA.triggerName)){let RA=eA.get(cA.triggerName);RA.value=hA,eA.set(cA.triggerName,RA)}}aA.destroy();return}}let VA=!I||!this.driver.containsElement(I,jA),ce=L.get(jA),EA=B.get(jA),sA=this._buildInstruction(cA,i,EA,ce,VA);if(sA.errors&&sA.errors.length){F.push(sA);return}if(VA){aA.onStart(()=>q1(jA,sA.fromStyles)),aA.onDestroy(()=>Nl(jA,sA.toStyles)),n.push(aA);return}if(cA.isFallbackTransition){aA.onStart(()=>q1(jA,sA.fromStyles)),aA.onDestroy(()=>Nl(jA,sA.toStyles)),n.push(aA);return}let TA=[];sA.timelines.forEach(Re=>{Re.stretchStartingKeyframe=!0,this.disabledNodes.has(Re.element)||TA.push(Re)}),sA.timelines=TA,i.append(jA,sA.timelines);let Ke={instruction:sA,player:aA,element:jA};r.push(Ke),sA.queriedElements.forEach(Re=>Sa(s,Re,[]).push(aA)),sA.preStyleProps.forEach((Re,hA)=>{if(Re.size){let eA=a.get(hA);eA||a.set(hA,eA=new Set),Re.forEach((RA,oA)=>eA.add(oA))}}),sA.postStyleProps.forEach((Re,hA)=>{let eA=c.get(hA);eA||c.set(hA,eA=new Set),Re.forEach((RA,oA)=>eA.add(oA))})});if(F.length){let p=[];F.forEach(V=>{p.push(klA(V.triggerName,V.errors))}),y.forEach(V=>V.destroy()),this.reportError(p)}let U=new Map,T=new Map;r.forEach(p=>{let V=p.element;i.has(V)&&(T.set(V,V),this._beforeAnimationBuild(p.player.namespaceId,p.instruction,U))}),n.forEach(p=>{let V=p.element;this._getPreviousPlayers(V,!1,p.namespaceId,p.triggerName,null).forEach(aA=>{Sa(U,V,[]).push(aA),aA.destroy()})});let N=Q.filter(p=>HlA(p,a,c)),K=new Map;TlA(K,this.driver,v,c,pc).forEach(p=>{HlA(p,a,c)&&N.push(p)});let j=new Map;d.forEach((p,V)=>{TlA(j,this.driver,new Set(p),a,mB)}),N.forEach(p=>{let V=K.get(p),cA=j.get(p);K.set(p,new Map([...V?.entries()??[],...cA?.entries()??[]]))});let IA=[],lA=[],uA={};r.forEach(p=>{let{element:V,player:cA,instruction:aA}=p;if(i.has(V)){if(l.has(V)){cA.onDestroy(()=>Nl(V,aA.toStyles)),cA.disabled=!0,cA.overrideTotalTime(aA.totalTime),n.push(cA);return}let jA=uA;if(T.size>1){let ce=V,EA=[];for(;ce=ce.parentNode;){let sA=T.get(ce);if(sA){jA=sA;break}EA.push(ce)}EA.forEach(sA=>T.set(sA,jA))}let VA=this._buildAnimation(cA.namespaceId,aA,U,o,j,K);if(cA.setRealPlayer(VA),jA===uA)IA.push(cA);else{let ce=this.playersByElement.get(jA);ce&&ce.length&&(cA.parentPlayer=n2(ce)),n.push(cA)}}else q1(V,aA.fromStyles),cA.onDestroy(()=>Nl(V,aA.toStyles)),lA.push(cA),l.has(V)&&n.push(cA)}),lA.forEach(p=>{let V=o.get(p.element);if(V&&V.length){let cA=n2(V);p.setRealPlayer(cA)}}),n.forEach(p=>{p.parentPlayer?p.syncPlayerEvents(p.parentPlayer):p.destroy()});for(let p=0;p!VA.destroyed);jA.length?NqA(this,V,jA):this.processLeaveNode(V)}return Q.length=0,IA.forEach(p=>{this.players.push(p),p.onDone(()=>{p.destroy();let V=this.players.indexOf(p);this.players.splice(V,1)}),p.play()}),IA}afterFlush(e){this._flushFns.push(e)}afterFlushAnimationsDone(e){this._whenQuietFns.push(e)}_getPreviousPlayers(e,A,i,n,o){let r=[];if(A){let s=this.playersByQueriedElement.get(e);s&&(r=s)}else{let s=this.playersByElement.get(e);if(s){let a=!o||o==Df;s.forEach(c=>{c.queued||!a&&c.triggerName!=n||r.push(c)})}}return(i||n)&&(r=r.filter(s=>!(i&&i!=s.namespaceId||n&&n!=s.triggerName))),r}_beforeAnimationBuild(e,A,i){let n=A.triggerName,o=A.element,r=A.isRemovalTransition?void 0:e,s=A.isRemovalTransition?void 0:n;for(let a of A.timelines){let c=a.element,l=c!==o,I=Sa(i,c,[]);this._getPreviousPlayers(c,l,r,s,A.toState).forEach(d=>{let B=d.getRealPlayer();B.beforeDestroy&&B.beforeDestroy(),d.destroy(),I.push(d)})}q1(o,A.fromStyles)}_buildAnimation(e,A,i,n,o,r){let s=A.triggerName,a=A.element,c=[],l=new Set,I=new Set,C=A.timelines.map(B=>{let E=B.element;l.add(E);let Q=E[_l];if(Q&&Q.removedBeforeQueried)return new ag(B.duration,B.delay);let u=E!==a,v=_qA((i.get(E)||SqA).map(U=>U.getRealPlayer())).filter(U=>{let T=U;return T.element?T.element===E:!1}),L=o.get(E),x=r.get(E),y=iU(this._normalizer,B.keyframes,L,x),F=this._buildPlayer(B,y,v);if(B.subTimeline&&n&&I.add(E),u){let U=new bf(e,s,E);U.setRealPlayer(F),c.push(U)}return F});c.forEach(B=>{Sa(this.playersByQueriedElement,B.element,[]).push(B),B.onDone(()=>LqA(this.playersByQueriedElement,B.element,B))}),l.forEach(B=>Hc(B,cU));let d=n2(C);return d.onDestroy(()=>{l.forEach(B=>Dh(B,cU)),Nl(a,A.toStyles)}),I.forEach(B=>{Sa(n,B,[]).push(d)}),d}_buildPlayer(e,A,i){return A.length>0?this.driver.animate(e.element,A,e.duration,e.delay,e.easing,i):new ag(e.duration,e.delay)}},bf=class{namespaceId;triggerName;element;_player=new ag;_containsRealPlayer=!1;_queuedCallbacks=new Map;destroyed=!1;parentPlayer=null;markedForDestroy=!1;disabled=!1;queued=!0;totalTime=0;constructor(e,A,i){this.namespaceId=e,this.triggerName=A,this.element=i}setRealPlayer(e){this._containsRealPlayer||(this._player=e,this._queuedCallbacks.forEach((A,i)=>{A.forEach(n=>A7(e,i,void 0,n))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(e.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(e){this.totalTime=e}syncPlayerEvents(e){let A=this._player;A.triggerCallback&&e.onStart(()=>A.triggerCallback("start")),e.onDone(()=>this.finish()),e.onDestroy(()=>this.destroy())}_queueEvent(e,A){Sa(this._queuedCallbacks,e,[]).push(A)}onDone(e){this.queued&&this._queueEvent("done",e),this._player.onDone(e)}onStart(e){this.queued&&this._queueEvent("start",e),this._player.onStart(e)}onDestroy(e){this.queued&&this._queueEvent("destroy",e),this._player.onDestroy(e)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(e){this.queued||this._player.setPosition(e)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(e){let A=this._player;A.triggerCallback&&A.triggerCallback(e)}};function LqA(t,e,A){let i=t.get(e);if(i){if(i.length){let n=i.indexOf(A);i.splice(n,1)}i.length==0&&t.delete(e)}return i}function xqA(t){return t??null}function c7(t){return t&&t.nodeType===1}function FqA(t){return t=="start"||t=="done"}function JlA(t,e){let A=t.style.display;return t.style.display=e??"none",A}function TlA(t,e,A,i,n){let o=[];A.forEach(a=>o.push(JlA(a)));let r=[];i.forEach((a,c)=>{let l=new Map;a.forEach(I=>{let C=e.computeStyle(c,I,n);l.set(I,C),(!C||C.length==0)&&(c[_l]=RqA,r.push(c))}),t.set(c,l)});let s=0;return A.forEach(a=>JlA(a,o[s++])),r}function zlA(t,e){let A=new Map;if(t.forEach(s=>A.set(s,[])),e.length==0)return A;let i=1,n=new Set(e),o=new Map;function r(s){if(!s)return i;let a=o.get(s);if(a)return a;let c=s.parentNode;return A.has(c)?a=c:n.has(c)?a=i:a=r(c),o.set(s,a),a}return e.forEach(s=>{let a=r(s);a!==i&&A.get(a).push(s)}),A}function Hc(t,e){t.classList?.add(e)}function Dh(t,e){t.classList?.remove(e)}function NqA(t,e,A){n2(A).onDone(()=>t.processLeaveNode(e))}function _qA(t){let e=[];return ZlA(t,e),e}function ZlA(t,e){for(let A=0;An.add(o)):e.set(t,i),A.delete(t),!0}var yh=class{_driver;_normalizer;_transitionEngine;_timelineEngine;_triggerCache={};onRemovalComplete=(e,A)=>{};constructor(e,A,i){this._driver=A,this._normalizer=i,this._transitionEngine=new yU(e.body,A,i),this._timelineEngine=new wU(e.body,A,i),this._transitionEngine.onRemovalComplete=(n,o)=>this.onRemovalComplete(n,o)}registerTrigger(e,A,i,n,o){let r=e+"-"+n,s=this._triggerCache[r];if(!s){let a=[],c=[],l=PlA(this._driver,o,a,c);if(a.length)throw ulA(n,a);s=wqA(n,l,this._normalizer),this._triggerCache[r]=s}this._transitionEngine.registerTrigger(A,n,s)}register(e,A){this._transitionEngine.register(e,A)}destroy(e,A){this._transitionEngine.destroy(e,A)}onInsert(e,A,i,n){this._transitionEngine.insertNode(e,A,i,n)}onRemove(e,A,i){this._transitionEngine.removeNode(e,A,i)}disableAnimations(e,A){this._transitionEngine.markElementAsDisabled(e,A)}process(e,A,i,n){if(i.charAt(0)=="@"){let[o,r]=nU(i),s=n;this._timelineEngine.command(o,A,r,s)}else this._transitionEngine.trigger(e,A,i,n)}listen(e,A,i,n,o){if(i.charAt(0)=="@"){let[r,s]=nU(i);return this._timelineEngine.listen(r,A,s,o)}return this._transitionEngine.listen(e,A,i,n,o)}flush(e=-1){this._transitionEngine.flush(e)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(e){this._transitionEngine.afterFlushAnimationsDone(e)}};function UqA(t,e){let A=null,i=null;return Array.isArray(e)&&e.length?(A=BU(e[0]),e.length>1&&(i=BU(e[e.length-1]))):e instanceof Map&&(A=BU(e)),A||i?new KqA(t,A,i):null}var KqA=(()=>{class t{_element;_startStyles;_endStyles;static initialStylesByElement=new WeakMap;_state=0;_initialStyles;constructor(A,i,n){this._element=A,this._startStyles=i,this._endStyles=n;let o=t.initialStylesByElement.get(A);o||t.initialStylesByElement.set(A,o=new Map),this._initialStyles=o}start(){this._state<1&&(this._startStyles&&Nl(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(Nl(this._element,this._initialStyles),this._endStyles&&(Nl(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(t.initialStylesByElement.delete(this._element),this._startStyles&&(q1(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(q1(this._element,this._endStyles),this._endStyles=null),Nl(this._element,this._initialStyles),this._state=3)}}return t})();function BU(t){let e=null;return t.forEach((A,i)=>{YqA(i)&&(e=e||new Map,e.set(i,A))}),e}function YqA(t){return t==="display"||t==="position"}var E7=class{element;keyframes;options;_specialStyles;_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_duration;_delay;_initialized=!1;_finished=!1;_started=!1;_destroyed=!1;_finalKeyframe;_originalOnDoneFns=[];_originalOnStartFns=[];domPlayer;time=0;parentPlayer=null;currentSnapshot=new Map;constructor(e,A,i,n){this.element=e,this.keyframes=A,this.options=i,this._specialStyles=n,this._duration=i.duration,this._delay=i.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this._buildPlayer(),this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return;this._initialized=!0;let e=this.keyframes;this.domPlayer=this._triggerWebAnimation(this.element,e,this.options),this._finalKeyframe=e.length?e[e.length-1]:new Map;let A=()=>this._onFinish();this.domPlayer.addEventListener("finish",A),this.onDestroy(()=>{this.domPlayer.removeEventListener("finish",A)})}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer.pause()}_convertKeyframesToObject(e){let A=[];return e.forEach(i=>{A.push(Object.fromEntries(i))}),A}_triggerWebAnimation(e,A,i){return e.animate(this._convertKeyframesToObject(A),i)}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}play(){this._buildPlayer(),this.hasStarted()||(this._onStartFns.forEach(e=>e()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),this.domPlayer.play()}pause(){this.init(),this.domPlayer.pause()}finish(){this.init(),this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish()}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer&&this.domPlayer.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}setPosition(e){this.domPlayer===void 0&&this.init(),this.domPlayer.currentTime=e*this.time}getPosition(){return+(this.domPlayer.currentTime??0)/this.time}get totalTime(){return this._delay+this._duration}beforeDestroy(){let e=new Map;this.hasStarted()&&this._finalKeyframe.forEach((i,n)=>{n!=="offset"&&e.set(n,this._finished?i:r7(this.element,n))}),this.currentSnapshot=e}triggerCallback(e){let A=e==="start"?this._onStartFns:this._onDoneFns;A.forEach(i=>i()),A.length=0}},h7=class{validateStyleProperty(e){return!0}validateAnimatableStyleProperty(e){return!0}containsElement(e,A){return oU(e,A)}getParentElement(e){return t7(e)}query(e,A,i){return rU(e,A,i)}computeStyle(e,A,i){return r7(e,A)}animate(e,A,i,n,o,r=[]){let s=n==0?"both":"forwards",a={duration:i,delay:n,fill:s};o&&(a.easing=o);let c=new Map,l=r.filter(d=>d instanceof E7);xlA(i,n)&&l.forEach(d=>{d.currentSnapshot.forEach((B,E)=>c.set(E,B))});let I=RlA(A).map(d=>new Map(d));I=FlA(e,I,c);let C=UqA(e,I);return new E7(e,I,a,C)}};var l7="@",WlA="@.disabled",Q7=class{namespaceId;delegate;engine;_onDestroy;\u0275type=0;constructor(e,A,i,n){this.namespaceId=e,this.delegate=A,this.engine=i,this._onDestroy=n}get data(){return this.delegate.data}destroyNode(e){this.delegate.destroyNode?.(e)}destroy(){this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),this._onDestroy?.()}createElement(e,A){return this.delegate.createElement(e,A)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}appendChild(e,A){this.delegate.appendChild(e,A),this.engine.onInsert(this.namespaceId,A,e,!1)}insertBefore(e,A,i,n=!0){this.delegate.insertBefore(e,A,i),this.engine.onInsert(this.namespaceId,A,e,n)}removeChild(e,A,i){this.parentNode(A)&&this.engine.onRemove(this.namespaceId,A,this.delegate)}selectRootElement(e,A){return this.delegate.selectRootElement(e,A)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,A,i,n){this.delegate.setAttribute(e,A,i,n)}removeAttribute(e,A,i){this.delegate.removeAttribute(e,A,i)}addClass(e,A){this.delegate.addClass(e,A)}removeClass(e,A){this.delegate.removeClass(e,A)}setStyle(e,A,i,n){this.delegate.setStyle(e,A,i,n)}removeStyle(e,A,i){this.delegate.removeStyle(e,A,i)}setProperty(e,A,i){A.charAt(0)==l7&&A==WlA?this.disableAnimations(e,!!i):this.delegate.setProperty(e,A,i)}setValue(e,A){this.delegate.setValue(e,A)}listen(e,A,i,n){return this.delegate.listen(e,A,i,n)}disableAnimations(e,A){this.engine.disableAnimations(e,A)}},vU=class extends Q7{factory;constructor(e,A,i,n,o){super(A,i,n,o),this.factory=e,this.namespaceId=A}setProperty(e,A,i){A.charAt(0)==l7?A.charAt(1)=="."&&A==WlA?(i=i===void 0?!0:!!i,this.disableAnimations(e,i)):this.engine.process(this.namespaceId,e,A.slice(1),i):this.delegate.setProperty(e,A,i)}listen(e,A,i,n){if(A.charAt(0)==l7){let o=JqA(e),r=A.slice(1),s="";return r.charAt(0)!=l7&&([r,s]=TqA(r)),this.engine.listen(this.namespaceId,o,r,s,a=>{let c=a._data||-1;this.factory.scheduleListenerCallback(c,i,a)})}return this.delegate.listen(e,A,i,n)}};function JqA(t){switch(t){case"body":return document.body;case"document":return document;case"window":return window;default:return t}}function TqA(t){let e=t.indexOf("."),A=t.substring(0,e),i=t.slice(e+1);return[A,i]}var u7=class{delegate;engine;_zone;_currentId=0;_microtaskId=1;_animationCallbacksBuffer=[];_rendererCache=new Map;_cdRecurDepth=0;constructor(e,A,i){this.delegate=e,this.engine=A,this._zone=i,A.onRemovalComplete=(n,o)=>{o?.removeChild(null,n)}}createRenderer(e,A){let i="",n=this.delegate.createRenderer(e,A);if(!e||!A?.data?.animation){let c=this._rendererCache,l=c.get(n);if(!l){let I=()=>c.delete(n);l=new Q7(i,n,this.engine,I),c.set(n,l)}return l}let o=A.id,r=A.id+"-"+this._currentId;this._currentId++,this.engine.register(r,e);let s=c=>{Array.isArray(c)?c.forEach(s):this.engine.registerTrigger(o,r,e,c.name,c)};return A.data.animation.forEach(s),new vU(this,r,n,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(e,A,i){if(e>=0&&eA(i));return}let n=this._animationCallbacksBuffer;n.length==0&&queueMicrotask(()=>{this._zone.run(()=>{n.forEach(o=>{let[r,s]=o;r(s)}),this._animationCallbacksBuffer=[]})}),n.push([A,i])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}componentReplaced(e){this.engine.flush(),this.delegate.componentReplaced?.(e)}};var HqA=(()=>{class t extends yh{constructor(A,i,n){super(A,i,n)}ngOnDestroy(){this.flush()}static \u0275fac=function(i){return new(i||t)(he(tt),he($C),he(Ad))};static \u0275prov=SA({token:t,factory:t.\u0275fac})}return t})();function OqA(){return new g7}function PqA(t,e,A){return new u7(t,e,A)}var $lA=[{provide:Ad,useFactory:OqA},{provide:yh,useClass:HqA},{provide:ds,useFactory:PqA,deps:[xQ,yh,de]}],jqA=[{provide:$C,useClass:bU},{provide:mi,useValue:"NoopAnimations"},...$lA],XlA=[{provide:$C,useFactory:()=>new h7},{provide:mi,useFactory:()=>"BrowserAnimations"},...$lA],f7=(()=>{class t{static withConfig(A){return{ngModule:t,providers:A.disableAnimations?jqA:XlA}}static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({providers:XlA,imports:[NQ]})}return t})();var qqA=new BA("mat-chips-default-options",{providedIn:"root",factory:()=>({separatorKeyCodes:[13]})});var AgA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({providers:[dB,{provide:qqA,useValue:{separatorKeyCodes:[13]}}],imports:[Ve,Xa,Ve]})}return t})();var VqA=["input"],ZqA=["formField"],WqA=["*"],kU=class{source;value;constructor(e,A){this.source=e,this.value=A}};var XqA=new BA("MatRadioGroup"),$qA=new BA("mat-radio-default-options",{providedIn:"root",factory:AVA});function AVA(){return{color:"accent",disabledInteractive:!1}}var eVA=(()=>{class t{_elementRef=m(te);_changeDetector=m(lt);_focusMonitor=m(Jr);_radioDispatcher=m(uB);_defaultOptions=m($qA,{optional:!0});_ngZone=m(de);_renderer=m(Gi);_uniqueId=m($i).getId("mat-radio-");_cleanupClick;id=this._uniqueId;name;ariaLabel;ariaLabelledby;ariaDescribedby;disableRipple=!1;tabIndex=0;get checked(){return this._checked}set checked(A){this._checked!==A&&(this._checked=A,A&&this.radioGroup&&this.radioGroup.value!==this.value?this.radioGroup.selected=this:!A&&this.radioGroup&&this.radioGroup.value===this.value&&(this.radioGroup.selected=null),A&&this._radioDispatcher.notify(this.id,this.name),this._changeDetector.markForCheck())}get value(){return this._value}set value(A){this._value!==A&&(this._value=A,this.radioGroup!==null&&(this.checked||(this.checked=this.radioGroup.value===A),this.checked&&(this.radioGroup.selected=this)))}get labelPosition(){return this._labelPosition||this.radioGroup&&this.radioGroup.labelPosition||"after"}set labelPosition(A){this._labelPosition=A}_labelPosition;get disabled(){return this._disabled||this.radioGroup!==null&&this.radioGroup.disabled}set disabled(A){this._setDisabled(A)}get required(){return this._required||this.radioGroup&&this.radioGroup.required}set required(A){this._required=A}get color(){return this._color||this.radioGroup&&this.radioGroup.color||this._defaultOptions&&this._defaultOptions.color||"accent"}set color(A){this._color=A}_color;get disabledInteractive(){return this._disabledInteractive||this.radioGroup!==null&&this.radioGroup.disabledInteractive}set disabledInteractive(A){this._disabledInteractive=A}_disabledInteractive;change=new XA;radioGroup;get inputId(){return`${this.id||this._uniqueId}-input`}_checked=!1;_disabled;_required;_value=null;_removeUniqueSelectionListener=()=>{};_previousTabIndex;_inputElement;_rippleTrigger;_noopAnimations;_injector=m(Dt);constructor(){m(Ln).load(Qr);let A=m(XqA,{optional:!0}),i=m(mi,{optional:!0}),n=m(new Er("tabindex"),{optional:!0});this.radioGroup=A,this._noopAnimations=i==="NoopAnimations",this._disabledInteractive=this._defaultOptions?.disabledInteractive??!1,n&&(this.tabIndex=Mi(n,0))}focus(A,i){i?this._focusMonitor.focusVia(this._inputElement,i,A):this._inputElement.nativeElement.focus(A)}_markForCheck(){this._changeDetector.markForCheck()}ngOnInit(){this.radioGroup&&(this.checked=this.radioGroup.value===this._value,this.checked&&(this.radioGroup.selected=this),this.name=this.radioGroup.name),this._removeUniqueSelectionListener=this._radioDispatcher.listen((A,i)=>{A!==this.id&&i===this.name&&(this.checked=!1)})}ngDoCheck(){this._updateTabIndex()}ngAfterViewInit(){this._updateTabIndex(),this._focusMonitor.monitor(this._elementRef,!0).subscribe(A=>{!A&&this.radioGroup&&this.radioGroup._touch()}),this._ngZone.runOutsideAngular(()=>{this._cleanupClick=this._renderer.listen(this._inputElement.nativeElement,"click",this._onInputClick)})}ngOnDestroy(){this._cleanupClick?.(),this._focusMonitor.stopMonitoring(this._elementRef),this._removeUniqueSelectionListener()}_emitChangeEvent(){this.change.emit(new kU(this,this._value))}_isRippleDisabled(){return this.disableRipple||this.disabled}_onInputInteraction(A){if(A.stopPropagation(),!this.checked&&!this.disabled){let i=this.radioGroup&&this.value!==this.radioGroup.value;this.checked=!0,this._emitChangeEvent(),this.radioGroup&&(this.radioGroup._controlValueAccessorChangeFn(this.value),i&&this.radioGroup._emitChangeEvent())}}_onTouchTargetClick(A){this._onInputInteraction(A),(!this.disabled||this.disabledInteractive)&&this._inputElement?.nativeElement.focus()}_setDisabled(A){this._disabled!==A&&(this._disabled=A,this._changeDetector.markForCheck())}_onInputClick=A=>{this.disabled&&this.disabledInteractive&&A.preventDefault()};_updateTabIndex(){let A=this.radioGroup,i;if(!A||!A.selected||this.disabled?i=this.tabIndex:i=A.selected===this?this.tabIndex:-1,i!==this._previousTabIndex){let n=this._inputElement?.nativeElement;n&&(n.setAttribute("tabindex",i+""),this._previousTabIndex=i,Vo(()=>{queueMicrotask(()=>{A&&A.selected&&A.selected!==this&&document.activeElement===n&&(A.selected?._inputElement.nativeElement.focus(),document.activeElement===n&&this._inputElement.nativeElement.blur())})},{injector:this._injector}))}}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-radio-button"]],viewQuery:function(i,n){if(i&1&&(Ge(VqA,5),Ge(ZqA,7,te)),i&2){let o;$A(o=Ae())&&(n._inputElement=o.first),$A(o=Ae())&&(n._rippleTrigger=o.first)}},hostAttrs:[1,"mat-mdc-radio-button"],hostVars:19,hostBindings:function(i,n){i&1&&mA("focus",function(){return n._inputElement.nativeElement.focus()}),i&2&&(_e("id",n.id)("tabindex",null)("aria-label",null)("aria-labelledby",null)("aria-describedby",null),ue("mat-primary",n.color==="primary")("mat-accent",n.color==="accent")("mat-warn",n.color==="warn")("mat-mdc-radio-checked",n.checked)("mat-mdc-radio-disabled",n.disabled)("mat-mdc-radio-disabled-interactive",n.disabledInteractive)("_mat-animation-noopable",n._noopAnimations))},inputs:{id:"id",name:"name",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],disableRipple:[2,"disableRipple","disableRipple",ae],tabIndex:[2,"tabIndex","tabIndex",A=>A==null?0:Mi(A)],checked:[2,"checked","checked",ae],value:"value",labelPosition:"labelPosition",disabled:[2,"disabled","disabled",ae],required:[2,"required","required",ae],color:"color",disabledInteractive:[2,"disabledInteractive","disabledInteractive",ae]},outputs:{change:"change"},exportAs:["matRadioButton"],ngContentSelectors:WqA,decls:13,vars:17,consts:[["formField",""],["input",""],["mat-internal-form-field","",3,"labelPosition"],[1,"mdc-radio"],[1,"mat-mdc-radio-touch-target",3,"click"],["type","radio",1,"mdc-radio__native-control",3,"change","id","checked","disabled","required"],[1,"mdc-radio__background"],[1,"mdc-radio__outer-circle"],[1,"mdc-radio__inner-circle"],["mat-ripple","",1,"mat-radio-ripple","mat-focus-indicator",3,"matRippleTrigger","matRippleDisabled","matRippleCentered"],[1,"mat-ripple-element","mat-radio-persistent-ripple"],[1,"mdc-label",3,"for"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"div",2,0)(2,"div",3)(3,"div",4),mA("click",function(s){return LA(o),xA(n._onTouchTargetClick(s))}),R(),S(4,"input",5,1),mA("change",function(s){return LA(o),xA(n._onInputInteraction(s))}),R(),S(6,"div",6),UA(7,"div",7)(8,"div",8),R(),S(9,"div",9),UA(10,"div",10),R()(),S(11,"label",11),xe(12),R()()}i&2&&(vA("labelPosition",n.labelPosition),_(2),ue("mdc-radio--disabled",n.disabled),_(2),vA("id",n.inputId)("checked",n.checked)("disabled",n.disabled&&!n.disabledInteractive)("required",n.required),_e("name",n.name)("value",n.value)("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-describedby",n.ariaDescribedby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),_(5),vA("matRippleTrigger",n._rippleTrigger.nativeElement)("matRippleDisabled",n._isRippleDisabled())("matRippleCentered",!0),_(2),vA("for",n.inputId))},dependencies:[Gs,BB],styles:['.mat-mdc-radio-button{-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-radio-button .mdc-radio{display:inline-block;position:relative;flex:0 0 auto;box-sizing:content-box;width:20px;height:20px;cursor:pointer;will-change:opacity,transform,border-color,color;padding:calc((var(--mdc-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-radio-button .mdc-radio:hover .mdc-radio__native-control:not([disabled]):not(:focus)~.mdc-radio__background::before{opacity:.04;transform:scale(1)}.mat-mdc-radio-button .mdc-radio:hover .mdc-radio__native-control:not([disabled])~.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-hover-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mdc-radio:hover .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio:hover .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-hover-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio:active .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-pressed-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mdc-radio:active .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio:active .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-pressed-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__background{display:inline-block;position:relative;box-sizing:border-box;width:20px;height:20px}.mat-mdc-radio-button .mdc-radio__background::before{position:absolute;transform:scale(0, 0);border-radius:50%;opacity:0;pointer-events:none;content:"";transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1);width:var(--mdc-radio-state-layer-size, 40px);height:var(--mdc-radio-state-layer-size, 40px);top:calc(-1*(var(--mdc-radio-state-layer-size, 40px) - 20px)/2);left:calc(-1*(var(--mdc-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-radio-button .mdc-radio__outer-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:50%;transition:border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-radio-button .mdc-radio__inner-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transform:scale(0, 0);border-width:10px;border-style:solid;border-radius:50%;transition:transform 90ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-radio-button .mdc-radio__native-control{position:absolute;margin:0;padding:0;opacity:0;top:0;right:0;left:0;cursor:inherit;z-index:1;width:var(--mdc-radio-state-layer-size, 40px);height:var(--mdc-radio-state-layer-size, 40px)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background{transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__outer-circle{transition:border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle{transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:focus+.mdc-radio__background::before{transform:scale(1);opacity:.12;transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background{cursor:default}.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-radio-button .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-selected-focus-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle{transform:scale(0.5);transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled{pointer-events:auto}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled:hover .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled:hover .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__background::before,.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__outer-circle,.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__inner-circle{transition:none !important}.mat-mdc-radio-button .mdc-radio__background::before{background-color:var(--mat-radio-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button.mat-mdc-radio-checked .mat-ripple-element,.mat-mdc-radio-button.mat-mdc-radio-checked .mdc-radio__background::before{background-color:var(--mat-radio-checked-ripple-color, var(--mat-sys-primary))}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mat-ripple-element,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__background::before{background-color:var(--mat-radio-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mat-internal-form-field{color:var(--mat-radio-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-radio-label-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-radio-label-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-radio-label-text-size, var(--mat-sys-body-medium-size));letter-spacing:var(--mat-radio-label-text-tracking, var(--mat-sys-body-medium-tracking));font-weight:var(--mat-radio-label-text-weight, var(--mat-sys-body-medium-weight))}.mat-mdc-radio-button .mdc-radio--disabled+label{color:var(--mat-radio-disabled-label-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-radio-button .mat-radio-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:50%}.mat-mdc-radio-button .mat-radio-ripple .mat-ripple-element{opacity:.14}.mat-mdc-radio-button .mat-radio-ripple::before{border-radius:50%}.mat-mdc-radio-button .mdc-radio .mdc-radio__native-control:focus:enabled:not(:checked)~.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-focus-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button.cdk-focused .mat-focus-indicator::before{content:""}.mat-mdc-radio-disabled{cursor:default;pointer-events:none}.mat-mdc-radio-disabled.mat-mdc-radio-disabled-interactive{pointer-events:auto}.mat-mdc-radio-touch-target{position:absolute;top:50%;left:50%;height:48px;width:48px;transform:translate(-50%, -50%);display:var(--mat-radio-touch-target-display, block)}[dir=rtl] .mat-mdc-radio-touch-target{left:auto;right:50%;transform:translate(50%, -50%)}'],encapsulation:2,changeDetection:0})}return t})(),egA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Xa,eVA,Ve]})}return t})();var m7=class t{static \u0275fac=function(A){return new(A||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[g0,e6,scA,rq,f0,Ty,KI,fP,ecA,acA,gcA,QcA,egA,a8,PaA,haA,NaA,$cA,c8,pcA,f7,VaA,zcA.forRoot(),HcA,EH,AgA,$j,ncA]})};var Mf=class t{static \u0275fac=function(A){return new(A||t)};static \u0275mod=ge({type:t,bootstrap:[mh]});static \u0275inj=le({providers:[Jg,K2,Tg,Eh,hh,j1,zc,Bh,J2,zg],imports:[m7,NQ,e6,Vb,$y,Ty,f0,KI,f7]})};fetch("./assets/config/runtime-config.json").then(t=>t.json()).then(t=>{window.runtimeConfig=t,Gp().bootstrapModule(Mf).catch(e=>console.error(e))});Gp().bootstrapModule(Mf).catch(t=>console.error(t)); + `;this.renderer.appendChild(i,this.renderer.createText(n)),this.renderer.appendChild(this.document.head,i)}static \u0275fac=function(A){return new(A||t)(zA(il),zA(Jg),zA(Bh),zA(Eh),zA(Tg),zA(hh),zA(Us),zA(j1),zA(ra),zA(J2),zA(zc),zA(zg),zA(Qc),zA(Gi),zA(tt))};static \u0275cmp=YA({type:t,selectors:[["app-chat"]],viewQuery:function(A,i){if(A&1&&(Ge(QPA,5,te),Ge(uPA,5),Ge(jC,5),Ge(qC,5),Ge(PC,5),Ge(fPA,5),Ge(mPA,5),Ge(pPA,5)),A&2){let n;$A(n=Ae())&&(i.videoContainer=n.first),$A(n=Ae())&&(i.sideDrawer=n.first),$A(n=Ae())&&(i.eventTabComponent=n.first),$A(n=Ae())&&(i.sessionTab=n.first),$A(n=Ae())&&(i.evalTab=n.first),$A(n=Ae())&&(i.scrollContainer=n.first),$A(n=Ae())&&(i.textarea=n.first),$A(n=Ae())&&(i.bottomPanelRef=n.first)}},standalone:!1,features:[ct([{provide:TI,useClass:$G}])],decls:28,vars:15,consts:[["sideDrawer",""],["autoScroll",""],["videoContainer",""],["messageTextarea",""],["fileInput",""],["bottomPanel",""],["autosize","",1,"drawer-container"],["matTooltip","Open panel",1,"material-symbols-outlined",2,"position","absolute","width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-left","20px","margin-top","20px","z-index","9999"],["mode","side","appResizableDrawer","",1,"side-drawer"],[2,"margin-top","20px","margin-left","20px","display","flex"],[2,"width","100%"],[1,"drawer-header"],[1,"drawer-logo"],["src","assets/ADK-512-color.svg","width","32px","height","32px"],["matTooltip","Collapse panel",1,"material-symbols-outlined",2,"color","#c4c7c5","cursor","pointer","margin-right","15px",3,"click"],[1,"app-select-container"],[1,"app-select",3,"selectionChange","placeholder","formControl"],[1,"app-name-option",3,"value"],[1,"tabs-container"],[1,"details-panel-container"],[1,"resize-handler"],[1,"chat-container"],[1,"chat-toolbar",3,"ngClass"],[1,"chat-card"],["mat-fab","","color","primary",1,"fab-button"],[1,"chat-messages"],[1,"chat-input"],["appResizableBottomPanel","",1,"trace-detail-container"],["matTooltip","Open panel",1,"material-symbols-outlined",2,"position","absolute","width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-left","20px","margin-top","20px","z-index","9999",3,"click"],[3,"selectedTabChange"],[1,"tabs-header"],["mat-tab-label",""],[3,"traceData"],[3,"selectedEvent","eventsMap","traceData"],[3,"sessionState"],[3,"artifacts"],[3,"sessionSelected","sessionReloaded","userId","appName","sessionId"],[1,"tab-label"],[3,"shouldShowTab","sessionSelected","evalCaseSelected","evalSetIdSelected","shouldReturnToSession","evalNotInstalledMsg","appName","userId","sessionId"],[1,"details-content"],[2,"display","flex","justify-content","flex-end","margin-top","10px"],["aria-label","Select event",1,"event-paginator",3,"page","length","pageSize","pageIndex"],["mat-mini-fab",""],[3,"click"],["label","Event"],[1,"event-graph-container"],[3,"innerHtml"],[1,"json-viewer-container"],[3,"json"],["label","Request"],["label","Response"],[3,"click","innerHtml"],["matTooltip","Open panel",1,"material-symbols-outlined",2,"width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-left","20px","margin-top","-2px","z-index","9999"],["matTooltip","Open panel",1,"material-symbols-outlined",2,"width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-left","20px","margin-top","-2px","z-index","9999",3,"click"],[2,"display","flex"],[1,"toolbar-session-text"],[1,"toolbar-session-id"],[1,"toolbar-actions"],["mat-button","",2,"height","30px",3,"click"],["mat-flat-button","",2,"height","30px",3,"click","disabled"],["matTooltip","Edit current eval case",1,"material-symbols-outlined","toolbar-icon",3,"click"],["matTooltip","Delete current eval case",1,"material-symbols-outlined","toolbar-icon",3,"click"],[1,"toolbar-sse-toggle"],[1,"example-margin",3,"change","checked"],[2,"margin-left","8px","margin-right","8px","height","22px",3,"vertical"],[2,"display","flex","align-items","center"],[1,"toolbar-new-sesison",3,"click"],["matTooltip","Delete current session",1,"material-symbols-outlined","toolbar-icon",3,"click"],["matTooltip","Export current session",1,"material-symbols-outlined","toolbar-icon",3,"click"],["matTooltip","Import session",1,"material-symbols-outlined","toolbar-icon"],["matTooltip","Import session",1,"material-symbols-outlined","toolbar-icon",3,"click"],[1,"empty-state-container"],[1,"warning"],[1,"error"],["mat-fab","","color","primary",1,"fab-button",3,"click"],[3,"ngClass"],["mat-mini-fab","",3,"matTooltip","class"],[1,"message-card",3,"ngClass","ngStyle"],["mat-stroked-button","",1,"function-event-button",3,"ngClass"],[1,"material-symbols-outlined"],["mat-mini-fab","",3,"click","matTooltip"],["fontSet","material-symbols-outlined"],["mode","buffer",1,"loading-bar"],[1,"attachments"],[1,"thought-chip"],[1,"eval-compare-container"],[1,"attachment"],["alt","attachment",1,"image-preview-chat",3,"src"],["download","",3,"href"],[1,"edit-message-container"],[1,"message-text",3,"data","ngStyle"],["rows","4","cols","80",1,"message-textarea",3,"ngModelChange","keydown","ngModel"],[1,"edit-message-buttons-container"],["matTooltip","Cancel editing",1,"material-symbols-outlined",2,"width","24px","height","24px","color","#c4c7c5","cursor","pointer","margin-right","16px",3,"click"],["matTooltip","Save eval case message",1,"material-symbols-outlined",2,"width","24px","height","24px","color","rgb(97, 151, 202)","cursor","pointer","margin-right","16px",3,"click"],[3,"innerHTML"],[1,"generated-image-container"],["alt","image",1,"generated-image",3,"click","src"],[3,"base64data"],[1,"html-artifact-container"],[1,"link-style-button",3,"click"],["alt","image",1,"image-preview-chat",3,"click","src"],[1,"actual-expected-compare-container"],[1,"score-threshold-container"],[1,"actual-result"],[1,"eval-response-header","header-actual"],[1,"expected-result"],[1,"eval-response-header","header-expected"],[1,"header-actual"],[1,"header-expected"],["mat-stroked-button","",1,"function-event-button",3,"click","ngClass"],["matTooltip","Edit eval case message",1,"material-symbols-outlined","eval-case-edit-button",3,"click","ngClass"],["matTooltip","Delete eval case message",1,"material-symbols-outlined","eval-case-edit-button",3,"click","ngClass"],["matTooltip","Edit function arguments",1,"material-symbols-outlined","eval-case-edit-button",3,"click","ngClass"],["type","file","multiple","","hidden","",3,"change"],["appearance","outline",1,"input-field"],[1,"file-preview"],["matInput","","cdkTextareaAutosize","","cdkAutosizeMinRows","1","cdkAutosizeMaxRows","10","placeholder","Type a Message...",1,"chat-input-box",2,"caret-color","white",3,"ngModelChange","keydown.enter","ngModel"],[1,"chat-input-actions"],["mat-icon-button","","matTooltip","Upload local file",1,"function-event-button",3,"click"],["mat-icon-button","","matSuffix","",3,"click","ngStyle","matTooltip"],[1,"image-container"],[1,"file-container"],["alt","preview",1,"image-preview",3,"src"],["mat-icon-button","",1,"delete-button",3,"click"],["color","warn"],[1,"file-info"],[1,"bottom-resize-handler"],[3,"panelClosed","userId","appName","sessionId"]],template:function(A,i){if(A&1){let n=De();S(0,"mat-drawer-container",6),NA(1,kPA,2,0,"span",7),S(2,"mat-drawer",8,0)(4,"div",9)(5,"div",10)(6,"div",11)(7,"div",12),UA(8,"img",13),tA(9," Agent Development Kit "),R(),S(10,"span",14),mA("click",function(){return LA(n),xA(i.toggleSidePanel())}),tA(11,"left_panel_close"),R()()()(),S(12,"div",15)(13,"mat-select",16),mA("selectionChange",function(r){return LA(n),xA(i.onAppSelection(r))}),NA(14,RPA,2,0),Ta(15,"async"),NA(16,LPA,2,2,"mat-option",17),R()(),NA(17,YPA,18,9,"div",18)(18,TPA,20,7,"div",19),UA(19,"div",20),R(),S(20,"div",21),NA(21,VPA,4,5,"div",22),S(22,"mat-card",23),NA(23,tjA,2,1)(24,ijA,3,0,"button",24)(25,UjA,6,0,"div",25)(26,zjA,17,10,"div",26),R(),NA(27,HjA,4,3,"div",27),R()()}if(A&2){let n;_(),FA(!i.showSidePanel&&i.appName===""?1:-1),_(12),vA("placeholder",i.isLoadingApps()?"Loading...":"Select an agent")("formControl",i.selectedAppControl),_(),FA((n=w2(15,13,i.apps$))?14:-1,n),_(2),FA(i.selectedAppControl.value&&i.isLoadingApps()?16:-1),_(),FA(i.appName!=""&&i.showSidePanel?17:-1),_(),FA(i.selectedEvent&&i.showSidePanel?18:-1),_(3),FA(i.appName!=""?21:-1),_(2),FA(i.selectedAppControl.value?-1:23),_(),FA(i.longRunningEvents.length>0?24:-1),_(),FA(i.appName!=""?25:-1),_(),FA(i.appName!=""&&i.isChatMode()?26:-1),_(),FA(i.bottomPanelVisible?27:-1)}},dependencies:[Ha,yQ,fc,na,ja,rcA,T2,lg,gP,P1,JaA,ur,EB,HO,zO,Sk,ZaA,Qh,RG,LG,GG,af,Py,pB,x2,wB,mcA,TcA,Xy,cM,jC,qC,PC,Su,df,zI,Bf,Ef,Qf,uf,bQ],styles:[".expand-side-drawer[_ngcontent-%COMP%]{position:relative;top:4%;left:1%}.drawer-container[_ngcontent-%COMP%]{height:100%;background-color:#131314}.generated-image-container[_ngcontent-%COMP%]{max-width:400px}.generated-image[_ngcontent-%COMP%]{max-width:100%;min-width:40px;border-radius:8px}.chat-container[_ngcontent-%COMP%]{width:100%;height:100%;max-width:100%;margin:auto;display:flex;flex-direction:column;flex:1}.event-container[_ngcontent-%COMP%]{color:#fff}.html-artifact-container[_ngcontent-%COMP%], .drawer-header[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:flex-start;align-items:center}.drawer-header[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{width:36px;height:36px;color:#bdc1c6;cursor:pointer;display:flex;align-items:center;justify-content:center}.chat-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;overflow:hidden;flex:1;min-height:12%;box-shadow:none;background-color:#131314}.loading-bar[_ngcontent-%COMP%]{width:100px;margin:15px}.chat-messages[_ngcontent-%COMP%]{flex-grow:1;overflow-y:auto;padding:20px;margin-top:16px}.message-card[_ngcontent-%COMP%]{padding:5px 20px;margin:5px;border-radius:20px;max-width:80%;font-size:14px;font-weight:400;position:relative;display:inline-block}.function-event-button[_ngcontent-%COMP%]{background-color:#fff;margin:5px 5px 10px}.function-event-button-highlight[_ngcontent-%COMP%]{background-color:#0f5223;border-color:#0f5223!important;color:#fff!important}.user-message[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center}.user-message[_ngcontent-%COMP%] .message-card[_ngcontent-%COMP%]{background-color:#004a77;align-self:flex-end;color:#fff;box-shadow:none}.bot-message[_ngcontent-%COMP%]{display:flex;align-items:center}.bot-message[_ngcontent-%COMP%] .message-card[_ngcontent-%COMP%]{background-color:#303030;align-self:flex-start;color:#fff;box-shadow:none}.bot-message[_ngcontent-%COMP%]:focus-within .message-card[_ngcontent-%COMP%]{background-color:#131314;border:1px solid #8ab4f8}.message-textarea[_ngcontent-%COMP%]{background-color:#303030;max-width:100%;border:none;font-family:Google Sans,Helvetica Neue,sans-serif}.message-textarea[_ngcontent-%COMP%]:focus{background-color:#131314;outline:none}.edit-message-buttons-container[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.message-card[_ngcontent-%COMP%] .eval-compare-container[_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:10px;z-index:10;background-color:#484848;overflow:hidden;border-radius:20px;padding:5px 20px;margin-bottom:10px;font-size:16px}.message-card[_ngcontent-%COMP%] .eval-compare-container[_ngcontent-%COMP%] .actual-result[_ngcontent-%COMP%]{border-right:2px solid #8a8686;padding-right:8px;min-width:350px;max-width:350px}.message-card[_ngcontent-%COMP%] .eval-compare-container[_ngcontent-%COMP%] .expected-result[_ngcontent-%COMP%]{padding-left:12px;min-width:350px;max-width:350px}.message-card[_ngcontent-%COMP%]:hover .eval-compare-container[_ngcontent-%COMP%]{visibility:visible}.actual-expected-compare-container[_ngcontent-%COMP%]{display:flex}.score-threshold-container[_ngcontent-%COMP%]{display:flex;justify-content:center;gap:10px;align-items:center;margin-top:15px;font-size:14px;font-weight:600}.eval-response-header[_ngcontent-%COMP%]{padding-bottom:5px;border-bottom:2px solid #8a8686;font-style:italic;font-weight:700}.header-expected[_ngcontent-%COMP%]{color:#44c265}.header-actual[_ngcontent-%COMP%]{color:#ff8983}.eval-case-edit-button[_ngcontent-%COMP%]{cursor:pointer;margin-left:4px;margin-right:4px}.eval-pass[_ngcontent-%COMP%]{display:flex;color:#44c265}.eval-fail[_ngcontent-%COMP%]{display:flex;color:#ff8983}.navigation-button-sidepanel[_ngcontent-%COMP%]{margin-left:auto;margin-right:20px}.chat-input[_ngcontent-%COMP%]{display:flex;padding:10px;width:60%;margin:0 auto}.hidden[_ngcontent-%COMP%]{visibility:hidden}.input-field[_ngcontent-%COMP%]{flex-grow:1}.input-field[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{color:#fff;border:none;padding:10px;box-sizing:content-box}.input-field[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]::placeholder{color:#8e918f}.input-field[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:#fff;background-color:#333537}.chat-input-actions[_ngcontent-%COMP%]{width:106%;margin-top:10px;display:flex;justify-content:space-between}.chat-input-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin-left:10px;margin-right:10px}.fab-button[_ngcontent-%COMP%]{position:fixed;bottom:200px;right:100px;z-index:1000}.sidepanel-toggle[_ngcontent-%COMP%]{position:relative;top:100px;z-index:1000}.side-drawer[_ngcontent-%COMP%]{background-color:#1b1b1b;color:#fff;border-radius:0}.tabs-container[_ngcontent-%COMP%]{width:100%;margin-top:20px}.tab-label[_ngcontent-%COMP%]{font-size:14px}.file-preview[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:5px;margin-top:2px;margin-bottom:8px}.file-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:5px;background:#eee;padding:5px;border-radius:4px}.image-preview[_ngcontent-%COMP%]{width:40px;height:40px;object-fit:cover;border-radius:4px}.image-preview-chat[_ngcontent-%COMP%]{max-width:90%;max-height:70vh;width:auto;height:auto;border-radius:8px;cursor:pointer;transition:transform .2s ease-in-out}button[_ngcontent-%COMP%]{margin-left:20px;margin-right:20px}.app-select[_ngcontent-%COMP%]{width:100%}.empty-state-container[_ngcontent-%COMP%]{color:#eee;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;font-family:Google Sans,sans-serif;font-weight:400;letter-spacing:normal;line-height:24px;font-size:18px}.empty-state-container[_ngcontent-%COMP%] pre.warning[_ngcontent-%COMP%]{color:#ffc185}.empty-state-container[_ngcontent-%COMP%] pre.error[_ngcontent-%COMP%]{color:#ff4545}[_nghost-%COMP%] .mat-mdc-unelevated-button:not(:disabled){color:#202124;background-color:#8ab4f8}[_nghost-%COMP%] .message-text p{white-space:pre-line;word-break:break-word;overflow-wrap:break-word}[_nghost-%COMP%] .mdc-linear-progress__buffer-dots{background:#fff}[_nghost-%COMP%] .mat-mdc-select-arrow-wrapper{margin-left:4px}[_nghost-%COMP%] .mat-mdc-text-field-wrapper{border:1px solid #8e918f}[_nghost-%COMP%] .input-field .mat-mdc-text-field-wrapper{border:1px solid #8e918f;border-radius:16px}[_nghost-%COMP%] .mdc-notched-outline__leading, [_nghost-%COMP%] .mdc-notched-outline__notch, [_nghost-%COMP%] .mdc-notched-outline__trailing{border:none}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{padding:0 10px 0 40px}[_nghost-%COMP%] .segment-key{color:#d3d3d3!important}[_nghost-%COMP%] .mat-mdc-mini-fab{background-color:#fff}[_nghost-%COMP%] .mat-mdc-mini-fab mat-icon{color:#000}.mat-mdc-select-placeholder[_ngcontent-%COMP%]{margin-left:20px}.resize-handler[_ngcontent-%COMP%]{background:#5f6368;width:4px;border-radius:4px;position:absolute;display:block;height:20%;top:40%;right:0;z-index:9999;cursor:ew-resize}.bottom-resize-handler[_ngcontent-%COMP%]{background:#5f6368;height:5px;border-radius:4px;position:absolute;display:block;width:20%;left:40%;top:0;right:0;z-index:9999;cursor:ns-resize}.trace-detail-container[_ngcontent-%COMP%]{position:relative;background-color:#1b1b1b}.trace-detail-container[_ngcontent-%COMP%] app-trace-event[_ngcontent-%COMP%]{padding-top:8px}.new-session-button[_ngcontent-%COMP%]{margin-top:0;margin-left:50px;width:130px;height:28px;font-size:14px}.app-select-container[_ngcontent-%COMP%]{width:35%;margin-top:12px;background-color:#212123;margin-left:10px;height:30px;display:flex;justify-content:space-between;padding-left:20px;padding-right:20px;border-radius:10px;padding-top:5px}.app-select-container[_ngcontent-%COMP%]{--mat-select-placeholder-text-color: #8ab4f8}.app-select-container[_ngcontent-%COMP%]{--mat-select-enabled-trigger-text-color: #8ab4f8}.app-select-container[_ngcontent-%COMP%]{--mat-select-enabled-arrow-color: #8ab4f8}.json-viewer-container[_ngcontent-%COMP%]{margin:10px}.event-paginator[_ngcontent-%COMP%]{margin-top:-8px;margin-right:auto;background-color:inherit;display:flex;justify-content:center}[_nghost-%COMP%] .mat-mdc-paginator-page-size{display:none!important}.details-panel-container[_ngcontent-%COMP%]{position:absolute;width:100%;height:98%;left:0;right:0;bottom:0;background:#242424;display:inline-block;justify-content:center;align-items:center;z-index:10}.details-content[_ngcontent-%COMP%]{color:#fff;font-size:14px}.adk-checkbox[_ngcontent-%COMP%]{position:fixed;bottom:0;left:0;right:0;margin-bottom:20px;margin-left:20px}.drawer-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.drawer-header[_ngcontent-%COMP%]{--mdc-filled-button-container-color: #89b4f8}.drawer-header[_ngcontent-%COMP%]{--mdc-filled-button-label-text-color: black}.chat-toolbar[_ngcontent-%COMP%]{position:sticky;top:0;height:48px;background:#1b1b1b;display:flex;align-items:center;z-index:10}.chat-toolbar.edit-mode[_ngcontent-%COMP%]{background:#44c2651a}.attachment[_ngcontent-%COMP%]{display:flex;align-items:center}.toolbar-actions[_ngcontent-%COMP%]{margin-left:auto;display:flex;align-items:center}.toolbar-session-text[_ngcontent-%COMP%]{color:#fdfdfd;font-family:Roboto;font-size:12px;font-style:normal;font-weight:500;line-height:12px;letter-spacing:.8px;text-transform:uppercase;margin-left:20px;padding-top:4px}.toolbar-session-id[_ngcontent-%COMP%]{color:#9aa0a6;font-family:Google Sans Mono,monospace;font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:.25px;margin-left:5px}.toolbar-icon[_ngcontent-%COMP%]{width:24px;height:24px;color:#c4c7c5;cursor:pointer;margin-right:16px}.toolbar-new-sesison[_ngcontent-%COMP%]{font-size:14px;margin-right:16px;color:#9aa0a6;cursor:pointer;display:flex;align-items:center}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mat-switch-label-text-size: 14px}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mat-switch-label-text-color: #9aa0a6}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-track-color: #8ab4f9}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-focus-track-color: #8ab4f9}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-hover-track-color: #8ab4f9}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-handle-color: #1b73e8}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-focus-handle-color: #1b73e8}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-selected-hover-handle-color: #1b73e8}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-track-height: 24px}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mdc-switch-track-width: 46px}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mat-switch-track-outline-color: #1b73e8}.toolbar-sse-toggle[_ngcontent-%COMP%]{--mat-switch-with-icon-handle-size: 20px}.image-container[_ngcontent-%COMP%]{position:relative;display:inline-block;border-radius:12px;overflow:hidden}.image-preview[_ngcontent-%COMP%]{display:block;width:100%;height:auto;border-radius:12px;width:80px;height:80px}.delete-button[_ngcontent-%COMP%]{position:absolute;top:1px;right:1px;background-color:#000000b3;border:none;border-radius:50%;padding:8px;cursor:pointer;color:#fff;display:flex;align-items:center;justify-content:center;margin-right:0;scale:.7}.delete-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px}.file-container[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;gap:8px;height:80px;background-color:#1e1e1e;border-radius:12px}.file-info[_ngcontent-%COMP%]{margin-right:60px;padding-top:20px;padding-left:16px}.thought-chip[_ngcontent-%COMP%]{border-radius:5px;background-color:#8ab4f8;width:80px;text-align:center;margin-top:5px}.event-graph-container[_ngcontent-%COMP%]{margin-top:16px;margin-bottom:16px;display:flex;justify-content:center;max-height:33%;cursor:pointer}.event-graph-container[_ngcontent-%COMP%] svg{width:100%;height:100%;display:block;object-fit:contain}.event-graph-container[_ngcontent-%COMP%] svg text{font-family:Google Sans Mono,monospace;font-size:11px}[_nghost-%COMP%] pre{white-space:pre-wrap;word-break:break-word;overflow-x:auto;max-width:100%}.link-style-button[_ngcontent-%COMP%]{background:none;border:none;padding:0;font:inherit;color:#007bff!important;text-decoration:underline;cursor:pointer;outline:none;font-size:14px}.drawer-logo[_ngcontent-%COMP%]{margin-left:9px;display:flex;align-items:center;font-size:16px;font-style:normal;font-weight:500;line-height:24px;letter-spacing:.1px}.drawer-logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{margin-right:9px} .mat-drawer-content{display:flex!important} .mat-drawer{border-right:1px solid #444746!important}.app-name-option[_ngcontent-%COMP%], .app-select[_ngcontent-%COMP%]{color:#9aa0a6;font-family:Google Sans Mono,monospace;font-style:normal;font-weight:400;padding-left:unset}"],changeDetection:0})};var mh=class t{title="agent_framework_web";userId="";appName="";sessionId="";constructor(){}static \u0275fac=function(A){return new(A||t)};static \u0275cmp=YA({type:t,selectors:[["app-root"]],standalone:!1,decls:1,vars:0,template:function(A,i){A&1&&UA(0,"app-chat")},dependencies:[ff],encapsulation:2})};var jjA=[{path:"",component:mh}],$y=class t{static \u0275fac=function(A){return new(A||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[R6.forRoot(jjA),R6]})};function ilA(t){return new ZA(3e3,!1)}function qjA(){return new ZA(3100,!1)}function VjA(){return new ZA(3101,!1)}function ZjA(t){return new ZA(3001,!1)}function WjA(t){return new ZA(3003,!1)}function XjA(t){return new ZA(3004,!1)}function olA(t,e){return new ZA(3005,!1)}function rlA(){return new ZA(3006,!1)}function slA(){return new ZA(3007,!1)}function alA(t,e){return new ZA(3008,!1)}function clA(t){return new ZA(3002,!1)}function llA(t,e,A,i,n){return new ZA(3010,!1)}function glA(){return new ZA(3011,!1)}function IlA(){return new ZA(3012,!1)}function ClA(){return new ZA(3200,!1)}function dlA(){return new ZA(3202,!1)}function BlA(){return new ZA(3013,!1)}function ElA(t){return new ZA(3014,!1)}function hlA(t){return new ZA(3015,!1)}function QlA(t){return new ZA(3016,!1)}function ulA(t,e){return new ZA(3404,!1)}function $jA(t){return new ZA(3502,!1)}function flA(t){return new ZA(3503,!1)}function mlA(){return new ZA(3300,!1)}function plA(t){return new ZA(3504,!1)}function wlA(t){return new ZA(3301,!1)}function DlA(t,e){return new ZA(3302,!1)}function ylA(t){return new ZA(3303,!1)}function vlA(t,e){return new ZA(3400,!1)}function blA(t){return new ZA(3401,!1)}function MlA(t){return new ZA(3402,!1)}function klA(t,e){return new ZA(3505,!1)}function n2(t){switch(t.length){case 0:return new ag;case 1:return t[0];default:return new JI(t)}}function iU(t,e,A=new Map,i=new Map){let n=[],o=[],r=-1,s=null;if(e.forEach(a=>{let c=a.get("offset"),l=c==r,I=l&&s||new Map;a.forEach((C,d)=>{let B=d,E=C;if(d!=="offset")switch(B=t.normalizePropertyName(B,n),E){case mB:E=A.get(d);break;case pc:E=i.get(d);break;default:E=t.normalizeStyleValue(d,B,E,n);break}I.set(B,E)}),l||o.push(I),s=I,r=c}),n.length)throw $jA(n);return o}function A7(t,e,A,i){switch(e){case"start":t.onStart(()=>i(A&&AU(A,"start",t)));break;case"done":t.onDone(()=>i(A&&AU(A,"done",t)));break;case"destroy":t.onDestroy(()=>i(A&&AU(A,"destroy",t)));break}}function AU(t,e,A){let i=A.totalTime,n=!!A.disabled,o=e7(t.element,t.triggerName,t.fromState,t.toState,e||t.phaseName,i??t.totalTime,n),r=t._data;return r!=null&&(o._data=r),o}function e7(t,e,A,i,n="",o=0,r){return{element:t,triggerName:e,fromState:A,toState:i,phaseName:n,totalTime:o,disabled:!!r}}function Sa(t,e,A){let i=t.get(e);return i||t.set(e,i=A),i}function nU(t){let e=t.indexOf(":"),A=t.substring(1,e),i=t.slice(e+1);return[A,i]}var AqA=typeof document>"u"?null:document.documentElement;function t7(t){let e=t.parentNode||t.host||null;return e===AqA?null:e}function eqA(t){return t.substring(1,6)=="ebkit"}var WC=null,nlA=!1;function SlA(t){WC||(WC=tqA()||{},nlA=WC.style?"WebkitAppearance"in WC.style:!1);let e=!0;return WC.style&&!eqA(t)&&(e=t in WC.style,!e&&nlA&&(e="Webkit"+t.charAt(0).toUpperCase()+t.slice(1)in WC.style)),e}function tqA(){return typeof document<"u"?document.body:null}function oU(t,e){for(;e;){if(e===t)return!0;e=t7(e)}return!1}function rU(t,e,A){if(A)return Array.from(t.querySelectorAll(e));let i=t.querySelector(e);return i?[i]:[]}var iqA=1e3,sU="{{",nqA="}}",aU="ng-enter",i7="ng-leave",mf="ng-trigger",pf=".ng-trigger",cU="ng-animating",n7=".ng-animating";function Pg(t){if(typeof t=="number")return t;let e=t.match(/^(-?[\.\d]+)(m?s)/);return!e||e.length<2?0:eU(parseFloat(e[1]),e[2])}function eU(t,e){switch(e){case"s":return t*iqA;default:return t}}function wf(t,e,A){return t.hasOwnProperty("duration")?t:oqA(t,e,A)}function oqA(t,e,A){let i=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i,n,o=0,r="";if(typeof t=="string"){let s=t.match(i);if(s===null)return e.push(ilA(t)),{duration:0,delay:0,easing:""};n=eU(parseFloat(s[1]),s[2]);let a=s[3];a!=null&&(o=eU(parseFloat(a),s[4]));let c=s[5];c&&(r=c)}else n=t;if(!A){let s=!1,a=e.length;n<0&&(e.push(qjA()),s=!0),o<0&&(e.push(VjA()),s=!0),s&&e.splice(a,0,ilA(t))}return{duration:n,delay:o,easing:r}}function RlA(t){return t.length?t[0]instanceof Map?t:t.map(e=>new Map(Object.entries(e))):[]}function Nl(t,e,A){e.forEach((i,n)=>{let o=o7(n);A&&!A.has(n)&&A.set(n,t.style[o]),t.style[o]=i})}function q1(t,e){e.forEach((A,i)=>{let n=o7(i);t.style[n]=""})}function ph(t){return Array.isArray(t)?t.length==1?t[0]:tP(t):t}function LlA(t,e,A){let i=e.params||{},n=lU(t);n.length&&n.forEach(o=>{i.hasOwnProperty(o)||A.push(ZjA(o))})}var tU=new RegExp(`${sU}\\s*(.+?)\\s*${nqA}`,"g");function lU(t){let e=[];if(typeof t=="string"){let A;for(;A=tU.exec(t);)e.push(A[1]);tU.lastIndex=0}return e}function wh(t,e,A){let i=`${t}`,n=i.replace(tU,(o,r)=>{let s=e[r];return s==null&&(A.push(WjA(r)),s=""),s.toString()});return n==i?t:n}var rqA=/-+([a-z0-9])/g;function o7(t){return t.replace(rqA,(...e)=>e[1].toUpperCase())}function xlA(t,e){return t===0||e===0}function FlA(t,e,A){if(A.size&&e.length){let i=e[0],n=[];if(A.forEach((o,r)=>{i.has(r)||n.push(r),i.set(r,o)}),n.length)for(let o=1;or.set(s,r7(t,s)))}}return e}function Ra(t,e,A){switch(e.type){case Wt.Trigger:return t.visitTrigger(e,A);case Wt.State:return t.visitState(e,A);case Wt.Transition:return t.visitTransition(e,A);case Wt.Sequence:return t.visitSequence(e,A);case Wt.Group:return t.visitGroup(e,A);case Wt.Animate:return t.visitAnimate(e,A);case Wt.Keyframes:return t.visitKeyframes(e,A);case Wt.Style:return t.visitStyle(e,A);case Wt.Reference:return t.visitReference(e,A);case Wt.AnimateChild:return t.visitAnimateChild(e,A);case Wt.AnimateRef:return t.visitAnimateRef(e,A);case Wt.Query:return t.visitQuery(e,A);case Wt.Stagger:return t.visitStagger(e,A);default:throw XjA(e.type)}}function r7(t,e){return window.getComputedStyle(t)[e]}var bU=(()=>{class t{validateStyleProperty(A){return SlA(A)}containsElement(A,i){return oU(A,i)}getParentElement(A){return t7(A)}query(A,i,n){return rU(A,i,n)}computeStyle(A,i,n){return n||""}animate(A,i,n,o,r,s=[],a){return new ag(n,o)}static \u0275fac=function(i){return new(i||t)};static \u0275prov=SA({token:t,factory:t.\u0275fac})}return t})(),$C=class{static NOOP=new bU},Ad=class{};var sqA=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),g7=class extends Ad{normalizePropertyName(e,A){return o7(e)}normalizeStyleValue(e,A,i,n){let o="",r=i.toString().trim();if(sqA.has(A)&&i!==0&&i!=="0")if(typeof i=="number")o="px";else{let s=i.match(/^[+-]?[\d\.]+([a-z]*)$/);s&&s[1].length==0&&n.push(olA(e,i))}return r+o}};var I7="*";function aqA(t,e){let A=[];return typeof t=="string"?t.split(/\s*,\s*/).forEach(i=>cqA(i,A,e)):A.push(t),A}function cqA(t,e,A){if(t[0]==":"){let a=lqA(t,A);if(typeof a=="function"){e.push(a);return}t=a}let i=t.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/);if(i==null||i.length<4)return A.push(hlA(t)),e;let n=i[1],o=i[2],r=i[3];e.push(NlA(n,r));let s=n==I7&&r==I7;o[0]=="<"&&!s&&e.push(NlA(r,n))}function lqA(t,e){switch(t){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(A,i)=>parseFloat(i)>parseFloat(A);case":decrement":return(A,i)=>parseFloat(i) *"}}var s7=new Set(["true","1"]),a7=new Set(["false","0"]);function NlA(t,e){let A=s7.has(t)||a7.has(t),i=s7.has(e)||a7.has(e);return(n,o)=>{let r=t==I7||t==n,s=e==I7||e==o;return!r&&A&&typeof n=="boolean"&&(r=n?s7.has(t):a7.has(t)),!s&&i&&typeof o=="boolean"&&(s=o?s7.has(e):a7.has(e)),r&&s}}var OlA=":self",gqA=new RegExp(`s*${OlA}s*,?`,"g");function PlA(t,e,A,i){return new EU(t).build(e,A,i)}var _lA="",EU=class{_driver;constructor(e){this._driver=e}build(e,A,i){let n=new hU(A);return this._resetContextStyleTimingState(n),Ra(this,ph(e),n)}_resetContextStyleTimingState(e){e.currentQuerySelector=_lA,e.collectedStyles=new Map,e.collectedStyles.set(_lA,new Map),e.currentTime=0}visitTrigger(e,A){let i=A.queryCount=0,n=A.depCount=0,o=[],r=[];return e.name.charAt(0)=="@"&&A.errors.push(rlA()),e.definitions.forEach(s=>{if(this._resetContextStyleTimingState(A),s.type==Wt.State){let a=s,c=a.name;c.toString().split(/\s*,\s*/).forEach(l=>{a.name=l,o.push(this.visitState(a,A))}),a.name=c}else if(s.type==Wt.Transition){let a=this.visitTransition(s,A);i+=a.queryCount,n+=a.depCount,r.push(a)}else A.errors.push(slA())}),{type:Wt.Trigger,name:e.name,states:o,transitions:r,queryCount:i,depCount:n,options:null}}visitState(e,A){let i=this.visitStyle(e.styles,A),n=e.options&&e.options.params||null;if(i.containsDynamicStyles){let o=new Set,r=n||{};i.styles.forEach(s=>{s instanceof Map&&s.forEach(a=>{lU(a).forEach(c=>{r.hasOwnProperty(c)||o.add(c)})})}),o.size&&A.errors.push(alA(e.name,[...o.values()]))}return{type:Wt.State,name:e.name,style:i,options:n?{params:n}:null}}visitTransition(e,A){A.queryCount=0,A.depCount=0;let i=Ra(this,ph(e.animation),A),n=aqA(e.expr,A.errors);return{type:Wt.Transition,matchers:n,animation:i,queryCount:A.queryCount,depCount:A.depCount,options:XC(e.options)}}visitSequence(e,A){return{type:Wt.Sequence,steps:e.steps.map(i=>Ra(this,i,A)),options:XC(e.options)}}visitGroup(e,A){let i=A.currentTime,n=0,o=e.steps.map(r=>{A.currentTime=i;let s=Ra(this,r,A);return n=Math.max(n,A.currentTime),s});return A.currentTime=n,{type:Wt.Group,steps:o,options:XC(e.options)}}visitAnimate(e,A){let i=BqA(e.timings,A.errors);A.currentAnimateTimings=i;let n,o=e.styles?e.styles:ar({});if(o.type==Wt.Keyframes)n=this.visitKeyframes(o,A);else{let r=e.styles,s=!1;if(!r){s=!0;let c={};i.easing&&(c.easing=i.easing),r=ar(c)}A.currentTime+=i.duration+i.delay;let a=this.visitStyle(r,A);a.isEmptyStep=s,n=a}return A.currentAnimateTimings=null,{type:Wt.Animate,timings:i,style:n,options:null}}visitStyle(e,A){let i=this._makeStyleAst(e,A);return this._validateStyleAst(i,A),i}_makeStyleAst(e,A){let i=[],n=Array.isArray(e.styles)?e.styles:[e.styles];for(let s of n)typeof s=="string"?s===pc?i.push(s):A.errors.push(clA(s)):i.push(new Map(Object.entries(s)));let o=!1,r=null;return i.forEach(s=>{if(s instanceof Map&&(s.has("easing")&&(r=s.get("easing"),s.delete("easing")),!o)){for(let a of s.values())if(a.toString().indexOf(sU)>=0){o=!0;break}}}),{type:Wt.Style,styles:i,easing:r,offset:e.offset,containsDynamicStyles:o,options:null}}_validateStyleAst(e,A){let i=A.currentAnimateTimings,n=A.currentTime,o=A.currentTime;i&&o>0&&(o-=i.duration+i.delay),e.styles.forEach(r=>{typeof r!="string"&&r.forEach((s,a)=>{let c=A.collectedStyles.get(A.currentQuerySelector),l=c.get(a),I=!0;l&&(o!=n&&o>=l.startTime&&n<=l.endTime&&(A.errors.push(llA(a,l.startTime,l.endTime,o,n)),I=!1),o=l.startTime),I&&c.set(a,{startTime:o,endTime:n}),A.options&&LlA(s,A.options,A.errors)})})}visitKeyframes(e,A){let i={type:Wt.Keyframes,styles:[],options:null};if(!A.currentAnimateTimings)return A.errors.push(glA()),i;let n=1,o=0,r=[],s=!1,a=!1,c=0,l=e.steps.map(u=>{let v=this._makeStyleAst(u,A),L=v.offset!=null?v.offset:dqA(v.styles),x=0;return L!=null&&(o++,x=v.offset=L),a=a||x<0||x>1,s=s||x0&&o{let L=C>0?v==d?1:C*v:r[v],x=L*Q;A.currentTime=B+E.delay+x,E.duration=x,this._validateStyleAst(u,A),u.offset=L,i.styles.push(u)}),i}visitReference(e,A){return{type:Wt.Reference,animation:Ra(this,ph(e.animation),A),options:XC(e.options)}}visitAnimateChild(e,A){return A.depCount++,{type:Wt.AnimateChild,options:XC(e.options)}}visitAnimateRef(e,A){return{type:Wt.AnimateRef,animation:this.visitReference(e.animation,A),options:XC(e.options)}}visitQuery(e,A){let i=A.currentQuerySelector,n=e.options||{};A.queryCount++,A.currentQuery=e;let[o,r]=IqA(e.selector);A.currentQuerySelector=i.length?i+" "+o:o,Sa(A.collectedStyles,A.currentQuerySelector,new Map);let s=Ra(this,ph(e.animation),A);return A.currentQuery=null,A.currentQuerySelector=i,{type:Wt.Query,selector:o,limit:n.limit||0,optional:!!n.optional,includeSelf:r,animation:s,originalSelector:e.selector,options:XC(e.options)}}visitStagger(e,A){A.currentQuery||A.errors.push(BlA());let i=e.timings==="full"?{duration:0,delay:0,easing:"full"}:wf(e.timings,A.errors,!0);return{type:Wt.Stagger,animation:Ra(this,ph(e.animation),A),timings:i,options:null}}};function IqA(t){let e=!!t.split(/\s*,\s*/).find(A=>A==OlA);return e&&(t=t.replace(gqA,"")),t=t.replace(/@\*/g,pf).replace(/@\w+/g,A=>pf+"-"+A.slice(1)).replace(/:animating/g,n7),[t,e]}function CqA(t){return t?nA({},t):null}var hU=class{errors;queryCount=0;depCount=0;currentTransition=null;currentQuery=null;currentQuerySelector=null;currentAnimateTimings=null;currentTime=0;collectedStyles=new Map;options=null;unsupportedCSSPropertiesFound=new Set;constructor(e){this.errors=e}};function dqA(t){if(typeof t=="string")return null;let e=null;if(Array.isArray(t))t.forEach(A=>{if(A instanceof Map&&A.has("offset")){let i=A;e=parseFloat(i.get("offset")),i.delete("offset")}});else if(t instanceof Map&&t.has("offset")){let A=t;e=parseFloat(A.get("offset")),A.delete("offset")}return e}function BqA(t,e){if(t.hasOwnProperty("duration"))return t;if(typeof t=="number"){let o=wf(t,e).duration;return gU(o,0,"")}let A=t;if(A.split(/\s+/).some(o=>o.charAt(0)=="{"&&o.charAt(1)=="{")){let o=gU(0,0,"");return o.dynamic=!0,o.strValue=A,o}let n=wf(A,e);return gU(n.duration,n.delay,n.easing)}function XC(t){return t?(t=nA({},t),t.params&&(t.params=CqA(t.params))):t={},t}function gU(t,e,A){return{duration:t,delay:e,easing:A}}function MU(t,e,A,i,n,o,r=null,s=!1){return{type:1,element:t,keyframes:e,preStyleProps:A,postStyleProps:i,duration:n,delay:o,totalTime:n+o,easing:r,subTimeline:s}}var yf=class{_map=new Map;get(e){return this._map.get(e)||[]}append(e,A){let i=this._map.get(e);i||this._map.set(e,i=[]),i.push(...A)}has(e){return this._map.has(e)}clear(){this._map.clear()}},EqA=1,hqA=":enter",QqA=new RegExp(hqA,"g"),uqA=":leave",fqA=new RegExp(uqA,"g");function jlA(t,e,A,i,n,o=new Map,r=new Map,s,a,c=[]){return new QU().buildKeyframes(t,e,A,i,n,o,r,s,a,c)}var QU=class{buildKeyframes(e,A,i,n,o,r,s,a,c,l=[]){c=c||new yf;let I=new uU(e,A,c,n,o,l,[]);I.options=a;let C=a.delay?Pg(a.delay):0;I.currentTimeline.delayNextStep(C),I.currentTimeline.setStyles([r],null,I.errors,a),Ra(this,i,I);let d=I.timelines.filter(B=>B.containsAnimation());if(d.length&&s.size){let B;for(let E=d.length-1;E>=0;E--){let Q=d[E];if(Q.element===A){B=Q;break}}B&&!B.allowOnlyTimelineStyles()&&B.setStyles([s],null,I.errors,a)}return d.length?d.map(B=>B.buildKeyframes()):[MU(A,[],[],[],0,C,"",!1)]}visitTrigger(e,A){}visitState(e,A){}visitTransition(e,A){}visitAnimateChild(e,A){let i=A.subInstructions.get(A.element);if(i){let n=A.createSubContext(e.options),o=A.currentTimeline.currentTime,r=this._visitSubInstructions(i,n,n.options);o!=r&&A.transformIntoNewTimeline(r)}A.previousNode=e}visitAnimateRef(e,A){let i=A.createSubContext(e.options);i.transformIntoNewTimeline(),this._applyAnimationRefDelays([e.options,e.animation.options],A,i),this.visitReference(e.animation,i),A.transformIntoNewTimeline(i.currentTimeline.currentTime),A.previousNode=e}_applyAnimationRefDelays(e,A,i){for(let n of e){let o=n?.delay;if(o){let r=typeof o=="number"?o:Pg(wh(o,n?.params??{},A.errors));i.delayNextStep(r)}}}_visitSubInstructions(e,A,i){let o=A.currentTimeline.currentTime,r=i.duration!=null?Pg(i.duration):null,s=i.delay!=null?Pg(i.delay):null;return r!==0&&e.forEach(a=>{let c=A.appendInstructionToTimeline(a,r,s);o=Math.max(o,c.duration+c.delay)}),o}visitReference(e,A){A.updateOptions(e.options,!0),Ra(this,e.animation,A),A.previousNode=e}visitSequence(e,A){let i=A.subContextCount,n=A,o=e.options;if(o&&(o.params||o.delay)&&(n=A.createSubContext(o),n.transformIntoNewTimeline(),o.delay!=null)){n.previousNode.type==Wt.Style&&(n.currentTimeline.snapshotCurrentStyles(),n.previousNode=C7);let r=Pg(o.delay);n.delayNextStep(r)}e.steps.length&&(e.steps.forEach(r=>Ra(this,r,n)),n.currentTimeline.applyStylesToKeyframe(),n.subContextCount>i&&n.transformIntoNewTimeline()),A.previousNode=e}visitGroup(e,A){let i=[],n=A.currentTimeline.currentTime,o=e.options&&e.options.delay?Pg(e.options.delay):0;e.steps.forEach(r=>{let s=A.createSubContext(e.options);o&&s.delayNextStep(o),Ra(this,r,s),n=Math.max(n,s.currentTimeline.currentTime),i.push(s.currentTimeline)}),i.forEach(r=>A.currentTimeline.mergeTimelineCollectedStyles(r)),A.transformIntoNewTimeline(n),A.previousNode=e}_visitTiming(e,A){if(e.dynamic){let i=e.strValue,n=A.params?wh(i,A.params,A.errors):i;return wf(n,A.errors)}else return{duration:e.duration,delay:e.delay,easing:e.easing}}visitAnimate(e,A){let i=A.currentAnimateTimings=this._visitTiming(e.timings,A),n=A.currentTimeline;i.delay&&(A.incrementTime(i.delay),n.snapshotCurrentStyles());let o=e.style;o.type==Wt.Keyframes?this.visitKeyframes(o,A):(A.incrementTime(i.duration),this.visitStyle(o,A),n.applyStylesToKeyframe()),A.currentAnimateTimings=null,A.previousNode=e}visitStyle(e,A){let i=A.currentTimeline,n=A.currentAnimateTimings;!n&&i.hasCurrentStyleProperties()&&i.forwardFrame();let o=n&&n.easing||e.easing;e.isEmptyStep?i.applyEmptyStep(o):i.setStyles(e.styles,o,A.errors,A.options),A.previousNode=e}visitKeyframes(e,A){let i=A.currentAnimateTimings,n=A.currentTimeline.duration,o=i.duration,s=A.createSubContext().currentTimeline;s.easing=i.easing,e.styles.forEach(a=>{let c=a.offset||0;s.forwardTime(c*o),s.setStyles(a.styles,a.easing,A.errors,A.options),s.applyStylesToKeyframe()}),A.currentTimeline.mergeTimelineCollectedStyles(s),A.transformIntoNewTimeline(n+o),A.previousNode=e}visitQuery(e,A){let i=A.currentTimeline.currentTime,n=e.options||{},o=n.delay?Pg(n.delay):0;o&&(A.previousNode.type===Wt.Style||i==0&&A.currentTimeline.hasCurrentStyleProperties())&&(A.currentTimeline.snapshotCurrentStyles(),A.previousNode=C7);let r=i,s=A.invokeQuery(e.selector,e.originalSelector,e.limit,e.includeSelf,!!n.optional,A.errors);A.currentQueryTotal=s.length;let a=null;s.forEach((c,l)=>{A.currentQueryIndex=l;let I=A.createSubContext(e.options,c);o&&I.delayNextStep(o),c===A.element&&(a=I.currentTimeline),Ra(this,e.animation,I),I.currentTimeline.applyStylesToKeyframe();let C=I.currentTimeline.currentTime;r=Math.max(r,C)}),A.currentQueryIndex=0,A.currentQueryTotal=0,A.transformIntoNewTimeline(r),a&&(A.currentTimeline.mergeTimelineCollectedStyles(a),A.currentTimeline.snapshotCurrentStyles()),A.previousNode=e}visitStagger(e,A){let i=A.parentContext,n=A.currentTimeline,o=e.timings,r=Math.abs(o.duration),s=r*(A.currentQueryTotal-1),a=r*A.currentQueryIndex;switch(o.duration<0?"reverse":o.easing){case"reverse":a=s-a;break;case"full":a=i.currentStaggerTime;break}let l=A.currentTimeline;a&&l.delayNextStep(a);let I=l.currentTime;Ra(this,e.animation,A),A.previousNode=e,i.currentStaggerTime=n.currentTime-I+(n.startTime-i.currentTimeline.startTime)}},C7={},uU=class t{_driver;element;subInstructions;_enterClassName;_leaveClassName;errors;timelines;parentContext=null;currentTimeline;currentAnimateTimings=null;previousNode=C7;subContextCount=0;options={};currentQueryIndex=0;currentQueryTotal=0;currentStaggerTime=0;constructor(e,A,i,n,o,r,s,a){this._driver=e,this.element=A,this.subInstructions=i,this._enterClassName=n,this._leaveClassName=o,this.errors=r,this.timelines=s,this.currentTimeline=a||new d7(this._driver,A,0),s.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(e,A){if(!e)return;let i=e,n=this.options;i.duration!=null&&(n.duration=Pg(i.duration)),i.delay!=null&&(n.delay=Pg(i.delay));let o=i.params;if(o){let r=n.params;r||(r=this.options.params={}),Object.keys(o).forEach(s=>{(!A||!r.hasOwnProperty(s))&&(r[s]=wh(o[s],r,this.errors))})}}_copyOptions(){let e={};if(this.options){let A=this.options.params;if(A){let i=e.params={};Object.keys(A).forEach(n=>{i[n]=A[n]})}}return e}createSubContext(e=null,A,i){let n=A||this.element,o=new t(this._driver,n,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(n,i||0));return o.previousNode=this.previousNode,o.currentAnimateTimings=this.currentAnimateTimings,o.options=this._copyOptions(),o.updateOptions(e),o.currentQueryIndex=this.currentQueryIndex,o.currentQueryTotal=this.currentQueryTotal,o.parentContext=this,this.subContextCount++,o}transformIntoNewTimeline(e){return this.previousNode=C7,this.currentTimeline=this.currentTimeline.fork(this.element,e),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(e,A,i){let n={duration:A??e.duration,delay:this.currentTimeline.currentTime+(i??0)+e.delay,easing:""},o=new fU(this._driver,e.element,e.keyframes,e.preStyleProps,e.postStyleProps,n,e.stretchStartingKeyframe);return this.timelines.push(o),n}incrementTime(e){this.currentTimeline.forwardTime(this.currentTimeline.duration+e)}delayNextStep(e){e>0&&this.currentTimeline.delayNextStep(e)}invokeQuery(e,A,i,n,o,r){let s=[];if(n&&s.push(this.element),e.length>0){e=e.replace(QqA,"."+this._enterClassName),e=e.replace(fqA,"."+this._leaveClassName);let a=i!=1,c=this._driver.query(this.element,e,a);i!==0&&(c=i<0?c.slice(c.length+i,c.length):c.slice(0,i)),s.push(...c)}return!o&&s.length==0&&r.push(ElA(A)),s}},d7=class t{_driver;element;startTime;_elementTimelineStylesLookup;duration=0;easing=null;_previousKeyframe=new Map;_currentKeyframe=new Map;_keyframes=new Map;_styleSummary=new Map;_localTimelineStyles=new Map;_globalTimelineStyles;_pendingStyles=new Map;_backFill=new Map;_currentEmptyStepKeyframe=null;constructor(e,A,i,n){this._driver=e,this.element=A,this.startTime=i,this._elementTimelineStylesLookup=n,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(A),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(A,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(e){let A=this._keyframes.size===1&&this._pendingStyles.size;this.duration||A?(this.forwardTime(this.currentTime+e),A&&this.snapshotCurrentStyles()):this.startTime+=e}fork(e,A){return this.applyStylesToKeyframe(),new t(this._driver,e,A||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=EqA,this._loadKeyframe()}forwardTime(e){this.applyStylesToKeyframe(),this.duration=e,this._loadKeyframe()}_updateStyle(e,A){this._localTimelineStyles.set(e,A),this._globalTimelineStyles.set(e,A),this._styleSummary.set(e,{time:this.currentTime,value:A})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(e){e&&this._previousKeyframe.set("easing",e);for(let[A,i]of this._globalTimelineStyles)this._backFill.set(A,i||pc),this._currentKeyframe.set(A,pc);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(e,A,i,n){A&&this._previousKeyframe.set("easing",A);let o=n&&n.params||{},r=mqA(e,this._globalTimelineStyles);for(let[s,a]of r){let c=wh(a,o,i);this._pendingStyles.set(s,c),this._localTimelineStyles.has(s)||this._backFill.set(s,this._globalTimelineStyles.get(s)??pc),this._updateStyle(s,c)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((e,A)=>{this._currentKeyframe.set(A,e)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((e,A)=>{this._currentKeyframe.has(A)||this._currentKeyframe.set(A,e)}))}snapshotCurrentStyles(){for(let[e,A]of this._localTimelineStyles)this._pendingStyles.set(e,A),this._updateStyle(e,A)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let e=[];for(let A in this._currentKeyframe)e.push(A);return e}mergeTimelineCollectedStyles(e){e._styleSummary.forEach((A,i)=>{let n=this._styleSummary.get(i);(!n||A.time>n.time)&&this._updateStyle(i,A.value)})}buildKeyframes(){this.applyStylesToKeyframe();let e=new Set,A=new Set,i=this._keyframes.size===1&&this.duration===0,n=[];this._keyframes.forEach((s,a)=>{let c=new Map([...this._backFill,...s]);c.forEach((l,I)=>{l===mB?e.add(I):l===pc&&A.add(I)}),i||c.set("offset",a/this.duration),n.push(c)});let o=[...e.values()],r=[...A.values()];if(i){let s=n[0],a=new Map(s);s.set("offset",0),a.set("offset",1),n=[s,a]}return MU(this.element,n,o,r,this.duration,this.startTime,this.easing,!1)}},fU=class extends d7{keyframes;preStyleProps;postStyleProps;_stretchStartingKeyframe;timings;constructor(e,A,i,n,o,r,s=!1){super(e,A,r.delay),this.keyframes=i,this.preStyleProps=n,this.postStyleProps=o,this._stretchStartingKeyframe=s,this.timings={duration:r.duration,delay:r.delay,easing:r.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let e=this.keyframes,{delay:A,duration:i,easing:n}=this.timings;if(this._stretchStartingKeyframe&&A){let o=[],r=i+A,s=A/r,a=new Map(e[0]);a.set("offset",0),o.push(a);let c=new Map(e[0]);c.set("offset",GlA(s)),o.push(c);let l=e.length-1;for(let I=1;I<=l;I++){let C=new Map(e[I]),d=C.get("offset"),B=A+d*i;C.set("offset",GlA(B/r)),o.push(C)}i=r,A=0,n="",e=o}return MU(this.element,e,this.preStyleProps,this.postStyleProps,i,A,n,!0)}};function GlA(t,e=3){let A=Math.pow(10,e-1);return Math.round(t*A)/A}function mqA(t,e){let A=new Map,i;return t.forEach(n=>{if(n==="*"){i??=e.keys();for(let o of i)A.set(o,pc)}else for(let[o,r]of n)A.set(o,r)}),A}function UlA(t,e,A,i,n,o,r,s,a,c,l,I,C){return{type:0,element:t,triggerName:e,isRemovalTransition:n,fromState:A,fromStyles:o,toState:i,toStyles:r,timelines:s,queriedElements:a,preStyleProps:c,postStyleProps:l,totalTime:I,errors:C}}var IU={},B7=class{_triggerName;ast;_stateStyles;constructor(e,A,i){this._triggerName=e,this.ast=A,this._stateStyles=i}match(e,A,i,n){return pqA(this.ast.matchers,e,A,i,n)}buildStyles(e,A,i){let n=this._stateStyles.get("*");return e!==void 0&&(n=this._stateStyles.get(e?.toString())||n),n?n.buildStyles(A,i):new Map}build(e,A,i,n,o,r,s,a,c,l){let I=[],C=this.ast.options&&this.ast.options.params||IU,d=s&&s.params||IU,B=this.buildStyles(i,d,I),E=a&&a.params||IU,Q=this.buildStyles(n,E,I),u=new Set,v=new Map,L=new Map,x=n==="void",y={params:qlA(E,C),delay:this.ast.options?.delay},F=l?[]:jlA(e,A,this.ast.animation,o,r,B,Q,y,c,I),U=0;return F.forEach(T=>{U=Math.max(T.duration+T.delay,U)}),I.length?UlA(A,this._triggerName,i,n,x,B,Q,[],[],v,L,U,I):(F.forEach(T=>{let N=T.element,K=Sa(v,N,new Set);T.preStyleProps.forEach(j=>K.add(j));let H=Sa(L,N,new Set);T.postStyleProps.forEach(j=>H.add(j)),N!==A&&u.add(N)}),UlA(A,this._triggerName,i,n,x,B,Q,F,[...u.values()],v,L,U))}};function pqA(t,e,A,i,n){return t.some(o=>o(e,A,i,n))}function qlA(t,e){let A=nA({},e);return Object.entries(t).forEach(([i,n])=>{n!=null&&(A[i]=n)}),A}var mU=class{styles;defaultParams;normalizer;constructor(e,A,i){this.styles=e,this.defaultParams=A,this.normalizer=i}buildStyles(e,A){let i=new Map,n=qlA(e,this.defaultParams);return this.styles.styles.forEach(o=>{typeof o!="string"&&o.forEach((r,s)=>{r&&(r=wh(r,n,A));let a=this.normalizer.normalizePropertyName(s,A);r=this.normalizer.normalizeStyleValue(s,a,r,A),i.set(s,r)})}),i}};function wqA(t,e,A){return new pU(t,e,A)}var pU=class{name;ast;_normalizer;transitionFactories=[];fallbackTransition;states=new Map;constructor(e,A,i){this.name=e,this.ast=A,this._normalizer=i,A.states.forEach(n=>{let o=n.options&&n.options.params||{};this.states.set(n.name,new mU(n.style,o,i))}),KlA(this.states,"true","1"),KlA(this.states,"false","0"),A.transitions.forEach(n=>{this.transitionFactories.push(new B7(e,n,this.states))}),this.fallbackTransition=DqA(e,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(e,A,i,n){return this.transitionFactories.find(r=>r.match(e,A,i,n))||null}matchStyles(e,A,i){return this.fallbackTransition.buildStyles(e,A,i)}};function DqA(t,e,A){let i=[(r,s)=>!0],n={type:Wt.Sequence,steps:[],options:null},o={type:Wt.Transition,animation:n,matchers:i,options:null,queryCount:0,depCount:0};return new B7(t,o,e)}function KlA(t,e,A){t.has(e)?t.has(A)||t.set(A,t.get(e)):t.has(A)&&t.set(e,t.get(A))}var yqA=new yf,wU=class{bodyNode;_driver;_normalizer;_animations=new Map;_playersById=new Map;players=[];constructor(e,A,i){this.bodyNode=e,this._driver=A,this._normalizer=i}register(e,A){let i=[],n=[],o=PlA(this._driver,A,i,n);if(i.length)throw flA(i);this._animations.set(e,o)}_buildPlayer(e,A,i){let n=e.element,o=iU(this._normalizer,e.keyframes,A,i);return this._driver.animate(n,o,e.duration,e.delay,e.easing,[],!0)}create(e,A,i={}){let n=[],o=this._animations.get(e),r,s=new Map;if(o?(r=jlA(this._driver,A,o,aU,i7,new Map,new Map,i,yqA,n),r.forEach(l=>{let I=Sa(s,l.element,new Map);l.postStyleProps.forEach(C=>I.set(C,null))})):(n.push(mlA()),r=[]),n.length)throw plA(n);s.forEach((l,I)=>{l.forEach((C,d)=>{l.set(d,this._driver.computeStyle(I,d,pc))})});let a=r.map(l=>{let I=s.get(l.element);return this._buildPlayer(l,new Map,I)}),c=n2(a);return this._playersById.set(e,c),c.onDestroy(()=>this.destroy(e)),this.players.push(c),c}destroy(e){let A=this._getPlayer(e);A.destroy(),this._playersById.delete(e);let i=this.players.indexOf(A);i>=0&&this.players.splice(i,1)}_getPlayer(e){let A=this._playersById.get(e);if(!A)throw wlA(e);return A}listen(e,A,i,n){let o=e7(A,"","","");return A7(this._getPlayer(e),i,o,n),()=>{}}command(e,A,i,n){if(i=="register"){this.register(e,n[0]);return}if(i=="create"){let r=n[0]||{};this.create(e,A,r);return}let o=this._getPlayer(e);switch(i){case"play":o.play();break;case"pause":o.pause();break;case"reset":o.reset();break;case"restart":o.restart();break;case"finish":o.finish();break;case"init":o.init();break;case"setPosition":o.setPosition(parseFloat(n[0]));break;case"destroy":this.destroy(e);break}}},YlA="ng-animate-queued",vqA=".ng-animate-queued",CU="ng-animate-disabled",bqA=".ng-animate-disabled",MqA="ng-star-inserted",kqA=".ng-star-inserted",SqA=[],VlA={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},RqA={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},_l="__ng_removed",vf=class{namespaceId;value;options;get params(){return this.options.params}constructor(e,A=""){this.namespaceId=A;let i=e&&e.hasOwnProperty("value"),n=i?e.value:e;if(this.value=xqA(n),i){let o=e,{value:r}=o,s=y7(o,["value"]);this.options=s}else this.options={};this.options.params||(this.options.params={})}absorbOptions(e){let A=e.params;if(A){let i=this.options.params;Object.keys(A).forEach(n=>{i[n]==null&&(i[n]=A[n])})}}},Df="void",dU=new vf(Df),DU=class{id;hostElement;_engine;players=[];_triggers=new Map;_queue=[];_elementListeners=new Map;_hostClassName;constructor(e,A,i){this.id=e,this.hostElement=A,this._engine=i,this._hostClassName="ng-tns-"+e,Hc(A,this._hostClassName)}listen(e,A,i,n){if(!this._triggers.has(A))throw DlA(i,A);if(i==null||i.length==0)throw ylA(A);if(!FqA(i))throw vlA(i,A);let o=Sa(this._elementListeners,e,[]),r={name:A,phase:i,callback:n};o.push(r);let s=Sa(this._engine.statesByElement,e,new Map);return s.has(A)||(Hc(e,mf),Hc(e,mf+"-"+A),s.set(A,dU)),()=>{this._engine.afterFlush(()=>{let a=o.indexOf(r);a>=0&&o.splice(a,1),this._triggers.has(A)||s.delete(A)})}}register(e,A){return this._triggers.has(e)?!1:(this._triggers.set(e,A),!0)}_getTrigger(e){let A=this._triggers.get(e);if(!A)throw blA(e);return A}trigger(e,A,i,n=!0){let o=this._getTrigger(A),r=new bf(this.id,A,e),s=this._engine.statesByElement.get(e);s||(Hc(e,mf),Hc(e,mf+"-"+A),this._engine.statesByElement.set(e,s=new Map));let a=s.get(A),c=new vf(i,this.id);if(!(i&&i.hasOwnProperty("value"))&&a&&c.absorbOptions(a.options),s.set(A,c),a||(a=dU),!(c.value===Df)&&a.value===c.value){if(!GqA(a.params,c.params)){let E=[],Q=o.matchStyles(a.value,a.params,E),u=o.matchStyles(c.value,c.params,E);E.length?this._engine.reportError(E):this._engine.afterFlush(()=>{q1(e,Q),Nl(e,u)})}return}let C=Sa(this._engine.playersByElement,e,[]);C.forEach(E=>{E.namespaceId==this.id&&E.triggerName==A&&E.queued&&E.destroy()});let d=o.matchTransition(a.value,c.value,e,c.params),B=!1;if(!d){if(!n)return;d=o.fallbackTransition,B=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:A,transition:d,fromState:a,toState:c,player:r,isFallbackTransition:B}),B||(Hc(e,YlA),r.onStart(()=>{Dh(e,YlA)})),r.onDone(()=>{let E=this.players.indexOf(r);E>=0&&this.players.splice(E,1);let Q=this._engine.playersByElement.get(e);if(Q){let u=Q.indexOf(r);u>=0&&Q.splice(u,1)}}),this.players.push(r),C.push(r),r}deregister(e){this._triggers.delete(e),this._engine.statesByElement.forEach(A=>A.delete(e)),this._elementListeners.forEach((A,i)=>{this._elementListeners.set(i,A.filter(n=>n.name!=e))})}clearElementCache(e){this._engine.statesByElement.delete(e),this._elementListeners.delete(e);let A=this._engine.playersByElement.get(e);A&&(A.forEach(i=>i.destroy()),this._engine.playersByElement.delete(e))}_signalRemovalForInnerTriggers(e,A){let i=this._engine.driver.query(e,pf,!0);i.forEach(n=>{if(n[_l])return;let o=this._engine.fetchNamespacesByElement(n);o.size?o.forEach(r=>r.triggerLeaveAnimation(n,A,!1,!0)):this.clearElementCache(n)}),this._engine.afterFlushAnimationsDone(()=>i.forEach(n=>this.clearElementCache(n)))}triggerLeaveAnimation(e,A,i,n){let o=this._engine.statesByElement.get(e),r=new Map;if(o){let s=[];if(o.forEach((a,c)=>{if(r.set(c,a.value),this._triggers.has(c)){let l=this.trigger(e,c,Df,n);l&&s.push(l)}}),s.length)return this._engine.markElementAsRemoved(this.id,e,!0,A,r),i&&n2(s).onDone(()=>this._engine.processLeaveNode(e)),!0}return!1}prepareLeaveAnimationListeners(e){let A=this._elementListeners.get(e),i=this._engine.statesByElement.get(e);if(A&&i){let n=new Set;A.forEach(o=>{let r=o.name;if(n.has(r))return;n.add(r);let a=this._triggers.get(r).fallbackTransition,c=i.get(r)||dU,l=new vf(Df),I=new bf(this.id,r,e);this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:r,transition:a,fromState:c,toState:l,player:I,isFallbackTransition:!0})})}}removeNode(e,A){let i=this._engine;if(e.childElementCount&&this._signalRemovalForInnerTriggers(e,A),this.triggerLeaveAnimation(e,A,!0))return;let n=!1;if(i.totalAnimations){let o=i.players.length?i.playersByQueriedElement.get(e):[];if(o&&o.length)n=!0;else{let r=e;for(;r=r.parentNode;)if(i.statesByElement.get(r)){n=!0;break}}}if(this.prepareLeaveAnimationListeners(e),n)i.markElementAsRemoved(this.id,e,!1,A);else{let o=e[_l];(!o||o===VlA)&&(i.afterFlush(()=>this.clearElementCache(e)),i.destroyInnerAnimations(e),i._onRemovalComplete(e,A))}}insertNode(e,A){Hc(e,this._hostClassName)}drainQueuedTransitions(e){let A=[];return this._queue.forEach(i=>{let n=i.player;if(n.destroyed)return;let o=i.element,r=this._elementListeners.get(o);r&&r.forEach(s=>{if(s.name==i.triggerName){let a=e7(o,i.triggerName,i.fromState.value,i.toState.value);a._data=e,A7(i.player,s.phase,a,s.callback)}}),n.markedForDestroy?this._engine.afterFlush(()=>{n.destroy()}):A.push(i)}),this._queue=[],A.sort((i,n)=>{let o=i.transition.ast.depCount,r=n.transition.ast.depCount;return o==0||r==0?o-r:this._engine.driver.containsElement(i.element,n.element)?1:-1})}destroy(e){this.players.forEach(A=>A.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,e)}},yU=class{bodyNode;driver;_normalizer;players=[];newHostElements=new Map;playersByElement=new Map;playersByQueriedElement=new Map;statesByElement=new Map;disabledNodes=new Set;totalAnimations=0;totalQueuedPlayers=0;_namespaceLookup={};_namespaceList=[];_flushFns=[];_whenQuietFns=[];namespacesByHostElement=new Map;collectedEnterElements=[];collectedLeaveElements=[];onRemovalComplete=(e,A)=>{};_onRemovalComplete(e,A){this.onRemovalComplete(e,A)}constructor(e,A,i){this.bodyNode=e,this.driver=A,this._normalizer=i}get queuedPlayers(){let e=[];return this._namespaceList.forEach(A=>{A.players.forEach(i=>{i.queued&&e.push(i)})}),e}createNamespace(e,A){let i=new DU(e,A,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,A)?this._balanceNamespaceList(i,A):(this.newHostElements.set(A,i),this.collectEnterElement(A)),this._namespaceLookup[e]=i}_balanceNamespaceList(e,A){let i=this._namespaceList,n=this.namespacesByHostElement;if(i.length-1>=0){let r=!1,s=this.driver.getParentElement(A);for(;s;){let a=n.get(s);if(a){let c=i.indexOf(a);i.splice(c+1,0,e),r=!0;break}s=this.driver.getParentElement(s)}r||i.unshift(e)}else i.push(e);return n.set(A,e),e}register(e,A){let i=this._namespaceLookup[e];return i||(i=this.createNamespace(e,A)),i}registerTrigger(e,A,i){let n=this._namespaceLookup[e];n&&n.register(A,i)&&this.totalAnimations++}destroy(e,A){e&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let i=this._fetchNamespace(e);this.namespacesByHostElement.delete(i.hostElement);let n=this._namespaceList.indexOf(i);n>=0&&this._namespaceList.splice(n,1),i.destroy(A),delete this._namespaceLookup[e]}))}_fetchNamespace(e){return this._namespaceLookup[e]}fetchNamespacesByElement(e){let A=new Set,i=this.statesByElement.get(e);if(i){for(let n of i.values())if(n.namespaceId){let o=this._fetchNamespace(n.namespaceId);o&&A.add(o)}}return A}trigger(e,A,i,n){if(c7(A)){let o=this._fetchNamespace(e);if(o)return o.trigger(A,i,n),!0}return!1}insertNode(e,A,i,n){if(!c7(A))return;let o=A[_l];if(o&&o.setForRemoval){o.setForRemoval=!1,o.setForMove=!0;let r=this.collectedLeaveElements.indexOf(A);r>=0&&this.collectedLeaveElements.splice(r,1)}if(e){let r=this._fetchNamespace(e);r&&r.insertNode(A,i)}n&&this.collectEnterElement(A)}collectEnterElement(e){this.collectedEnterElements.push(e)}markElementAsDisabled(e,A){A?this.disabledNodes.has(e)||(this.disabledNodes.add(e),Hc(e,CU)):this.disabledNodes.has(e)&&(this.disabledNodes.delete(e),Dh(e,CU))}removeNode(e,A,i){if(c7(A)){let n=e?this._fetchNamespace(e):null;n?n.removeNode(A,i):this.markElementAsRemoved(e,A,!1,i);let o=this.namespacesByHostElement.get(A);o&&o.id!==e&&o.removeNode(A,i)}else this._onRemovalComplete(A,i)}markElementAsRemoved(e,A,i,n,o){this.collectedLeaveElements.push(A),A[_l]={namespaceId:e,setForRemoval:n,hasAnimation:i,removedBeforeQueried:!1,previousTriggersValues:o}}listen(e,A,i,n,o){return c7(A)?this._fetchNamespace(e).listen(A,i,n,o):()=>{}}_buildInstruction(e,A,i,n,o){return e.transition.build(this.driver,e.element,e.fromState.value,e.toState.value,i,n,e.fromState.options,e.toState.options,A,o)}destroyInnerAnimations(e){let A=this.driver.query(e,pf,!0);A.forEach(i=>this.destroyActiveAnimationsForElement(i)),this.playersByQueriedElement.size!=0&&(A=this.driver.query(e,n7,!0),A.forEach(i=>this.finishActiveQueriedAnimationOnElement(i)))}destroyActiveAnimationsForElement(e){let A=this.playersByElement.get(e);A&&A.forEach(i=>{i.queued?i.markedForDestroy=!0:i.destroy()})}finishActiveQueriedAnimationOnElement(e){let A=this.playersByQueriedElement.get(e);A&&A.forEach(i=>i.finish())}whenRenderingDone(){return new Promise(e=>{if(this.players.length)return n2(this.players).onDone(()=>e());e()})}processLeaveNode(e){let A=e[_l];if(A&&A.setForRemoval){if(e[_l]=VlA,A.namespaceId){this.destroyInnerAnimations(e);let i=this._fetchNamespace(A.namespaceId);i&&i.clearElementCache(e)}this._onRemovalComplete(e,A.setForRemoval)}e.classList?.contains(CU)&&this.markElementAsDisabled(e,!1),this.driver.query(e,bqA,!0).forEach(i=>{this.markElementAsDisabled(i,!1)})}flush(e=-1){let A=[];if(this.newHostElements.size&&(this.newHostElements.forEach((i,n)=>this._balanceNamespaceList(i,n)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let i=0;ii()),this._flushFns=[],this._whenQuietFns.length){let i=this._whenQuietFns;this._whenQuietFns=[],A.length?n2(A).onDone(()=>{i.forEach(n=>n())}):i.forEach(n=>n())}}reportError(e){throw MlA(e)}_flushAnimations(e,A){let i=new yf,n=[],o=new Map,r=[],s=new Map,a=new Map,c=new Map,l=new Set;this.disabledNodes.forEach(p=>{l.add(p);let V=this.driver.query(p,vqA,!0);for(let cA=0;cA{let cA=aU+E++;B.set(V,cA),p.forEach(aA=>Hc(aA,cA))});let Q=[],u=new Set,v=new Set;for(let p=0;pu.add(aA)):v.add(V))}let L=new Map,x=zlA(C,Array.from(u));x.forEach((p,V)=>{let cA=i7+E++;L.set(V,cA),p.forEach(aA=>Hc(aA,cA))}),e.push(()=>{d.forEach((p,V)=>{let cA=B.get(V);p.forEach(aA=>Dh(aA,cA))}),x.forEach((p,V)=>{let cA=L.get(V);p.forEach(aA=>Dh(aA,cA))}),Q.forEach(p=>{this.processLeaveNode(p)})});let y=[],F=[];for(let p=this._namespaceList.length-1;p>=0;p--)this._namespaceList[p].drainQueuedTransitions(A).forEach(cA=>{let aA=cA.player,jA=cA.element;if(y.push(aA),this.collectedEnterElements.length){let Re=jA[_l];if(Re&&Re.setForMove){if(Re.previousTriggersValues&&Re.previousTriggersValues.has(cA.triggerName)){let hA=Re.previousTriggersValues.get(cA.triggerName),eA=this.statesByElement.get(cA.element);if(eA&&eA.has(cA.triggerName)){let RA=eA.get(cA.triggerName);RA.value=hA,eA.set(cA.triggerName,RA)}}aA.destroy();return}}let VA=!I||!this.driver.containsElement(I,jA),ce=L.get(jA),EA=B.get(jA),sA=this._buildInstruction(cA,i,EA,ce,VA);if(sA.errors&&sA.errors.length){F.push(sA);return}if(VA){aA.onStart(()=>q1(jA,sA.fromStyles)),aA.onDestroy(()=>Nl(jA,sA.toStyles)),n.push(aA);return}if(cA.isFallbackTransition){aA.onStart(()=>q1(jA,sA.fromStyles)),aA.onDestroy(()=>Nl(jA,sA.toStyles)),n.push(aA);return}let TA=[];sA.timelines.forEach(Re=>{Re.stretchStartingKeyframe=!0,this.disabledNodes.has(Re.element)||TA.push(Re)}),sA.timelines=TA,i.append(jA,sA.timelines);let Ke={instruction:sA,player:aA,element:jA};r.push(Ke),sA.queriedElements.forEach(Re=>Sa(s,Re,[]).push(aA)),sA.preStyleProps.forEach((Re,hA)=>{if(Re.size){let eA=a.get(hA);eA||a.set(hA,eA=new Set),Re.forEach((RA,oA)=>eA.add(oA))}}),sA.postStyleProps.forEach((Re,hA)=>{let eA=c.get(hA);eA||c.set(hA,eA=new Set),Re.forEach((RA,oA)=>eA.add(oA))})});if(F.length){let p=[];F.forEach(V=>{p.push(klA(V.triggerName,V.errors))}),y.forEach(V=>V.destroy()),this.reportError(p)}let U=new Map,T=new Map;r.forEach(p=>{let V=p.element;i.has(V)&&(T.set(V,V),this._beforeAnimationBuild(p.player.namespaceId,p.instruction,U))}),n.forEach(p=>{let V=p.element;this._getPreviousPlayers(V,!1,p.namespaceId,p.triggerName,null).forEach(aA=>{Sa(U,V,[]).push(aA),aA.destroy()})});let N=Q.filter(p=>HlA(p,a,c)),K=new Map;TlA(K,this.driver,v,c,pc).forEach(p=>{HlA(p,a,c)&&N.push(p)});let j=new Map;d.forEach((p,V)=>{TlA(j,this.driver,new Set(p),a,mB)}),N.forEach(p=>{let V=K.get(p),cA=j.get(p);K.set(p,new Map([...V?.entries()??[],...cA?.entries()??[]]))});let IA=[],lA=[],uA={};r.forEach(p=>{let{element:V,player:cA,instruction:aA}=p;if(i.has(V)){if(l.has(V)){cA.onDestroy(()=>Nl(V,aA.toStyles)),cA.disabled=!0,cA.overrideTotalTime(aA.totalTime),n.push(cA);return}let jA=uA;if(T.size>1){let ce=V,EA=[];for(;ce=ce.parentNode;){let sA=T.get(ce);if(sA){jA=sA;break}EA.push(ce)}EA.forEach(sA=>T.set(sA,jA))}let VA=this._buildAnimation(cA.namespaceId,aA,U,o,j,K);if(cA.setRealPlayer(VA),jA===uA)IA.push(cA);else{let ce=this.playersByElement.get(jA);ce&&ce.length&&(cA.parentPlayer=n2(ce)),n.push(cA)}}else q1(V,aA.fromStyles),cA.onDestroy(()=>Nl(V,aA.toStyles)),lA.push(cA),l.has(V)&&n.push(cA)}),lA.forEach(p=>{let V=o.get(p.element);if(V&&V.length){let cA=n2(V);p.setRealPlayer(cA)}}),n.forEach(p=>{p.parentPlayer?p.syncPlayerEvents(p.parentPlayer):p.destroy()});for(let p=0;p!VA.destroyed);jA.length?NqA(this,V,jA):this.processLeaveNode(V)}return Q.length=0,IA.forEach(p=>{this.players.push(p),p.onDone(()=>{p.destroy();let V=this.players.indexOf(p);this.players.splice(V,1)}),p.play()}),IA}afterFlush(e){this._flushFns.push(e)}afterFlushAnimationsDone(e){this._whenQuietFns.push(e)}_getPreviousPlayers(e,A,i,n,o){let r=[];if(A){let s=this.playersByQueriedElement.get(e);s&&(r=s)}else{let s=this.playersByElement.get(e);if(s){let a=!o||o==Df;s.forEach(c=>{c.queued||!a&&c.triggerName!=n||r.push(c)})}}return(i||n)&&(r=r.filter(s=>!(i&&i!=s.namespaceId||n&&n!=s.triggerName))),r}_beforeAnimationBuild(e,A,i){let n=A.triggerName,o=A.element,r=A.isRemovalTransition?void 0:e,s=A.isRemovalTransition?void 0:n;for(let a of A.timelines){let c=a.element,l=c!==o,I=Sa(i,c,[]);this._getPreviousPlayers(c,l,r,s,A.toState).forEach(d=>{let B=d.getRealPlayer();B.beforeDestroy&&B.beforeDestroy(),d.destroy(),I.push(d)})}q1(o,A.fromStyles)}_buildAnimation(e,A,i,n,o,r){let s=A.triggerName,a=A.element,c=[],l=new Set,I=new Set,C=A.timelines.map(B=>{let E=B.element;l.add(E);let Q=E[_l];if(Q&&Q.removedBeforeQueried)return new ag(B.duration,B.delay);let u=E!==a,v=_qA((i.get(E)||SqA).map(U=>U.getRealPlayer())).filter(U=>{let T=U;return T.element?T.element===E:!1}),L=o.get(E),x=r.get(E),y=iU(this._normalizer,B.keyframes,L,x),F=this._buildPlayer(B,y,v);if(B.subTimeline&&n&&I.add(E),u){let U=new bf(e,s,E);U.setRealPlayer(F),c.push(U)}return F});c.forEach(B=>{Sa(this.playersByQueriedElement,B.element,[]).push(B),B.onDone(()=>LqA(this.playersByQueriedElement,B.element,B))}),l.forEach(B=>Hc(B,cU));let d=n2(C);return d.onDestroy(()=>{l.forEach(B=>Dh(B,cU)),Nl(a,A.toStyles)}),I.forEach(B=>{Sa(n,B,[]).push(d)}),d}_buildPlayer(e,A,i){return A.length>0?this.driver.animate(e.element,A,e.duration,e.delay,e.easing,i):new ag(e.duration,e.delay)}},bf=class{namespaceId;triggerName;element;_player=new ag;_containsRealPlayer=!1;_queuedCallbacks=new Map;destroyed=!1;parentPlayer=null;markedForDestroy=!1;disabled=!1;queued=!0;totalTime=0;constructor(e,A,i){this.namespaceId=e,this.triggerName=A,this.element=i}setRealPlayer(e){this._containsRealPlayer||(this._player=e,this._queuedCallbacks.forEach((A,i)=>{A.forEach(n=>A7(e,i,void 0,n))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(e.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(e){this.totalTime=e}syncPlayerEvents(e){let A=this._player;A.triggerCallback&&e.onStart(()=>A.triggerCallback("start")),e.onDone(()=>this.finish()),e.onDestroy(()=>this.destroy())}_queueEvent(e,A){Sa(this._queuedCallbacks,e,[]).push(A)}onDone(e){this.queued&&this._queueEvent("done",e),this._player.onDone(e)}onStart(e){this.queued&&this._queueEvent("start",e),this._player.onStart(e)}onDestroy(e){this.queued&&this._queueEvent("destroy",e),this._player.onDestroy(e)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(e){this.queued||this._player.setPosition(e)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(e){let A=this._player;A.triggerCallback&&A.triggerCallback(e)}};function LqA(t,e,A){let i=t.get(e);if(i){if(i.length){let n=i.indexOf(A);i.splice(n,1)}i.length==0&&t.delete(e)}return i}function xqA(t){return t??null}function c7(t){return t&&t.nodeType===1}function FqA(t){return t=="start"||t=="done"}function JlA(t,e){let A=t.style.display;return t.style.display=e??"none",A}function TlA(t,e,A,i,n){let o=[];A.forEach(a=>o.push(JlA(a)));let r=[];i.forEach((a,c)=>{let l=new Map;a.forEach(I=>{let C=e.computeStyle(c,I,n);l.set(I,C),(!C||C.length==0)&&(c[_l]=RqA,r.push(c))}),t.set(c,l)});let s=0;return A.forEach(a=>JlA(a,o[s++])),r}function zlA(t,e){let A=new Map;if(t.forEach(s=>A.set(s,[])),e.length==0)return A;let i=1,n=new Set(e),o=new Map;function r(s){if(!s)return i;let a=o.get(s);if(a)return a;let c=s.parentNode;return A.has(c)?a=c:n.has(c)?a=i:a=r(c),o.set(s,a),a}return e.forEach(s=>{let a=r(s);a!==i&&A.get(a).push(s)}),A}function Hc(t,e){t.classList?.add(e)}function Dh(t,e){t.classList?.remove(e)}function NqA(t,e,A){n2(A).onDone(()=>t.processLeaveNode(e))}function _qA(t){let e=[];return ZlA(t,e),e}function ZlA(t,e){for(let A=0;An.add(o)):e.set(t,i),A.delete(t),!0}var yh=class{_driver;_normalizer;_transitionEngine;_timelineEngine;_triggerCache={};onRemovalComplete=(e,A)=>{};constructor(e,A,i){this._driver=A,this._normalizer=i,this._transitionEngine=new yU(e.body,A,i),this._timelineEngine=new wU(e.body,A,i),this._transitionEngine.onRemovalComplete=(n,o)=>this.onRemovalComplete(n,o)}registerTrigger(e,A,i,n,o){let r=e+"-"+n,s=this._triggerCache[r];if(!s){let a=[],c=[],l=PlA(this._driver,o,a,c);if(a.length)throw ulA(n,a);s=wqA(n,l,this._normalizer),this._triggerCache[r]=s}this._transitionEngine.registerTrigger(A,n,s)}register(e,A){this._transitionEngine.register(e,A)}destroy(e,A){this._transitionEngine.destroy(e,A)}onInsert(e,A,i,n){this._transitionEngine.insertNode(e,A,i,n)}onRemove(e,A,i){this._transitionEngine.removeNode(e,A,i)}disableAnimations(e,A){this._transitionEngine.markElementAsDisabled(e,A)}process(e,A,i,n){if(i.charAt(0)=="@"){let[o,r]=nU(i),s=n;this._timelineEngine.command(o,A,r,s)}else this._transitionEngine.trigger(e,A,i,n)}listen(e,A,i,n,o){if(i.charAt(0)=="@"){let[r,s]=nU(i);return this._timelineEngine.listen(r,A,s,o)}return this._transitionEngine.listen(e,A,i,n,o)}flush(e=-1){this._transitionEngine.flush(e)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(e){this._transitionEngine.afterFlushAnimationsDone(e)}};function UqA(t,e){let A=null,i=null;return Array.isArray(e)&&e.length?(A=BU(e[0]),e.length>1&&(i=BU(e[e.length-1]))):e instanceof Map&&(A=BU(e)),A||i?new KqA(t,A,i):null}var KqA=(()=>{class t{_element;_startStyles;_endStyles;static initialStylesByElement=new WeakMap;_state=0;_initialStyles;constructor(A,i,n){this._element=A,this._startStyles=i,this._endStyles=n;let o=t.initialStylesByElement.get(A);o||t.initialStylesByElement.set(A,o=new Map),this._initialStyles=o}start(){this._state<1&&(this._startStyles&&Nl(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(Nl(this._element,this._initialStyles),this._endStyles&&(Nl(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(t.initialStylesByElement.delete(this._element),this._startStyles&&(q1(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(q1(this._element,this._endStyles),this._endStyles=null),Nl(this._element,this._initialStyles),this._state=3)}}return t})();function BU(t){let e=null;return t.forEach((A,i)=>{YqA(i)&&(e=e||new Map,e.set(i,A))}),e}function YqA(t){return t==="display"||t==="position"}var E7=class{element;keyframes;options;_specialStyles;_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_duration;_delay;_initialized=!1;_finished=!1;_started=!1;_destroyed=!1;_finalKeyframe;_originalOnDoneFns=[];_originalOnStartFns=[];domPlayer;time=0;parentPlayer=null;currentSnapshot=new Map;constructor(e,A,i,n){this.element=e,this.keyframes=A,this.options=i,this._specialStyles=n,this._duration=i.duration,this._delay=i.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this._buildPlayer(),this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return;this._initialized=!0;let e=this.keyframes;this.domPlayer=this._triggerWebAnimation(this.element,e,this.options),this._finalKeyframe=e.length?e[e.length-1]:new Map;let A=()=>this._onFinish();this.domPlayer.addEventListener("finish",A),this.onDestroy(()=>{this.domPlayer.removeEventListener("finish",A)})}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer.pause()}_convertKeyframesToObject(e){let A=[];return e.forEach(i=>{A.push(Object.fromEntries(i))}),A}_triggerWebAnimation(e,A,i){return e.animate(this._convertKeyframesToObject(A),i)}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}play(){this._buildPlayer(),this.hasStarted()||(this._onStartFns.forEach(e=>e()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),this.domPlayer.play()}pause(){this.init(),this.domPlayer.pause()}finish(){this.init(),this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish()}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer&&this.domPlayer.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}setPosition(e){this.domPlayer===void 0&&this.init(),this.domPlayer.currentTime=e*this.time}getPosition(){return+(this.domPlayer.currentTime??0)/this.time}get totalTime(){return this._delay+this._duration}beforeDestroy(){let e=new Map;this.hasStarted()&&this._finalKeyframe.forEach((i,n)=>{n!=="offset"&&e.set(n,this._finished?i:r7(this.element,n))}),this.currentSnapshot=e}triggerCallback(e){let A=e==="start"?this._onStartFns:this._onDoneFns;A.forEach(i=>i()),A.length=0}},h7=class{validateStyleProperty(e){return!0}validateAnimatableStyleProperty(e){return!0}containsElement(e,A){return oU(e,A)}getParentElement(e){return t7(e)}query(e,A,i){return rU(e,A,i)}computeStyle(e,A,i){return r7(e,A)}animate(e,A,i,n,o,r=[]){let s=n==0?"both":"forwards",a={duration:i,delay:n,fill:s};o&&(a.easing=o);let c=new Map,l=r.filter(d=>d instanceof E7);xlA(i,n)&&l.forEach(d=>{d.currentSnapshot.forEach((B,E)=>c.set(E,B))});let I=RlA(A).map(d=>new Map(d));I=FlA(e,I,c);let C=UqA(e,I);return new E7(e,I,a,C)}};var l7="@",WlA="@.disabled",Q7=class{namespaceId;delegate;engine;_onDestroy;\u0275type=0;constructor(e,A,i,n){this.namespaceId=e,this.delegate=A,this.engine=i,this._onDestroy=n}get data(){return this.delegate.data}destroyNode(e){this.delegate.destroyNode?.(e)}destroy(){this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),this._onDestroy?.()}createElement(e,A){return this.delegate.createElement(e,A)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}appendChild(e,A){this.delegate.appendChild(e,A),this.engine.onInsert(this.namespaceId,A,e,!1)}insertBefore(e,A,i,n=!0){this.delegate.insertBefore(e,A,i),this.engine.onInsert(this.namespaceId,A,e,n)}removeChild(e,A,i){this.parentNode(A)&&this.engine.onRemove(this.namespaceId,A,this.delegate)}selectRootElement(e,A){return this.delegate.selectRootElement(e,A)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,A,i,n){this.delegate.setAttribute(e,A,i,n)}removeAttribute(e,A,i){this.delegate.removeAttribute(e,A,i)}addClass(e,A){this.delegate.addClass(e,A)}removeClass(e,A){this.delegate.removeClass(e,A)}setStyle(e,A,i,n){this.delegate.setStyle(e,A,i,n)}removeStyle(e,A,i){this.delegate.removeStyle(e,A,i)}setProperty(e,A,i){A.charAt(0)==l7&&A==WlA?this.disableAnimations(e,!!i):this.delegate.setProperty(e,A,i)}setValue(e,A){this.delegate.setValue(e,A)}listen(e,A,i,n){return this.delegate.listen(e,A,i,n)}disableAnimations(e,A){this.engine.disableAnimations(e,A)}},vU=class extends Q7{factory;constructor(e,A,i,n,o){super(A,i,n,o),this.factory=e,this.namespaceId=A}setProperty(e,A,i){A.charAt(0)==l7?A.charAt(1)=="."&&A==WlA?(i=i===void 0?!0:!!i,this.disableAnimations(e,i)):this.engine.process(this.namespaceId,e,A.slice(1),i):this.delegate.setProperty(e,A,i)}listen(e,A,i,n){if(A.charAt(0)==l7){let o=JqA(e),r=A.slice(1),s="";return r.charAt(0)!=l7&&([r,s]=TqA(r)),this.engine.listen(this.namespaceId,o,r,s,a=>{let c=a._data||-1;this.factory.scheduleListenerCallback(c,i,a)})}return this.delegate.listen(e,A,i,n)}};function JqA(t){switch(t){case"body":return document.body;case"document":return document;case"window":return window;default:return t}}function TqA(t){let e=t.indexOf("."),A=t.substring(0,e),i=t.slice(e+1);return[A,i]}var u7=class{delegate;engine;_zone;_currentId=0;_microtaskId=1;_animationCallbacksBuffer=[];_rendererCache=new Map;_cdRecurDepth=0;constructor(e,A,i){this.delegate=e,this.engine=A,this._zone=i,A.onRemovalComplete=(n,o)=>{o?.removeChild(null,n)}}createRenderer(e,A){let i="",n=this.delegate.createRenderer(e,A);if(!e||!A?.data?.animation){let c=this._rendererCache,l=c.get(n);if(!l){let I=()=>c.delete(n);l=new Q7(i,n,this.engine,I),c.set(n,l)}return l}let o=A.id,r=A.id+"-"+this._currentId;this._currentId++,this.engine.register(r,e);let s=c=>{Array.isArray(c)?c.forEach(s):this.engine.registerTrigger(o,r,e,c.name,c)};return A.data.animation.forEach(s),new vU(this,r,n,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(e,A,i){if(e>=0&&eA(i));return}let n=this._animationCallbacksBuffer;n.length==0&&queueMicrotask(()=>{this._zone.run(()=>{n.forEach(o=>{let[r,s]=o;r(s)}),this._animationCallbacksBuffer=[]})}),n.push([A,i])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}componentReplaced(e){this.engine.flush(),this.delegate.componentReplaced?.(e)}};var HqA=(()=>{class t extends yh{constructor(A,i,n){super(A,i,n)}ngOnDestroy(){this.flush()}static \u0275fac=function(i){return new(i||t)(he(tt),he($C),he(Ad))};static \u0275prov=SA({token:t,factory:t.\u0275fac})}return t})();function OqA(){return new g7}function PqA(t,e,A){return new u7(t,e,A)}var $lA=[{provide:Ad,useFactory:OqA},{provide:yh,useClass:HqA},{provide:ds,useFactory:PqA,deps:[xQ,yh,de]}],jqA=[{provide:$C,useClass:bU},{provide:mi,useValue:"NoopAnimations"},...$lA],XlA=[{provide:$C,useFactory:()=>new h7},{provide:mi,useFactory:()=>"BrowserAnimations"},...$lA],f7=(()=>{class t{static withConfig(A){return{ngModule:t,providers:A.disableAnimations?jqA:XlA}}static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({providers:XlA,imports:[NQ]})}return t})();var qqA=new BA("mat-chips-default-options",{providedIn:"root",factory:()=>({separatorKeyCodes:[13]})});var AgA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({providers:[dB,{provide:qqA,useValue:{separatorKeyCodes:[13]}}],imports:[Ve,Xa,Ve]})}return t})();var VqA=["input"],ZqA=["formField"],WqA=["*"],kU=class{source;value;constructor(e,A){this.source=e,this.value=A}};var XqA=new BA("MatRadioGroup"),$qA=new BA("mat-radio-default-options",{providedIn:"root",factory:AVA});function AVA(){return{color:"accent",disabledInteractive:!1}}var eVA=(()=>{class t{_elementRef=m(te);_changeDetector=m(lt);_focusMonitor=m(Jr);_radioDispatcher=m(uB);_defaultOptions=m($qA,{optional:!0});_ngZone=m(de);_renderer=m(Gi);_uniqueId=m($i).getId("mat-radio-");_cleanupClick;id=this._uniqueId;name;ariaLabel;ariaLabelledby;ariaDescribedby;disableRipple=!1;tabIndex=0;get checked(){return this._checked}set checked(A){this._checked!==A&&(this._checked=A,A&&this.radioGroup&&this.radioGroup.value!==this.value?this.radioGroup.selected=this:!A&&this.radioGroup&&this.radioGroup.value===this.value&&(this.radioGroup.selected=null),A&&this._radioDispatcher.notify(this.id,this.name),this._changeDetector.markForCheck())}get value(){return this._value}set value(A){this._value!==A&&(this._value=A,this.radioGroup!==null&&(this.checked||(this.checked=this.radioGroup.value===A),this.checked&&(this.radioGroup.selected=this)))}get labelPosition(){return this._labelPosition||this.radioGroup&&this.radioGroup.labelPosition||"after"}set labelPosition(A){this._labelPosition=A}_labelPosition;get disabled(){return this._disabled||this.radioGroup!==null&&this.radioGroup.disabled}set disabled(A){this._setDisabled(A)}get required(){return this._required||this.radioGroup&&this.radioGroup.required}set required(A){this._required=A}get color(){return this._color||this.radioGroup&&this.radioGroup.color||this._defaultOptions&&this._defaultOptions.color||"accent"}set color(A){this._color=A}_color;get disabledInteractive(){return this._disabledInteractive||this.radioGroup!==null&&this.radioGroup.disabledInteractive}set disabledInteractive(A){this._disabledInteractive=A}_disabledInteractive;change=new XA;radioGroup;get inputId(){return`${this.id||this._uniqueId}-input`}_checked=!1;_disabled;_required;_value=null;_removeUniqueSelectionListener=()=>{};_previousTabIndex;_inputElement;_rippleTrigger;_noopAnimations;_injector=m(Dt);constructor(){m(Ln).load(Qr);let A=m(XqA,{optional:!0}),i=m(mi,{optional:!0}),n=m(new Er("tabindex"),{optional:!0});this.radioGroup=A,this._noopAnimations=i==="NoopAnimations",this._disabledInteractive=this._defaultOptions?.disabledInteractive??!1,n&&(this.tabIndex=Mi(n,0))}focus(A,i){i?this._focusMonitor.focusVia(this._inputElement,i,A):this._inputElement.nativeElement.focus(A)}_markForCheck(){this._changeDetector.markForCheck()}ngOnInit(){this.radioGroup&&(this.checked=this.radioGroup.value===this._value,this.checked&&(this.radioGroup.selected=this),this.name=this.radioGroup.name),this._removeUniqueSelectionListener=this._radioDispatcher.listen((A,i)=>{A!==this.id&&i===this.name&&(this.checked=!1)})}ngDoCheck(){this._updateTabIndex()}ngAfterViewInit(){this._updateTabIndex(),this._focusMonitor.monitor(this._elementRef,!0).subscribe(A=>{!A&&this.radioGroup&&this.radioGroup._touch()}),this._ngZone.runOutsideAngular(()=>{this._cleanupClick=this._renderer.listen(this._inputElement.nativeElement,"click",this._onInputClick)})}ngOnDestroy(){this._cleanupClick?.(),this._focusMonitor.stopMonitoring(this._elementRef),this._removeUniqueSelectionListener()}_emitChangeEvent(){this.change.emit(new kU(this,this._value))}_isRippleDisabled(){return this.disableRipple||this.disabled}_onInputInteraction(A){if(A.stopPropagation(),!this.checked&&!this.disabled){let i=this.radioGroup&&this.value!==this.radioGroup.value;this.checked=!0,this._emitChangeEvent(),this.radioGroup&&(this.radioGroup._controlValueAccessorChangeFn(this.value),i&&this.radioGroup._emitChangeEvent())}}_onTouchTargetClick(A){this._onInputInteraction(A),(!this.disabled||this.disabledInteractive)&&this._inputElement?.nativeElement.focus()}_setDisabled(A){this._disabled!==A&&(this._disabled=A,this._changeDetector.markForCheck())}_onInputClick=A=>{this.disabled&&this.disabledInteractive&&A.preventDefault()};_updateTabIndex(){let A=this.radioGroup,i;if(!A||!A.selected||this.disabled?i=this.tabIndex:i=A.selected===this?this.tabIndex:-1,i!==this._previousTabIndex){let n=this._inputElement?.nativeElement;n&&(n.setAttribute("tabindex",i+""),this._previousTabIndex=i,Vo(()=>{queueMicrotask(()=>{A&&A.selected&&A.selected!==this&&document.activeElement===n&&(A.selected?._inputElement.nativeElement.focus(),document.activeElement===n&&this._inputElement.nativeElement.blur())})},{injector:this._injector}))}}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=YA({type:t,selectors:[["mat-radio-button"]],viewQuery:function(i,n){if(i&1&&(Ge(VqA,5),Ge(ZqA,7,te)),i&2){let o;$A(o=Ae())&&(n._inputElement=o.first),$A(o=Ae())&&(n._rippleTrigger=o.first)}},hostAttrs:[1,"mat-mdc-radio-button"],hostVars:19,hostBindings:function(i,n){i&1&&mA("focus",function(){return n._inputElement.nativeElement.focus()}),i&2&&(_e("id",n.id)("tabindex",null)("aria-label",null)("aria-labelledby",null)("aria-describedby",null),ue("mat-primary",n.color==="primary")("mat-accent",n.color==="accent")("mat-warn",n.color==="warn")("mat-mdc-radio-checked",n.checked)("mat-mdc-radio-disabled",n.disabled)("mat-mdc-radio-disabled-interactive",n.disabledInteractive)("_mat-animation-noopable",n._noopAnimations))},inputs:{id:"id",name:"name",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],disableRipple:[2,"disableRipple","disableRipple",ae],tabIndex:[2,"tabIndex","tabIndex",A=>A==null?0:Mi(A)],checked:[2,"checked","checked",ae],value:"value",labelPosition:"labelPosition",disabled:[2,"disabled","disabled",ae],required:[2,"required","required",ae],color:"color",disabledInteractive:[2,"disabledInteractive","disabledInteractive",ae]},outputs:{change:"change"},exportAs:["matRadioButton"],ngContentSelectors:WqA,decls:13,vars:17,consts:[["formField",""],["input",""],["mat-internal-form-field","",3,"labelPosition"],[1,"mdc-radio"],[1,"mat-mdc-radio-touch-target",3,"click"],["type","radio",1,"mdc-radio__native-control",3,"change","id","checked","disabled","required"],[1,"mdc-radio__background"],[1,"mdc-radio__outer-circle"],[1,"mdc-radio__inner-circle"],["mat-ripple","",1,"mat-radio-ripple","mat-focus-indicator",3,"matRippleTrigger","matRippleDisabled","matRippleCentered"],[1,"mat-ripple-element","mat-radio-persistent-ripple"],[1,"mdc-label",3,"for"]],template:function(i,n){if(i&1){let o=De();Yt(),S(0,"div",2,0)(2,"div",3)(3,"div",4),mA("click",function(s){return LA(o),xA(n._onTouchTargetClick(s))}),R(),S(4,"input",5,1),mA("change",function(s){return LA(o),xA(n._onInputInteraction(s))}),R(),S(6,"div",6),UA(7,"div",7)(8,"div",8),R(),S(9,"div",9),UA(10,"div",10),R()(),S(11,"label",11),xe(12),R()()}i&2&&(vA("labelPosition",n.labelPosition),_(2),ue("mdc-radio--disabled",n.disabled),_(2),vA("id",n.inputId)("checked",n.checked)("disabled",n.disabled&&!n.disabledInteractive)("required",n.required),_e("name",n.name)("value",n.value)("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-describedby",n.ariaDescribedby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),_(5),vA("matRippleTrigger",n._rippleTrigger.nativeElement)("matRippleDisabled",n._isRippleDisabled())("matRippleCentered",!0),_(2),vA("for",n.inputId))},dependencies:[Gs,BB],styles:['.mat-mdc-radio-button{-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-radio-button .mdc-radio{display:inline-block;position:relative;flex:0 0 auto;box-sizing:content-box;width:20px;height:20px;cursor:pointer;will-change:opacity,transform,border-color,color;padding:calc((var(--mdc-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-radio-button .mdc-radio:hover .mdc-radio__native-control:not([disabled]):not(:focus)~.mdc-radio__background::before{opacity:.04;transform:scale(1)}.mat-mdc-radio-button .mdc-radio:hover .mdc-radio__native-control:not([disabled])~.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-hover-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mdc-radio:hover .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio:hover .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-hover-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio:active .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-pressed-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mdc-radio:active .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio:active .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-pressed-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__background{display:inline-block;position:relative;box-sizing:border-box;width:20px;height:20px}.mat-mdc-radio-button .mdc-radio__background::before{position:absolute;transform:scale(0, 0);border-radius:50%;opacity:0;pointer-events:none;content:"";transition:opacity 90ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms cubic-bezier(0.4, 0, 0.6, 1);width:var(--mdc-radio-state-layer-size, 40px);height:var(--mdc-radio-state-layer-size, 40px);top:calc(-1*(var(--mdc-radio-state-layer-size, 40px) - 20px)/2);left:calc(-1*(var(--mdc-radio-state-layer-size, 40px) - 20px)/2)}.mat-mdc-radio-button .mdc-radio__outer-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:50%;transition:border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-radio-button .mdc-radio__inner-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transform:scale(0, 0);border-width:10px;border-style:solid;border-radius:50%;transition:transform 90ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-radio-button .mdc-radio__native-control{position:absolute;margin:0;padding:0;opacity:0;top:0;right:0;left:0;cursor:inherit;z-index:1;width:var(--mdc-radio-state-layer-size, 40px);height:var(--mdc-radio-state-layer-size, 40px)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background{transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__outer-circle{transition:border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle{transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:focus+.mdc-radio__background::before{transform:scale(1);opacity:.12;transition:opacity 90ms cubic-bezier(0, 0, 0.2, 1),transform 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background{cursor:default}.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-radio-button .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__inner-circle{border-color:var(--mdc-radio-selected-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-selected-focus-icon-color, var(--mat-sys-primary))}.mat-mdc-radio-button .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle{transform:scale(0.5);transition:transform 90ms cubic-bezier(0, 0, 0.2, 1),border-color 90ms cubic-bezier(0, 0, 0.2, 1)}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled{pointer-events:auto}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-unselected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-unselected-icon-opacity, 0.38)}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled:hover .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled:hover .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus+.mdc-radio__background .mdc-radio__outer-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control+.mdc-radio__background .mdc-radio__inner-circle,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-selected-icon-color, var(--mat-sys-on-surface));opacity:var(--mdc-radio-disabled-selected-icon-opacity, 0.38)}.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__background::before,.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__outer-circle,.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__inner-circle{transition:none !important}.mat-mdc-radio-button .mdc-radio__background::before{background-color:var(--mat-radio-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button.mat-mdc-radio-checked .mat-ripple-element,.mat-mdc-radio-button.mat-mdc-radio-checked .mdc-radio__background::before{background-color:var(--mat-radio-checked-ripple-color, var(--mat-sys-primary))}.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mat-ripple-element,.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__background::before{background-color:var(--mat-radio-ripple-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button .mat-internal-form-field{color:var(--mat-radio-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-radio-label-text-font, var(--mat-sys-body-medium-font));line-height:var(--mat-radio-label-text-line-height, var(--mat-sys-body-medium-line-height));font-size:var(--mat-radio-label-text-size, var(--mat-sys-body-medium-size));letter-spacing:var(--mat-radio-label-text-tracking, var(--mat-sys-body-medium-tracking));font-weight:var(--mat-radio-label-text-weight, var(--mat-sys-body-medium-weight))}.mat-mdc-radio-button .mdc-radio--disabled+label{color:var(--mat-radio-disabled-label-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-radio-button .mat-radio-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:50%}.mat-mdc-radio-button .mat-radio-ripple .mat-ripple-element{opacity:.14}.mat-mdc-radio-button .mat-radio-ripple::before{border-radius:50%}.mat-mdc-radio-button .mdc-radio .mdc-radio__native-control:focus:enabled:not(:checked)~.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-unselected-focus-icon-color, var(--mat-sys-on-surface))}.mat-mdc-radio-button.cdk-focused .mat-focus-indicator::before{content:""}.mat-mdc-radio-disabled{cursor:default;pointer-events:none}.mat-mdc-radio-disabled.mat-mdc-radio-disabled-interactive{pointer-events:auto}.mat-mdc-radio-touch-target{position:absolute;top:50%;left:50%;height:48px;width:48px;transform:translate(-50%, -50%);display:var(--mat-radio-touch-target-display, block)}[dir=rtl] .mat-mdc-radio-touch-target{left:auto;right:50%;transform:translate(50%, -50%)}'],encapsulation:2,changeDetection:0})}return t})(),egA=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[Ve,Xa,eVA,Ve]})}return t})();var m7=class t{static \u0275fac=function(A){return new(A||t)};static \u0275mod=ge({type:t});static \u0275inj=le({imports:[g0,e6,scA,rq,f0,Ty,KI,fP,ecA,acA,gcA,QcA,egA,a8,PaA,haA,NaA,$cA,c8,pcA,f7,VaA,zcA.forRoot(),HcA,EH,AgA,$j,ncA]})};var Mf=class t{static \u0275fac=function(A){return new(A||t)};static \u0275mod=ge({type:t,bootstrap:[mh]});static \u0275inj=le({providers:[Jg,K2,Tg,Eh,hh,j1,zc,Bh,J2,zg],imports:[m7,NQ,e6,Vb,$y,Ty,f0,KI,f7]})};fetch("./assets/config/runtime-config.json").then(t=>t.json()).then(t=>{window.runtimeConfig=t,Gp().bootstrapModule(Mf).catch(e=>console.error(e))});Gp().bootstrapModule(Mf).catch(t=>console.error(t)); diff --git a/src/google/adk/cli/browser/polyfills-B6TNHZQ6.js b/src/google/adk/cli/browser/polyfills-B6TNHZQ6.js deleted file mode 100644 index 21c405ad..00000000 --- a/src/google/adk/cli/browser/polyfills-B6TNHZQ6.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright 2025 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var ce=globalThis;function te(t){return(ce.__Zone_symbol_prefix||"__zone_symbol__")+t}function ht(){let t=ce.performance;function n(I){t&&t.mark&&t.mark(I)}function a(I,s){t&&t.measure&&t.measure(I,s)}n("Zone");class e{static __symbol__=te;static assertZonePatched(){if(ce.Promise!==S.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let s=e.current;for(;s.parent;)s=s.parent;return s}static get current(){return b.zone}static get currentTask(){return D}static __load_patch(s,i,r=!1){if(S.hasOwnProperty(s)){let E=ce[te("forceDuplicateZoneCheck")]===!0;if(!r&&E)throw Error("Already loaded patch: "+s)}else if(!ce["__Zone_disable_"+s]){let E="Zone:"+s;n(E),S[s]=i(ce,e,R),a(E,E)}}get parent(){return this._parent}get name(){return this._name}_parent;_name;_properties;_zoneDelegate;constructor(s,i){this._parent=s,this._name=i?i.name||"unnamed":"",this._properties=i&&i.properties||{},this._zoneDelegate=new f(this,this._parent&&this._parent._zoneDelegate,i)}get(s){let i=this.getZoneWith(s);if(i)return i._properties[s]}getZoneWith(s){let i=this;for(;i;){if(i._properties.hasOwnProperty(s))return i;i=i._parent}return null}fork(s){if(!s)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,s)}wrap(s,i){if(typeof s!="function")throw new Error("Expecting function got: "+s);let r=this._zoneDelegate.intercept(this,s,i),E=this;return function(){return E.runGuarded(r,this,arguments,i)}}run(s,i,r,E){b={parent:b,zone:this};try{return this._zoneDelegate.invoke(this,s,i,r,E)}finally{b=b.parent}}runGuarded(s,i=null,r,E){b={parent:b,zone:this};try{try{return this._zoneDelegate.invoke(this,s,i,r,E)}catch(x){if(this._zoneDelegate.handleError(this,x))throw x}}finally{b=b.parent}}runTask(s,i,r){if(s.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(s.zone||J).name+"; Execution: "+this.name+")");let E=s,{type:x,data:{isPeriodic:ee=!1,isRefreshable:M=!1}={}}=s;if(s.state===q&&(x===U||x===k))return;let he=s.state!=A;he&&E._transitionTo(A,d);let _e=D;D=E,b={parent:b,zone:this};try{x==k&&s.data&&!ee&&!M&&(s.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,E,i,r)}catch(Q){if(this._zoneDelegate.handleError(this,Q))throw Q}}finally{let Q=s.state;if(Q!==q&&Q!==X)if(x==U||ee||M&&Q===p)he&&E._transitionTo(d,A,p);else{let Te=E._zoneDelegates;this._updateTaskCount(E,-1),he&&E._transitionTo(q,A,q),M&&(E._zoneDelegates=Te)}b=b.parent,D=_e}}scheduleTask(s){if(s.zone&&s.zone!==this){let r=this;for(;r;){if(r===s.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${s.zone.name}`);r=r.parent}}s._transitionTo(p,q);let i=[];s._zoneDelegates=i,s._zone=this;try{s=this._zoneDelegate.scheduleTask(this,s)}catch(r){throw s._transitionTo(X,p,q),this._zoneDelegate.handleError(this,r),r}return s._zoneDelegates===i&&this._updateTaskCount(s,1),s.state==p&&s._transitionTo(d,p),s}scheduleMicroTask(s,i,r,E){return this.scheduleTask(new g(F,s,i,r,E,void 0))}scheduleMacroTask(s,i,r,E,x){return this.scheduleTask(new g(k,s,i,r,E,x))}scheduleEventTask(s,i,r,E,x){return this.scheduleTask(new g(U,s,i,r,E,x))}cancelTask(s){if(s.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(s.zone||J).name+"; Execution: "+this.name+")");if(!(s.state!==d&&s.state!==A)){s._transitionTo(V,d,A);try{this._zoneDelegate.cancelTask(this,s)}catch(i){throw s._transitionTo(X,V),this._zoneDelegate.handleError(this,i),i}return this._updateTaskCount(s,-1),s._transitionTo(q,V),s.runCount=-1,s}}_updateTaskCount(s,i){let r=s._zoneDelegates;i==-1&&(s._zoneDelegates=null);for(let E=0;EI.hasTask(i,r),onScheduleTask:(I,s,i,r)=>I.scheduleTask(i,r),onInvokeTask:(I,s,i,r,E,x)=>I.invokeTask(i,r,E,x),onCancelTask:(I,s,i,r)=>I.cancelTask(i,r)};class f{get zone(){return this._zone}_zone;_taskCounts={microTask:0,macroTask:0,eventTask:0};_parentDelegate;_forkDlgt;_forkZS;_forkCurrZone;_interceptDlgt;_interceptZS;_interceptCurrZone;_invokeDlgt;_invokeZS;_invokeCurrZone;_handleErrorDlgt;_handleErrorZS;_handleErrorCurrZone;_scheduleTaskDlgt;_scheduleTaskZS;_scheduleTaskCurrZone;_invokeTaskDlgt;_invokeTaskZS;_invokeTaskCurrZone;_cancelTaskDlgt;_cancelTaskZS;_cancelTaskCurrZone;_hasTaskDlgt;_hasTaskDlgtOwner;_hasTaskZS;_hasTaskCurrZone;constructor(s,i,r){this._zone=s,this._parentDelegate=i,this._forkZS=r&&(r&&r.onFork?r:i._forkZS),this._forkDlgt=r&&(r.onFork?i:i._forkDlgt),this._forkCurrZone=r&&(r.onFork?this._zone:i._forkCurrZone),this._interceptZS=r&&(r.onIntercept?r:i._interceptZS),this._interceptDlgt=r&&(r.onIntercept?i:i._interceptDlgt),this._interceptCurrZone=r&&(r.onIntercept?this._zone:i._interceptCurrZone),this._invokeZS=r&&(r.onInvoke?r:i._invokeZS),this._invokeDlgt=r&&(r.onInvoke?i:i._invokeDlgt),this._invokeCurrZone=r&&(r.onInvoke?this._zone:i._invokeCurrZone),this._handleErrorZS=r&&(r.onHandleError?r:i._handleErrorZS),this._handleErrorDlgt=r&&(r.onHandleError?i:i._handleErrorDlgt),this._handleErrorCurrZone=r&&(r.onHandleError?this._zone:i._handleErrorCurrZone),this._scheduleTaskZS=r&&(r.onScheduleTask?r:i._scheduleTaskZS),this._scheduleTaskDlgt=r&&(r.onScheduleTask?i:i._scheduleTaskDlgt),this._scheduleTaskCurrZone=r&&(r.onScheduleTask?this._zone:i._scheduleTaskCurrZone),this._invokeTaskZS=r&&(r.onInvokeTask?r:i._invokeTaskZS),this._invokeTaskDlgt=r&&(r.onInvokeTask?i:i._invokeTaskDlgt),this._invokeTaskCurrZone=r&&(r.onInvokeTask?this._zone:i._invokeTaskCurrZone),this._cancelTaskZS=r&&(r.onCancelTask?r:i._cancelTaskZS),this._cancelTaskDlgt=r&&(r.onCancelTask?i:i._cancelTaskDlgt),this._cancelTaskCurrZone=r&&(r.onCancelTask?this._zone:i._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;let E=r&&r.onHasTask,x=i&&i._hasTaskZS;(E||x)&&(this._hasTaskZS=E?r:c,this._hasTaskDlgt=i,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,r.onScheduleTask||(this._scheduleTaskZS=c,this._scheduleTaskDlgt=i,this._scheduleTaskCurrZone=this._zone),r.onInvokeTask||(this._invokeTaskZS=c,this._invokeTaskDlgt=i,this._invokeTaskCurrZone=this._zone),r.onCancelTask||(this._cancelTaskZS=c,this._cancelTaskDlgt=i,this._cancelTaskCurrZone=this._zone))}fork(s,i){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,s,i):new e(s,i)}intercept(s,i,r){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,s,i,r):i}invoke(s,i,r,E,x){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,s,i,r,E,x):i.apply(r,E)}handleError(s,i){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,s,i):!0}scheduleTask(s,i){let r=i;if(this._scheduleTaskZS)this._hasTaskZS&&r._zoneDelegates.push(this._hasTaskDlgtOwner),r=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,s,i),r||(r=i);else if(i.scheduleFn)i.scheduleFn(i);else if(i.type==F)z(i);else throw new Error("Task is missing scheduleFn.");return r}invokeTask(s,i,r,E){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,s,i,r,E):i.callback.apply(r,E)}cancelTask(s,i){let r;if(this._cancelTaskZS)r=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,s,i);else{if(!i.cancelFn)throw Error("Task is not cancelable");r=i.cancelFn(i)}return r}hasTask(s,i){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,s,i)}catch(r){this.handleError(s,r)}}_updateTaskCount(s,i){let r=this._taskCounts,E=r[s],x=r[s]=E+i;if(x<0)throw new Error("More tasks executed then were scheduled.");if(E==0||x==0){let ee={microTask:r.microTask>0,macroTask:r.macroTask>0,eventTask:r.eventTask>0,change:s};this.hasTask(this._zone,ee)}}}class g{type;source;invoke;callback;data;scheduleFn;cancelFn;_zone=null;runCount=0;_zoneDelegates=null;_state="notScheduled";constructor(s,i,r,E,x,ee){if(this.type=s,this.source=i,this.data=E,this.scheduleFn=x,this.cancelFn=ee,!r)throw new Error("callback is not defined");this.callback=r;let M=this;s===U&&E&&E.useG?this.invoke=g.invokeTask:this.invoke=function(){return g.invokeTask.call(ce,M,this,arguments)}}static invokeTask(s,i,r){s||(s=this),K++;try{return s.runCount++,s.zone.runTask(s,i,r)}finally{K==1&&$(),K--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(q,p)}_transitionTo(s,i,r){if(this._state===i||this._state===r)this._state=s,s==q&&(this._zoneDelegates=null);else throw new Error(`${this.type} '${this.source}': can not transition to '${s}', expecting state '${i}'${r?" or '"+r+"'":""}, was '${this._state}'.`)}toString(){return this.data&&typeof this.data.handleId<"u"?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}let T=te("setTimeout"),y=te("Promise"),w=te("then"),_=[],P=!1,L;function H(I){if(L||ce[y]&&(L=ce[y].resolve(0)),L){let s=L[w];s||(s=L.then),s.call(L,I)}else ce[T](I,0)}function z(I){K===0&&_.length===0&&H($),I&&_.push(I)}function $(){if(!P){for(P=!0;_.length;){let I=_;_=[];for(let s=0;sb,onUnhandledError:W,microtaskDrainDone:W,scheduleMicroTask:z,showUncaughtError:()=>!e[te("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:W,patchMethod:()=>W,bindArguments:()=>[],patchThen:()=>W,patchMacroTask:()=>W,patchEventPrototype:()=>W,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>W,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>W,wrapWithCurrentZone:()=>W,filterProperties:()=>[],attachOriginToPatched:()=>W,_redefineProperty:()=>W,patchCallbacks:()=>W,nativeScheduleMicroTask:H},b={parent:null,zone:new e(null,null)},D=null,K=0;function W(){}return a("Zone","Zone"),e}function dt(){let t=globalThis,n=t[te("forceDuplicateZoneCheck")]===!0;if(t.Zone&&(n||typeof t.Zone.__symbol__!="function"))throw new Error("Zone already loaded.");return t.Zone??=ht(),t.Zone}var pe=Object.getOwnPropertyDescriptor,Me=Object.defineProperty,Ae=Object.getPrototypeOf,_t=Object.create,Tt=Array.prototype.slice,je="addEventListener",He="removeEventListener",Ne=te(je),Ze=te(He),ae="true",le="false",ve=te("");function Ve(t,n){return Zone.current.wrap(t,n)}function xe(t,n,a,e,c){return Zone.current.scheduleMacroTask(t,n,a,e,c)}var j=te,we=typeof window<"u",be=we?window:void 0,Y=we&&be||globalThis,Et="removeAttribute";function Fe(t,n){for(let a=t.length-1;a>=0;a--)typeof t[a]=="function"&&(t[a]=Ve(t[a],n+"_"+a));return t}function gt(t,n){let a=t.constructor.name;for(let e=0;e{let y=function(){return T.apply(this,Fe(arguments,a+"."+c))};return fe(y,T),y})(f)}}}function et(t){return t?t.writable===!1?!1:!(typeof t.get=="function"&&typeof t.set>"u"):!0}var tt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,De=!("nw"in Y)&&typeof Y.process<"u"&&Y.process.toString()==="[object process]",Ge=!De&&!tt&&!!(we&&be.HTMLElement),nt=typeof Y.process<"u"&&Y.process.toString()==="[object process]"&&!tt&&!!(we&&be.HTMLElement),Ce={},kt=j("enable_beforeunload"),Xe=function(t){if(t=t||Y.event,!t)return;let n=Ce[t.type];n||(n=Ce[t.type]=j("ON_PROPERTY"+t.type));let a=this||t.target||Y,e=a[n],c;if(Ge&&a===be&&t.type==="error"){let f=t;c=e&&e.call(this,f.message,f.filename,f.lineno,f.colno,f.error),c===!0&&t.preventDefault()}else c=e&&e.apply(this,arguments),t.type==="beforeunload"&&Y[kt]&&typeof c=="string"?t.returnValue=c:c!=null&&!c&&t.preventDefault();return c};function Ye(t,n,a){let e=pe(t,n);if(!e&&a&&pe(a,n)&&(e={enumerable:!0,configurable:!0}),!e||!e.configurable)return;let c=j("on"+n+"patched");if(t.hasOwnProperty(c)&&t[c])return;delete e.writable,delete e.value;let f=e.get,g=e.set,T=n.slice(2),y=Ce[T];y||(y=Ce[T]=j("ON_PROPERTY"+T)),e.set=function(w){let _=this;if(!_&&t===Y&&(_=Y),!_)return;typeof _[y]=="function"&&_.removeEventListener(T,Xe),g?.call(_,null),_[y]=w,typeof w=="function"&&_.addEventListener(T,Xe,!1)},e.get=function(){let w=this;if(!w&&t===Y&&(w=Y),!w)return null;let _=w[y];if(_)return _;if(f){let P=f.call(this);if(P)return e.set.call(this,P),typeof w[Et]=="function"&&w.removeAttribute(n),P}return null},Me(t,n,e),t[c]=!0}function rt(t,n,a){if(n)for(let e=0;efunction(g,T){let y=a(g,T);return y.cbIdx>=0&&typeof T[y.cbIdx]=="function"?xe(y.name,T[y.cbIdx],y,c):f.apply(g,T)})}function fe(t,n){t[j("OriginalDelegate")]=n}var $e=!1,Le=!1;function yt(){if($e)return Le;$e=!0;try{let t=be.navigator.userAgent;(t.indexOf("MSIE ")!==-1||t.indexOf("Trident/")!==-1||t.indexOf("Edge/")!==-1)&&(Le=!0)}catch{}return Le}function Je(t){return typeof t=="function"}function Ke(t){return typeof t=="number"}var pt={useG:!0},ne={},ot={},st=new RegExp("^"+ve+"(\\w+)(true|false)$"),it=j("propagationStopped");function ct(t,n){let a=(n?n(t):t)+le,e=(n?n(t):t)+ae,c=ve+a,f=ve+e;ne[t]={},ne[t][le]=c,ne[t][ae]=f}function vt(t,n,a,e){let c=e&&e.add||je,f=e&&e.rm||He,g=e&&e.listeners||"eventListeners",T=e&&e.rmAll||"removeAllListeners",y=j(c),w="."+c+":",_="prependListener",P="."+_+":",L=function(p,d,A){if(p.isRemoved)return;let V=p.callback;typeof V=="object"&&V.handleEvent&&(p.callback=k=>V.handleEvent(k),p.originalDelegate=V);let X;try{p.invoke(p,d,[A])}catch(k){X=k}let F=p.options;if(F&&typeof F=="object"&&F.once){let k=p.originalDelegate?p.originalDelegate:p.callback;d[f].call(d,A.type,k,F)}return X};function H(p,d,A){if(d=d||t.event,!d)return;let V=p||d.target||t,X=V[ne[d.type][A?ae:le]];if(X){let F=[];if(X.length===1){let k=L(X[0],V,d);k&&F.push(k)}else{let k=X.slice();for(let U=0;U{throw U})}}}let z=function(p){return H(this,p,!1)},$=function(p){return H(this,p,!0)};function J(p,d){if(!p)return!1;let A=!0;d&&d.useG!==void 0&&(A=d.useG);let V=d&&d.vh,X=!0;d&&d.chkDup!==void 0&&(X=d.chkDup);let F=!1;d&&d.rt!==void 0&&(F=d.rt);let k=p;for(;k&&!k.hasOwnProperty(c);)k=Ae(k);if(!k&&p[c]&&(k=p),!k||k[y])return!1;let U=d&&d.eventNameToString,S={},R=k[y]=k[c],b=k[j(f)]=k[f],D=k[j(g)]=k[g],K=k[j(T)]=k[T],W;d&&d.prepend&&(W=k[j(d.prepend)]=k[d.prepend]);function I(o,u){return u?typeof o=="boolean"?{capture:o,passive:!0}:o?typeof o=="object"&&o.passive!==!1?{...o,passive:!0}:o:{passive:!0}:o}let s=function(o){if(!S.isExisting)return R.call(S.target,S.eventName,S.capture?$:z,S.options)},i=function(o){if(!o.isRemoved){let u=ne[o.eventName],v;u&&(v=u[o.capture?ae:le]);let C=v&&o.target[v];if(C){for(let m=0;mre.zone.cancelTask(re);o.call(Ee,"abort",ie,{once:!0}),re.removeAbortListener=()=>Ee.removeEventListener("abort",ie)}if(S.target=null,me&&(me.taskData=null),Be&&(S.options.once=!0),typeof re.options!="boolean"&&(re.options=se),re.target=N,re.capture=Se,re.eventName=Z,B&&(re.originalDelegate=G),O?ge.unshift(re):ge.push(re),m)return N}};return k[c]=l(R,w,ee,M,F),W&&(k[_]=l(W,P,E,M,F,!0)),k[f]=function(){let o=this||t,u=arguments[0];d&&d.transferEventName&&(u=d.transferEventName(u));let v=arguments[2],C=v?typeof v=="boolean"?!0:v.capture:!1,m=arguments[1];if(!m)return b.apply(this,arguments);if(V&&!V(b,m,o,arguments))return;let O=ne[u],N;O&&(N=O[C?ae:le]);let Z=N&&o[N];if(Z)for(let G=0;Gfunction(c,f){c[it]=!0,e&&e.apply(c,f)})}function Pt(t,n){n.patchMethod(t,"queueMicrotask",a=>function(e,c){Zone.current.scheduleMicroTask("queueMicrotask",c[0])})}var Re=j("zoneTask");function ke(t,n,a,e){let c=null,f=null;n+=e,a+=e;let g={};function T(w){let _=w.data;_.args[0]=function(){return w.invoke.apply(this,arguments)};let P=c.apply(t,_.args);return Ke(P)?_.handleId=P:(_.handle=P,_.isRefreshable=Je(P.refresh)),w}function y(w){let{handle:_,handleId:P}=w.data;return f.call(t,_??P)}c=ue(t,n,w=>function(_,P){if(Je(P[0])){let L={isRefreshable:!1,isPeriodic:e==="Interval",delay:e==="Timeout"||e==="Interval"?P[1]||0:void 0,args:P},H=P[0];P[0]=function(){try{return H.apply(this,arguments)}finally{let{handle:A,handleId:V,isPeriodic:X,isRefreshable:F}=L;!X&&!F&&(V?delete g[V]:A&&(A[Re]=null))}};let z=xe(n,P[0],L,T,y);if(!z)return z;let{handleId:$,handle:J,isRefreshable:q,isPeriodic:p}=z.data;if($)g[$]=z;else if(J&&(J[Re]=z,q&&!p)){let d=J.refresh;J.refresh=function(){let{zone:A,state:V}=z;return V==="notScheduled"?(z._state="scheduled",A._updateTaskCount(z,1)):V==="running"&&(z._state="scheduling"),d.call(this)}}return J??$??z}else return w.apply(t,P)}),f=ue(t,a,w=>function(_,P){let L=P[0],H;Ke(L)?(H=g[L],delete g[L]):(H=L?.[Re],H?L[Re]=null:H=L),H?.type?H.cancelFn&&H.zone.cancelTask(H):w.apply(t,P)})}function Rt(t,n){let{isBrowser:a,isMix:e}=n.getGlobalObjects();if(!a&&!e||!t.customElements||!("customElements"in t))return;let c=["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formAssociatedCallback","formDisabledCallback","formResetCallback","formStateRestoreCallback"];n.patchCallbacks(n,t.customElements,"customElements","define",c)}function Ct(t,n){if(Zone[n.symbol("patchEventTarget")])return;let{eventNames:a,zoneSymbolEventNames:e,TRUE_STR:c,FALSE_STR:f,ZONE_SYMBOL_PREFIX:g}=n.getGlobalObjects();for(let y=0;yf.target===t);if(e.length===0)return n;let c=e[0].ignoreProperties;return n.filter(f=>c.indexOf(f)===-1)}function Qe(t,n,a,e){if(!t)return;let c=lt(t,n,a);rt(t,c,e)}function Ie(t){return Object.getOwnPropertyNames(t).filter(n=>n.startsWith("on")&&n.length>2).map(n=>n.substring(2))}function Dt(t,n){if(De&&!nt||Zone[t.symbol("patchEvents")])return;let a=n.__Zone_ignore_on_properties,e=[];if(Ge){let c=window;e=e.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);let f=[];Qe(c,Ie(c),a&&a.concat(f),Ae(c))}e=e.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let c=0;c{let a=n[t.__symbol__("legacyPatch")];a&&a()}),t.__load_patch("timers",n=>{let a="set",e="clear";ke(n,a,e,"Timeout"),ke(n,a,e,"Interval"),ke(n,a,e,"Immediate")}),t.__load_patch("requestAnimationFrame",n=>{ke(n,"request","cancel","AnimationFrame"),ke(n,"mozRequest","mozCancel","AnimationFrame"),ke(n,"webkitRequest","webkitCancel","AnimationFrame")}),t.__load_patch("blocking",(n,a)=>{let e=["alert","prompt","confirm"];for(let c=0;cfunction(w,_){return a.current.run(g,n,_,y)})}}),t.__load_patch("EventTarget",(n,a,e)=>{wt(n,e),Ct(n,e);let c=n.XMLHttpRequestEventTarget;c&&c.prototype&&e.patchEventTarget(n,e,[c.prototype])}),t.__load_patch("MutationObserver",(n,a,e)=>{ye("MutationObserver"),ye("WebKitMutationObserver")}),t.__load_patch("IntersectionObserver",(n,a,e)=>{ye("IntersectionObserver")}),t.__load_patch("FileReader",(n,a,e)=>{ye("FileReader")}),t.__load_patch("on_property",(n,a,e)=>{Dt(e,n)}),t.__load_patch("customElements",(n,a,e)=>{Rt(n,e)}),t.__load_patch("XHR",(n,a)=>{w(n);let e=j("xhrTask"),c=j("xhrSync"),f=j("xhrListener"),g=j("xhrScheduled"),T=j("xhrURL"),y=j("xhrErrorBeforeScheduled");function w(_){let P=_.XMLHttpRequest;if(!P)return;let L=P.prototype;function H(R){return R[e]}let z=L[Ne],$=L[Ze];if(!z){let R=_.XMLHttpRequestEventTarget;if(R){let b=R.prototype;z=b[Ne],$=b[Ze]}}let J="readystatechange",q="scheduled";function p(R){let b=R.data,D=b.target;D[g]=!1,D[y]=!1;let K=D[f];z||(z=D[Ne],$=D[Ze]),K&&$.call(D,J,K);let W=D[f]=()=>{if(D.readyState===D.DONE)if(!b.aborted&&D[g]&&R.state===q){let s=D[a.__symbol__("loadfalse")];if(D.status!==0&&s&&s.length>0){let i=R.invoke;R.invoke=function(){let r=D[a.__symbol__("loadfalse")];for(let E=0;Efunction(R,b){return R[c]=b[2]==!1,R[T]=b[1],V.apply(R,b)}),X="XMLHttpRequest.send",F=j("fetchTaskAborting"),k=j("fetchTaskScheduling"),U=ue(L,"send",()=>function(R,b){if(a.current[k]===!0||R[c])return U.apply(R,b);{let D={target:R,url:R[T],isPeriodic:!1,args:b,aborted:!1},K=xe(X,d,D,p,A);R&&R[y]===!0&&!D.aborted&&K.state===q&&K.invoke()}}),S=ue(L,"abort",()=>function(R,b){let D=H(R);if(D&&typeof D.type=="string"){if(D.cancelFn==null||D.data&&D.data.aborted)return;D.zone.cancelTask(D)}else if(a.current[F]===!0)return S.apply(R,b)})}}),t.__load_patch("geolocation",n=>{n.navigator&&n.navigator.geolocation&>(n.navigator.geolocation,["getCurrentPosition","watchPosition"])}),t.__load_patch("PromiseRejectionEvent",(n,a)=>{function e(c){return function(f){at(n,c).forEach(T=>{let y=n.PromiseRejectionEvent;if(y){let w=new y(c,{promise:f.promise,reason:f.rejection});T.invoke(w)}})}}n.PromiseRejectionEvent&&(a[j("unhandledPromiseRejectionHandler")]=e("unhandledrejection"),a[j("rejectionHandledHandler")]=e("rejectionhandled"))}),t.__load_patch("queueMicrotask",(n,a,e)=>{Pt(n,e)})}function Ot(t){t.__load_patch("ZoneAwarePromise",(n,a,e)=>{let c=Object.getOwnPropertyDescriptor,f=Object.defineProperty;function g(h){if(h&&h.toString===Object.prototype.toString){let l=h.constructor&&h.constructor.name;return(l||"")+": "+JSON.stringify(h)}return h?h.toString():Object.prototype.toString.call(h)}let T=e.symbol,y=[],w=n[T("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")]!==!1,_=T("Promise"),P=T("then"),L="__creationTrace__";e.onUnhandledError=h=>{if(e.showUncaughtError()){let l=h&&h.rejection;l?console.error("Unhandled Promise rejection:",l instanceof Error?l.message:l,"; Zone:",h.zone.name,"; Task:",h.task&&h.task.source,"; Value:",l,l instanceof Error?l.stack:void 0):console.error(h)}},e.microtaskDrainDone=()=>{for(;y.length;){let h=y.shift();try{h.zone.runGuarded(()=>{throw h.throwOriginal?h.rejection:h})}catch(l){z(l)}}};let H=T("unhandledPromiseRejectionHandler");function z(h){e.onUnhandledError(h);try{let l=a[H];typeof l=="function"&&l.call(this,h)}catch{}}function $(h){return h&&typeof h.then=="function"}function J(h){return h}function q(h){return M.reject(h)}let p=T("state"),d=T("value"),A=T("finally"),V=T("parentPromiseValue"),X=T("parentPromiseState"),F="Promise.then",k=null,U=!0,S=!1,R=0;function b(h,l){return o=>{try{I(h,l,o)}catch(u){I(h,!1,u)}}}let D=function(){let h=!1;return function(o){return function(){h||(h=!0,o.apply(null,arguments))}}},K="Promise resolved with itself",W=T("currentTaskTrace");function I(h,l,o){let u=D();if(h===o)throw new TypeError(K);if(h[p]===k){let v=null;try{(typeof o=="object"||typeof o=="function")&&(v=o&&o.then)}catch(C){return u(()=>{I(h,!1,C)})(),h}if(l!==S&&o instanceof M&&o.hasOwnProperty(p)&&o.hasOwnProperty(d)&&o[p]!==k)i(o),I(h,o[p],o[d]);else if(l!==S&&typeof v=="function")try{v.call(o,u(b(h,l)),u(b(h,!1)))}catch(C){u(()=>{I(h,!1,C)})()}else{h[p]=l;let C=h[d];if(h[d]=o,h[A]===A&&l===U&&(h[p]=h[X],h[d]=h[V]),l===S&&o instanceof Error){let m=a.currentTask&&a.currentTask.data&&a.currentTask.data[L];m&&f(o,W,{configurable:!0,enumerable:!1,writable:!0,value:m})}for(let m=0;m{try{let O=h[d],N=!!o&&A===o[A];N&&(o[V]=O,o[X]=C);let Z=l.run(m,void 0,N&&m!==q&&m!==J?[]:[O]);I(o,!0,Z)}catch(O){I(o,!1,O)}},o)}let E="function ZoneAwarePromise() { [native code] }",x=function(){},ee=n.AggregateError;class M{static toString(){return E}static resolve(l){return l instanceof M?l:I(new this(null),U,l)}static reject(l){return I(new this(null),S,l)}static withResolvers(){let l={};return l.promise=new M((o,u)=>{l.resolve=o,l.reject=u}),l}static any(l){if(!l||typeof l[Symbol.iterator]!="function")return Promise.reject(new ee([],"All promises were rejected"));let o=[],u=0;try{for(let m of l)u++,o.push(M.resolve(m))}catch{return Promise.reject(new ee([],"All promises were rejected"))}if(u===0)return Promise.reject(new ee([],"All promises were rejected"));let v=!1,C=[];return new M((m,O)=>{for(let N=0;N{v||(v=!0,m(Z))},Z=>{C.push(Z),u--,u===0&&(v=!0,O(new ee(C,"All promises were rejected")))})})}static race(l){let o,u,v=new this((O,N)=>{o=O,u=N});function C(O){o(O)}function m(O){u(O)}for(let O of l)$(O)||(O=this.resolve(O)),O.then(C,m);return v}static all(l){return M.allWithCallback(l)}static allSettled(l){return(this&&this.prototype instanceof M?this:M).allWithCallback(l,{thenCallback:u=>({status:"fulfilled",value:u}),errorCallback:u=>({status:"rejected",reason:u})})}static allWithCallback(l,o){let u,v,C=new this((Z,G)=>{u=Z,v=G}),m=2,O=0,N=[];for(let Z of l){$(Z)||(Z=this.resolve(Z));let G=O;try{Z.then(B=>{N[G]=o?o.thenCallback(B):B,m--,m===0&&u(N)},B=>{o?(N[G]=o.errorCallback(B),m--,m===0&&u(N)):v(B)})}catch(B){v(B)}m++,O++}return m-=2,m===0&&u(N),C}constructor(l){let o=this;if(!(o instanceof M))throw new Error("Must be an instanceof Promise.");o[p]=k,o[d]=[];try{let u=D();l&&l(u(b(o,U)),u(b(o,S)))}catch(u){I(o,!1,u)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return M}then(l,o){let u=this.constructor?.[Symbol.species];(!u||typeof u!="function")&&(u=this.constructor||M);let v=new u(x),C=a.current;return this[p]==k?this[d].push(C,v,l,o):r(this,C,v,l,o),v}catch(l){return this.then(null,l)}finally(l){let o=this.constructor?.[Symbol.species];(!o||typeof o!="function")&&(o=M);let u=new o(x);u[A]=A;let v=a.current;return this[p]==k?this[d].push(v,u,l,l):r(this,v,u,l,l),u}}M.resolve=M.resolve,M.reject=M.reject,M.race=M.race,M.all=M.all;let he=n[_]=n.Promise;n.Promise=M;let _e=T("thenPatched");function Q(h){let l=h.prototype,o=c(l,"then");if(o&&(o.writable===!1||!o.configurable))return;let u=l.then;l[P]=u,h.prototype.then=function(v,C){return new M((O,N)=>{u.call(this,O,N)}).then(v,C)},h[_e]=!0}e.patchThen=Q;function Te(h){return function(l,o){let u=h.apply(l,o);if(u instanceof M)return u;let v=u.constructor;return v[_e]||Q(v),u}}return he&&(Q(he),ue(n,"fetch",h=>Te(h))),Promise[a.__symbol__("uncaughtPromiseErrors")]=y,M})}function Nt(t){t.__load_patch("toString",n=>{let a=Function.prototype.toString,e=j("OriginalDelegate"),c=j("Promise"),f=j("Error"),g=function(){if(typeof this=="function"){let _=this[e];if(_)return typeof _=="function"?a.call(_):Object.prototype.toString.call(_);if(this===Promise){let P=n[c];if(P)return a.call(P)}if(this===Error){let P=n[f];if(P)return a.call(P)}}return a.call(this)};g[e]=a,Function.prototype.toString=g;let T=Object.prototype.toString,y="[object Promise]";Object.prototype.toString=function(){return typeof Promise=="function"&&this instanceof Promise?y:T.call(this)}})}function Zt(t,n,a,e,c){let f=Zone.__symbol__(e);if(n[f])return;let g=n[f]=n[e];n[e]=function(T,y,w){return y&&y.prototype&&c.forEach(function(_){let P=`${a}.${e}::`+_,L=y.prototype;try{if(L.hasOwnProperty(_)){let H=t.ObjectGetOwnPropertyDescriptor(L,_);H&&H.value?(H.value=t.wrapWithCurrentZone(H.value,P),t._redefineProperty(y.prototype,_,H)):L[_]&&(L[_]=t.wrapWithCurrentZone(L[_],P))}else L[_]&&(L[_]=t.wrapWithCurrentZone(L[_],P))}catch{}}),g.call(n,T,y,w)},t.attachOriginToPatched(n[e],g)}function Lt(t){t.__load_patch("util",(n,a,e)=>{let c=Ie(n);e.patchOnProperties=rt,e.patchMethod=ue,e.bindArguments=Fe,e.patchMacroTask=mt;let f=a.__symbol__("BLACK_LISTED_EVENTS"),g=a.__symbol__("UNPATCHED_EVENTS");n[g]&&(n[f]=n[g]),n[f]&&(a[f]=a[g]=n[f]),e.patchEventPrototype=bt,e.patchEventTarget=vt,e.isIEOrEdge=yt,e.ObjectDefineProperty=Me,e.ObjectGetOwnPropertyDescriptor=pe,e.ObjectCreate=_t,e.ArraySlice=Tt,e.patchClass=ye,e.wrapWithCurrentZone=Ve,e.filterProperties=lt,e.attachOriginToPatched=fe,e._redefineProperty=Object.defineProperty,e.patchCallbacks=Zt,e.getGlobalObjects=()=>({globalSources:ot,zoneSymbolEventNames:ne,eventNames:c,isBrowser:Ge,isMix:nt,isNode:De,TRUE_STR:ae,FALSE_STR:le,ZONE_SYMBOL_PREFIX:ve,ADD_EVENT_LISTENER_STR:je,REMOVE_EVENT_LISTENER_STR:He})})}function It(t){Ot(t),Nt(t),Lt(t)}var ut=dt();It(ut);St(ut); diff --git a/src/google/adk/cli/browser/polyfills-FFHMD2TL.js b/src/google/adk/cli/browser/polyfills-FFHMD2TL.js new file mode 100644 index 00000000..499003db --- /dev/null +++ b/src/google/adk/cli/browser/polyfills-FFHMD2TL.js @@ -0,0 +1,17 @@ +/** + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var ce=globalThis;function te(e){return(ce.__Zone_symbol_prefix||"__zone_symbol__")+e}function dt(){let e=ce.performance;function n(M){e&&e.mark&&e.mark(M)}function a(M,s){e&&e.measure&&e.measure(M,s)}n("Zone");class t{static{this.__symbol__=te}static assertZonePatched(){if(ce.Promise!==S.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let s=t.current;for(;s.parent;)s=s.parent;return s}static get current(){return b.zone}static get currentTask(){return D}static __load_patch(s,i,o=!1){if(S.hasOwnProperty(s)){let g=ce[te("forceDuplicateZoneCheck")]===!0;if(!o&&g)throw Error("Already loaded patch: "+s)}else if(!ce["__Zone_disable_"+s]){let g="Zone:"+s;n(g),S[s]=i(ce,t,w),a(g,g)}}get parent(){return this._parent}get name(){return this._name}constructor(s,i){this._parent=s,this._name=i?i.name||"unnamed":"",this._properties=i&&i.properties||{},this._zoneDelegate=new f(this,this._parent&&this._parent._zoneDelegate,i)}get(s){let i=this.getZoneWith(s);if(i)return i._properties[s]}getZoneWith(s){let i=this;for(;i;){if(i._properties.hasOwnProperty(s))return i;i=i._parent}return null}fork(s){if(!s)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,s)}wrap(s,i){if(typeof s!="function")throw new Error("Expecting function got: "+s);let o=this._zoneDelegate.intercept(this,s,i),g=this;return function(){return g.runGuarded(o,this,arguments,i)}}run(s,i,o,g){b={parent:b,zone:this};try{return this._zoneDelegate.invoke(this,s,i,o,g)}finally{b=b.parent}}runGuarded(s,i=null,o,g){b={parent:b,zone:this};try{try{return this._zoneDelegate.invoke(this,s,i,o,g)}catch(V){if(this._zoneDelegate.handleError(this,V))throw V}}finally{b=b.parent}}runTask(s,i,o){if(s.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(s.zone||J).name+"; Execution: "+this.name+")");let g=s,{type:V,data:{isPeriodic:ee=!1,isRefreshable:Z=!1}={}}=s;if(s.state===q&&(V===z||V===y))return;let he=s.state!=A;he&&g._transitionTo(A,d);let _e=D;D=g,b={parent:b,zone:this};try{V==y&&s.data&&!ee&&!Z&&(s.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,g,i,o)}catch(Q){if(this._zoneDelegate.handleError(this,Q))throw Q}}finally{let Q=s.state;if(Q!==q&&Q!==X)if(V==z||ee||Z&&Q===k)he&&g._transitionTo(d,A,k);else{let Ee=g._zoneDelegates;this._updateTaskCount(g,-1),he&&g._transitionTo(q,A,q),Z&&(g._zoneDelegates=Ee)}b=b.parent,D=_e}}scheduleTask(s){if(s.zone&&s.zone!==this){let o=this;for(;o;){if(o===s.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${s.zone.name}`);o=o.parent}}s._transitionTo(k,q);let i=[];s._zoneDelegates=i,s._zone=this;try{s=this._zoneDelegate.scheduleTask(this,s)}catch(o){throw s._transitionTo(X,k,q),this._zoneDelegate.handleError(this,o),o}return s._zoneDelegates===i&&this._updateTaskCount(s,1),s.state==k&&s._transitionTo(d,k),s}scheduleMicroTask(s,i,o,g){return this.scheduleTask(new E(G,s,i,o,g,void 0))}scheduleMacroTask(s,i,o,g,V){return this.scheduleTask(new E(y,s,i,o,g,V))}scheduleEventTask(s,i,o,g,V){return this.scheduleTask(new E(z,s,i,o,g,V))}cancelTask(s){if(s.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(s.zone||J).name+"; Execution: "+this.name+")");if(!(s.state!==d&&s.state!==A)){s._transitionTo(x,d,A);try{this._zoneDelegate.cancelTask(this,s)}catch(i){throw s._transitionTo(X,x),this._zoneDelegate.handleError(this,i),i}return this._updateTaskCount(s,-1),s._transitionTo(q,x),s.runCount=-1,s}}_updateTaskCount(s,i){let o=s._zoneDelegates;i==-1&&(s._zoneDelegates=null);for(let g=0;gM.hasTask(i,o),onScheduleTask:(M,s,i,o)=>M.scheduleTask(i,o),onInvokeTask:(M,s,i,o,g,V)=>M.invokeTask(i,o,g,V),onCancelTask:(M,s,i,o)=>M.cancelTask(i,o)};class f{get zone(){return this._zone}constructor(s,i,o){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this._zone=s,this._parentDelegate=i,this._forkZS=o&&(o&&o.onFork?o:i._forkZS),this._forkDlgt=o&&(o.onFork?i:i._forkDlgt),this._forkCurrZone=o&&(o.onFork?this._zone:i._forkCurrZone),this._interceptZS=o&&(o.onIntercept?o:i._interceptZS),this._interceptDlgt=o&&(o.onIntercept?i:i._interceptDlgt),this._interceptCurrZone=o&&(o.onIntercept?this._zone:i._interceptCurrZone),this._invokeZS=o&&(o.onInvoke?o:i._invokeZS),this._invokeDlgt=o&&(o.onInvoke?i:i._invokeDlgt),this._invokeCurrZone=o&&(o.onInvoke?this._zone:i._invokeCurrZone),this._handleErrorZS=o&&(o.onHandleError?o:i._handleErrorZS),this._handleErrorDlgt=o&&(o.onHandleError?i:i._handleErrorDlgt),this._handleErrorCurrZone=o&&(o.onHandleError?this._zone:i._handleErrorCurrZone),this._scheduleTaskZS=o&&(o.onScheduleTask?o:i._scheduleTaskZS),this._scheduleTaskDlgt=o&&(o.onScheduleTask?i:i._scheduleTaskDlgt),this._scheduleTaskCurrZone=o&&(o.onScheduleTask?this._zone:i._scheduleTaskCurrZone),this._invokeTaskZS=o&&(o.onInvokeTask?o:i._invokeTaskZS),this._invokeTaskDlgt=o&&(o.onInvokeTask?i:i._invokeTaskDlgt),this._invokeTaskCurrZone=o&&(o.onInvokeTask?this._zone:i._invokeTaskCurrZone),this._cancelTaskZS=o&&(o.onCancelTask?o:i._cancelTaskZS),this._cancelTaskDlgt=o&&(o.onCancelTask?i:i._cancelTaskDlgt),this._cancelTaskCurrZone=o&&(o.onCancelTask?this._zone:i._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;let g=o&&o.onHasTask,V=i&&i._hasTaskZS;(g||V)&&(this._hasTaskZS=g?o:c,this._hasTaskDlgt=i,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,o.onScheduleTask||(this._scheduleTaskZS=c,this._scheduleTaskDlgt=i,this._scheduleTaskCurrZone=this._zone),o.onInvokeTask||(this._invokeTaskZS=c,this._invokeTaskDlgt=i,this._invokeTaskCurrZone=this._zone),o.onCancelTask||(this._cancelTaskZS=c,this._cancelTaskDlgt=i,this._cancelTaskCurrZone=this._zone))}fork(s,i){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,s,i):new t(s,i)}intercept(s,i,o){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,s,i,o):i}invoke(s,i,o,g,V){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,s,i,o,g,V):i.apply(o,g)}handleError(s,i){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,s,i):!0}scheduleTask(s,i){let o=i;if(this._scheduleTaskZS)this._hasTaskZS&&o._zoneDelegates.push(this._hasTaskDlgtOwner),o=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,s,i),o||(o=i);else if(i.scheduleFn)i.scheduleFn(i);else if(i.type==G)U(i);else throw new Error("Task is missing scheduleFn.");return o}invokeTask(s,i,o,g){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,s,i,o,g):i.callback.apply(o,g)}cancelTask(s,i){let o;if(this._cancelTaskZS)o=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,s,i);else{if(!i.cancelFn)throw Error("Task is not cancelable");o=i.cancelFn(i)}return o}hasTask(s,i){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,s,i)}catch(o){this.handleError(s,o)}}_updateTaskCount(s,i){let o=this._taskCounts,g=o[s],V=o[s]=g+i;if(V<0)throw new Error("More tasks executed then were scheduled.");if(g==0||V==0){let ee={microTask:o.microTask>0,macroTask:o.macroTask>0,eventTask:o.eventTask>0,change:s};this.hasTask(this._zone,ee)}}}class E{constructor(s,i,o,g,V,ee){if(this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=s,this.source=i,this.data=g,this.scheduleFn=V,this.cancelFn=ee,!o)throw new Error("callback is not defined");this.callback=o;let Z=this;s===z&&g&&g.useG?this.invoke=E.invokeTask:this.invoke=function(){return E.invokeTask.call(ce,Z,this,arguments)}}static invokeTask(s,i,o){s||(s=this),K++;try{return s.runCount++,s.zone.runTask(s,i,o)}finally{K==1&&$(),K--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(q,k)}_transitionTo(s,i,o){if(this._state===i||this._state===o)this._state=s,s==q&&(this._zoneDelegates=null);else throw new Error(`${this.type} '${this.source}': can not transition to '${s}', expecting state '${i}'${o?" or '"+o+"'":""}, was '${this._state}'.`)}toString(){return this.data&&typeof this.data.handleId<"u"?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}let T=te("setTimeout"),p=te("Promise"),C=te("then"),_=[],P=!1,I;function H(M){if(I||ce[p]&&(I=ce[p].resolve(0)),I){let s=I[C];s||(s=I.then),s.call(I,M)}else ce[T](M,0)}function U(M){K===0&&_.length===0&&H($),M&&_.push(M)}function $(){if(!P){for(P=!0;_.length;){let M=_;_=[];for(let s=0;sb,onUnhandledError:W,microtaskDrainDone:W,scheduleMicroTask:U,showUncaughtError:()=>!t[te("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:W,patchMethod:()=>W,bindArguments:()=>[],patchThen:()=>W,patchMacroTask:()=>W,patchEventPrototype:()=>W,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>W,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>W,wrapWithCurrentZone:()=>W,filterProperties:()=>[],attachOriginToPatched:()=>W,_redefineProperty:()=>W,patchCallbacks:()=>W,nativeScheduleMicroTask:H},b={parent:null,zone:new t(null,null)},D=null,K=0;function W(){}return a("Zone","Zone"),t}function _t(){let e=globalThis,n=e[te("forceDuplicateZoneCheck")]===!0;if(e.Zone&&(n||typeof e.Zone.__symbol__!="function"))throw new Error("Zone already loaded.");return e.Zone??=dt(),e.Zone}var be=Object.getOwnPropertyDescriptor,Ae=Object.defineProperty,je=Object.getPrototypeOf,Et=Object.create,Tt=Array.prototype.slice,He="addEventListener",xe="removeEventListener",Le=te(He),Ie=te(xe),ae="true",le="false",Pe=te("");function Ve(e,n){return Zone.current.wrap(e,n)}function Ge(e,n,a,t,c){return Zone.current.scheduleMacroTask(e,n,a,t,c)}var j=te,De=typeof window<"u",pe=De?window:void 0,Y=De&&pe||globalThis,gt="removeAttribute";function Fe(e,n){for(let a=e.length-1;a>=0;a--)typeof e[a]=="function"&&(e[a]=Ve(e[a],n+"_"+a));return e}function yt(e,n){let a=e.constructor.name;for(let t=0;t{let p=function(){return T.apply(this,Fe(arguments,a+"."+c))};return fe(p,T),p})(f)}}}function tt(e){return e?e.writable===!1?!1:!(typeof e.get=="function"&&typeof e.set>"u"):!0}var nt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Se=!("nw"in Y)&&typeof Y.process<"u"&&Y.process.toString()==="[object process]",Be=!Se&&!nt&&!!(De&&pe.HTMLElement),rt=typeof Y.process<"u"&&Y.process.toString()==="[object process]"&&!nt&&!!(De&&pe.HTMLElement),Ce={},mt=j("enable_beforeunload"),Ye=function(e){if(e=e||Y.event,!e)return;let n=Ce[e.type];n||(n=Ce[e.type]=j("ON_PROPERTY"+e.type));let a=this||e.target||Y,t=a[n],c;if(Be&&a===pe&&e.type==="error"){let f=e;c=t&&t.call(this,f.message,f.filename,f.lineno,f.colno,f.error),c===!0&&e.preventDefault()}else c=t&&t.apply(this,arguments),e.type==="beforeunload"&&Y[mt]&&typeof c=="string"?e.returnValue=c:c!=null&&!c&&e.preventDefault();return c};function $e(e,n,a){let t=be(e,n);if(!t&&a&&be(a,n)&&(t={enumerable:!0,configurable:!0}),!t||!t.configurable)return;let c=j("on"+n+"patched");if(e.hasOwnProperty(c)&&e[c])return;delete t.writable,delete t.value;let f=t.get,E=t.set,T=n.slice(2),p=Ce[T];p||(p=Ce[T]=j("ON_PROPERTY"+T)),t.set=function(C){let _=this;if(!_&&e===Y&&(_=Y),!_)return;typeof _[p]=="function"&&_.removeEventListener(T,Ye),E&&E.call(_,null),_[p]=C,typeof C=="function"&&_.addEventListener(T,Ye,!1)},t.get=function(){let C=this;if(!C&&e===Y&&(C=Y),!C)return null;let _=C[p];if(_)return _;if(f){let P=f.call(this);if(P)return t.set.call(this,P),typeof C[gt]=="function"&&C.removeAttribute(n),P}return null},Ae(e,n,t),e[c]=!0}function ot(e,n,a){if(n)for(let t=0;tfunction(E,T){let p=a(E,T);return p.cbIdx>=0&&typeof T[p.cbIdx]=="function"?Ge(p.name,T[p.cbIdx],p,c):f.apply(E,T)})}function fe(e,n){e[j("OriginalDelegate")]=n}var Je=!1,Me=!1;function kt(){try{let e=pe.navigator.userAgent;if(e.indexOf("MSIE ")!==-1||e.indexOf("Trident/")!==-1)return!0}catch{}return!1}function vt(){if(Je)return Me;Je=!0;try{let e=pe.navigator.userAgent;(e.indexOf("MSIE ")!==-1||e.indexOf("Trident/")!==-1||e.indexOf("Edge/")!==-1)&&(Me=!0)}catch{}return Me}function Ke(e){return typeof e=="function"}function Qe(e){return typeof e=="number"}var me=!1;if(typeof window<"u")try{let e=Object.defineProperty({},"passive",{get:function(){me=!0}});window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch{me=!1}var bt={useG:!0},ne={},st={},it=new RegExp("^"+Pe+"(\\w+)(true|false)$"),ct=j("propagationStopped");function at(e,n){let a=(n?n(e):e)+le,t=(n?n(e):e)+ae,c=Pe+a,f=Pe+t;ne[e]={},ne[e][le]=c,ne[e][ae]=f}function Pt(e,n,a,t){let c=t&&t.add||He,f=t&&t.rm||xe,E=t&&t.listeners||"eventListeners",T=t&&t.rmAll||"removeAllListeners",p=j(c),C="."+c+":",_="prependListener",P="."+_+":",I=function(k,d,A){if(k.isRemoved)return;let x=k.callback;typeof x=="object"&&x.handleEvent&&(k.callback=y=>x.handleEvent(y),k.originalDelegate=x);let X;try{k.invoke(k,d,[A])}catch(y){X=y}let G=k.options;if(G&&typeof G=="object"&&G.once){let y=k.originalDelegate?k.originalDelegate:k.callback;d[f].call(d,A.type,y,G)}return X};function H(k,d,A){if(d=d||e.event,!d)return;let x=k||d.target||e,X=x[ne[d.type][A?ae:le]];if(X){let G=[];if(X.length===1){let y=I(X[0],x,d);y&&G.push(y)}else{let y=X.slice();for(let z=0;z{throw z})}}}let U=function(k){return H(this,k,!1)},$=function(k){return H(this,k,!0)};function J(k,d){if(!k)return!1;let A=!0;d&&d.useG!==void 0&&(A=d.useG);let x=d&&d.vh,X=!0;d&&d.chkDup!==void 0&&(X=d.chkDup);let G=!1;d&&d.rt!==void 0&&(G=d.rt);let y=k;for(;y&&!y.hasOwnProperty(c);)y=je(y);if(!y&&k[c]&&(y=k),!y||y[p])return!1;let z=d&&d.eventNameToString,S={},w=y[p]=y[c],b=y[j(f)]=y[f],D=y[j(E)]=y[E],K=y[j(T)]=y[T],W;d&&d.prepend&&(W=y[j(d.prepend)]=y[d.prepend]);function M(r,u){return!me&&typeof r=="object"&&r?!!r.capture:!me||!u?r:typeof r=="boolean"?{capture:r,passive:!0}:r?typeof r=="object"&&r.passive!==!1?{...r,passive:!0}:r:{passive:!0}}let s=function(r){if(!S.isExisting)return w.call(S.target,S.eventName,S.capture?$:U,S.options)},i=function(r){if(!r.isRemoved){let u=ne[r.eventName],v;u&&(v=u[r.capture?ae:le]);let R=v&&r.target[v];if(R){for(let m=0;mre.zone.cancelTask(re);r.call(Te,"abort",ie,{once:!0}),re.removeAbortListener=()=>Te.removeEventListener("abort",ie)}if(S.target=null,ke&&(ke.taskData=null),Ue&&(S.options.once=!0),!me&&typeof re.options=="boolean"||(re.options=se),re.target=N,re.capture=Oe,re.eventName=L,B&&(re.originalDelegate=F),O?ge.unshift(re):ge.push(re),m)return N}};return y[c]=l(w,C,ee,Z,G),W&&(y[_]=l(W,P,g,Z,G,!0)),y[f]=function(){let r=this||e,u=arguments[0];d&&d.transferEventName&&(u=d.transferEventName(u));let v=arguments[2],R=v?typeof v=="boolean"?!0:v.capture:!1,m=arguments[1];if(!m)return b.apply(this,arguments);if(x&&!x(b,m,r,arguments))return;let O=ne[u],N;O&&(N=O[R?ae:le]);let L=N&&r[N];if(L)for(let F=0;Ffunction(c,f){c[ct]=!0,t&&t.apply(c,f)})}function Rt(e,n){n.patchMethod(e,"queueMicrotask",a=>function(t,c){Zone.current.scheduleMicroTask("queueMicrotask",c[0])})}var Re=j("zoneTask");function ye(e,n,a,t){let c=null,f=null;n+=t,a+=t;let E={};function T(C){let _=C.data;_.args[0]=function(){return C.invoke.apply(this,arguments)};let P=c.apply(e,_.args);return Qe(P)?_.handleId=P:(_.handle=P,_.isRefreshable=Ke(P.refresh)),C}function p(C){let{handle:_,handleId:P}=C.data;return f.call(e,_??P)}c=ue(e,n,C=>function(_,P){if(Ke(P[0])){let I={isRefreshable:!1,isPeriodic:t==="Interval",delay:t==="Timeout"||t==="Interval"?P[1]||0:void 0,args:P},H=P[0];P[0]=function(){try{return H.apply(this,arguments)}finally{let{handle:A,handleId:x,isPeriodic:X,isRefreshable:G}=I;!X&&!G&&(x?delete E[x]:A&&(A[Re]=null))}};let U=Ge(n,P[0],I,T,p);if(!U)return U;let{handleId:$,handle:J,isRefreshable:q,isPeriodic:k}=U.data;if($)E[$]=U;else if(J&&(J[Re]=U,q&&!k)){let d=J.refresh;J.refresh=function(){let{zone:A,state:x}=U;return x==="notScheduled"?(U._state="scheduled",A._updateTaskCount(U,1)):x==="running"&&(U._state="scheduling"),d.call(this)}}return J??$??U}else return C.apply(e,P)}),f=ue(e,a,C=>function(_,P){let I=P[0],H;Qe(I)?(H=E[I],delete E[I]):(H=I?.[Re],H?I[Re]=null:H=I),H?.type?H.cancelFn&&H.zone.cancelTask(H):C.apply(e,P)})}function Ct(e,n){let{isBrowser:a,isMix:t}=n.getGlobalObjects();if(!a&&!t||!e.customElements||!("customElements"in e))return;let c=["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formAssociatedCallback","formDisabledCallback","formResetCallback","formStateRestoreCallback"];n.patchCallbacks(n,e.customElements,"customElements","define",c)}function Dt(e,n){if(Zone[n.symbol("patchEventTarget")])return;let{eventNames:a,zoneSymbolEventNames:t,TRUE_STR:c,FALSE_STR:f,ZONE_SYMBOL_PREFIX:E}=n.getGlobalObjects();for(let p=0;pf.target===e);if(!t||t.length===0)return n;let c=t[0].ignoreProperties;return n.filter(f=>c.indexOf(f)===-1)}function et(e,n,a,t){if(!e)return;let c=ut(e,n,a);ot(e,c,t)}function Ze(e){return Object.getOwnPropertyNames(e).filter(n=>n.startsWith("on")&&n.length>2).map(n=>n.substring(2))}function Ot(e,n){if(Se&&!rt||Zone[e.symbol("patchEvents")])return;let a=n.__Zone_ignore_on_properties,t=[];if(Be){let c=window;t=t.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);let f=kt()?[{target:c,ignoreProperties:["error"]}]:[];et(c,Ze(c),a&&a.concat(f),je(c))}t=t.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let c=0;c{let a=n[e.__symbol__("legacyPatch")];a&&a()}),e.__load_patch("timers",n=>{let a="set",t="clear";ye(n,a,t,"Timeout"),ye(n,a,t,"Interval"),ye(n,a,t,"Immediate")}),e.__load_patch("requestAnimationFrame",n=>{ye(n,"request","cancel","AnimationFrame"),ye(n,"mozRequest","mozCancel","AnimationFrame"),ye(n,"webkitRequest","webkitCancel","AnimationFrame")}),e.__load_patch("blocking",(n,a)=>{let t=["alert","prompt","confirm"];for(let c=0;cfunction(C,_){return a.current.run(E,n,_,p)})}}),e.__load_patch("EventTarget",(n,a,t)=>{St(n,t),Dt(n,t);let c=n.XMLHttpRequestEventTarget;c&&c.prototype&&t.patchEventTarget(n,t,[c.prototype])}),e.__load_patch("MutationObserver",(n,a,t)=>{ve("MutationObserver"),ve("WebKitMutationObserver")}),e.__load_patch("IntersectionObserver",(n,a,t)=>{ve("IntersectionObserver")}),e.__load_patch("FileReader",(n,a,t)=>{ve("FileReader")}),e.__load_patch("on_property",(n,a,t)=>{Ot(t,n)}),e.__load_patch("customElements",(n,a,t)=>{Ct(n,t)}),e.__load_patch("XHR",(n,a)=>{C(n);let t=j("xhrTask"),c=j("xhrSync"),f=j("xhrListener"),E=j("xhrScheduled"),T=j("xhrURL"),p=j("xhrErrorBeforeScheduled");function C(_){let P=_.XMLHttpRequest;if(!P)return;let I=P.prototype;function H(w){return w[t]}let U=I[Le],$=I[Ie];if(!U){let w=_.XMLHttpRequestEventTarget;if(w){let b=w.prototype;U=b[Le],$=b[Ie]}}let J="readystatechange",q="scheduled";function k(w){let b=w.data,D=b.target;D[E]=!1,D[p]=!1;let K=D[f];U||(U=D[Le],$=D[Ie]),K&&$.call(D,J,K);let W=D[f]=()=>{if(D.readyState===D.DONE)if(!b.aborted&&D[E]&&w.state===q){let s=D[a.__symbol__("loadfalse")];if(D.status!==0&&s&&s.length>0){let i=w.invoke;w.invoke=function(){let o=D[a.__symbol__("loadfalse")];for(let g=0;gfunction(w,b){return w[c]=b[2]==!1,w[T]=b[1],x.apply(w,b)}),X="XMLHttpRequest.send",G=j("fetchTaskAborting"),y=j("fetchTaskScheduling"),z=ue(I,"send",()=>function(w,b){if(a.current[y]===!0||w[c])return z.apply(w,b);{let D={target:w,url:w[T],isPeriodic:!1,args:b,aborted:!1},K=Ge(X,d,D,k,A);w&&w[p]===!0&&!D.aborted&&K.state===q&&K.invoke()}}),S=ue(I,"abort",()=>function(w,b){let D=H(w);if(D&&typeof D.type=="string"){if(D.cancelFn==null||D.data&&D.data.aborted)return;D.zone.cancelTask(D)}else if(a.current[G]===!0)return S.apply(w,b)})}}),e.__load_patch("geolocation",n=>{n.navigator&&n.navigator.geolocation&&yt(n.navigator.geolocation,["getCurrentPosition","watchPosition"])}),e.__load_patch("PromiseRejectionEvent",(n,a)=>{function t(c){return function(f){lt(n,c).forEach(T=>{let p=n.PromiseRejectionEvent;if(p){let C=new p(c,{promise:f.promise,reason:f.rejection});T.invoke(C)}})}}n.PromiseRejectionEvent&&(a[j("unhandledPromiseRejectionHandler")]=t("unhandledrejection"),a[j("rejectionHandledHandler")]=t("rejectionhandled"))}),e.__load_patch("queueMicrotask",(n,a,t)=>{Rt(n,t)})}function Lt(e){e.__load_patch("ZoneAwarePromise",(n,a,t)=>{let c=Object.getOwnPropertyDescriptor,f=Object.defineProperty;function E(h){if(h&&h.toString===Object.prototype.toString){let l=h.constructor&&h.constructor.name;return(l||"")+": "+JSON.stringify(h)}return h?h.toString():Object.prototype.toString.call(h)}let T=t.symbol,p=[],C=n[T("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")]!==!1,_=T("Promise"),P=T("then"),I="__creationTrace__";t.onUnhandledError=h=>{if(t.showUncaughtError()){let l=h&&h.rejection;l?console.error("Unhandled Promise rejection:",l instanceof Error?l.message:l,"; Zone:",h.zone.name,"; Task:",h.task&&h.task.source,"; Value:",l,l instanceof Error?l.stack:void 0):console.error(h)}},t.microtaskDrainDone=()=>{for(;p.length;){let h=p.shift();try{h.zone.runGuarded(()=>{throw h.throwOriginal?h.rejection:h})}catch(l){U(l)}}};let H=T("unhandledPromiseRejectionHandler");function U(h){t.onUnhandledError(h);try{let l=a[H];typeof l=="function"&&l.call(this,h)}catch{}}function $(h){return h&&h.then}function J(h){return h}function q(h){return Z.reject(h)}let k=T("state"),d=T("value"),A=T("finally"),x=T("parentPromiseValue"),X=T("parentPromiseState"),G="Promise.then",y=null,z=!0,S=!1,w=0;function b(h,l){return r=>{try{M(h,l,r)}catch(u){M(h,!1,u)}}}let D=function(){let h=!1;return function(r){return function(){h||(h=!0,r.apply(null,arguments))}}},K="Promise resolved with itself",W=T("currentTaskTrace");function M(h,l,r){let u=D();if(h===r)throw new TypeError(K);if(h[k]===y){let v=null;try{(typeof r=="object"||typeof r=="function")&&(v=r&&r.then)}catch(R){return u(()=>{M(h,!1,R)})(),h}if(l!==S&&r instanceof Z&&r.hasOwnProperty(k)&&r.hasOwnProperty(d)&&r[k]!==y)i(r),M(h,r[k],r[d]);else if(l!==S&&typeof v=="function")try{v.call(r,u(b(h,l)),u(b(h,!1)))}catch(R){u(()=>{M(h,!1,R)})()}else{h[k]=l;let R=h[d];if(h[d]=r,h[A]===A&&l===z&&(h[k]=h[X],h[d]=h[x]),l===S&&r instanceof Error){let m=a.currentTask&&a.currentTask.data&&a.currentTask.data[I];m&&f(r,W,{configurable:!0,enumerable:!1,writable:!0,value:m})}for(let m=0;m{try{let O=h[d],N=!!r&&A===r[A];N&&(r[x]=O,r[X]=R);let L=l.run(m,void 0,N&&m!==q&&m!==J?[]:[O]);M(r,!0,L)}catch(O){M(r,!1,O)}},r)}let g="function ZoneAwarePromise() { [native code] }",V=function(){},ee=n.AggregateError;class Z{static toString(){return g}static resolve(l){return l instanceof Z?l:M(new this(null),z,l)}static reject(l){return M(new this(null),S,l)}static withResolvers(){let l={};return l.promise=new Z((r,u)=>{l.resolve=r,l.reject=u}),l}static any(l){if(!l||typeof l[Symbol.iterator]!="function")return Promise.reject(new ee([],"All promises were rejected"));let r=[],u=0;try{for(let m of l)u++,r.push(Z.resolve(m))}catch{return Promise.reject(new ee([],"All promises were rejected"))}if(u===0)return Promise.reject(new ee([],"All promises were rejected"));let v=!1,R=[];return new Z((m,O)=>{for(let N=0;N{v||(v=!0,m(L))},L=>{R.push(L),u--,u===0&&(v=!0,O(new ee(R,"All promises were rejected")))})})}static race(l){let r,u,v=new this((O,N)=>{r=O,u=N});function R(O){r(O)}function m(O){u(O)}for(let O of l)$(O)||(O=this.resolve(O)),O.then(R,m);return v}static all(l){return Z.allWithCallback(l)}static allSettled(l){return(this&&this.prototype instanceof Z?this:Z).allWithCallback(l,{thenCallback:u=>({status:"fulfilled",value:u}),errorCallback:u=>({status:"rejected",reason:u})})}static allWithCallback(l,r){let u,v,R=new this((L,F)=>{u=L,v=F}),m=2,O=0,N=[];for(let L of l){$(L)||(L=this.resolve(L));let F=O;try{L.then(B=>{N[F]=r?r.thenCallback(B):B,m--,m===0&&u(N)},B=>{r?(N[F]=r.errorCallback(B),m--,m===0&&u(N)):v(B)})}catch(B){v(B)}m++,O++}return m-=2,m===0&&u(N),R}constructor(l){let r=this;if(!(r instanceof Z))throw new Error("Must be an instanceof Promise.");r[k]=y,r[d]=[];try{let u=D();l&&l(u(b(r,z)),u(b(r,S)))}catch(u){M(r,!1,u)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return Z}then(l,r){let u=this.constructor?.[Symbol.species];(!u||typeof u!="function")&&(u=this.constructor||Z);let v=new u(V),R=a.current;return this[k]==y?this[d].push(R,v,l,r):o(this,R,v,l,r),v}catch(l){return this.then(null,l)}finally(l){let r=this.constructor?.[Symbol.species];(!r||typeof r!="function")&&(r=Z);let u=new r(V);u[A]=A;let v=a.current;return this[k]==y?this[d].push(v,u,l,l):o(this,v,u,l,l),u}}Z.resolve=Z.resolve,Z.reject=Z.reject,Z.race=Z.race,Z.all=Z.all;let he=n[_]=n.Promise;n.Promise=Z;let _e=T("thenPatched");function Q(h){let l=h.prototype,r=c(l,"then");if(r&&(r.writable===!1||!r.configurable))return;let u=l.then;l[P]=u,h.prototype.then=function(v,R){return new Z((O,N)=>{u.call(this,O,N)}).then(v,R)},h[_e]=!0}t.patchThen=Q;function Ee(h){return function(l,r){let u=h.apply(l,r);if(u instanceof Z)return u;let v=u.constructor;return v[_e]||Q(v),u}}return he&&(Q(he),ue(n,"fetch",h=>Ee(h))),Promise[a.__symbol__("uncaughtPromiseErrors")]=p,Z})}function It(e){e.__load_patch("toString",n=>{let a=Function.prototype.toString,t=j("OriginalDelegate"),c=j("Promise"),f=j("Error"),E=function(){if(typeof this=="function"){let _=this[t];if(_)return typeof _=="function"?a.call(_):Object.prototype.toString.call(_);if(this===Promise){let P=n[c];if(P)return a.call(P)}if(this===Error){let P=n[f];if(P)return a.call(P)}}return a.call(this)};E[t]=a,Function.prototype.toString=E;let T=Object.prototype.toString,p="[object Promise]";Object.prototype.toString=function(){return typeof Promise=="function"&&this instanceof Promise?p:T.call(this)}})}function Mt(e,n,a,t,c){let f=Zone.__symbol__(t);if(n[f])return;let E=n[f]=n[t];n[t]=function(T,p,C){return p&&p.prototype&&c.forEach(function(_){let P=`${a}.${t}::`+_,I=p.prototype;try{if(I.hasOwnProperty(_)){let H=e.ObjectGetOwnPropertyDescriptor(I,_);H&&H.value?(H.value=e.wrapWithCurrentZone(H.value,P),e._redefineProperty(p.prototype,_,H)):I[_]&&(I[_]=e.wrapWithCurrentZone(I[_],P))}else I[_]&&(I[_]=e.wrapWithCurrentZone(I[_],P))}catch{}}),E.call(n,T,p,C)},e.attachOriginToPatched(n[t],E)}function Zt(e){e.__load_patch("util",(n,a,t)=>{let c=Ze(n);t.patchOnProperties=ot,t.patchMethod=ue,t.bindArguments=Fe,t.patchMacroTask=pt;let f=a.__symbol__("BLACK_LISTED_EVENTS"),E=a.__symbol__("UNPATCHED_EVENTS");n[E]&&(n[f]=n[E]),n[f]&&(a[f]=a[E]=n[f]),t.patchEventPrototype=wt,t.patchEventTarget=Pt,t.isIEOrEdge=vt,t.ObjectDefineProperty=Ae,t.ObjectGetOwnPropertyDescriptor=be,t.ObjectCreate=Et,t.ArraySlice=Tt,t.patchClass=ve,t.wrapWithCurrentZone=Ve,t.filterProperties=ut,t.attachOriginToPatched=fe,t._redefineProperty=Object.defineProperty,t.patchCallbacks=Mt,t.getGlobalObjects=()=>({globalSources:st,zoneSymbolEventNames:ne,eventNames:c,isBrowser:Be,isMix:rt,isNode:Se,TRUE_STR:ae,FALSE_STR:le,ZONE_SYMBOL_PREFIX:Pe,ADD_EVENT_LISTENER_STR:He,REMOVE_EVENT_LISTENER_STR:xe})})}function At(e){Lt(e),It(e),Zt(e)}var ft=_t();At(ft);Nt(ft); diff --git a/src/google/adk/cli/cli_tools_click.py b/src/google/adk/cli/cli_tools_click.py index d9886dc8..95e61778 100644 --- a/src/google/adk/cli/cli_tools_click.py +++ b/src/google/adk/cli/cli_tools_click.py @@ -583,6 +583,13 @@ def fast_api_common_options(): default=False, help="Optional. Whether to enable A2A endpoint.", ) + @click.option( + "--reload_agents", + is_flag=True, + default=False, + show_default=True, + help="Optional. Whether to enable live reload for agents changes.", + ) @functools.wraps(func) def wrapper(*args, **kwargs): return func(*args, **kwargs) @@ -625,6 +632,7 @@ def cli_web( session_db_url: Optional[str] = None, # Deprecated artifact_storage_uri: Optional[str] = None, # Deprecated a2a: bool = False, + reload_agents: bool = False, ): """Starts a FastAPI server with Web UI for agents. @@ -674,6 +682,7 @@ def cli_web( a2a=a2a, host=host, port=port, + reload_agents=reload_agents, ) config = uvicorn.Config( app, @@ -721,6 +730,7 @@ def cli_api_server( session_db_url: Optional[str] = None, # Deprecated artifact_storage_uri: Optional[str] = None, # Deprecated a2a: bool = False, + reload_agents: bool = False, ): """Starts a FastAPI server for agents. @@ -748,6 +758,7 @@ def cli_api_server( a2a=a2a, host=host, port=port, + reload_agents=reload_agents, ), host=host, port=port, @@ -861,6 +872,7 @@ def cli_deploy_cloud_run( session_db_url: Optional[str] = None, # Deprecated artifact_storage_uri: Optional[str] = None, # Deprecated a2a: bool = False, + reload_agents: bool = False, ): """Deploys an agent to Cloud Run. diff --git a/src/google/adk/cli/fast_api.py b/src/google/adk/cli/fast_api.py index 13605147..83cd8999 100644 --- a/src/google/adk/cli/fast_api.py +++ b/src/google/adk/cli/fast_api.py @@ -49,6 +49,8 @@ from pydantic import Field from pydantic import ValidationError from starlette.types import Lifespan from typing_extensions import override +from watchdog.events import FileSystemEventHandler +from watchdog.observers import Observer from ..agents import RunConfig from ..agents.live_request_queue import LiveRequest @@ -87,6 +89,21 @@ from .utils.agent_loader import AgentLoader logger = logging.getLogger("google_adk." + __name__) _EVAL_SET_FILE_EXTENSION = ".evalset.json" +_app_name = "" +_runners_to_clean = set() + + +class AgentChangeEventHandler(FileSystemEventHandler): + + def __init__(self, agent_loader: AgentLoader): + self.agent_loader = agent_loader + + def on_modified(self, event): + if not (event.src_path.endswith(".py") or event.src_path.endswith(".yaml")): + return + logger.info("Change detected in agents directory: %s", event.src_path) + self.agent_loader.remove_agent_from_cache(_app_name) + _runners_to_clean.add(_app_name) class ApiServerSpanExporter(export.SpanExporter): @@ -205,6 +222,7 @@ def get_fast_api_app( host: str = "127.0.0.1", port: int = 8000, trace_to_cloud: bool = False, + reload_agents: bool = False, lifespan: Optional[Lifespan[FastAPI]] = None, ) -> FastAPI: # InMemory tracing dict. @@ -235,7 +253,6 @@ def get_fast_api_app( @asynccontextmanager async def internal_lifespan(app: FastAPI): - try: if lifespan: async with lifespan(app) as lifespan_context: @@ -243,6 +260,9 @@ def get_fast_api_app( else: yield finally: + if reload_agents: + observer.stop() + observer.join() # Create tasks for all runner closures to run concurrently await cleanup.close_runners(list(runner_dict.values())) @@ -336,6 +356,13 @@ def get_fast_api_app( # initialize Agent Loader agent_loader = AgentLoader(agents_dir) + # Set up a file system watcher to detect changes in the agents directory. + observer = Observer() + if reload_agents: + event_handler = AgentChangeEventHandler(agent_loader) + observer.schedule(event_handler, agents_dir, recursive=True) + observer.start() + @app.get("/list-apps") def list_apps() -> list[str]: base_path = Path.cwd() / agents_dir @@ -390,6 +417,9 @@ def get_fast_api_app( ) if not session: raise HTTPException(status_code=404, detail="Session not found") + + global _app_name + _app_name = app_name return session @app.get( @@ -947,6 +977,11 @@ def get_fast_api_app( async def _get_runner_async(app_name: str) -> Runner: """Returns the runner for the given app.""" + if app_name in _runners_to_clean: + _runners_to_clean.remove(app_name) + runner = runner_dict.pop(app_name, None) + await cleanup.close_runners(list([runner])) + envs.load_dotenv_for_agent(os.path.basename(app_name), agents_dir) if app_name in runner_dict: return runner_dict[app_name] diff --git a/src/google/adk/cli/utils/agent_loader.py b/src/google/adk/cli/utils/agent_loader.py index cd61dfbf..1e206846 100644 --- a/src/google/adk/cli/utils/agent_loader.py +++ b/src/google/adk/cli/utils/agent_loader.py @@ -16,11 +16,16 @@ from __future__ import annotations import importlib import logging +import os import sys from typing import Optional +from pydantic import ValidationError + from . import envs +from ...agents import config_agent_utils from ...agents.base_agent import BaseAgent +from ...utils.feature_decorator import working_in_progress logger = logging.getLogger("google_adk." + __name__) @@ -34,6 +39,8 @@ class AgentLoader: agents_dir/{agent_name}.py (with root_agent defined in the module) c) {agent_name} as a package name agents_dir/{agent_name}/__init__.py (with root_agent in the package) + d) {agent_name} as a YAML config folder: + agents_dir/{agent_name}/root_agent.yaml defines the root agent """ @@ -128,6 +135,29 @@ class AgentLoader: return None + @working_in_progress("_load_from_yaml_config is not ready for use.") + def _load_from_yaml_config(self, agent_name: str) -> Optional[BaseAgent]: + # Load from the config file at agents_dir/{agent_name}/root_agent.yaml + config_path = os.path.join(self.agents_dir, agent_name, "root_agent.yaml") + try: + agent = config_agent_utils.from_config(config_path) + logger.info("Loaded root agent for %s from %s", agent_name, config_path) + return agent + except FileNotFoundError: + logger.debug("Config file %s not found.", config_path) + return None + except ValidationError as e: + logger.error("Config file %s is invalid YAML.", config_path) + raise e + except Exception as e: + if hasattr(e, "msg"): + e.msg = f"Fail to load '{config_path}' config. " + e.msg + raise e + e.args = ( + f"Fail to load '{config_path}' config. {e.args[0] if e.args else ''}", + ) + e.args[1:] + raise e + def _perform_load(self, agent_name: str) -> BaseAgent: """Internal logic to load an agent""" # Add self.agents_dir to sys.path @@ -145,10 +175,14 @@ class AgentLoader: if root_agent := self._load_from_submodule(agent_name): return root_agent + if root_agent := self._load_from_yaml_config(agent_name): + return root_agent + # If no root_agent was found by any pattern raise ValueError( f"No root_agent found for '{agent_name}'. Searched in" - f" '{agent_name}.agent.root_agent', '{agent_name}.root_agent'." + f" '{agent_name}.agent.root_agent', '{agent_name}.root_agent' and" + f" '{agent_name}/root_agent.yaml'." f" Ensure '{self.agents_dir}/{agent_name}' is structured correctly," " an .env file can be loaded if present, and a root_agent is" " exposed." @@ -164,3 +198,15 @@ class AgentLoader: agent = self._perform_load(agent_name) self._agent_cache[agent_name] = agent return agent + + def remove_agent_from_cache(self, agent_name: str): + # Clear module cache for the agent and its submodules + keys_to_delete = [ + module_name + for module_name in sys.modules + if module_name == agent_name or module_name.startswith(f"{agent_name}.") + ] + for key in keys_to_delete: + logger.debug("Deleting module %s", key) + del sys.modules[key] + self._agent_cache.pop(agent_name, None) diff --git a/src/google/adk/evaluation/agent_creator.py b/src/google/adk/evaluation/agent_creator.py new file mode 100644 index 00000000..7299675c --- /dev/null +++ b/src/google/adk/evaluation/agent_creator.py @@ -0,0 +1,35 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +from typing_extensions import override + +from ..agents import BaseAgent + + +class IdentityAgentCreator: + """An implementation of the AgentCreator interface that always returns a copy of the root agent.""" + + def __init__(self, root_agent: BaseAgent): + self._root_agent = root_agent + + @override + def get_agent( + self, + ) -> BaseAgent: + """Returns a deep copy of the root agent.""" + # TODO: Use Agent.clone() when the PR is merged. + # return self._root_agent.model_copy(deep=True) + return self._root_agent.clone() diff --git a/src/google/adk/evaluation/base_eval_service.py b/src/google/adk/evaluation/base_eval_service.py index 5dff2fec..bfbb0f3c 100644 --- a/src/google/adk/evaluation/base_eval_service.py +++ b/src/google/adk/evaluation/base_eval_service.py @@ -16,6 +16,7 @@ from __future__ import annotations from abc import ABC from abc import abstractmethod +from enum import Enum from typing import AsyncGenerator from typing import Optional @@ -56,6 +57,19 @@ class InferenceConfig(BaseModel): charges.""", ) + parallelism: int = Field( + default=4, + description="""Number of parallel inferences to run during an Eval. Few +factors to consider while changing this value: + +1) Your available quota with the model. Models tend to enforce per-minute or +per-second SLAs. Using a larger value could result in the eval quickly consuming +the quota. + +2) The tools used by the Agent could also have their SLA. Using a larger value +could also overwhelm those tools.""", + ) + class InferenceRequest(BaseModel): """Represent a request to perform inferences for the eval cases in an eval set.""" @@ -88,6 +102,14 @@ in an eval set are evaluated. ) +class InferenceStatus(Enum): + """Status of the inference.""" + + UNKNOWN = 0 + SUCCESS = 1 + FAILURE = 2 + + class InferenceResult(BaseModel): """Contains inference results for a single eval case.""" @@ -106,14 +128,25 @@ class InferenceResult(BaseModel): description="""Id of the eval case for which inferences were generated.""", ) - inferences: list[Invocation] = Field( - description="""Inferences obtained from the Agent for the eval case.""" + inferences: Optional[list[Invocation]] = Field( + default=None, + description="""Inferences obtained from the Agent for the eval case.""", ) session_id: Optional[str] = Field( description="""Id of the inference session.""" ) + status: InferenceStatus = Field( + default=InferenceStatus.UNKNOWN, + description="""Status of the inference.""", + ) + + error_message: Optional[str] = Field( + default=None, + description="""Error message if the inference failed.""", + ) + class EvaluateRequest(BaseModel): model_config = ConfigDict( diff --git a/src/google/adk/evaluation/eval_case.py b/src/google/adk/evaluation/eval_case.py index 172a8309..4902b356 100644 --- a/src/google/adk/evaluation/eval_case.py +++ b/src/google/adk/evaluation/eval_case.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations from typing import Any from typing import Optional -from typing import Tuple from google.genai import types as genai_types from pydantic import alias_generators @@ -37,11 +37,11 @@ class IntermediateData(EvalBaseModel): tool_uses: list[genai_types.FunctionCall] = [] """Tool use trajectory in chronological order.""" - intermediate_responses: list[Tuple[str, list[genai_types.Part]]] = [] + intermediate_responses: list[tuple[str, list[genai_types.Part]]] = [] """Intermediate responses generated by sub-agents to convey progress or status in a multi-agent system, distinct from the final response. - This is expressed as a Tuple of: + This is expressed as a tuple of: - Author: Usually the sub-agent name that generated the intermediate response. diff --git a/src/google/adk/evaluation/eval_metrics.py b/src/google/adk/evaluation/eval_metrics.py index 225cd1d2..8cf23542 100644 --- a/src/google/adk/evaluation/eval_metrics.py +++ b/src/google/adk/evaluation/eval_metrics.py @@ -18,9 +18,11 @@ from enum import Enum from typing import Optional from typing import Union +from google.genai import types as genai_types from pydantic import alias_generators from pydantic import BaseModel from pydantic import ConfigDict +from pydantic import Field from typing_extensions import TypeAlias from .eval_case import Invocation @@ -38,6 +40,24 @@ class PrebuiltMetrics(Enum): MetricName: TypeAlias = Union[str, PrebuiltMetrics] +class JudgeModelOptions(BaseModel): + """Options for an eval metric's judge model.""" + + judge_model: str = Field( + default="gemini-2.5-flash", + description="""The judge model to use for evaluation. It can be a model name.""", + ) + + judge_model_config: Optional[genai_types.GenerateContentConfig] = Field( + default=None, description="""The configuration for the judge model.""" + ) + + num_samples: Optional[int] = Field( + default=None, + description="""The number of times to sample the model for each invocation evaluation.""", + ) + + class EvalMetric(BaseModel): """A metric used to evaluate a particular aspect of an eval case.""" @@ -52,6 +72,11 @@ class EvalMetric(BaseModel): threshold: float """A threshold value. Each metric decides how to interpret this threshold.""" + judge_model_options: Optional[JudgeModelOptions] = Field( + default=None, + description="""Options for the judge model.""", + ) + class EvalMetricResult(EvalMetric): """The actual computed score/value of a particular EvalMetric.""" diff --git a/src/google/adk/evaluation/evaluation_generator.py b/src/google/adk/evaluation/evaluation_generator.py index 1359967b..3d828dbf 100644 --- a/src/google/adk/evaluation/evaluation_generator.py +++ b/src/google/adk/evaluation/evaluation_generator.py @@ -137,7 +137,7 @@ class EvaluationGenerator: async def _generate_inferences_from_root_agent( invocations: list[Invocation], root_agent: Agent, - reset_func: Any, + reset_func: Optional[Any] = None, initial_session: Optional[SessionInput] = None, session_id: Optional[str] = None, session_service: Optional[BaseSessionService] = None, diff --git a/src/google/adk/evaluation/final_response_match_v2.py b/src/google/adk/evaluation/final_response_match_v2.py new file mode 100644 index 00000000..ad43448d --- /dev/null +++ b/src/google/adk/evaluation/final_response_match_v2.py @@ -0,0 +1,230 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import logging +import re +from typing import Optional + +from typing_extensions import override + +from ..models.llm_response import LlmResponse +from ..utils.feature_decorator import working_in_progress +from .eval_case import Invocation +from .eval_metrics import EvalMetric +from .evaluator import EvalStatus +from .evaluator import EvaluationResult +from .evaluator import PerInvocationResult +from .llm_as_judge import LlmAsJudge +from .llm_as_judge_utils import get_eval_status +from .llm_as_judge_utils import get_text_from_content +from .llm_as_judge_utils import Label + +logger = logging.getLogger("google_adk." + __name__) + +_FINAL_RESPONSE_MATCH_V2_PROMPT = """You are an expert rater for an AI agent. The AI agent is going to call an API to answer the user query and generate API tool use code based for the choice of the API and API arguments. The ideal model response should be a function call that fulfills user query, or a natural language response hedges or asks users for further clarification if a function call does not apply. +The primary focus of this rating task is to check correctness of the model responses. + +The data consists of: +- A user query. +- A model generated response for the prompt. The responses can consist of: + - Natural language, when the model is asking for clarification, or tells the user it does not possess the requested functionality / option. + - Code, in the form of one or multiple python function calls, and additional code as needed, for when the model is fulfilling the user request. +You can use the help from a reference response annotated by a human rater. This reference response is of high quality. You can compare the agent's response with the reference response and decide if the agent's response is valid. +Note sometimes the reference response only contains the key entities of the correct answer and you need to be flexible to allow the agent response to contain more information than the reference response, or to present the key entities in a different format or structure or in shorter or longer format. +When the agent response is provided in the form of tables/dataframes or should be best provided in the form of tables/dataframes: focus on the key entities and main components requested in the user query and check whether you can retrieve those from the agent response. Likewise, if you have the reference response, then find out the key entities and main components in them and check whether you can retrieve those from the agent response. If the prompt does not specify any format instructions and the main items/components are included in the response then tolerate the differences in the formatting of those tables/dataframes. + +You should follow the constitutions below very carefully to rate the model response: +- Allow flexibility of format even when reference code only uses one of the possible format, unless API spec or user prompt has explicit format requirement + - e.g. For state name, allow both abbreviation and full name unless API spec has explicit requirement. e.g. both 'tx' and 'Texas' should be allowed in the agent response even when reference code only uses one of them. + - e.g. If a reference response list outputs in a list format, the agent response is allowed to use sentence format and vice versa unless user prompt explicitly asks for a specific format. + - e.g. For numbers, allow flexibility of formatting, e.g. 1000000 vs 1,000,000. +- The model shouldn't assume that it doesn't have access to according data or incapable of answering the question if reference response is able to find a legit answer. +- If the model response contains the correct final answer, rate it as valid even when the model response contains more information than the reference response. +- If the user prompt has csv or other table format data, don't read it yourself. Trust the reference response final answer instead. +- When the validation needs maths, date calculations, do not use your own calculator. Trust the reference response final answer instead. +- Be mindful about unit of numbers. For example, if the reference response says 100 miles, but the model response says 100 km, it is invalid. +- When the agent response or the reference response is provided in the form of tables/dataframes: focus on the key entities and main components requested in the user query and check whether you can retrieve those from the agent response and whether those match the reference response. If the user query does not specify any format instructions and the main items/components are included in the response then tolerate the differences in the formatting of those tables/dataframes. +- When the answer is in numeric format, check whether there are any format requirements in the numeric format, rounding, precision, number of decimals, etc. specified in the user query and the prompt. If there are no such instructions, then tolerate different numerical formats. +- When the answer is in numeric format and there are rounding or precision differences between the agent response and the reference response, if no further instructions are provided evaluate if the rounding strategy or precision in the agent response follows the standards for that entity. For instance, model accuracy scores must be reported with at least two decimal places (e.g., 0.798 → 0.80 is acceptable, but 0.7 is not). + +Below are the inputs: +{{ + "User prompt": {prompt}, + "Agent response": {response}, + "Reference response": {golden_response}, +}} + +The answer should be a json alone which follows the json structure below: +{{ + "reasoning": [reasoning], + "is_the_agent_response_valid": [valid or invalid], +}} +Answer with assertiveness: +""" + +_DEFAULT_NUM_SAMPLES = 5 + + +def _parse_critique(response: str) -> Label: + """Parses the judge model critique and extracts the final label. + + Args: + response: model response + + Returns: + The extracted label, either VALID, INVALID, or NOT_FOUND. + """ + # Regex matching the label field in the response. The end of the field is + # identified by either a comma, new line, or an end-bracket. + label_match_is_response_valid = re.search( + r'"is_the_agent_response_valid":\s*\[*[\n\s]*"*([^"^\]^\s]*)"*[\n\s]*\]*\s*[,\n\}]', + response, + ) + # In case the model names the label field as "is_the_agent_response_*invalid*" + # instead of "..._*valid*" + label_match_is_response_invalid = re.search( + r'"is_the_agent_response_invalid":\s*\[*[\n\s]*"*([^"^\]^\s]*)"*[\n\s]*\]*\s*[,\n\}]', + response, + ) + # Remove any trailing whitespace, commas, or end-brackets from the label. + if label_match_is_response_valid: + label = label_match_is_response_valid.group(1).strip(r"\s,\}") + if label in [ + Label.INVALID.value, + Label.ALMOST.value, + Label.FALSE.value, + *Label.PARTIALLY_VALID.value, + ]: + label = Label.INVALID + elif label in [Label.VALID.value, Label.TRUE.value]: + label = Label.VALID + else: + label = Label.NOT_FOUND + elif label_match_is_response_invalid: + label = label_match_is_response_invalid.group(1).strip(r"\s,\}") + label = ( + Label.INVALID + if label in [Label.TRUE.value, Label.INVALID.value] + else Label.VALID + ) + else: + label = Label.NOT_FOUND + return label + + +@working_in_progress +class FinalResponseMatchV2Evaluator(LlmAsJudge): + """V2 final response match evaluator which uses an LLM to judge responses. + + The evaluator prompts the LLM to output whether the agent final response is + valid or invalid, hence outputs a score of 0 or 1. Repeated invocation samples + are aggregated by taking majority vote, and then the overall score is the + fraction, ranging from 0 to 1, of valid samples. Higher values of overall + score indicate better final response performance of the agent. + """ + + def __init__( + self, + eval_metric: EvalMetric, + ): + super().__init__(eval_metric) + self._auto_rater_prompt_template = _FINAL_RESPONSE_MATCH_V2_PROMPT + assert self._eval_metric.judge_model_options is not None + if self._eval_metric.judge_model_options.num_samples is None: + self._eval_metric.judge_model_options.num_samples = _DEFAULT_NUM_SAMPLES + + @override + def format_auto_rater_prompt( + self, actual_invocation: Invocation, expected_invocation: Invocation + ) -> str: + reference = get_text_from_content(expected_invocation.final_response) + response = get_text_from_content(actual_invocation.final_response) + user_prompt = get_text_from_content(expected_invocation.user_content) + return self._auto_rater_prompt_template.format( + prompt=user_prompt, + response=response, + golden_response=reference, + ) + + @override + def convert_auto_rater_response_to_score( + self, llm_response: LlmResponse + ) -> Optional[float]: + response_text = get_text_from_content(llm_response.content) + if response_text is None: + return None + label = _parse_critique(response_text) + if label == Label.VALID: + return 1.0 + elif label == Label.INVALID: + return 0.0 + else: + return None + + @override + def aggregate_per_invocation_samples( + self, + per_invocation_samples: list[PerInvocationResult], + ) -> PerInvocationResult: + """Aggregates samples of per-invocation results by taking majority vote. + + Only consider results that were successfully evaluated. In the case of a + tie, consider the result to be invalid. + + Args: + per_invocation_samples: Samples of per-invocation results to + aggregate. + + Returns: + If there is a majority of valid results, return the first valid result. + Otherwise, return the first invalid result. If no results were + successfully evaluated, return the first sample. + """ + positive_results = [] + negative_results = [] + for result in per_invocation_samples: + if result.score == 1.0: + positive_results.append(result) + elif result.score == 0.0: + negative_results.append(result) + # If no results were successfully evaluated, just return the first sample. + if not positive_results and not negative_results: + return per_invocation_samples[0] + elif len(positive_results) > len(negative_results): + return positive_results[0] + else: + return negative_results[0] + + @override + def aggregate_invocation_results( + self, per_invocation_results: list[PerInvocationResult] + ) -> EvaluationResult: + """Computes the fraction of invocation results that are valid.""" + num_valid = 0 + num_evaluated = 0 + for result in per_invocation_results: + if result.score is None or result.eval_status == EvalStatus.NOT_EVALUATED: + continue + num_evaluated += 1 + num_valid += result.score + overall_score = num_valid / num_evaluated + return EvaluationResult( + overall_score=overall_score, + overall_eval_status=get_eval_status( + overall_score, self._eval_metric.threshold + ), + per_invocation_results=per_invocation_results, + ) diff --git a/src/google/adk/evaluation/llm_as_judge.py b/src/google/adk/evaluation/llm_as_judge.py new file mode 100644 index 00000000..ac1b3306 --- /dev/null +++ b/src/google/adk/evaluation/llm_as_judge.py @@ -0,0 +1,141 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +from abc import abstractmethod +from typing import Optional + +from google.genai import types as genai_types +from typing_extensions import override + +from ..models.base_llm import BaseLlm +from ..models.llm_request import LlmRequest +from ..models.llm_response import LlmResponse +from ..models.registry import LLMRegistry +from .eval_case import Invocation +from .eval_metrics import EvalMetric +from .evaluator import EvaluationResult +from .evaluator import Evaluator +from .evaluator import PerInvocationResult +from .llm_as_judge_utils import get_eval_status + + +class LlmAsJudge(Evaluator): + """Evaluator based on a LLM. + + It is meant to be extended by specific auto-raters for different evaluation + tasks: + - Provide the prompt template, and implement format_auto_rater_prompt to + format the auto-rater prompt for a given invocation. + - Implement convert_auto_rater_response_to_score to parse the auto-rater + response and return the corresponding score. + - Implement aggregate_invocation_results to aggregate the per-invocation + results to get the overall score. + - (Optional) Override aggregate_per_invocation_result_samples to aggregate + multiple auto-rater samples of the same invocation. + """ + + def __init__( + self, + eval_metric: EvalMetric, + ): + self._eval_metric = eval_metric + if not eval_metric.judge_model_options: + raise ValueError("Judge model options is required for LlmAsJudge.") + self._judge_model_options = eval_metric.judge_model_options + if self._judge_model_options.judge_model_config is None: + self._judge_model_options.judge_model_config = ( + genai_types.GenerateContentConfig() + ) + self._judge_model = self._setup_auto_rater() + + @abstractmethod + def format_auto_rater_prompt( + self, actual: Invocation, expected: Invocation + ) -> str: + """Formats the auto-rater prompt to evaluate the given invocation.""" + + @abstractmethod + def convert_auto_rater_response_to_score( + self, auto_rater_response: LlmResponse + ) -> Optional[float]: + """Parses auto_rater_response and returns the corresponding score, or None if the score cannot be determined.""" + + @abstractmethod + def aggregate_per_invocation_samples( + self, + per_invocation_samples: list[PerInvocationResult], + ) -> PerInvocationResult: + """Aggregates repeated per-invocation samples to get the final result for the invocation.""" + + @abstractmethod + def aggregate_invocation_results( + self, + per_invocation_results: list[PerInvocationResult], + ) -> EvaluationResult: + """Aggregates the per invocation results to get the overall score.""" + + @override + async def evaluate_invocations( + self, + actual_invocations: list[Invocation], + expected_invocations: list[Invocation], + ) -> EvaluationResult: + per_invocation_results = [] + for actual, expected in zip(actual_invocations, expected_invocations): + auto_rater_prompt = self.format_auto_rater_prompt(actual, expected) + llm_request = LlmRequest( + model=self._judge_model_options.judge_model, + contents=[ + genai_types.Content( + parts=[genai_types.Part(text=auto_rater_prompt)], + role="user", + ) + ], + config=self._judge_model_options.judge_model_config, + ) + num_samples = self._judge_model_options.num_samples + invocation_result_samples = [] + for _ in range(num_samples): + async for llm_response in self._judge_model.generate_content_async( + llm_request + ): + # Non-streaming call, so there is only one response content. + score = self.convert_auto_rater_response_to_score(llm_response) + invocation_result_samples.append( + PerInvocationResult( + actual_invocation=actual, + expected_invocation=expected, + score=score, + eval_status=get_eval_status( + score, self._eval_metric.threshold + ), + ) + ) + if not invocation_result_samples: + continue + per_invocation_results.append( + self.aggregate_per_invocation_samples(invocation_result_samples) + ) + + if per_invocation_results: + return self.aggregate_invocation_results(per_invocation_results) + return EvaluationResult() + + def _setup_auto_rater(self) -> BaseLlm: + model_id = self._judge_model_options.judge_model + llm_registry = LLMRegistry() + llm_class = llm_registry.resolve(model_id) + return llm_class(model=model_id) diff --git a/src/google/adk/evaluation/llm_as_judge_utils.py b/src/google/adk/evaluation/llm_as_judge_utils.py new file mode 100644 index 00000000..c5b780fc --- /dev/null +++ b/src/google/adk/evaluation/llm_as_judge_utils.py @@ -0,0 +1,48 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import enum +from typing import Optional + +from google.genai import types as genai_types + +from .evaluator import EvalStatus + + +@enum.unique +class Label(enum.Enum): + """Labels for auto rater response.""" + + TRUE = "true" + INVALID = "invalid" + VALID = "valid" + PARTIALLY_VALID = "partially_valid", "partially valid", "partially" + ALMOST = "almost" + FALSE = "false" + NOT_FOUND = "label field not found" + + +def get_text_from_content( + content: Optional[genai_types.Content], +) -> Optional[str]: + if content and content.parts: + return "\n".join([p.text for p in content.parts if p.text]) + + +def get_eval_status(score: Optional[float], threshold: float) -> EvalStatus: + if score is None: + return EvalStatus.NOT_EVALUATED + return EvalStatus.PASSED if score >= threshold else EvalStatus.FAILED diff --git a/src/google/adk/evaluation/local_eval_service.py b/src/google/adk/evaluation/local_eval_service.py new file mode 100644 index 00000000..14214ac6 --- /dev/null +++ b/src/google/adk/evaluation/local_eval_service.py @@ -0,0 +1,183 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import asyncio +import logging +from typing import AsyncGenerator +from typing import Callable +from typing import Optional +import uuid + +from typing_extensions import override + +from ..agents import BaseAgent +from ..artifacts.base_artifact_service import BaseArtifactService +from ..artifacts.in_memory_artifact_service import InMemoryArtifactService +from ..errors.not_found_error import NotFoundError +from ..sessions.base_session_service import BaseSessionService +from ..sessions.in_memory_session_service import InMemorySessionService +from ..utils.feature_decorator import working_in_progress +from .base_eval_service import BaseEvalService +from .base_eval_service import EvaluateRequest +from .base_eval_service import InferenceRequest +from .base_eval_service import InferenceResult +from .base_eval_service import InferenceStatus +from .eval_result import EvalCaseResult +from .eval_set import EvalCase +from .eval_set_results_manager import EvalSetResultsManager +from .eval_sets_manager import EvalSetsManager +from .evaluation_generator import EvaluationGenerator +from .metric_evaluator_registry import DEFAULT_METRIC_EVALUATOR_REGISTRY +from .metric_evaluator_registry import MetricEvaluatorRegistry + +logger = logging.getLogger('google_adk.' + __name__) + +EVAL_SESSION_ID_PREFIX = '___eval___session___' + + +def _get_session_id() -> str: + return f'{EVAL_SESSION_ID_PREFIX}{str(uuid.uuid4())}' + + +@working_in_progress("Incomplete feature, don't use yet") +class LocalEvalService(BaseEvalService): + """An implementation of BaseEvalService, that runs the evals locally.""" + + def __init__( + self, + root_agent: BaseAgent, + eval_sets_manager: EvalSetsManager, + metric_evaluator_registry: MetricEvaluatorRegistry = DEFAULT_METRIC_EVALUATOR_REGISTRY, + session_service: BaseSessionService = InMemorySessionService(), + artifact_service: BaseArtifactService = InMemoryArtifactService(), + eval_set_results_manager: Optional[EvalSetResultsManager] = None, + session_id_supplier: Callable[[], str] = _get_session_id, + ): + self._root_agent = root_agent + self._eval_sets_manager = eval_sets_manager + self._metric_evaluator_registry = metric_evaluator_registry + self._session_service = session_service + self._artifact_service = artifact_service + self._eval_set_results_manager = eval_set_results_manager + self._session_id_supplier = session_id_supplier + + @override + async def perform_inference( + self, + inference_request: InferenceRequest, + ) -> AsyncGenerator[InferenceResult, None]: + """Returns InferenceResult obtained from the Agent as and when they are available. + + Args: + inference_request: The request for generating inferences. + """ + # Get the eval set from the storage. + eval_set = self._eval_sets_manager.get_eval_set( + app_name=inference_request.app_name, + eval_set_id=inference_request.eval_set_id, + ) + + if not eval_set: + raise NotFoundError( + f'Eval set with id {inference_request.eval_set_id} not found for app' + f' {inference_request.app_name}' + ) + + # Select eval cases for which we need to run inferencing. If the inference + # request specified eval cases, then we use only those. + eval_cases = eval_set.eval_cases + if inference_request.eval_case_ids: + eval_cases = [ + eval_case + for eval_case in eval_cases + if eval_case.eval_id in inference_request.eval_case_ids + ] + + root_agent = self._root_agent.clone() + + semaphore = asyncio.Semaphore( + value=inference_request.inference_config.parallelism + ) + + async def run_inference(eval_case): + async with semaphore: + return await self._perform_inference_sigle_eval_item( + app_name=inference_request.app_name, + eval_set_id=inference_request.eval_set_id, + eval_case=eval_case, + root_agent=root_agent, + ) + + inference_results = [run_inference(eval_case) for eval_case in eval_cases] + for inference_result in asyncio.as_completed(inference_results): + yield await inference_result + + @override + async def evaluate( + self, + evaluate_request: EvaluateRequest, + ) -> AsyncGenerator[EvalCaseResult, None]: + """Returns EvalCaseResult for each item as and when they are available. + + Args: + evaluate_request: The request to perform metric evaluations on the + inferences. + """ + raise NotImplementedError() + + async def _perform_inference_sigle_eval_item( + self, + app_name: str, + eval_set_id: str, + eval_case: EvalCase, + root_agent: BaseAgent, + ) -> InferenceResult: + initial_session = eval_case.session_input + session_id = self._session_id_supplier() + inference_result = InferenceResult( + app_name=app_name, + eval_set_id=eval_set_id, + eval_case_id=eval_case.eval_id, + session_id=session_id, + ) + + try: + inferences = ( + await EvaluationGenerator._generate_inferences_from_root_agent( + invocations=eval_case.conversation, + root_agent=root_agent, + initial_session=initial_session, + session_id=session_id, + session_service=self._session_service, + artifact_service=self._artifact_service, + ) + ) + + inference_result.inferences = inferences + inference_result.status = InferenceStatus.SUCCESS + + return inference_result + except Exception as e: + # We intentionally catch the Exception as we don't failures to affect + # other inferences. + logger.error( + 'Inference failed for eval case `%s` with error %s', + eval_case.eval_id, + e, + ) + inference_result.status = InferenceStatus.FAILURE + inference_result.error_message = str(e) + return inference_result diff --git a/src/google/adk/flows/llm_flows/base_llm_flow.py b/src/google/adk/flows/llm_flows/base_llm_flow.py index be1a1571..bb2759f6 100644 --- a/src/google/adk/flows/llm_flows/base_llm_flow.py +++ b/src/google/adk/flows/llm_flows/base_llm_flow.py @@ -283,14 +283,10 @@ class BaseLlmFlow(ABC): async for event in self._run_one_step_async(invocation_context): last_event = event yield event - if not last_event or last_event.is_final_response(): + if not last_event or last_event.is_final_response() or last_event.partial: + if last_event and last_event.partial: + logger.warning('The last event is partial, which is not expected.') break - if last_event.partial: - # TODO: handle this in BaseLlm level. - raise ValueError( - f"Last event shouldn't be partial. LLM max output limit may be" - f' reached.' - ) async def _run_one_step_async( self, @@ -569,21 +565,32 @@ class BaseLlmFlow(ABC): if not isinstance(agent, LlmAgent): return - if not agent.canonical_before_model_callbacks: - return - callback_context = CallbackContext( invocation_context, event_actions=model_response_event.actions ) + # First run callbacks from the plugins. + callback_response = ( + await invocation_context.plugin_manager.run_before_model_callback( + callback_context=callback_context, + llm_request=llm_request, + ) + ) + if callback_response: + return callback_response + + # If no overrides are provided from the plugins, further run the canonical + # callbacks. + if not agent.canonical_before_model_callbacks: + return for callback in agent.canonical_before_model_callbacks: - before_model_callback_content = callback( + callback_response = callback( callback_context=callback_context, llm_request=llm_request ) - if inspect.isawaitable(before_model_callback_content): - before_model_callback_content = await before_model_callback_content - if before_model_callback_content: - return before_model_callback_content + if inspect.isawaitable(callback_response): + callback_response = await callback_response + if callback_response: + return callback_response async def _handle_after_model_callback( self, @@ -597,21 +604,32 @@ class BaseLlmFlow(ABC): if not isinstance(agent, LlmAgent): return - if not agent.canonical_after_model_callbacks: - return - callback_context = CallbackContext( invocation_context, event_actions=model_response_event.actions ) + # First run callbacks from the plugins. + callback_response = ( + await invocation_context.plugin_manager.run_after_model_callback( + callback_context=CallbackContext(invocation_context), + llm_response=llm_response, + ) + ) + if callback_response: + return callback_response + + # If no overrides are provided from the plugins, further run the canonical + # callbacks. + if not agent.canonical_after_model_callbacks: + return for callback in agent.canonical_after_model_callbacks: - after_model_callback_content = callback( + callback_response = callback( callback_context=callback_context, llm_response=llm_response ) - if inspect.isawaitable(after_model_callback_content): - after_model_callback_content = await after_model_callback_content - if after_model_callback_content: - return after_model_callback_content + if inspect.isawaitable(callback_response): + callback_response = await callback_response + if callback_response: + return callback_response def _finalize_model_response_event( self, diff --git a/src/google/adk/flows/llm_flows/functions.py b/src/google/adk/flows/llm_flows/functions.py index 5c690f1f..c64b7cec 100644 --- a/src/google/adk/flows/llm_flows/functions.py +++ b/src/google/adk/flows/llm_flows/functions.py @@ -153,37 +153,67 @@ async def handle_function_calls_async( # do not use "args" as the variable name, because it is a reserved keyword # in python debugger. function_args = function_call.args or {} - function_response: Optional[dict] = None - for callback in agent.canonical_before_tool_callbacks: - function_response = callback( - tool=tool, args=function_args, tool_context=tool_context - ) - if inspect.isawaitable(function_response): - function_response = await function_response - if function_response: - break + # Step 1: Check if plugin before_tool_callback overrides the function + # response. + function_response = ( + await invocation_context.plugin_manager.run_before_tool_callback( + tool=tool, tool_args=function_args, tool_context=tool_context + ) + ) - if not function_response: + # Step 2: If no overrides are provided from the plugins, further run the + # canonical callback. + if function_response is None: + for callback in agent.canonical_before_tool_callbacks: + function_response = callback( + tool=tool, args=function_args, tool_context=tool_context + ) + if inspect.isawaitable(function_response): + function_response = await function_response + if function_response: + break + + # Step 3: Otherwise, proceed calling the tool normally. + if function_response is None: function_response = await __call_tool_async( tool, args=function_args, tool_context=tool_context ) - for callback in agent.canonical_after_tool_callbacks: - altered_function_response = callback( - tool=tool, - args=function_args, - tool_context=tool_context, - tool_response=function_response, - ) - if inspect.isawaitable(altered_function_response): - altered_function_response = await altered_function_response - if altered_function_response is not None: - function_response = altered_function_response - break + # Step 4: Check if plugin after_tool_callback overrides the function + # response. + altered_function_response = ( + await invocation_context.plugin_manager.run_after_tool_callback( + tool=tool, + tool_args=function_args, + tool_context=tool_context, + result=function_response, + ) + ) + + # Step 5: If no overrides are provided from the plugins, further run the + # canonical after_tool_callbacks. + if altered_function_response is None: + for callback in agent.canonical_after_tool_callbacks: + altered_function_response = callback( + tool=tool, + args=function_args, + tool_context=tool_context, + tool_response=function_response, + ) + if inspect.isawaitable(altered_function_response): + altered_function_response = await altered_function_response + if altered_function_response: + break + + # Step 6: If alternative response exists from after_tool_callback, use it + # instead of the original function response. + if altered_function_response is not None: + function_response = altered_function_response if tool.is_long_running: - # Allow long running function to return None to not provide function response. + # Allow long running function to return None to not provide function + # response. if not function_response: continue @@ -264,6 +294,7 @@ async def handle_function_calls_live( # ) # if new_response: # function_response = new_response + altered_function_response = None if agent.after_tool_callback: altered_function_response = agent.after_tool_callback( tool=tool, @@ -273,8 +304,8 @@ async def handle_function_calls_live( ) if inspect.isawaitable(altered_function_response): altered_function_response = await altered_function_response - if altered_function_response is not None: - function_response = altered_function_response + if altered_function_response is not None: + function_response = altered_function_response if tool.is_long_running: # Allow async function to return None to not provide function response. diff --git a/src/google/adk/memory/in_memory_memory_service.py b/src/google/adk/memory/in_memory_memory_service.py index 129ba5bc..8b6f3613 100644 --- a/src/google/adk/memory/in_memory_memory_service.py +++ b/src/google/adk/memory/in_memory_memory_service.py @@ -14,6 +14,7 @@ from __future__ import annotations import re +import threading from typing import TYPE_CHECKING from typing_extensions import override @@ -42,38 +43,43 @@ class InMemoryMemoryService(BaseMemoryService): Uses keyword matching instead of semantic search. - It is not suitable for multi-threaded production environments. Use it for - testing and development only. + This class is thread-safe, however, it should be used for testing and + development only. """ def __init__(self): + self._lock = threading.Lock() + self._session_events: dict[str, dict[str, list[Event]]] = {} - """Keys are app_name/user_id, session_id. Values are session event lists.""" + """Keys are "{app_name}/{user_id}". Values are dicts of session_id to + session event lists. + """ @override async def add_session_to_memory(self, session: Session): user_key = _user_key(session.app_name, session.user_id) - self._session_events[user_key] = self._session_events.get( - _user_key(session.app_name, session.user_id), {} - ) - self._session_events[user_key][session.id] = [ - event - for event in session.events - if event.content and event.content.parts - ] + + with self._lock: + self._session_events[user_key] = self._session_events.get(user_key, {}) + self._session_events[user_key][session.id] = [ + event + for event in session.events + if event.content and event.content.parts + ] @override async def search_memory( self, *, app_name: str, user_id: str, query: str ) -> SearchMemoryResponse: user_key = _user_key(app_name, user_id) - if user_key not in self._session_events: - return SearchMemoryResponse() + + with self._lock: + session_event_lists = self._session_events.get(user_key, {}) words_in_query = set(query.lower().split()) response = SearchMemoryResponse() - for session_events in self._session_events[user_key].values(): + for session_events in session_event_lists.values(): for event in session_events: if not event.content or not event.content.parts: continue diff --git a/src/google/adk/models/anthropic_llm.py b/src/google/adk/models/anthropic_llm.py index a3a0e096..15d78d72 100644 --- a/src/google/adk/models/anthropic_llm.py +++ b/src/google/adk/models/anthropic_llm.py @@ -16,6 +16,7 @@ from __future__ import annotations +import base64 from functools import cached_property import logging import os @@ -45,7 +46,7 @@ __all__ = ["Claude"] logger = logging.getLogger("google_adk." + __name__) -MAX_TOKEN = 1024 +MAX_TOKEN = 8192 class ClaudeRequest(BaseModel): @@ -70,6 +71,14 @@ def to_google_genai_finish_reason( return "FINISH_REASON_UNSPECIFIED" +def _is_image_part(part: types.Part) -> bool: + return ( + part.inline_data + and part.inline_data.mime_type + and part.inline_data.mime_type.startswith("image") + ) + + def part_to_message_block( part: types.Part, ) -> Union[ @@ -80,7 +89,7 @@ def part_to_message_block( ]: if part.text: return anthropic_types.TextBlockParam(text=part.text, type="text") - if part.function_call: + elif part.function_call: assert part.function_call.name return anthropic_types.ToolUseBlockParam( @@ -89,7 +98,7 @@ def part_to_message_block( input=part.function_call.args, type="tool_use", ) - if part.function_response: + elif part.function_response: content = "" if ( "result" in part.function_response.response @@ -105,15 +114,45 @@ def part_to_message_block( content=content, is_error=False, ) - raise NotImplementedError("Not supported yet.") + elif _is_image_part(part): + data = base64.b64encode(part.inline_data.data).decode() + return anthropic_types.ImageBlockParam( + type="image", + source=dict( + type="base64", media_type=part.inline_data.mime_type, data=data + ), + ) + elif part.executable_code: + return anthropic_types.TextBlockParam( + type="text", + text="Code:```python\n" + part.executable_code.code + "\n```", + ) + elif part.code_execution_result: + return anthropic_types.TextBlockParam( + text="Execution Result:```code_output\n" + + part.code_execution_result.output + + "\n```", + type="text", + ) + + raise NotImplementedError(f"Not supported yet: {part}") def content_to_message_param( content: types.Content, ) -> anthropic_types.MessageParam: + message_block = [] + for part in content.parts or []: + # Image data is not supported in Claude for model turns. + if _is_image_part(part): + logger.warning("Image data is not supported in Claude for model turns.") + continue + + message_block.append(part_to_message_block(part)) + return { "role": to_claude_role(content.role), - "content": [part_to_message_block(part) for part in content.parts or []], + "content": message_block, } diff --git a/src/google/adk/models/google_llm.py b/src/google/adk/models/google_llm.py index bff2b675..b56610f2 100644 --- a/src/google/adk/models/google_llm.py +++ b/src/google/adk/models/google_llm.py @@ -150,12 +150,10 @@ class Gemini(BaseLlm): thought_text = '' text = '' yield llm_response - if ( - (text or thought_text) - and response - and response.candidates - and response.candidates[0].finish_reason == types.FinishReason.STOP - ): + + # generate an aggregated content at the end regardless the + # response.candidates[0].finish_reason + if (text or thought_text) and response and response.candidates: parts = [] if thought_text: parts.append(types.Part(text=thought_text, thought=True)) @@ -163,6 +161,8 @@ class Gemini(BaseLlm): parts.append(types.Part.from_text(text=text)) yield LlmResponse( content=types.ModelContent(parts=parts), + error_code=response.candidates[0].finish_reason, + error_message=response.candidates[0].finish_message, usage_metadata=usage_metadata, ) diff --git a/src/google/adk/models/lite_llm.py b/src/google/adk/models/lite_llm.py index 39514d6f..2dfcbba8 100644 --- a/src/google/adk/models/lite_llm.py +++ b/src/google/adk/models/lite_llm.py @@ -35,6 +35,7 @@ from litellm import acompletion from litellm import ChatCompletionAssistantMessage from litellm import ChatCompletionAssistantToolCall from litellm import ChatCompletionDeveloperMessage +from litellm import ChatCompletionFileObject from litellm import ChatCompletionImageUrlObject from litellm import ChatCompletionMessageToolCall from litellm import ChatCompletionTextObject @@ -262,6 +263,12 @@ def _get_content( video_url=data_uri, ) ) + elif part.inline_data.mime_type == "application/pdf": + content_objects.append( + ChatCompletionFileObject( + type="file", file={"file_data": data_uri, "format": "pdf"} + ) + ) else: raise ValueError("LiteLlm(BaseLlm) does not support this content part.") diff --git a/src/google/adk/plugins/__init__.py b/src/google/adk/plugins/__init__.py new file mode 100644 index 00000000..b0c771ed --- /dev/null +++ b/src/google/adk/plugins/__init__.py @@ -0,0 +1,17 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may in obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .base_plugin import BasePlugin + +__all__ = ['BasePlugin'] diff --git a/src/google/adk/plugins/base_plugin.py b/src/google/adk/plugins/base_plugin.py new file mode 100644 index 00000000..cc7d85f3 --- /dev/null +++ b/src/google/adk/plugins/base_plugin.py @@ -0,0 +1,320 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may in obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +from abc import ABC +from typing import Any +from typing import Optional +from typing import TYPE_CHECKING +from typing import TypeVar + +from google.genai import types + +from ..agents.base_agent import BaseAgent +from ..agents.callback_context import CallbackContext +from ..events.event import Event +from ..models.llm_request import LlmRequest +from ..models.llm_response import LlmResponse +from ..tools.base_tool import BaseTool +from ..utils.feature_decorator import working_in_progress + +if TYPE_CHECKING: + from ..agents.invocation_context import InvocationContext + from ..tools.tool_context import ToolContext + + +# Type alias: The value may or may not be awaitable, and value is optional. +T = TypeVar("T") + + +@working_in_progress( + "Plugin is under development now. Check again around Jul. 2025" +) +class BasePlugin(ABC): + """Base class for creating plugins. + + Plugins provide a structured way to intercept and modify agent, tool, and + LLM behaviors at critical execution points in a callback manner. While agent + callbacks apply to a particular agent, plugins applies globally to all + agents added in the runner. Plugins are best used for adding custom behaviors + like logging, monitoring, caching, or modifying requests and responses at key + stages. + + A plugin can implement one or more methods of callbacks, but should not + implement the same method of callback for multiple times. + + Relation with [Agent callbacks](https://google.github.io/adk-docs/callbacks/): + + **Execution Order** + Similar to Agent callbacks, Plugins are executed in the order they are + registered. However, Plugin and Agent Callbacks are executed sequentially, + with Plugins takes precedence over agent callbacks. When the callback in a + plugin returns a value, it will short circuit all remaining plugins and + agent callbacks, causing all remaining plugins and agent callbacks + to be skipped. + + **Change Propagation** + Plugins and agent callbacks can both modify the value of the input parameters, + including agent input, tool input, and LLM request/response, etc. They work in + the exactly same way. The modifications will be visible and passed to the next + callback in the chain. For example, if a plugin modifies the tool input with + before_tool_callback, the modified tool input will be passed to the + before_tool_callback of the next plugin, and further passed to the agent + callbacks if not short circuited. + + To use a plugin, implement the desired callback methods and pass an instance + of your custom plugin class to the ADK Runner. + + Examples: + A simple plugin that logs every tool call. + + >>> class ToolLoggerPlugin(BasePlugin): + .. def __init__(self): + .. super().__init__(name="tool_logger") + .. + .. async def before_tool_callback( + .. self, *, tool: BaseTool, tool_args: dict[str, Any], + tool_context: + ToolContext + .. ): + .. print(f"[{self.name}] Calling tool '{tool.name}' with args: + {tool_args}") + .. + .. async def after_tool_callback( + .. self, *, tool: BaseTool, tool_args: dict, tool_context: + ToolContext, result: dict + .. ): + .. print(f"[{self.name}] Tool '{tool.name}' finished with result: + {result}") + .. + >>> # Add the plugin to ADK Runner + >>> # runner = Runner( + >>> # ... + >>> # plugins=[ToolLoggerPlugin(), AgentPolicyPlugin()], + >>> # ) + """ + + def __init__(self, name: str): + """Initializes the plugin. + + Args: + name: A unique identifier for this plugin instance. + """ + super().__init__() + self.name = name + + async def on_user_message_callback( + self, + *, + invocation_context: InvocationContext, + user_message: types.Content, + ) -> Optional[types.Content]: + """Callback executed when a user message is received before an invocation starts. + + This callback helps logging and modifying the user message before the + runner starts the invocation. + + Args: + invocation_context: The context for the entire invocation. + user_message: The message content input by user. + + Returns: + An optional `types.Content` to be returned to the ADK. Returning a + value to replace the user message. Returning `None` to proceed + normally. + """ + pass + + async def before_run_callback( + self, *, invocation_context: InvocationContext + ) -> Optional[types.Content]: + """Callback executed before the ADK runner runs. + + This is the first callback to be called in the lifecycle, ideal for global + setup or initialization tasks. + + Args: + invocation_context: The context for the entire invocation, containing + session information, the root agent, etc. + + Returns: + An optional `Event` to be returned to the ADK. Returning a value to + halt execution of the runner and ends the runner with that event. Return + `None` to proceed normally. + """ + pass + + async def on_event_callback( + self, *, invocation_context: InvocationContext, event: Event + ) -> Optional[Event]: + """Callback executed after an event is yielded from runner. + + This is the ideal place to make modification to the event before the event + is handled by the underlying agent app. + + Args: + invocation_context: The context for the entire invocation. + event: The event raised by the runner. + + Returns: + An optional value. A non-`None` return may be used by the framework to + modify or replace the response. Returning `None` allows the original + response to be used. + """ + pass + + async def after_run_callback( + self, *, invocation_context: InvocationContext + ) -> Optional[None]: + """Callback executed after an ADK runner run has completed. + + This is the final callback in the ADK lifecycle, suitable for cleanup, final + logging, or reporting tasks. + + Args: + invocation_context: The context for the entire invocation. + + Returns: + None + """ + pass + + async def before_agent_callback( + self, *, agent: BaseAgent, callback_context: CallbackContext + ) -> Optional[types.Content]: + """Callback executed before an agent's primary logic is invoked. + + This callback can be used for logging, setup, or to short-circuit the + agent's execution by returning a value. + + Args: + agent: The agent that is about to run. + callback_context: The context for the agent invocation. + + Returns: + An optional `types.Content` object. If a value is returned, it will bypass + the agent's callbacks and its execution, and return this value directly. + Returning `None` allows the agent to proceed normally. + """ + pass + + async def after_agent_callback( + self, *, agent: BaseAgent, callback_context: CallbackContext + ) -> Optional[types.Content]: + """Callback executed after an agent's primary logic has completed. + + This callback can be used to inspect, log, or modify the agent's final + result before it is returned. + + Args: + agent: The agent that has just run. + callback_context: The context for the agent invocation. + + Returns: + An optional `types.Content` object. If a value is returned, it will + replace the agent's original result. Returning `None` uses the original, + unmodified result. + """ + pass + + async def before_model_callback( + self, *, callback_context: CallbackContext, llm_request: LlmRequest + ) -> Optional[LlmResponse]: + """Callback executed before a request is sent to the model. + + This provides an opportunity to inspect, log, or modify the `LlmRequest` + object. It can also be used to implement caching by returning a cached + `LlmResponse`, which would skip the actual model call. + + Args: + callback_context: The context for the current agent call. + llm_request: The prepared request object to be sent to the model. + + Returns: + An optional value. The interpretation of a non-`None` trigger an early + exit and returns the response immediately. Returning `None` allows the LLM + request to proceed normally. + """ + pass + + async def after_model_callback( + self, *, callback_context: CallbackContext, llm_response: LlmResponse + ) -> Optional[LlmResponse]: + """Callback executed after a response is received from the model. + + This is the ideal place to log model responses, collect metrics on token + usage, or perform post-processing on the raw `LlmResponse`. + + Args: + callback_context: The context for the current agent call. + llm_response: The response object received from the model. + + Returns: + An optional value. A non-`None` return may be used by the framework to + modify or replace the response. Returning `None` allows the original + response to be used. + """ + pass + + async def before_tool_callback( + self, + *, + tool: BaseTool, + tool_args: dict[str, Any], + tool_context: ToolContext, + ) -> Optional[dict]: + """Callback executed before a tool is called. + + This callback is useful for logging tool usage, input validation, or + modifying the arguments before they are passed to the tool. + + Args: + tool: The tool instance that is about to be executed. + tool_args: The dictionary of arguments to be used for invoking the tool. + tool_context: The context specific to the tool execution. + + Returns: + An optional dictionary. If a dictionary is returned, it will stop the tool + execution and return this response immediately. Returning `None` uses the + original, unmodified arguments. + """ + pass + + async def after_tool_callback( + self, + *, + tool: BaseTool, + tool_args: dict[str, Any], + tool_context: ToolContext, + result: dict, + ) -> Optional[dict]: + """Callback executed after a tool has been called. + + This callback allows for inspecting, logging, or modifying the result + returned by a tool. + + Args: + tool: The tool instance that has just been executed. + tool_args: The original arguments that were passed to the tool. + tool_context: The context specific to the tool execution. + result: The dictionary returned by the tool invocation. + + Returns: + An optional dictionary. If a dictionary is returned, it will **replace** + the original result from the tool. This allows for post-processing or + altering tool outputs. Returning `None` uses the original, unmodified + result. + """ + pass diff --git a/src/google/adk/plugins/plugin_manager.py b/src/google/adk/plugins/plugin_manager.py new file mode 100644 index 00000000..3680c351 --- /dev/null +++ b/src/google/adk/plugins/plugin_manager.py @@ -0,0 +1,265 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import logging +from typing import Any +from typing import List +from typing import Literal +from typing import Optional +from typing import TYPE_CHECKING + +from google.genai import types + +from .base_plugin import BasePlugin + +if TYPE_CHECKING: + from ..agents.base_agent import BaseAgent + from ..agents.callback_context import CallbackContext + from ..agents.invocation_context import InvocationContext + from ..events.event import Event + from ..models.llm_request import LlmRequest + from ..models.llm_response import LlmResponse + from ..tools.base_tool import BaseTool + from ..tools.tool_context import ToolContext + +# A type alias for the names of the available plugin callbacks. +# This helps with static analysis and prevents typos when calling run_callbacks. +PluginCallbackName = Literal[ + "on_user_message_callback", + "before_run_callback", + "after_run_callback", + "on_event_callback", + "before_agent_callback", + "after_agent_callback", + "before_tool_callback", + "after_tool_callback", + "before_model_callback", + "after_model_callback", +] + +logger = logging.getLogger("google_adk." + __name__) + + +class PluginManager: + """Manages the registration and execution of plugins. + + The PluginManager is an internal class that orchestrates the invocation of + plugin callbacks at key points in the SDK's execution lifecycle. It maintains + a list of registered plugins and ensures they are called in the order they + were registered. + + The core execution logic implements an "early exit" strategy: if any plugin + callback returns a non-`None` value, the execution of subsequent plugins for + that specific event is halted, and the returned value is propagated up the + call stack. This allows plugins to short-circuit operations like agent runs, + tool calls, or model requests. + """ + + def __init__(self, plugins: Optional[List[BasePlugin]] = None): + """Initializes the plugin service. + + Args: + plugins: An optional list of plugins to register upon initialization. + """ + self.plugins: List[BasePlugin] = [] + if plugins: + for plugin in plugins: + self.register_plugin(plugin) + + def register_plugin(self, plugin: BasePlugin) -> None: + """Registers a new plugin. + + Args: + plugin: The plugin instance to register. + + Raises: + ValueError: If a plugin with the same name is already registered. + """ + if any(p.name == plugin.name for p in self.plugins): + raise ValueError(f"Plugin with name '{plugin.name}' already registered.") + self.plugins.append(plugin) + logger.info("Plugin '%s' registered.", plugin.name) + + def get_plugin(self, plugin_name: str) -> Optional[BasePlugin]: + """Retrieves a registered plugin by its name. + + Args: + plugin_name: The name of the plugin to retrieve. + + Returns: + The plugin instance if found, otherwise `None`. + """ + return next((p for p in self.plugins if p.name == plugin_name), None) + + async def run_on_user_message_callback( + self, + *, + user_message: types.Content, + invocation_context: InvocationContext, + ) -> Optional[types.Content]: + """Runs the `on_user_message_callback` for all plugins.""" + return await self._run_callbacks( + "on_user_message_callback", + user_message=user_message, + invocation_context=invocation_context, + ) + + async def run_before_run_callback( + self, *, invocation_context: InvocationContext + ) -> Optional[types.Content]: + """Runs the `before_run_callback` for all plugins.""" + return await self._run_callbacks( + "before_run_callback", invocation_context=invocation_context + ) + + async def run_after_run_callback( + self, *, invocation_context: InvocationContext + ) -> Optional[None]: + """Runs the `after_run_callback` for all plugins.""" + return await self._run_callbacks( + "after_run_callback", invocation_context=invocation_context + ) + + async def run_on_event_callback( + self, *, invocation_context: InvocationContext, event: Event + ) -> Optional[Event]: + """Runs the `on_event_callback` for all plugins.""" + return await self._run_callbacks( + "on_event_callback", + invocation_context=invocation_context, + event=event, + ) + + async def run_before_agent_callback( + self, *, agent: BaseAgent, callback_context: CallbackContext + ) -> Optional[types.Content]: + """Runs the `before_agent_callback` for all plugins.""" + return await self._run_callbacks( + "before_agent_callback", + agent=agent, + callback_context=callback_context, + ) + + async def run_after_agent_callback( + self, *, agent: BaseAgent, callback_context: CallbackContext + ) -> Optional[types.Content]: + """Runs the `after_agent_callback` for all plugins.""" + return await self._run_callbacks( + "after_agent_callback", + agent=agent, + callback_context=callback_context, + ) + + async def run_before_tool_callback( + self, + *, + tool: BaseTool, + tool_args: dict[str, Any], + tool_context: ToolContext, + ) -> Optional[dict]: + """Runs the `before_tool_callback` for all plugins.""" + return await self._run_callbacks( + "before_tool_callback", + tool=tool, + tool_args=tool_args, + tool_context=tool_context, + ) + + async def run_after_tool_callback( + self, + *, + tool: BaseTool, + tool_args: dict[str, Any], + tool_context: ToolContext, + result: dict, + ) -> Optional[dict]: + """Runs the `after_tool_callback` for all plugins.""" + return await self._run_callbacks( + "after_tool_callback", + tool=tool, + tool_args=tool_args, + tool_context=tool_context, + result=result, + ) + + async def run_before_model_callback( + self, *, callback_context: CallbackContext, llm_request: LlmRequest + ) -> Optional[LlmResponse]: + """Runs the `before_model_callback` for all plugins.""" + return await self._run_callbacks( + "before_model_callback", + callback_context=callback_context, + llm_request=llm_request, + ) + + async def run_after_model_callback( + self, *, callback_context: CallbackContext, llm_response: LlmResponse + ) -> Optional[LlmResponse]: + """Runs the `after_model_callback` for all plugins.""" + return await self._run_callbacks( + "after_model_callback", + callback_context=callback_context, + llm_response=llm_response, + ) + + async def _run_callbacks( + self, callback_name: PluginCallbackName, **kwargs: Any + ) -> Optional[Any]: + """Executes a specific callback for all registered plugins. + + This private method iterates through the plugins and calls the specified + callback method on each one, passing the provided keyword arguments. + + The execution stops as soon as a plugin's callback returns a non-`None` + value. This "early exit" value is then returned by this method. If all + plugins are executed and all return `None`, this method also returns `None`. + + Args: + callback_name: The name of the callback method to execute. + **kwargs: Keyword arguments to be passed to the callback method. + + Returns: + The first non-`None` value returned by a plugin callback, or `None` if + all callbacks return `None`. + + Raises: + RuntimeError: If a plugin encounters an unhandled exception during + execution. The original exception is chained. + """ + for plugin in self.plugins: + # Each plugin might not implement all callbacks. The base class provides + # default `pass` implementations, so `getattr` will always succeed. + callback_method = getattr(plugin, callback_name) + try: + result = await callback_method(**kwargs) + if result is not None: + # Early exit: A plugin has returned a value. We stop + # processing further plugins and return this value immediately. + logger.debug( + "Plugin '%s' returned a value for callback '%s', exiting early.", + plugin.name, + callback_name, + ) + return result + except Exception as e: + error_message = ( + f"Error in plugin '{plugin.name}' during '{callback_name}'" + f" callback: {e}" + ) + logger.error(error_message, exc_info=True) + raise RuntimeError(error_message) from e + + return None diff --git a/src/google/adk/runners.py b/src/google/adk/runners.py index a95f1081..ccca19e0 100644 --- a/src/google/adk/runners.py +++ b/src/google/adk/runners.py @@ -18,7 +18,9 @@ import asyncio import logging import queue from typing import AsyncGenerator +from typing import Callable from typing import Generator +from typing import List from typing import Optional import warnings @@ -40,6 +42,8 @@ from .flows.llm_flows.functions import find_matching_function_call from .memory.base_memory_service import BaseMemoryService from .memory.in_memory_memory_service import InMemoryMemoryService from .platform.thread import create_thread +from .plugins.base_plugin import BasePlugin +from .plugins.plugin_manager import PluginManager from .sessions.base_session_service import BaseSessionService from .sessions.in_memory_session_service import InMemorySessionService from .sessions.session import Session @@ -60,6 +64,7 @@ class Runner: app_name: The application name of the runner. agent: The root agent to run. artifact_service: The artifact service for the runner. + plugin_manager: The plugin manager for the runner. session_service: The session service for the runner. memory_service: The memory service for the runner. """ @@ -70,6 +75,8 @@ class Runner: """The root agent to run.""" artifact_service: Optional[BaseArtifactService] = None """The artifact service for the runner.""" + plugin_manager: PluginManager + """The plugin manager for the runner.""" session_service: BaseSessionService """The session service for the runner.""" memory_service: Optional[BaseMemoryService] = None @@ -82,6 +89,7 @@ class Runner: *, app_name: str, agent: BaseAgent, + plugins: Optional[List[BasePlugin]] = None, artifact_service: Optional[BaseArtifactService] = None, session_service: BaseSessionService, memory_service: Optional[BaseMemoryService] = None, @@ -102,6 +110,7 @@ class Runner: self.session_service = session_service self.memory_service = memory_service self.credential_service = credential_service + self.plugin_manager = PluginManager(plugins=plugins) def run( self, @@ -191,6 +200,15 @@ class Runner: ) root_agent = self.agent + # Modify user message before execution. + modified_user_message = ( + await invocation_context.plugin_manager.run_on_user_message_callback( + invocation_context=invocation_context, user_message=new_message + ) + ) + if modified_user_message is not None: + new_message = modified_user_message + if new_message: await self._append_new_message_to_session( session, @@ -200,10 +218,64 @@ class Runner: ) invocation_context.agent = self._find_agent_to_run(session, root_agent) - async for event in invocation_context.agent.run_async(invocation_context): + + async def execute(ctx: InvocationContext) -> AsyncGenerator[Event]: + async for event in ctx.agent.run_async(ctx): + yield event + + async for event in self._exec_with_plugin( + invocation_context, session, execute + ): + yield event + + async def _exec_with_plugin( + self, + invocation_context: InvocationContext, + session: Session, + execute_fn: Callable[[InvocationContext], AsyncGenerator[Event, None]], + ) -> AsyncGenerator[Event, None]: + """Wraps execution with plugin callbacks. + + Args: + invocation_context: The invocation context + session: The current session + execute_fn: A callable that returns an AsyncGenerator of Events + + Yields: + Events from the execution, including any generated by plugins + """ + + plugin_manager = invocation_context.plugin_manager + + # Step 1: Run the before_run callbacks to see if we should early exit. + early_exit_result = await plugin_manager.run_before_run_callback( + invocation_context=invocation_context + ) + if isinstance(early_exit_result, Event): + await self.session_service.append_event( + session=session, + event=Event( + invocation_id=invocation_context.invocation_id, + author='model', + content=early_exit_result, + ), + ) + yield early_exit_result + else: + # Step 2: Otherwise continue with normal execution + async for event in execute_fn(invocation_context): if not event.partial: await self.session_service.append_event(session=session, event=event) - yield event + # Step 3: Run the on_event callbacks to optionally modify the event. + modified_event = await plugin_manager.run_on_event_callback( + invocation_context=invocation_context, event=event + ) + yield (modified_event if modified_event else event) + + # Step 4: Run the after_run callbacks to optionally modify the context. + await plugin_manager.run_after_run_callback( + invocation_context=invocation_context + ) async def _append_new_message_to_session( self, @@ -345,8 +417,14 @@ class Runner: invocation_context.active_streaming_tools[tool.__name__] = ( active_streaming_tool ) - async for event in invocation_context.agent.run_live(invocation_context): - await self.session_service.append_event(session=session, event=event) + + async def execute(ctx: InvocationContext) -> AsyncGenerator[Event]: + async for event in ctx.agent.run_live(ctx): + yield event + + async for event in self._exec_with_plugin( + invocation_context, session, execute + ): yield event def _find_agent_to_run( @@ -450,6 +528,7 @@ class Runner: session_service=self.session_service, memory_service=self.memory_service, credential_service=self.credential_service, + plugin_manager=self.plugin_manager, invocation_id=invocation_id, agent=self.agent, session=session, @@ -538,7 +617,13 @@ class InMemoryRunner(Runner): session service for the runner. """ - def __init__(self, agent: BaseAgent, *, app_name: str = 'InMemoryRunner'): + def __init__( + self, + agent: BaseAgent, + *, + app_name: str = 'InMemoryRunner', + plugins: Optional[list[BasePlugin]] = None, + ): """Initializes the InMemoryRunner. Args: @@ -551,6 +636,7 @@ class InMemoryRunner(Runner): app_name=app_name, agent=agent, artifact_service=InMemoryArtifactService(), + plugins=plugins, session_service=self._in_memory_session_service, memory_service=InMemoryMemoryService(), ) diff --git a/src/google/adk/sessions/database_session_service.py b/src/google/adk/sessions/database_session_service.py index 9d3f0ddc..8ba284da 100644 --- a/src/google/adk/sessions/database_session_service.py +++ b/src/google/adk/sessions/database_session_service.py @@ -137,7 +137,7 @@ class StorageSession(Base): DateTime(), default=func.now(), onupdate=func.now() ) - storage_events: Mapped[list["StorageEvent"]] = relationship( + storage_events: Mapped[list[StorageEvent]] = relationship( "StorageEvent", back_populates="storage_session", ) @@ -373,11 +373,11 @@ class DatabaseSessionService(BaseSessionService): # 4. Build the session object with generated id # 5. Return the session - with self.database_session_factory() as session_factory: + with self.database_session_factory() as sql_session: # Fetch app and user states from storage - storage_app_state = session_factory.get(StorageAppState, (app_name)) - storage_user_state = session_factory.get( + storage_app_state = sql_session.get(StorageAppState, (app_name)) + storage_user_state = sql_session.get( StorageUserState, (app_name, user_id) ) @@ -387,12 +387,12 @@ class DatabaseSessionService(BaseSessionService): # Create state tables if not exist if not storage_app_state: storage_app_state = StorageAppState(app_name=app_name, state={}) - session_factory.add(storage_app_state) + sql_session.add(storage_app_state) if not storage_user_state: storage_user_state = StorageUserState( app_name=app_name, user_id=user_id, state={} ) - session_factory.add(storage_user_state) + sql_session.add(storage_user_state) # Extract state deltas app_state_delta, user_state_delta, session_state = _extract_state_delta( @@ -416,10 +416,10 @@ class DatabaseSessionService(BaseSessionService): id=session_id, state=session_state, ) - session_factory.add(storage_session) - session_factory.commit() + sql_session.add(storage_session) + sql_session.commit() - session_factory.refresh(storage_session) + sql_session.refresh(storage_session) # Merge states for response merged_state = _merge_state(app_state, user_state, session_state) @@ -444,8 +444,8 @@ class DatabaseSessionService(BaseSessionService): # 1. Get the storage session entry from session table # 2. Get all the events based on session id and filtering config # 3. Convert and return the session - with self.database_session_factory() as session_factory: - storage_session = session_factory.get( + with self.database_session_factory() as sql_session: + storage_session = sql_session.get( StorageSession, (app_name, user_id, session_id) ) if storage_session is None: @@ -458,7 +458,7 @@ class DatabaseSessionService(BaseSessionService): timestamp_filter = True storage_events = ( - session_factory.query(StorageEvent) + sql_session.query(StorageEvent) .filter(StorageEvent.app_name == app_name) .filter(StorageEvent.session_id == storage_session.id) .filter(StorageEvent.user_id == user_id) @@ -473,8 +473,8 @@ class DatabaseSessionService(BaseSessionService): ) # Fetch states from storage - storage_app_state = session_factory.get(StorageAppState, (app_name)) - storage_user_state = session_factory.get( + storage_app_state = sql_session.get(StorageAppState, (app_name)) + storage_user_state = sql_session.get( StorageUserState, (app_name, user_id) ) @@ -500,9 +500,9 @@ class DatabaseSessionService(BaseSessionService): async def list_sessions( self, *, app_name: str, user_id: str ) -> ListSessionsResponse: - with self.database_session_factory() as session_factory: + with self.database_session_factory() as sql_session: results = ( - session_factory.query(StorageSession) + sql_session.query(StorageSession) .filter(StorageSession.app_name == app_name) .filter(StorageSession.user_id == user_id) .all() @@ -523,14 +523,14 @@ class DatabaseSessionService(BaseSessionService): async def delete_session( self, app_name: str, user_id: str, session_id: str ) -> None: - with self.database_session_factory() as session_factory: + with self.database_session_factory() as sql_session: stmt = delete(StorageSession).where( StorageSession.app_name == app_name, StorageSession.user_id == user_id, StorageSession.id == session_id, ) - session_factory.execute(stmt) - session_factory.commit() + sql_session.execute(stmt) + sql_session.commit() @override async def append_event(self, session: Session, event: Event) -> Event: @@ -542,8 +542,8 @@ class DatabaseSessionService(BaseSessionService): # 1. Check if timestamp is stale # 2. Update session attributes based on event config # 3. Store event to table - with self.database_session_factory() as session_factory: - storage_session = session_factory.get( + with self.database_session_factory() as sql_session: + storage_session = sql_session.get( StorageSession, (session.app_name, session.user_id, session.id) ) @@ -557,10 +557,8 @@ class DatabaseSessionService(BaseSessionService): ) # Fetch states from storage - storage_app_state = session_factory.get( - StorageAppState, (session.app_name) - ) - storage_user_state = session_factory.get( + storage_app_state = sql_session.get(StorageAppState, (session.app_name)) + storage_user_state = sql_session.get( StorageUserState, (session.app_name, session.user_id) ) @@ -589,10 +587,10 @@ class DatabaseSessionService(BaseSessionService): session_state.update(session_state_delta) storage_session.state = session_state - session_factory.add(StorageEvent.from_event(session, event)) + sql_session.add(StorageEvent.from_event(session, event)) - session_factory.commit() - session_factory.refresh(storage_session) + sql_session.commit() + sql_session.refresh(storage_session) # Update timestamp with commit time session.last_update_time = storage_session.update_timestamp_tz diff --git a/src/google/adk/tools/base_toolset.py b/src/google/adk/tools/base_toolset.py index 7b3174eb..6bd1384e 100644 --- a/src/google/adk/tools/base_toolset.py +++ b/src/google/adk/tools/base_toolset.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations from abc import ABC from abc import abstractmethod @@ -64,7 +65,7 @@ class BaseToolset(ABC): """Return all tools in the toolset based on the provided context. Args: - readony_context (ReadonlyContext, optional): Context used to filter tools + readonly_context (ReadonlyContext, optional): Context used to filter tools available to the agent. If None, all tools in the toolset are returned. Returns: diff --git a/src/google/adk/tools/enterprise_search_tool.py b/src/google/adk/tools/enterprise_search_tool.py index f3380bc5..e3ce0af4 100644 --- a/src/google/adk/tools/enterprise_search_tool.py +++ b/src/google/adk/tools/enterprise_search_tool.py @@ -47,8 +47,8 @@ class EnterpriseWebSearchTool(BaseTool): tool_context: ToolContext, llm_request: LlmRequest, ) -> None: - if llm_request.model and llm_request.model.startswith('gemini-'): - if llm_request.model.startswith('gemini-1') and llm_request.config.tools: + if llm_request.model and 'gemini-' in llm_request.model: + if 'gemini-1' in llm_request.model and llm_request.config.tools: raise ValueError( 'Enterprise web search tool can not be used with other tools in' ' Gemini 1.x.' diff --git a/src/google/adk/tools/google_api_tool/google_api_tool.py b/src/google/adk/tools/google_api_tool/google_api_tool.py index 4fc254b2..5b2d51a2 100644 --- a/src/google/adk/tools/google_api_tool/google_api_tool.py +++ b/src/google/adk/tools/google_api_tool/google_api_tool.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations + from typing import Any from typing import Dict from typing import Optional @@ -23,7 +25,9 @@ from .. import BaseTool from ...auth import AuthCredential from ...auth import AuthCredentialTypes from ...auth import OAuth2Auth +from ...auth.auth_credential import ServiceAccount from ..openapi_tool import RestApiTool +from ..openapi_tool.auth.auth_helpers import service_account_scheme_credential from ..tool_context import ToolContext @@ -34,6 +38,7 @@ class GoogleApiTool(BaseTool): rest_api_tool: RestApiTool, client_id: Optional[str] = None, client_secret: Optional[str] = None, + service_account: Optional[ServiceAccount] = None, ): super().__init__( name=rest_api_tool.name, @@ -41,7 +46,10 @@ class GoogleApiTool(BaseTool): is_long_running=rest_api_tool.is_long_running, ) self._rest_api_tool = rest_api_tool - self.configure_auth(client_id, client_secret) + if service_account is not None: + self.configure_sa_auth(service_account) + else: + self.configure_auth(client_id, client_secret) @override def _get_declaration(self) -> FunctionDeclaration: @@ -63,3 +71,10 @@ class GoogleApiTool(BaseTool): client_secret=client_secret, ), ) + + def configure_sa_auth(self, service_account: ServiceAccount): + auth_scheme, auth_credential = service_account_scheme_credential( + service_account + ) + self._rest_api_tool.auth_scheme = auth_scheme + self._rest_api_tool.auth_credential = auth_credential diff --git a/src/google/adk/tools/google_api_tool/google_api_toolset.py b/src/google/adk/tools/google_api_tool/google_api_toolset.py index 2cb00fa6..47b3838e 100644 --- a/src/google/adk/tools/google_api_tool/google_api_toolset.py +++ b/src/google/adk/tools/google_api_tool/google_api_toolset.py @@ -14,18 +14,15 @@ from __future__ import annotations -import inspect -import os -from typing import Any from typing import List from typing import Optional -from typing import Type from typing import Union from typing_extensions import override from ...agents.readonly_context import ReadonlyContext from ...auth import OpenIdConnectWithConfig +from ...auth.auth_credential import ServiceAccount from ...tools.base_toolset import BaseToolset from ...tools.base_toolset import ToolPredicate from ..openapi_tool import OpenAPIToolset @@ -48,11 +45,13 @@ class GoogleApiToolset(BaseToolset): client_id: Optional[str] = None, client_secret: Optional[str] = None, tool_filter: Optional[Union[ToolPredicate, List[str]]] = None, + service_account: Optional[ServiceAccount] = None, ): self.api_name = api_name self.api_version = api_version self._client_id = client_id self._client_secret = client_secret + self._service_account = service_account self._openapi_toolset = self._load_toolset_with_oidc_auth() self.tool_filter = tool_filter @@ -61,10 +60,10 @@ class GoogleApiToolset(BaseToolset): self, readonly_context: Optional[ReadonlyContext] = None ) -> List[GoogleApiTool]: """Get all tools in the toolset.""" - tools = [] - return [ - GoogleApiTool(tool, self._client_id, self._client_secret) + GoogleApiTool( + tool, self._client_id, self._client_secret, self._service_account + ) for tool in await self._openapi_toolset.get_tools(readonly_context) if self._is_tool_selected(tool, readonly_context) ] @@ -106,6 +105,9 @@ class GoogleApiToolset(BaseToolset): self._client_id = client_id self._client_secret = client_secret + def configure_sa_auth(self, service_account: ServiceAccount): + self._service_account = service_account + @override async def close(self): if self._openapi_toolset: diff --git a/src/google/adk/tools/google_api_tool/google_api_toolsets.py b/src/google/adk/tools/google_api_tool/google_api_toolsets.py index 22ecb39e..6e50440d 100644 --- a/src/google/adk/tools/google_api_tool/google_api_toolsets.py +++ b/src/google/adk/tools/google_api_tool/google_api_toolsets.py @@ -12,12 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations import logging from typing import List from typing import Optional from typing import Union +from ...auth.auth_credential import ServiceAccount from ..base_toolset import ToolPredicate from .google_api_toolset import GoogleApiToolset @@ -29,11 +31,14 @@ class BigQueryToolset(GoogleApiToolset): def __init__( self, - client_id: str = None, - client_secret: str = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, tool_filter: Optional[Union[ToolPredicate, List[str]]] = None, + service_account: Optional[ServiceAccount] = None, ): - super().__init__("bigquery", "v2", client_id, client_secret, tool_filter) + super().__init__( + "bigquery", "v2", client_id, client_secret, tool_filter, service_account + ) class CalendarToolset(GoogleApiToolset): @@ -41,11 +46,14 @@ class CalendarToolset(GoogleApiToolset): def __init__( self, - client_id: str = None, - client_secret: str = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, tool_filter: Optional[Union[ToolPredicate, List[str]]] = None, + service_account: Optional[ServiceAccount] = None, ): - super().__init__("calendar", "v3", client_id, client_secret, tool_filter) + super().__init__( + "calendar", "v3", client_id, client_secret, tool_filter, service_account + ) class GmailToolset(GoogleApiToolset): @@ -53,11 +61,14 @@ class GmailToolset(GoogleApiToolset): def __init__( self, - client_id: str = None, - client_secret: str = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, tool_filter: Optional[Union[ToolPredicate, List[str]]] = None, + service_account: Optional[ServiceAccount] = None, ): - super().__init__("gmail", "v1", client_id, client_secret, tool_filter) + super().__init__( + "gmail", "v1", client_id, client_secret, tool_filter, service_account + ) class YoutubeToolset(GoogleApiToolset): @@ -65,11 +76,14 @@ class YoutubeToolset(GoogleApiToolset): def __init__( self, - client_id: str = None, - client_secret: str = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, tool_filter: Optional[Union[ToolPredicate, List[str]]] = None, + service_account: Optional[ServiceAccount] = None, ): - super().__init__("youtube", "v3", client_id, client_secret, tool_filter) + super().__init__( + "youtube", "v3", client_id, client_secret, tool_filter, service_account + ) class SlidesToolset(GoogleApiToolset): @@ -77,11 +91,14 @@ class SlidesToolset(GoogleApiToolset): def __init__( self, - client_id: str = None, - client_secret: str = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, tool_filter: Optional[Union[ToolPredicate, List[str]]] = None, + service_account: Optional[ServiceAccount] = None, ): - super().__init__("slides", "v1", client_id, client_secret, tool_filter) + super().__init__( + "slides", "v1", client_id, client_secret, tool_filter, service_account + ) class SheetsToolset(GoogleApiToolset): @@ -89,9 +106,10 @@ class SheetsToolset(GoogleApiToolset): def __init__( self, - client_id: str = None, - client_secret: str = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, tool_filter: Optional[Union[ToolPredicate, List[str]]] = None, + service_account: Optional[ServiceAccount] = None, ): super().__init__("sheets", "v4", client_id, client_secret, tool_filter) @@ -101,8 +119,11 @@ class DocsToolset(GoogleApiToolset): def __init__( self, - client_id: str = None, - client_secret: str = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, tool_filter: Optional[Union[ToolPredicate, List[str]]] = None, + service_account: Optional[ServiceAccount] = None, ): - super().__init__("docs", "v1", client_id, client_secret, tool_filter) + super().__init__( + "docs", "v1", client_id, client_secret, tool_filter, service_account + ) diff --git a/src/google/adk/tools/mcp_tool/mcp_session_manager.py b/src/google/adk/tools/mcp_tool/mcp_session_manager.py index 90b39e6c..1853fb1a 100644 --- a/src/google/adk/tools/mcp_tool/mcp_session_manager.py +++ b/src/google/adk/tools/mcp_tool/mcp_session_manager.py @@ -251,6 +251,49 @@ class MCPSessionManager: """ return session._read_stream._closed or session._write_stream._closed + def _create_client(self, merged_headers: Optional[Dict[str, str]] = None): + """Creates an MCP client based on the connection parameters. + + Args: + merged_headers: Optional headers to include in the connection. + Only applicable for SSE and StreamableHTTP connections. + + Returns: + The appropriate MCP client instance. + + Raises: + ValueError: If the connection parameters are not supported. + """ + if isinstance(self._connection_params, StdioConnectionParams): + client = stdio_client( + server=self._connection_params.server_params, + errlog=self._errlog, + ) + elif isinstance(self._connection_params, SseConnectionParams): + client = sse_client( + url=self._connection_params.url, + headers=merged_headers, + timeout=self._connection_params.timeout, + sse_read_timeout=self._connection_params.sse_read_timeout, + ) + elif isinstance(self._connection_params, StreamableHTTPConnectionParams): + client = streamablehttp_client( + url=self._connection_params.url, + headers=merged_headers, + timeout=timedelta(seconds=self._connection_params.timeout), + sse_read_timeout=timedelta( + seconds=self._connection_params.sse_read_timeout + ), + terminate_on_close=self._connection_params.terminate_on_close, + ) + else: + raise ValueError( + 'Unable to initialize connection. Connection should be' + ' StdioServerParameters or SseServerParams, but got' + f' {self._connection_params}' + ) + return client + async def create_session( self, headers: Optional[Dict[str, str]] = None ) -> ClientSession: @@ -298,36 +341,7 @@ class MCPSessionManager: exit_stack = AsyncExitStack() try: - if isinstance(self._connection_params, StdioConnectionParams): - client = stdio_client( - server=self._connection_params.server_params, - errlog=self._errlog, - ) - elif isinstance(self._connection_params, SseConnectionParams): - client = sse_client( - url=self._connection_params.url, - headers=merged_headers, - timeout=self._connection_params.timeout, - sse_read_timeout=self._connection_params.sse_read_timeout, - ) - elif isinstance( - self._connection_params, StreamableHTTPConnectionParams - ): - client = streamablehttp_client( - url=self._connection_params.url, - headers=merged_headers, - timeout=timedelta(seconds=self._connection_params.timeout), - sse_read_timeout=timedelta( - seconds=self._connection_params.sse_read_timeout - ), - terminate_on_close=self._connection_params.terminate_on_close, - ) - else: - raise ValueError( - 'Unable to initialize connection. Connection should be' - ' StdioServerParameters or SseServerParams, but got' - f' {self._connection_params}' - ) + client = self._create_client(merged_headers) transports = await exit_stack.enter_async_context(client) # The streamable http client returns a GetSessionCallback in addition to the read/write MemoryObjectStreams diff --git a/src/google/adk/version.py b/src/google/adk/version.py index 1c061dd0..3f426c5d 100644 --- a/src/google/adk/version.py +++ b/src/google/adk/version.py @@ -13,4 +13,4 @@ # limitations under the License. # version: major.minor.patch -__version__ = "1.5.0" +__version__ = "1.6.1" diff --git a/tests/unittests/agents/test_agent_clone.py b/tests/unittests/agents/test_agent_clone.py new file mode 100644 index 00000000..7bda2a69 --- /dev/null +++ b/tests/unittests/agents/test_agent_clone.py @@ -0,0 +1,379 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Testings for the clone functionality of agents.""" + +from google.adk.agents.llm_agent import LlmAgent +from google.adk.agents.loop_agent import LoopAgent +from google.adk.agents.parallel_agent import ParallelAgent +from google.adk.agents.sequential_agent import SequentialAgent +import pytest + + +def test_llm_agent_clone(): + """Test cloning an LLM agent.""" + # Create an LLM agent + original = LlmAgent( + name="llm_agent", + description="An LLM agent", + instruction="You are a helpful assistant.", + ) + + # Clone it with name update + cloned = original.clone(update={"name": "cloned_llm_agent"}) + + # Verify the clone + assert cloned.name == "cloned_llm_agent" + assert cloned.description == "An LLM agent" + assert cloned.instruction == "You are a helpful assistant." + assert cloned.parent_agent is None + assert len(cloned.sub_agents) == 0 + assert isinstance(cloned, LlmAgent) + + # Verify the original is unchanged + assert original.name == "llm_agent" + assert original.instruction == "You are a helpful assistant." + + +def test_agent_with_sub_agents(): + """Test cloning an agent that has sub-agents.""" + # Create sub-agents + sub_agent1 = LlmAgent(name="sub_agent1", description="First sub-agent") + sub_agent2 = LlmAgent(name="sub_agent2", description="Second sub-agent") + + # Create a parent agent with sub-agents + original = SequentialAgent( + name="parent_agent", + description="Parent agent with sub-agents", + sub_agents=[sub_agent1, sub_agent2], + ) + + # Clone it with name update + cloned = original.clone(update={"name": "cloned_parent"}) + + # Verify the clone has sub-agents (deep copy behavior) + assert cloned.name == "cloned_parent" + assert cloned.description == "Parent agent with sub-agents" + assert cloned.parent_agent is None + assert len(cloned.sub_agents) == 2 + + # Sub-agents should be cloned with their original names + assert cloned.sub_agents[0].name == "sub_agent1" + assert cloned.sub_agents[1].name == "sub_agent2" + + # Sub-agents should have the cloned agent as their parent + assert cloned.sub_agents[0].parent_agent == cloned + assert cloned.sub_agents[1].parent_agent == cloned + + # Sub-agents should be different objects from the original + assert cloned.sub_agents[0] is not original.sub_agents[0] + assert cloned.sub_agents[1] is not original.sub_agents[1] + + # Verify the original still has sub-agents + assert original.name == "parent_agent" + assert len(original.sub_agents) == 2 + assert original.sub_agents[0].name == "sub_agent1" + assert original.sub_agents[1].name == "sub_agent2" + assert original.sub_agents[0].parent_agent == original + assert original.sub_agents[1].parent_agent == original + + +def test_three_level_nested_agent(): + """Test cloning a three-level nested agent to verify recursive cloning logic.""" + # Create third-level agents (leaf nodes) + leaf_agent1 = LlmAgent(name="leaf1", description="First leaf agent") + leaf_agent2 = LlmAgent(name="leaf2", description="Second leaf agent") + + # Create second-level agents + middle_agent1 = SequentialAgent( + name="middle1", description="First middle agent", sub_agents=[leaf_agent1] + ) + middle_agent2 = ParallelAgent( + name="middle2", + description="Second middle agent", + sub_agents=[leaf_agent2], + ) + + # Create top-level agent + root_agent = LoopAgent( + name="root_agent", + description="Root agent with three levels", + max_iterations=5, + sub_agents=[middle_agent1, middle_agent2], + ) + + # Clone the root agent + cloned_root = root_agent.clone(update={"name": "cloned_root"}) + + # Verify root level + assert cloned_root.name == "cloned_root" + assert cloned_root.description == "Root agent with three levels" + assert cloned_root.max_iterations == 5 + assert cloned_root.parent_agent is None + assert len(cloned_root.sub_agents) == 2 + assert isinstance(cloned_root, LoopAgent) + + # Verify middle level + cloned_middle1 = cloned_root.sub_agents[0] + cloned_middle2 = cloned_root.sub_agents[1] + + assert cloned_middle1.name == "middle1" + assert cloned_middle1.description == "First middle agent" + assert cloned_middle1.parent_agent == cloned_root + assert len(cloned_middle1.sub_agents) == 1 + assert isinstance(cloned_middle1, SequentialAgent) + + assert cloned_middle2.name == "middle2" + assert cloned_middle2.description == "Second middle agent" + assert cloned_middle2.parent_agent == cloned_root + assert len(cloned_middle2.sub_agents) == 1 + assert isinstance(cloned_middle2, ParallelAgent) + + # Verify leaf level + cloned_leaf1 = cloned_middle1.sub_agents[0] + cloned_leaf2 = cloned_middle2.sub_agents[0] + + assert cloned_leaf1.name == "leaf1" + assert cloned_leaf1.description == "First leaf agent" + assert cloned_leaf1.parent_agent == cloned_middle1 + assert len(cloned_leaf1.sub_agents) == 0 + assert isinstance(cloned_leaf1, LlmAgent) + + assert cloned_leaf2.name == "leaf2" + assert cloned_leaf2.description == "Second leaf agent" + assert cloned_leaf2.parent_agent == cloned_middle2 + assert len(cloned_leaf2.sub_agents) == 0 + assert isinstance(cloned_leaf2, LlmAgent) + + # Verify all objects are different from originals + assert cloned_root is not root_agent + assert cloned_middle1 is not middle_agent1 + assert cloned_middle2 is not middle_agent2 + assert cloned_leaf1 is not leaf_agent1 + assert cloned_leaf2 is not leaf_agent2 + + # Verify original structure is unchanged + assert root_agent.name == "root_agent" + assert root_agent.sub_agents[0].name == "middle1" + assert root_agent.sub_agents[1].name == "middle2" + assert root_agent.sub_agents[0].sub_agents[0].name == "leaf1" + assert root_agent.sub_agents[1].sub_agents[0].name == "leaf2" + + +def test_multiple_clones(): + """Test creating multiple clones with automatic naming.""" + # Create multiple agents and clone each one + original = LlmAgent( + name="original_agent", description="Agent for multiple cloning" + ) + + # Test multiple clones from the same original + clone1 = original.clone(update={"name": "clone1"}) + clone2 = original.clone(update={"name": "clone2"}) + + assert clone1.name == "clone1" + assert clone2.name == "clone2" + assert clone1 is not clone2 + + +def test_clone_with_complex_configuration(): + """Test cloning an agent with complex configuration.""" + # Create an LLM agent with various configurations + original = LlmAgent( + name="complex_agent", + description="A complex agent with many settings", + instruction="You are a specialized assistant.", + global_instruction="Always be helpful and accurate.", + disallow_transfer_to_parent=True, + disallow_transfer_to_peers=True, + include_contents="none", + ) + + # Clone it with name update + cloned = original.clone(update={"name": "complex_clone"}) + + # Verify all configurations are preserved + assert cloned.name == "complex_clone" + assert cloned.description == "A complex agent with many settings" + assert cloned.instruction == "You are a specialized assistant." + assert cloned.global_instruction == "Always be helpful and accurate." + assert cloned.disallow_transfer_to_parent is True + assert cloned.disallow_transfer_to_peers is True + assert cloned.include_contents == "none" + + # Verify parent and sub-agents are set + assert cloned.parent_agent is None + assert len(cloned.sub_agents) == 0 + + +def test_clone_without_updates(): + """Test cloning without providing updates (should use original values).""" + original = LlmAgent(name="test_agent", description="Test agent") + + cloned = original.clone() + + assert cloned.name == "test_agent" + assert cloned.description == "Test agent" + + +def test_clone_with_multiple_updates(): + """Test cloning with multiple field updates.""" + original = LlmAgent( + name="original_agent", + description="Original description", + instruction="Original instruction", + ) + + cloned = original.clone( + update={ + "name": "updated_agent", + "description": "Updated description", + "instruction": "Updated instruction", + } + ) + + assert cloned.name == "updated_agent" + assert cloned.description == "Updated description" + assert cloned.instruction == "Updated instruction" + + +def test_clone_with_sub_agents_deep_copy(): + """Test cloning with deep copy of sub-agents.""" + # Create an agent with sub-agents + sub_agent = LlmAgent(name="sub_agent", description="Sub agent") + original = LlmAgent( + name="root_agent", + description="Root agent", + sub_agents=[sub_agent], + ) + + # Clone with deep copy + cloned = original.clone(update={"name": "cloned_root_agent"}) + assert cloned.name == "cloned_root_agent" + assert cloned.sub_agents[0].name == "sub_agent" + assert cloned.sub_agents[0].parent_agent == cloned + assert cloned.sub_agents[0] is not original.sub_agents[0] + + +def test_clone_invalid_field(): + """Test that cloning with invalid fields raises an error.""" + original = LlmAgent(name="test_agent", description="Test agent") + + with pytest.raises(ValueError, match="Cannot update non-existent fields"): + original.clone(update={"invalid_field": "value"}) + + +def test_clone_parent_agent_field(): + """Test that cloning with parent_agent field raises an error.""" + original = LlmAgent(name="test_agent", description="Test agent") + + with pytest.raises( + ValueError, match="Cannot update `parent_agent` field in clone" + ): + original.clone(update={"parent_agent": None}) + + +def test_clone_preserves_agent_type(): + """Test that cloning preserves the specific agent type.""" + # Test LlmAgent + llm_original = LlmAgent(name="llm_test") + llm_cloned = llm_original.clone() + assert isinstance(llm_cloned, LlmAgent) + + # Test SequentialAgent + seq_original = SequentialAgent(name="seq_test") + seq_cloned = seq_original.clone() + assert isinstance(seq_cloned, SequentialAgent) + + # Test ParallelAgent + par_original = ParallelAgent(name="par_test") + par_cloned = par_original.clone() + assert isinstance(par_cloned, ParallelAgent) + + # Test LoopAgent + loop_original = LoopAgent(name="loop_test") + loop_cloned = loop_original.clone() + assert isinstance(loop_cloned, LoopAgent) + + +def test_clone_with_agent_specific_fields(): + # Test LoopAgent + loop_original = LoopAgent(name="loop_test") + loop_cloned = loop_original.clone({"max_iterations": 10}) + assert isinstance(loop_cloned, LoopAgent) + assert loop_cloned.max_iterations == 10 + + +def test_clone_with_none_update(): + """Test cloning with explicit None update parameter.""" + original = LlmAgent(name="test_agent", description="Test agent") + + cloned = original.clone(update=None) + + assert cloned.name == "test_agent" + assert cloned.description == "Test agent" + assert cloned is not original + + +def test_clone_with_empty_update(): + """Test cloning with empty update dictionary.""" + original = LlmAgent(name="test_agent", description="Test agent") + + cloned = original.clone(update={}) + + assert cloned.name == "test_agent" + assert cloned.description == "Test agent" + assert cloned is not original + + +def test_clone_with_sub_agents_update(): + """Test cloning with sub_agents provided in update.""" + # Create original sub-agents + original_sub1 = LlmAgent(name="original_sub1", description="Original sub 1") + original_sub2 = LlmAgent(name="original_sub2", description="Original sub 2") + + # Create new sub-agents for the update + new_sub1 = LlmAgent(name="new_sub1", description="New sub 1") + new_sub2 = LlmAgent(name="new_sub2", description="New sub 2") + + # Create original agent with sub-agents + original = SequentialAgent( + name="original_agent", + description="Original agent", + sub_agents=[original_sub1, original_sub2], + ) + + # Clone with sub_agents update + cloned = original.clone( + update={"name": "cloned_agent", "sub_agents": [new_sub1, new_sub2]} + ) + + # Verify the clone uses the new sub-agents + assert cloned.name == "cloned_agent" + assert len(cloned.sub_agents) == 2 + assert cloned.sub_agents[0].name == "new_sub1" + assert cloned.sub_agents[1].name == "new_sub2" + assert cloned.sub_agents[0].parent_agent == cloned + assert cloned.sub_agents[1].parent_agent == cloned + + # Verify original is unchanged + assert original.name == "original_agent" + assert len(original.sub_agents) == 2 + assert original.sub_agents[0].name == "original_sub1" + assert original.sub_agents[1].name == "original_sub2" + + +if __name__ == "__main__": + # Run a specific test for debugging + test_three_level_nested_agent() diff --git a/tests/unittests/agents/test_base_agent.py b/tests/unittests/agents/test_base_agent.py index 25aca8ff..4f8bd770 100644 --- a/tests/unittests/agents/test_base_agent.py +++ b/tests/unittests/agents/test_base_agent.py @@ -26,6 +26,8 @@ from google.adk.agents.base_agent import BaseAgent from google.adk.agents.callback_context import CallbackContext from google.adk.agents.invocation_context import InvocationContext from google.adk.events import Event +from google.adk.plugins.base_plugin import BasePlugin +from google.adk.plugins.plugin_manager import PluginManager from google.adk.sessions.in_memory_session_service import InMemorySessionService from google.genai import types import pytest @@ -83,6 +85,35 @@ async def _async_after_agent_callback_append_agent_reply( ) +class MockPlugin(BasePlugin): + before_agent_text = 'before_agent_text from MockPlugin' + after_agent_text = 'after_agent_text from MockPlugin' + + def __init__(self, name='mock_plugin'): + self.name = name + self.enable_before_agent_callback = False + self.enable_after_agent_callback = False + + async def before_agent_callback( + self, *, agent: BaseAgent, callback_context: CallbackContext + ) -> Optional[types.Content]: + if not self.enable_before_agent_callback: + return None + return types.Content(parts=[types.Part(text=self.before_agent_text)]) + + async def after_agent_callback( + self, *, agent: BaseAgent, callback_context: CallbackContext + ) -> Optional[types.Content]: + if not self.enable_after_agent_callback: + return None + return types.Content(parts=[types.Part(text=self.after_agent_text)]) + + +@pytest.fixture +def mock_plugin(): + return MockPlugin() + + class _IncompleteAgent(BaseAgent): pass @@ -113,7 +144,10 @@ class _TestingAgent(BaseAgent): async def _create_parent_invocation_context( - test_name: str, agent: BaseAgent, branch: Optional[str] = None + test_name: str, + agent: BaseAgent, + branch: Optional[str] = None, + plugins: list[BasePlugin] = [], ) -> InvocationContext: session_service = InMemorySessionService() session = await session_service.create_session( @@ -125,6 +159,7 @@ async def _create_parent_invocation_context( agent=agent, session=session, session_service=session_service, + plugin_manager=PluginManager(plugins=plugins), ) @@ -190,6 +225,36 @@ async def test_run_async_before_agent_callback_noop( spy_run_async_impl.assert_called_once() +@pytest.mark.asyncio +async def test_run_async_before_agent_callback_use_plugin( + request: pytest.FixtureRequest, + mocker: pytest_mock.MockerFixture, + mock_plugin: MockPlugin, +): + """Test that the before agent callback uses the plugin response if both plugin callback and canonical agent callbacks are present.""" + # Arrange + agent = _TestingAgent( + name=f'{request.function.__name__}_test_agent', + before_agent_callback=_before_agent_callback_bypass_agent, + ) + parent_ctx = await _create_parent_invocation_context( + request.function.__name__, agent, plugins=[mock_plugin] + ) + mock_plugin.enable_before_agent_callback = True + spy_run_async_impl = mocker.spy(agent, BaseAgent._run_async_impl.__name__) + spy_before_agent_callback = mocker.spy(agent, 'before_agent_callback') + + # Act + events = [e async for e in agent.run_async(parent_ctx)] + + # Assert + spy_before_agent_callback.assert_not_called() + spy_run_async_impl.assert_not_called() + + assert len(events) == 1 + assert events[0].content.parts[0].text == MockPlugin.before_agent_text + + @pytest.mark.asyncio async def test_run_async_with_async_before_agent_callback_noop( request: pytest.FixtureRequest, @@ -486,6 +551,34 @@ async def test_after_agent_callbacks_chain( mock_cb.assert_called(expected_calls_count) +@pytest.mark.asyncio +async def test_run_async_after_agent_callback_use_plugin( + request: pytest.FixtureRequest, + mocker: pytest_mock.MockerFixture, + mock_plugin: MockPlugin, +): + # Arrange + agent = _TestingAgent( + name=f'{request.function.__name__}_test_agent', + after_agent_callback=_after_agent_callback_noop, + ) + mock_plugin.enable_after_agent_callback = True + parent_ctx = await _create_parent_invocation_context( + request.function.__name__, agent, plugins=[mock_plugin] + ) + spy_after_agent_callback = mocker.spy(agent, 'after_agent_callback') + + # Act + events = [e async for e in agent.run_async(parent_ctx)] + + # Assert + spy_after_agent_callback.assert_not_called() + # The first event is regular model response, the second event is + # after_agent_callback response. + assert len(events) == 2 + assert events[1].content.parts[0].text == mock_plugin.after_agent_text + + @pytest.mark.asyncio async def test_run_async_after_agent_callback_noop( request: pytest.FixtureRequest, @@ -757,3 +850,7 @@ def test_set_parent_agent_for_sub_agent_twice( name=f'{request.function.__name__}_parent_2', sub_agents=[sub_agent], ) + + +if __name__ == '__main__': + pytest.main([__file__]) diff --git a/tests/unittests/agents/test_langgraph_agent.py b/tests/unittests/agents/test_langgraph_agent.py index aa6cb6ac..4e5d3481 100644 --- a/tests/unittests/agents/test_langgraph_agent.py +++ b/tests/unittests/agents/test_langgraph_agent.py @@ -17,6 +17,7 @@ from unittest.mock import MagicMock from google.adk.agents.invocation_context import InvocationContext from google.adk.agents.langgraph_agent import LangGraphAgent from google.adk.events import Event +from google.adk.plugins.plugin_manager import PluginManager from google.genai import types from langchain_core.messages import AIMessage from langchain_core.messages import HumanMessage @@ -169,6 +170,7 @@ async def test_langgraph_agent( mock_session.events = events_list mock_parent_context.invocation_id = "test_invocation_id" mock_parent_context.model_copy.return_value = mock_parent_context + mock_parent_context.plugin_manager = PluginManager(plugins=[]) weather_agent = LangGraphAgent( name="weather_agent", diff --git a/tests/unittests/agents/test_readonly_context.py b/tests/unittests/agents/test_readonly_context.py index aa4bafec..fbea0b0a 100644 --- a/tests/unittests/agents/test_readonly_context.py +++ b/tests/unittests/agents/test_readonly_context.py @@ -4,6 +4,7 @@ from unittest.mock import MagicMock from google.adk.agents.readonly_context import ReadonlyContext import pytest + @pytest.fixture def mock_invocation_context(): mock_context = MagicMock() diff --git a/tests/unittests/auth/exchanger/test_oauth2_credential_exchanger.py b/tests/unittests/auth/exchanger/test_oauth2_credential_exchanger.py index ef1dbbbe..31288511 100644 --- a/tests/unittests/auth/exchanger/test_oauth2_credential_exchanger.py +++ b/tests/unittests/auth/exchanger/test_oauth2_credential_exchanger.py @@ -208,9 +208,9 @@ class TestOAuth2CredentialExchanger: exchanger = OAuth2CredentialExchanger() - # Mock AUTHLIB_AVIALABLE to False + # Mock AUTHLIB_AVAILABLE to False with patch( - "google.adk.auth.exchanger.oauth2_credential_exchanger.AUTHLIB_AVIALABLE", + "google.adk.auth.exchanger.oauth2_credential_exchanger.AUTHLIB_AVAILABLE", False, ): result = await exchanger.exchange(credential, scheme) diff --git a/tests/unittests/auth/test_auth_handler.py b/tests/unittests/auth/test_auth_handler.py index f0d730d0..20a3f8e4 100644 --- a/tests/unittests/auth/test_auth_handler.py +++ b/tests/unittests/auth/test_auth_handler.py @@ -456,7 +456,7 @@ class TestExchangeAuthToken: self, auth_config_with_auth_code, monkeypatch ): """Test when token exchange is not supported.""" - monkeypatch.setattr("google.adk.auth.auth_handler.AUTHLIB_AVIALABLE", False) + monkeypatch.setattr("google.adk.auth.auth_handler.AUTHLIB_AVAILABLE", False) handler = AuthHandler(auth_config_with_auth_code) result = await handler.exchange_auth_token() diff --git a/tests/unittests/cli/utils/test_agent_loader.py b/tests/unittests/cli/utils/test_agent_loader.py index dafac921..2b68f3cc 100644 --- a/tests/unittests/cli/utils/test_agent_loader.py +++ b/tests/unittests/cli/utils/test_agent_loader.py @@ -19,6 +19,7 @@ import tempfile from textwrap import dedent from google.adk.cli.utils.agent_loader import AgentLoader +from pydantic import ValidationError import pytest @@ -30,6 +31,8 @@ class TestAgentLoader: """Ensure sys.path is restored after each test.""" original_path = sys.path.copy() original_env = os.environ.copy() + # Enable WIP features for YAML agent loading tests + os.environ["ADK_ALLOW_WIP_FEATURES"] = "true" yield sys.path[:] = original_path # Restore environment variables @@ -292,7 +295,8 @@ class TestAgentLoader: expected_msg_part_1 = "No root_agent found for 'nonexistent_agent'." expected_msg_part_2 = ( "Searched in 'nonexistent_agent.agent.root_agent'," - " 'nonexistent_agent.root_agent'." + " 'nonexistent_agent.root_agent' and" + " 'nonexistent_agent/root_agent.yaml'." ) expected_msg_part_3 = ( f"Ensure '{agents_dir}/nonexistent_agent' is structured correctly" @@ -443,3 +447,129 @@ class TestAgentLoader: # Now assert path was added assert str(temp_path) in sys.path assert agent.name == "path_agent" + + def create_yaml_agent_structure( + self, temp_dir: Path, agent_name: str, yaml_content: str + ): + """Create an agent structure with YAML configuration. + + Args: + temp_dir: The temporary directory to create the agent in + agent_name: Name of the agent + yaml_content: YAML content for the root_agent.yaml file + """ + agent_dir = temp_dir / agent_name + agent_dir.mkdir() + + # Create root_agent.yaml file + yaml_file = agent_dir / "root_agent.yaml" + yaml_file.write_text(yaml_content) + + def test_load_agent_from_yaml_config(self): + """Test loading an agent from YAML configuration.""" + with tempfile.TemporaryDirectory() as temp_dir: + temp_path = Path(temp_dir) + agent_name = "yaml_agent" + + # Create YAML configuration + yaml_content = dedent(""" + agent_class: LlmAgent + name: yaml_test_agent + model: gemini-2.0-flash + instruction: You are a test agent loaded from YAML configuration. + description: A test agent created from YAML config + """) + + self.create_yaml_agent_structure(temp_path, agent_name, yaml_content) + + # Load the agent + loader = AgentLoader(str(temp_path)) + agent = loader.load_agent(agent_name) + + # Assert agent was loaded correctly + assert agent.name == "yaml_test_agent" + # Check if it's an LlmAgent before accessing model and instruction + from google.adk.agents.llm_agent import LlmAgent + + if isinstance(agent, LlmAgent): + assert agent.model == "gemini-2.0-flash" + # Handle instruction which can be string or InstructionProvider + instruction_text = str(agent.instruction) + assert "test agent loaded from YAML" in instruction_text + + def test_yaml_agent_caching_returns_same_instance(self): + """Test that loading the same YAML agent twice returns the same instance.""" + with tempfile.TemporaryDirectory() as temp_dir: + temp_path = Path(temp_dir) + agent_name = "cached_yaml_agent" + + # Create YAML configuration + yaml_content = dedent(""" + agent_class: LlmAgent + name: cached_yaml_test_agent + model: gemini-2.0-flash + instruction: You are a cached test agent. + """) + + self.create_yaml_agent_structure(temp_path, agent_name, yaml_content) + + # Load the agent twice + loader = AgentLoader(str(temp_path)) + agent1 = loader.load_agent(agent_name) + agent2 = loader.load_agent(agent_name) + + # Assert same instance is returned + assert agent1 is agent2 + assert agent1.name == agent2.name + + def test_yaml_agent_not_found_error(self): + """Test that appropriate error is raised when YAML agent is not found.""" + with tempfile.TemporaryDirectory() as temp_dir: + loader = AgentLoader(temp_dir) + agents_dir = temp_dir # For use in the expected message string + + # Try to load non-existent YAML agent + with pytest.raises(ValueError) as exc_info: + loader.load_agent("nonexistent_yaml_agent") + + expected_msg_part_1 = "No root_agent found for 'nonexistent_yaml_agent'." + expected_msg_part_2 = ( + "Searched in 'nonexistent_yaml_agent.agent.root_agent'," + " 'nonexistent_yaml_agent.root_agent' and" + " 'nonexistent_yaml_agent/root_agent.yaml'." + ) + expected_msg_part_3 = ( + f"Ensure '{agents_dir}/nonexistent_yaml_agent' is structured" + " correctly" + ) + + assert expected_msg_part_1 in str(exc_info.value) + assert expected_msg_part_2 in str(exc_info.value) + assert expected_msg_part_3 in str(exc_info.value) + + def test_yaml_agent_invalid_yaml_error(self): + """Test that appropriate error is raised when YAML is invalid.""" + with tempfile.TemporaryDirectory() as temp_dir: + temp_path = Path(temp_dir) + agent_name = "invalid_yaml_agent" + + # Create invalid YAML content with wrong field name + invalid_yaml_content = dedent(""" + agent_type: LlmAgent + name: invalid_yaml_test_agent + model: gemini-2.0-flash + instruction: You are a test agent with invalid YAML + """) + + self.create_yaml_agent_structure( + temp_path, agent_name, invalid_yaml_content + ) + + loader = AgentLoader(str(temp_path)) + + # Try to load agent with invalid YAML + with pytest.raises(ValidationError) as exc_info: + loader.load_agent(agent_name) + + # Should raise some form of YAML parsing error + assert "Extra inputs are not permitted" in str(exc_info.value) diff --git a/tests/unittests/evaluation/test_final_response_match_v2.py b/tests/unittests/evaluation/test_final_response_match_v2.py new file mode 100644 index 00000000..859e6d20 --- /dev/null +++ b/tests/unittests/evaluation/test_final_response_match_v2.py @@ -0,0 +1,478 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +from google.adk.evaluation.eval_case import Invocation +from google.adk.evaluation.eval_metrics import EvalMetric +from google.adk.evaluation.eval_metrics import JudgeModelOptions +from google.adk.evaluation.evaluator import EvalStatus +from google.adk.evaluation.evaluator import PerInvocationResult +from google.adk.evaluation.final_response_match_v2 import _parse_critique +from google.adk.evaluation.final_response_match_v2 import FinalResponseMatchV2Evaluator +from google.adk.evaluation.llm_as_judge_utils import Label +from google.adk.models.llm_response import LlmResponse +from google.genai import types as genai_types +import pytest + + +@pytest.mark.parametrize( + "response_text", + [ + """```json + { + "is_the_agent_response_valid_or_invalid": "valid", + "reasoning": "The response is valid." + } + ```""", + """```json + { + "is_the_agent_response_valid": "undefined label", + } + ```""", + ], +) +def test_parse_critique_label_not_found(response_text): + label = _parse_critique(response_text) + assert label == Label.NOT_FOUND + + +@pytest.mark.parametrize( + "response_text", + [ + """```json + { + "is_the_agent_response_valid": "valid", + "reasoning": "The response is valid." + } + ```""", + """```json + { + "is_the_agent_response_valid": ["valid"], + "reasoning": "The response is valid." + } + ```""", + """```json + { + "is_the_agent_response_valid":\n [ "valid\n"], + "reasoning": "The response is valid." + } + ```""", + ], +) +def test_parse_critique(response_text): + label = _parse_critique(response_text) + assert label == Label.VALID + + +@pytest.mark.parametrize( + "response_text", + [ + """```json + { + "is_the_agent_response_invalid": "invalid", + "reasoning": "The response is invalid." + } + ```""", + """```json + { + "is_the_agent_response_invalid": ["invalid"], + "reasoning": "The response is invalid." + } + ```""", + """```json + { + "is_the_agent_response_invalid":\n [ "invalid\n"], + "reasoning": "The response is invalid." + } + ```""", + ], +) +def test_parse_critique_invalid(response_text): + label = _parse_critique(response_text) + assert label == Label.INVALID + + +def create_test_template() -> str: + return """ +This is a test template. + +{{ + "User prompt": {prompt}, + "Agent response": {response}, + "Reference response": {golden_response}, +}} + +The answer should be a json alone which follows the json structure below: +{{ + "is_the_agent_response_valid": [valid or invalid], + "reasoning": +}} +""" + + +def _create_test_evaluator_gemini( + threshold: float, +) -> FinalResponseMatchV2Evaluator: + evaluator = FinalResponseMatchV2Evaluator( + EvalMetric( + metric_name="final_response_match_v2", + threshold=threshold, + judge_model_options=JudgeModelOptions( + judge_model="gemini-2.5-flash", + num_samples=3, + ), + ), + ) + evaluator._auto_rater_prompt_template = create_test_template() + return evaluator + + +def _create_test_invocations( + candidate: str, reference: str +) -> tuple[Invocation, Invocation]: + """Returns tuple of (actual_invocation, expected_invocation).""" + actual_invocation = Invocation( + user_content=genai_types.Content( + parts=[genai_types.Part(text="This is a test query.")], + role="user", + ), + final_response=genai_types.Content( + parts=[genai_types.Part(text=candidate)], + role="model", + ), + ) + expected_invocation = Invocation( + user_content=genai_types.Content( + parts=[genai_types.Part(text="This is a test query.")], + role="user", + ), + final_response=genai_types.Content( + parts=[genai_types.Part(text=reference)], + role="model", + ), + ) + return actual_invocation, expected_invocation + + +def test_format_auto_rater_prompt(): + evaluator = _create_test_evaluator_gemini(threshold=0.8) + actual_invocation, expected_invocation = _create_test_invocations( + "candidate text", "reference text" + ) + prompt = evaluator.format_auto_rater_prompt( + actual_invocation, expected_invocation + ) + assert prompt == """ +This is a test template. + +{ + "User prompt": This is a test query., + "Agent response": candidate text, + "Reference response": reference text, +} + +The answer should be a json alone which follows the json structure below: +{ + "is_the_agent_response_valid": [valid or invalid], + "reasoning": +} +""" + + +def test_convert_auto_rater_response_to_score_valid(): + evaluator = _create_test_evaluator_gemini(threshold=0.8) + auto_rater_response = """```json +{ + "is_the_agent_response_valid": "valid", + "reasoning": "The response is valid." +} +```""" + llm_response = LlmResponse( + content=genai_types.Content( + parts=[genai_types.Part(text=auto_rater_response)], + role="model", + ) + ) + score = evaluator.convert_auto_rater_response_to_score(llm_response) + assert score == 1.0 + + +def test_convert_auto_rater_response_to_score_invalid(): + evaluator = _create_test_evaluator_gemini(threshold=0.8) + auto_rater_response = """```json +{ + "is_the_agent_response_valid": "invalid", + "reasoning": "The response is invalid." +} +```""" + llm_response = LlmResponse( + content=genai_types.Content( + parts=[genai_types.Part(text=auto_rater_response)], + role="model", + ) + ) + score = evaluator.convert_auto_rater_response_to_score(llm_response) + assert score == 0.0 + + +def test_convert_auto_rater_response_to_score_invalid_json(): + evaluator = _create_test_evaluator_gemini(threshold=0.8) + llm_response = LlmResponse( + content=genai_types.Content( + parts=[genai_types.Part(text="invalid json")], + role="model", + ) + ) + score = evaluator.convert_auto_rater_response_to_score(llm_response) + assert score is None + + +def test_convert_auto_rater_response_to_score_missing_key(): + evaluator = _create_test_evaluator_gemini(threshold=0.8) + llm_response = LlmResponse( + content=genai_types.Content( + parts=[genai_types.Part(text="{}")], + role="model", + ) + ) + score = evaluator.convert_auto_rater_response_to_score(llm_response) + assert score is None + + +def test_aggregate_per_invocation_samples_none_evaluated(): + evaluator = _create_test_evaluator_gemini(threshold=0.5) + + actual_invocation, expected_invocation = _create_test_invocations( + "candidate text", "reference text" + ) + + per_invocation_result_samples = [ + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=None, + eval_status=EvalStatus.NOT_EVALUATED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=None, + eval_status=EvalStatus.NOT_EVALUATED, + ), + ] + + assert ( + evaluator.aggregate_per_invocation_samples(per_invocation_result_samples) + == per_invocation_result_samples[0] + ) + + +def test_aggregate_per_invocation_samples_valid(): + evaluator = _create_test_evaluator_gemini(threshold=0.5) + + actual_invocation, expected_invocation = _create_test_invocations( + "candidate text", "reference text" + ) + + per_invocation_result_samples = [ + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.PASSED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.PASSED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=0.0, + eval_status=EvalStatus.FAILED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=0.0, + eval_status=EvalStatus.FAILED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.PASSED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.NOT_EVALUATED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=None, + eval_status=EvalStatus.NOT_EVALUATED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=0.0, + eval_status=EvalStatus.NOT_EVALUATED, + ), + ] + + per_invocation_result = evaluator.aggregate_per_invocation_samples( + per_invocation_result_samples + ) + + assert per_invocation_result.score == 1.0 + assert per_invocation_result.eval_status == EvalStatus.PASSED + + +def test_aggregate_per_invocation_samples_invalid(): + evaluator = _create_test_evaluator_gemini(threshold=0.5) + + actual_invocation, expected_invocation = _create_test_invocations( + "candidate text", "reference text" + ) + + per_invocation_result_samples = [ + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=0.0, + eval_status=EvalStatus.FAILED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.PASSED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=0.0, + eval_status=EvalStatus.FAILED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=0.0, + eval_status=EvalStatus.FAILED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.PASSED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.PASSED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.NOT_EVALUATED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=None, + eval_status=EvalStatus.NOT_EVALUATED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=0.0, + eval_status=EvalStatus.NOT_EVALUATED, + ), + ] + + per_invocation_result = evaluator.aggregate_per_invocation_samples( + per_invocation_result_samples + ) + + assert per_invocation_result.score == 0.0 + assert per_invocation_result.eval_status == EvalStatus.FAILED + + +def test_aggregate_invocation_results(): + evaluator = _create_test_evaluator_gemini(threshold=0.5) + + actual_invocation, expected_invocation = _create_test_invocations( + "candidate text", "reference text" + ) + + per_invocation_results = [ + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.PASSED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=1.0, + eval_status=EvalStatus.PASSED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=0.0, + eval_status=EvalStatus.FAILED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=0.0, + eval_status=EvalStatus.FAILED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=None, + eval_status=EvalStatus.PASSED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=100.0, + eval_status=EvalStatus.NOT_EVALUATED, + ), + PerInvocationResult( + actual_invocation=actual_invocation, + expected_invocation=expected_invocation, + score=None, + eval_status=EvalStatus.NOT_EVALUATED, + ), + ] + + aggregated_result = evaluator.aggregate_invocation_results( + per_invocation_results + ) + + # Only 4 / 8 invocations are evaluated, and 2 / 4 are valid. + assert aggregated_result.overall_score == 0.5 + assert aggregated_result.overall_eval_status == EvalStatus.PASSED diff --git a/tests/unittests/evaluation/test_llm_as_judge.py b/tests/unittests/evaluation/test_llm_as_judge.py new file mode 100644 index 00000000..2a4ba13c --- /dev/null +++ b/tests/unittests/evaluation/test_llm_as_judge.py @@ -0,0 +1,221 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +from typing import Optional +from unittest.mock import MagicMock + +from google.adk.evaluation.eval_case import Invocation +from google.adk.evaluation.eval_metrics import EvalMetric +from google.adk.evaluation.eval_metrics import JudgeModelOptions +from google.adk.evaluation.evaluator import EvalStatus +from google.adk.evaluation.evaluator import EvaluationResult +from google.adk.evaluation.evaluator import PerInvocationResult +from google.adk.evaluation.llm_as_judge import LlmAsJudge +from google.adk.evaluation.llm_as_judge_utils import get_eval_status +from google.adk.evaluation.llm_as_judge_utils import get_text_from_content +from google.adk.models.llm_response import LlmResponse +from google.genai import types as genai_types +import pytest + + +class MockLlmAsJudge(LlmAsJudge): + + def format_auto_rater_prompt( + self, actual_invocation: Invocation, expected_invocation: Invocation + ) -> str: + return "formatted prompt" + + def convert_auto_rater_response_to_score( + self, llm_response: LlmResponse + ) -> Optional[float]: + return 1.0 + + def aggregate_per_invocation_samples( + self, + per_invocation_samples: list[PerInvocationResult], + ) -> PerInvocationResult: + return per_invocation_samples[0] + + def aggregate_invocation_results( + self, per_invocation_results: list[PerInvocationResult] + ) -> EvaluationResult: + return EvaluationResult( + overall_score=1.0, overall_eval_status=EvalStatus.PASSED + ) + + +@pytest.fixture +def mock_llm_as_judge(): + return MockLlmAsJudge( + EvalMetric( + metric_name="test_metric", + threshold=0.5, + judge_model_options=JudgeModelOptions( + judge_model="gemini-2.5-flash", + judge_model_config=genai_types.GenerateContentConfig(), + num_samples=3, + ), + ), + ) + + +def test_get_text_from_content(): + content = genai_types.Content( + parts=[ + genai_types.Part(text="This is a test text."), + genai_types.Part(text="This is another test text."), + ], + role="model", + ) + assert ( + get_text_from_content(content) + == "This is a test text.\nThis is another test text." + ) + + +def test_get_eval_status(): + assert get_eval_status(score=0.8, threshold=0.8) == EvalStatus.PASSED + assert get_eval_status(score=0.7, threshold=0.8) == EvalStatus.FAILED + assert get_eval_status(score=0.8, threshold=0.9) == EvalStatus.FAILED + assert get_eval_status(score=0.9, threshold=0.8) == EvalStatus.PASSED + assert get_eval_status(score=None, threshold=0.8) == EvalStatus.NOT_EVALUATED + + +def test_llm_as_judge_init_missing_judge_model_options(): + with pytest.raises(ValueError): + MockLlmAsJudge( + EvalMetric(metric_name="test_metric", threshold=0.8), + ) + + +def test_llm_as_judge_init_unregistered_model(): + with pytest.raises(ValueError): + MockLlmAsJudge( + EvalMetric( + metric_name="test_metric", + threshold=0.8, + judge_model_options=JudgeModelOptions( + judge_model="unregistered_model", + ), + ), + ) + + +@pytest.fixture +def mock_judge_model(): + mock_judge_model = MagicMock() + + async def mock_generate_content_async(llm_request): + yield LlmResponse( + content=genai_types.Content( + parts=[genai_types.Part(text="auto rater response")], + ) + ) + + mock_judge_model.generate_content_async = mock_generate_content_async + return mock_judge_model + + +@pytest.mark.asyncio +async def test_evaluate_invocations_with_mock( + mock_llm_as_judge, mock_judge_model +): + mock_llm_as_judge._judge_model = mock_judge_model + + mock_format_auto_rater_prompt = MagicMock( + wraps=mock_llm_as_judge.format_auto_rater_prompt + ) + mock_llm_as_judge.format_auto_rater_prompt = mock_format_auto_rater_prompt + + mock_convert_auto_rater_response_to_score = MagicMock( + wraps=mock_llm_as_judge.convert_auto_rater_response_to_score + ) + mock_llm_as_judge.convert_auto_rater_response_to_score = ( + mock_convert_auto_rater_response_to_score + ) + + mock_aggregate_per_invocation_samples = MagicMock( + wraps=mock_llm_as_judge.aggregate_per_invocation_samples + ) + mock_llm_as_judge.aggregate_per_invocation_samples = ( + mock_aggregate_per_invocation_samples + ) + + mock_aggregate_invocation_results = MagicMock( + wraps=mock_llm_as_judge.aggregate_invocation_results + ) + mock_llm_as_judge.aggregate_invocation_results = ( + mock_aggregate_invocation_results + ) + + actual_invocations = [ + Invocation( + invocation_id="id1", + user_content=genai_types.Content( + parts=[genai_types.Part(text="user content 1")], + role="user", + ), + final_response=genai_types.Content( + parts=[genai_types.Part(text="final response 1")], + role="model", + ), + ), + Invocation( + invocation_id="id2", + user_content=genai_types.Content( + parts=[genai_types.Part(text="user content 2")], + role="user", + ), + final_response=genai_types.Content( + parts=[genai_types.Part(text="final response 2")], + role="model", + ), + ), + ] + expected_invocations = [ + Invocation( + invocation_id="id1", + user_content=genai_types.Content( + parts=[genai_types.Part(text="user content 1")], + role="user", + ), + final_response=genai_types.Content( + parts=[genai_types.Part(text="expected response 1")], + role="model", + ), + ), + Invocation( + invocation_id="id2", + user_content=genai_types.Content( + parts=[genai_types.Part(text="user content 2")], + role="user", + ), + final_response=genai_types.Content( + parts=[genai_types.Part(text="expected response 2")], + role="model", + ), + ), + ] + + result = await mock_llm_as_judge.evaluate_invocations( + actual_invocations, expected_invocations + ) + + # Assertions + assert result.overall_score == 1.0 + assert mock_llm_as_judge.format_auto_rater_prompt.call_count == 2 + assert mock_llm_as_judge.convert_auto_rater_response_to_score.call_count == 6 + assert mock_llm_as_judge.aggregate_invocation_results.call_count == 1 diff --git a/tests/unittests/evaluation/test_local_eval_service.py b/tests/unittests/evaluation/test_local_eval_service.py new file mode 100644 index 00000000..ca19a1bb --- /dev/null +++ b/tests/unittests/evaluation/test_local_eval_service.py @@ -0,0 +1,144 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from unittest import mock + +from google.adk.agents.llm_agent import LlmAgent +from google.adk.errors.not_found_error import NotFoundError +from google.adk.evaluation.base_eval_service import InferenceConfig +from google.adk.evaluation.base_eval_service import InferenceRequest +from google.adk.evaluation.eval_set import EvalCase +from google.adk.evaluation.eval_set import EvalSet +from google.adk.evaluation.eval_sets_manager import EvalSetsManager +from google.adk.evaluation.local_eval_service import LocalEvalService +from google.adk.models.registry import LLMRegistry +import pytest + + +@pytest.fixture +def mock_eval_sets_manager(): + return mock.create_autospec(EvalSetsManager) + + +@pytest.fixture +def dummy_agent(): + llm = LLMRegistry.new_llm("gemini-pro") + return LlmAgent(name="test_agent", model=llm) + + +@pytest.fixture +def eval_service(dummy_agent, mock_eval_sets_manager): + return LocalEvalService( + root_agent=dummy_agent, + eval_sets_manager=mock_eval_sets_manager, + ) + + +@pytest.mark.asyncio +async def test_perform_inference_success( + eval_service, dummy_agent, mock_eval_sets_manager +): + eval_set = EvalSet( + eval_set_id="test_eval_set", + eval_cases=[ + EvalCase(eval_id="case1", conversation=[], session_input=None), + EvalCase(eval_id="case2", conversation=[], session_input=None), + ], + ) + mock_eval_sets_manager.get_eval_set.return_value = eval_set + + mock_inference_result = mock.MagicMock() + eval_service._perform_inference_sigle_eval_item = mock.AsyncMock( + return_value=mock_inference_result + ) + + inference_request = InferenceRequest( + app_name="test_app", + eval_set_id="test_eval_set", + inference_config=InferenceConfig(parallelism=2), + ) + + results = [] + async for result in eval_service.perform_inference(inference_request): + results.append(result) + + assert len(results) == 2 + assert results[0] == mock_inference_result + assert results[1] == mock_inference_result + mock_eval_sets_manager.get_eval_set.assert_called_once_with( + app_name="test_app", eval_set_id="test_eval_set" + ) + assert eval_service._perform_inference_sigle_eval_item.call_count == 2 + + +@pytest.mark.asyncio +async def test_perform_inference_with_case_ids( + eval_service, dummy_agent, mock_eval_sets_manager +): + eval_set = EvalSet( + eval_set_id="test_eval_set", + eval_cases=[ + EvalCase(eval_id="case1", conversation=[], session_input=None), + EvalCase(eval_id="case2", conversation=[], session_input=None), + EvalCase(eval_id="case3", conversation=[], session_input=None), + ], + ) + mock_eval_sets_manager.get_eval_set.return_value = eval_set + + mock_inference_result = mock.MagicMock() + eval_service._perform_inference_sigle_eval_item = mock.AsyncMock( + return_value=mock_inference_result + ) + + inference_request = InferenceRequest( + app_name="test_app", + eval_set_id="test_eval_set", + eval_case_ids=["case1", "case3"], + inference_config=InferenceConfig(parallelism=1), + ) + + results = [] + async for result in eval_service.perform_inference(inference_request): + results.append(result) + + assert len(results) == 2 + eval_service._perform_inference_sigle_eval_item.assert_any_call( + app_name="test_app", + eval_set_id="test_eval_set", + eval_case=eval_set.eval_cases[0], + root_agent=dummy_agent, + ) + eval_service._perform_inference_sigle_eval_item.assert_any_call( + app_name="test_app", + eval_set_id="test_eval_set", + eval_case=eval_set.eval_cases[2], + root_agent=dummy_agent, + ) + + +@pytest.mark.asyncio +async def test_perform_inference_eval_set_not_found( + eval_service, mock_eval_sets_manager +): + mock_eval_sets_manager.get_eval_set.return_value = None + + inference_request = InferenceRequest( + app_name="test_app", + eval_set_id="not_found_set", + inference_config=InferenceConfig(parallelism=1), + ) + + with pytest.raises(NotFoundError): + async for _ in eval_service.perform_inference(inference_request): + pass diff --git a/tests/unittests/flows/llm_flows/test_base_llm_flow_partial_handling.py b/tests/unittests/flows/llm_flows/test_base_llm_flow_partial_handling.py new file mode 100644 index 00000000..c5043ac0 --- /dev/null +++ b/tests/unittests/flows/llm_flows/test_base_llm_flow_partial_handling.py @@ -0,0 +1,164 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from google.adk.agents import Agent +from google.adk.flows.llm_flows.base_llm_flow import BaseLlmFlow +from google.adk.models.llm_response import LlmResponse +from google.genai import types +import pytest + +from ... import testing_utils + + +class BaseLlmFlowForTesting(BaseLlmFlow): + """Test implementation of BaseLlmFlow for testing purposes.""" + + pass + + +@pytest.mark.asyncio +async def test_run_async_breaks_on_partial_event(): + """Test that run_async breaks when the last event is partial.""" + # Create a mock model that returns partial responses + partial_response = LlmResponse( + content=types.Content( + role='model', parts=[types.Part.from_text(text='Partial response')] + ), + partial=True, + ) + + mock_model = testing_utils.MockModel.create(responses=[partial_response]) + + agent = Agent(name='test_agent', model=mock_model) + invocation_context = await testing_utils.create_invocation_context( + agent=agent, user_content='test message' + ) + + flow = BaseLlmFlowForTesting() + events = [] + + # Collect events from the flow + async for event in flow.run_async(invocation_context): + events.append(event) + + # Should have one event (the partial response) + assert len(events) == 1 + assert events[0].partial is True + assert events[0].content.parts[0].text == 'Partial response' + + +@pytest.mark.asyncio +async def test_run_async_breaks_on_final_response(): + """Test that run_async breaks when the last event is a final response.""" + # Create a mock model that returns a final response + final_response = LlmResponse( + content=types.Content( + role='model', parts=[types.Part.from_text(text='Final response')] + ), + partial=False, + error_code=types.FinishReason.STOP, + ) + + mock_model = testing_utils.MockModel.create(responses=[final_response]) + + agent = Agent(name='test_agent', model=mock_model) + invocation_context = await testing_utils.create_invocation_context( + agent=agent, user_content='test message' + ) + + flow = BaseLlmFlowForTesting() + events = [] + + # Collect events from the flow + async for event in flow.run_async(invocation_context): + events.append(event) + + # Should have one event (the final response) + assert len(events) == 1 + assert events[0].partial is False + assert events[0].content.parts[0].text == 'Final response' + + +@pytest.mark.asyncio +async def test_run_async_breaks_on_no_last_event(): + """Test that run_async breaks when there is no last event.""" + # Create a mock model that returns an empty response (no content) + empty_response = LlmResponse(content=None, partial=False) + + mock_model = testing_utils.MockModel.create(responses=[empty_response]) + + agent = Agent(name='test_agent', model=mock_model) + invocation_context = await testing_utils.create_invocation_context( + agent=agent, user_content='test message' + ) + + flow = BaseLlmFlowForTesting() + events = [] + + # Collect events from the flow + async for event in flow.run_async(invocation_context): + events.append(event) + + # Should have no events because empty responses are filtered out + assert len(events) == 0 + + +@pytest.mark.asyncio +async def test_run_async_breaks_on_first_partial_response(): + """Test run_async breaks on the first partial response.""" + # Create responses with mixed partial states + partial_response = LlmResponse( + content=types.Content( + role='model', parts=[types.Part.from_text(text='Partial response')] + ), + partial=True, + ) + + # These won't be reached because the flow breaks on the first partial + non_partial_response = LlmResponse( + content=types.Content( + role='model', + parts=[types.Part.from_text(text='Non-partial response')], + ), + partial=False, + ) + + final_partial_response = LlmResponse( + content=types.Content( + role='model', + parts=[types.Part.from_text(text='Final partial response')], + ), + partial=True, + ) + + mock_model = testing_utils.MockModel.create( + responses=[partial_response, non_partial_response, final_partial_response] + ) + + agent = Agent(name='test_agent', model=mock_model) + invocation_context = await testing_utils.create_invocation_context( + agent=agent, user_content='test message' + ) + + flow = BaseLlmFlowForTesting() + events = [] + + # Collect events from the flow + async for event in flow.run_async(invocation_context): + events.append(event) + + # Should have only one event, breaking on the first partial response + assert len(events) == 1 + assert events[0].partial is True + assert events[0].content.parts[0].text == 'Partial response' diff --git a/tests/unittests/flows/llm_flows/test_plugin_model_callbacks.py b/tests/unittests/flows/llm_flows/test_plugin_model_callbacks.py new file mode 100644 index 00000000..b9b2dec3 --- /dev/null +++ b/tests/unittests/flows/llm_flows/test_plugin_model_callbacks.py @@ -0,0 +1,128 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Optional + +from google.adk.agents import Agent +from google.adk.agents.callback_context import CallbackContext +from google.adk.models import LlmRequest +from google.adk.models import LlmResponse +from google.adk.plugins.base_plugin import BasePlugin +from google.genai import types +import pytest + +from ... import testing_utils + + +class MockPlugin(BasePlugin): + before_model_text = 'before_model_text from MockPlugin' + after_model_text = 'after_model_text from MockPlugin' + + def __init__(self, name='mock_plugin'): + self.name = name + self.enable_before_model_callback = False + self.enable_after_model_callback = False + self.before_model_response = LlmResponse( + content=testing_utils.ModelContent( + [types.Part.from_text(text=self.before_model_text)] + ) + ) + self.after_model_response = LlmResponse( + content=testing_utils.ModelContent( + [types.Part.from_text(text=self.after_model_text)] + ) + ) + + async def before_model_callback( + self, *, callback_context: CallbackContext, llm_request: LlmRequest + ) -> Optional[LlmResponse]: + if not self.enable_before_model_callback: + return None + return self.before_model_response + + async def after_model_callback( + self, *, callback_context: CallbackContext, llm_response: LlmResponse + ) -> Optional[LlmResponse]: + if not self.enable_after_model_callback: + return None + return self.after_model_response + + +CANONICAL_MODEL_CALLBACK_CONTENT = 'canonical_model_callback_content' + + +def canonical_agent_model_callback(**kwargs) -> Optional[LlmResponse]: + return LlmResponse( + content=testing_utils.ModelContent( + [types.Part.from_text(text=CANONICAL_MODEL_CALLBACK_CONTENT)] + ) + ) + + +@pytest.fixture +def mock_plugin(): + return MockPlugin() + + +def test_before_model_callback_with_plugin(mock_plugin): + """Tests that the model response is overridden by before_model_callback from the plugin.""" + responses = ['model_response'] + mock_model = testing_utils.MockModel.create(responses=responses) + mock_plugin.enable_before_model_callback = True + agent = Agent( + name='root_agent', + model=mock_model, + ) + + runner = testing_utils.InMemoryRunner(agent, plugins=[mock_plugin]) + assert testing_utils.simplify_events(runner.run('test')) == [ + ('root_agent', mock_plugin.before_model_text), + ] + + +def test_before_model_fallback_canonical_callback(mock_plugin): + """Tests that when plugin returns empty response, the model response is overridden by the canonical agent model callback.""" + responses = ['model_response'] + mock_plugin.enable_before_model_callback = False + mock_model = testing_utils.MockModel.create(responses=responses) + agent = Agent( + name='root_agent', + model=mock_model, + before_model_callback=canonical_agent_model_callback, + ) + + runner = testing_utils.InMemoryRunner(agent) + assert testing_utils.simplify_events(runner.run('test')) == [ + ('root_agent', CANONICAL_MODEL_CALLBACK_CONTENT), + ] + + +def test_before_model_callback_fallback_model(mock_plugin): + """Tests that the model response is executed normally when both plugin and canonical agent model callback return empty response.""" + responses = ['model_response'] + mock_plugin.enable_before_model_callback = False + mock_model = testing_utils.MockModel.create(responses=responses) + agent = Agent( + name='root_agent', + model=mock_model, + ) + + runner = testing_utils.InMemoryRunner(agent, plugins=[mock_plugin]) + assert testing_utils.simplify_events(runner.run('test')) == [ + ('root_agent', 'model_response'), + ] + + +if __name__ == '__main__': + pytest.main([__file__]) diff --git a/tests/unittests/flows/llm_flows/test_plugin_tool_callbacks.py b/tests/unittests/flows/llm_flows/test_plugin_tool_callbacks.py new file mode 100644 index 00000000..a79e562a --- /dev/null +++ b/tests/unittests/flows/llm_flows/test_plugin_tool_callbacks.py @@ -0,0 +1,128 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Any +from typing import Dict +from typing import Optional + +from google.adk.agents import Agent +from google.adk.events.event import Event +from google.adk.flows.llm_flows.functions import handle_function_calls_async +from google.adk.plugins.base_plugin import BasePlugin +from google.adk.tools.base_tool import BaseTool +from google.adk.tools.function_tool import FunctionTool +from google.adk.tools.tool_context import ToolContext +from google.genai import types +import pytest + +from ... import testing_utils + + +class MockPlugin(BasePlugin): + before_tool_response = {"MockPlugin": "before_tool_response from MockPlugin"} + after_tool_response = {"MockPlugin": "after_tool_response from MockPlugin"} + + def __init__(self, name="mock_plugin"): + self.name = name + self.enable_before_tool_callback = False + self.enable_after_tool_callback = False + + async def before_tool_callback( + self, + *, + tool: BaseTool, + tool_args: dict[str, Any], + tool_context: ToolContext, + ) -> Optional[dict]: + if not self.enable_before_tool_callback: + return None + return self.before_tool_response + + async def after_tool_callback( + self, + *, + tool: BaseTool, + tool_args: dict[str, Any], + tool_context: ToolContext, + result: dict, + ) -> Optional[dict]: + if not self.enable_after_tool_callback: + return None + return self.after_tool_response + + +@pytest.fixture +def mock_tool(): + def simple_fn(**kwargs) -> Dict[str, Any]: + return {"initial": "response"} + + return FunctionTool(simple_fn) + + +@pytest.fixture +def mock_plugin(): + return MockPlugin() + + +async def invoke_tool_with_plugin(mock_tool, mock_plugin) -> Optional[Event]: + """Invokes a tool with a plugin.""" + model = testing_utils.MockModel.create(responses=[]) + agent = Agent( + name="agent", + model=model, + tools=[mock_tool], + ) + invocation_context = await testing_utils.create_invocation_context( + agent=agent, user_content="", plugins=[mock_plugin] + ) + # Build function call event + function_call = types.FunctionCall(name=mock_tool.name, args={}) + content = types.Content(parts=[types.Part(function_call=function_call)]) + event = Event( + invocation_id=invocation_context.invocation_id, + author=agent.name, + content=content, + ) + tools_dict = {mock_tool.name: mock_tool} + return await handle_function_calls_async( + invocation_context, + event, + tools_dict, + ) + + +@pytest.mark.asyncio +async def test_async_before_tool_callback(mock_tool, mock_plugin): + mock_plugin.enable_before_tool_callback = True + + result_event = await invoke_tool_with_plugin(mock_tool, mock_plugin) + + assert result_event is not None + part = result_event.content.parts[0] + assert part.function_response.response == mock_plugin.before_tool_response + + +@pytest.mark.asyncio +async def test_async_after_tool_callback(mock_tool, mock_plugin): + mock_plugin.enable_after_tool_callback = True + + result_event = await invoke_tool_with_plugin(mock_tool, mock_plugin) + + assert result_event is not None + part = result_event.content.parts[0] + assert part.function_response.response == mock_plugin.after_tool_response + + +if __name__ == "__main__": + pytest.main([__file__]) diff --git a/tests/unittests/models/test_google_llm.py b/tests/unittests/models/test_google_llm.py index fb8540bb..3212a760 100644 --- a/tests/unittests/models/test_google_llm.py +++ b/tests/unittests/models/test_google_llm.py @@ -669,3 +669,703 @@ def test_preprocess_request_handles_backend_specific_fields( assert file_part.file_data.display_name == expected_file_display_name assert inline_part.inline_data.display_name == expected_inline_display_name assert llm_request_with_files.config.labels == expected_labels + + +@pytest.mark.asyncio +async def test_generate_content_async_stream_aggregated_content_regardless_of_finish_reason(): + """Test that aggregated content is generated regardless of finish_reason.""" + gemini_llm = Gemini(model="gemini-1.5-flash") + llm_request = LlmRequest( + model="gemini-1.5-flash", + contents=[Content(role="user", parts=[Part.from_text(text="Hello")])], + config=types.GenerateContentConfig( + temperature=0.1, + response_modalities=[types.Modality.TEXT], + system_instruction="You are a helpful assistant", + ), + ) + + with mock.patch.object(gemini_llm, "api_client") as mock_client: + + class MockAsyncIterator: + + def __init__(self, seq): + self.iter = iter(seq) + + def __aiter__(self): + return self + + async def __anext__(self): + try: + return next(self.iter) + except StopIteration: + raise StopAsyncIteration + + # Test with different finish reasons + test_cases = [ + types.FinishReason.MAX_TOKENS, + types.FinishReason.SAFETY, + types.FinishReason.RECITATION, + types.FinishReason.OTHER, + ] + + for finish_reason in test_cases: + mock_responses = [ + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", parts=[Part.from_text(text="Hello")] + ), + finish_reason=None, + ) + ] + ), + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", parts=[Part.from_text(text=" world")] + ), + finish_reason=finish_reason, + finish_message=f"Finished with {finish_reason}", + ) + ] + ), + ] + + async def mock_coro(): + return MockAsyncIterator(mock_responses) + + mock_client.aio.models.generate_content_stream.return_value = mock_coro() + + responses = [ + resp + async for resp in gemini_llm.generate_content_async( + llm_request, stream=True + ) + ] + + # Should have 3 responses: 2 partial and 1 final aggregated + assert len(responses) == 3 + assert responses[0].partial is True + assert responses[1].partial is True + + # Final response should have aggregated content with error info + final_response = responses[2] + assert final_response.content.parts[0].text == "Hello world" + assert final_response.error_code == finish_reason + assert final_response.error_message == f"Finished with {finish_reason}" + + +@pytest.mark.asyncio +async def test_generate_content_async_stream_with_thought_and_text_error_handling(): + """Test that aggregated content with thought and text preserves error information.""" + gemini_llm = Gemini(model="gemini-1.5-flash") + llm_request = LlmRequest( + model="gemini-1.5-flash", + contents=[Content(role="user", parts=[Part.from_text(text="Hello")])], + config=types.GenerateContentConfig( + temperature=0.1, + response_modalities=[types.Modality.TEXT], + system_instruction="You are a helpful assistant", + ), + ) + + with mock.patch.object(gemini_llm, "api_client") as mock_client: + + class MockAsyncIterator: + + def __init__(self, seq): + self.iter = iter(seq) + + def __aiter__(self): + return self + + async def __anext__(self): + try: + return next(self.iter) + except StopIteration: + raise StopAsyncIteration + + mock_responses = [ + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", parts=[Part(text="Think1", thought=True)] + ), + finish_reason=None, + ) + ] + ), + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", parts=[Part.from_text(text="Answer")] + ), + finish_reason=types.FinishReason.MAX_TOKENS, + finish_message="Maximum tokens reached", + ) + ] + ), + ] + + async def mock_coro(): + return MockAsyncIterator(mock_responses) + + mock_client.aio.models.generate_content_stream.return_value = mock_coro() + + responses = [ + resp + async for resp in gemini_llm.generate_content_async( + llm_request, stream=True + ) + ] + + # Should have 3 responses: 2 partial and 1 final aggregated + assert len(responses) == 3 + assert responses[0].partial is True + assert responses[1].partial is True + + # Final response should have aggregated content with both thought and text + final_response = responses[2] + assert len(final_response.content.parts) == 2 + assert final_response.content.parts[0].text == "Think1" + assert final_response.content.parts[0].thought is True + assert final_response.content.parts[1].text == "Answer" + assert final_response.error_code == types.FinishReason.MAX_TOKENS + assert final_response.error_message == "Maximum tokens reached" + + +@pytest.mark.asyncio +async def test_generate_content_async_stream_no_aggregated_content_without_text(): + """Test that no aggregated content is generated when there's no accumulated text.""" + gemini_llm = Gemini(model="gemini-1.5-flash") + llm_request = LlmRequest( + model="gemini-1.5-flash", + contents=[Content(role="user", parts=[Part.from_text(text="Hello")])], + config=types.GenerateContentConfig( + temperature=0.1, + response_modalities=[types.Modality.TEXT], + system_instruction="You are a helpful assistant", + ), + ) + + with mock.patch.object(gemini_llm, "api_client") as mock_client: + + class MockAsyncIterator: + + def __init__(self, seq): + self.iter = iter(seq) + + def __aiter__(self): + return self + + async def __anext__(self): + try: + return next(self.iter) + except StopIteration: + raise StopAsyncIteration + + # Mock response with no text content + mock_responses = [ + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[ + Part( + function_call=types.FunctionCall( + name="test", args={} + ) + ) + ], + ), + finish_reason=types.FinishReason.STOP, + ) + ] + ), + ] + + async def mock_coro(): + return MockAsyncIterator(mock_responses) + + mock_client.aio.models.generate_content_stream.return_value = mock_coro() + + responses = [ + resp + async for resp in gemini_llm.generate_content_async( + llm_request, stream=True + ) + ] + + # Should have only 1 response (no aggregated content generated) + assert len(responses) == 1 + # Verify it's a function call, not text + assert responses[0].content.parts[0].function_call is not None + + +@pytest.mark.asyncio +async def test_generate_content_async_stream_mixed_text_function_call_text(): + """Test streaming with pattern: [text, function_call, text] to verify proper aggregation.""" + gemini_llm = Gemini(model="gemini-1.5-flash") + llm_request = LlmRequest( + model="gemini-1.5-flash", + contents=[Content(role="user", parts=[Part.from_text(text="Hello")])], + config=types.GenerateContentConfig( + temperature=0.1, + response_modalities=[types.Modality.TEXT], + system_instruction="You are a helpful assistant", + ), + ) + + with mock.patch.object(gemini_llm, "api_client") as mock_client: + + class MockAsyncIterator: + + def __init__(self, seq): + self.iter = iter(seq) + + def __aiter__(self): + return self + + async def __anext__(self): + try: + return next(self.iter) + except StopIteration: + raise StopAsyncIteration + + # Create responses with pattern: text -> function_call -> text + mock_responses = [ + # First text chunk + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", parts=[Part.from_text(text="First text")] + ), + finish_reason=None, + ) + ] + ), + # Function call interrupts the text flow + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[ + Part( + function_call=types.FunctionCall( + name="test_func", args={} + ) + ) + ], + ), + finish_reason=None, + ) + ] + ), + # More text after function call + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[Part.from_text(text=" second text")], + ), + finish_reason=types.FinishReason.STOP, + ) + ] + ), + ] + + async def mock_coro(): + return MockAsyncIterator(mock_responses) + + mock_client.aio.models.generate_content_stream.return_value = mock_coro() + + responses = [ + resp + async for resp in gemini_llm.generate_content_async( + llm_request, stream=True + ) + ] + + # Should have multiple responses: + # 1. Partial text "First text" + # 2. Aggregated "First text" when function call interrupts + # 3. Function call + # 4. Partial text " second text" + # 5. Final aggregated " second text" + assert len(responses) == 5 + + # First partial text + assert responses[0].partial is True + assert responses[0].content.parts[0].text == "First text" + + # Aggregated first text (when function call interrupts) + assert responses[1].content.parts[0].text == "First text" + assert ( + responses[1].partial is None + ) # Aggregated responses don't have partial flag + + # Function call + assert responses[2].content.parts[0].function_call is not None + assert responses[2].content.parts[0].function_call.name == "test_func" + + # Second partial text + assert responses[3].partial is True + assert responses[3].content.parts[0].text == " second text" + + # Final aggregated text with error info + assert responses[4].content.parts[0].text == " second text" + assert responses[4].error_code == types.FinishReason.STOP + + +@pytest.mark.asyncio +async def test_generate_content_async_stream_multiple_text_parts_in_single_response(): + """Test streaming with multiple text parts in a single response.""" + gemini_llm = Gemini(model="gemini-1.5-flash") + llm_request = LlmRequest( + model="gemini-1.5-flash", + contents=[Content(role="user", parts=[Part.from_text(text="Hello")])], + config=types.GenerateContentConfig( + temperature=0.1, + response_modalities=[types.Modality.TEXT], + system_instruction="You are a helpful assistant", + ), + ) + + with mock.patch.object(gemini_llm, "api_client") as mock_client: + + class MockAsyncIterator: + + def __init__(self, seq): + self.iter = iter(seq) + + def __aiter__(self): + return self + + async def __anext__(self): + try: + return next(self.iter) + except StopIteration: + raise StopAsyncIteration + + # Create a response with multiple text parts + mock_responses = [ + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[ + Part.from_text(text="First part"), + Part.from_text(text=" second part"), + ], + ), + finish_reason=types.FinishReason.STOP, + ) + ] + ), + ] + + async def mock_coro(): + return MockAsyncIterator(mock_responses) + + mock_client.aio.models.generate_content_stream.return_value = mock_coro() + + responses = [ + resp + async for resp in gemini_llm.generate_content_async( + llm_request, stream=True + ) + ] + + # Should handle only the first text part in current implementation + # Note: This test documents current behavior - the implementation only + # looks at parts[0].text, so it would only process "First part" + assert len(responses) >= 1 + assert responses[0].content.parts[0].text == "First part" + + +@pytest.mark.asyncio +async def test_generate_content_async_stream_complex_mixed_thought_text_function(): + """Test complex streaming with thought, text, and function calls mixed.""" + gemini_llm = Gemini(model="gemini-1.5-flash") + llm_request = LlmRequest( + model="gemini-1.5-flash", + contents=[Content(role="user", parts=[Part.from_text(text="Hello")])], + config=types.GenerateContentConfig( + temperature=0.1, + response_modalities=[types.Modality.TEXT], + system_instruction="You are a helpful assistant", + ), + ) + + with mock.patch.object(gemini_llm, "api_client") as mock_client: + + class MockAsyncIterator: + + def __init__(self, seq): + self.iter = iter(seq) + + def __aiter__(self): + return self + + async def __anext__(self): + try: + return next(self.iter) + except StopIteration: + raise StopAsyncIteration + + # Complex pattern: thought -> text -> function_call -> thought -> text + mock_responses = [ + # Thought + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[Part(text="Thinking...", thought=True)], + ), + finish_reason=None, + ) + ] + ), + # Regular text + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[Part.from_text(text="Here's my answer")], + ), + finish_reason=None, + ) + ] + ), + # Function call + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[ + Part( + function_call=types.FunctionCall( + name="lookup", args={} + ) + ) + ], + ), + finish_reason=None, + ) + ] + ), + # More thought + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[Part(text="More thinking...", thought=True)], + ), + finish_reason=None, + ) + ] + ), + # Final text + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[Part.from_text(text=" and conclusion")], + ), + finish_reason=types.FinishReason.STOP, + ) + ] + ), + ] + + async def mock_coro(): + return MockAsyncIterator(mock_responses) + + mock_client.aio.models.generate_content_stream.return_value = mock_coro() + + responses = [ + resp + async for resp in gemini_llm.generate_content_async( + llm_request, stream=True + ) + ] + + # Should properly separate thought and regular text across aggregations + assert len(responses) > 5 # Multiple partial + aggregated responses + + # Verify we get both thought and regular text parts in aggregated responses + aggregated_responses = [ + r + for r in responses + if r.partial is None and r.content and len(r.content.parts) > 1 + ] + assert ( + len(aggregated_responses) > 0 + ) # Should have at least one aggregated response with multiple parts + + # Final aggregated response should have both thought and text + final_response = responses[-1] + assert final_response.error_code == types.FinishReason.STOP + assert len(final_response.content.parts) == 2 # thought part + text part + assert final_response.content.parts[0].thought is True + assert "More thinking..." in final_response.content.parts[0].text + assert final_response.content.parts[1].text == " and conclusion" + + +@pytest.mark.asyncio +async def test_generate_content_async_stream_two_separate_text_aggregations(): + """Test that [text, function_call, text] results in two separate text aggregations.""" + gemini_llm = Gemini(model="gemini-1.5-flash") + llm_request = LlmRequest( + model="gemini-1.5-flash", + contents=[Content(role="user", parts=[Part.from_text(text="Hello")])], + config=types.GenerateContentConfig( + temperature=0.1, + response_modalities=[types.Modality.TEXT], + system_instruction="You are a helpful assistant", + ), + ) + + with mock.patch.object(gemini_llm, "api_client") as mock_client: + + class MockAsyncIterator: + + def __init__(self, seq): + self.iter = iter(seq) + + def __aiter__(self): + return self + + async def __anext__(self): + try: + return next(self.iter) + except StopIteration: + raise StopAsyncIteration + + # Create responses: multiple text chunks -> function_call -> multiple text chunks + mock_responses = [ + # First text accumulation (multiple chunks) + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", parts=[Part.from_text(text="First")] + ), + finish_reason=None, + ) + ] + ), + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", parts=[Part.from_text(text=" chunk")] + ), + finish_reason=None, + ) + ] + ), + # Function call interrupts + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", + parts=[ + Part( + function_call=types.FunctionCall( + name="divide", args={} + ) + ) + ], + ), + finish_reason=None, + ) + ] + ), + # Second text accumulation (multiple chunks) + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", parts=[Part.from_text(text="Second")] + ), + finish_reason=None, + ) + ] + ), + types.GenerateContentResponse( + candidates=[ + types.Candidate( + content=Content( + role="model", parts=[Part.from_text(text=" chunk")] + ), + finish_reason=types.FinishReason.STOP, + ) + ] + ), + ] + + async def mock_coro(): + return MockAsyncIterator(mock_responses) + + mock_client.aio.models.generate_content_stream.return_value = mock_coro() + + responses = [ + resp + async for resp in gemini_llm.generate_content_async( + llm_request, stream=True + ) + ] + + # Find the aggregated text responses (non-partial, text-only) + aggregated_text_responses = [ + r + for r in responses + if ( + r.partial is None + and r.content + and r.content.parts + and r.content.parts[0].text + and not r.content.parts[0].function_call + ) + ] + + # Should have two separate text aggregations: "First chunk" and "Second chunk" + assert len(aggregated_text_responses) >= 2 + + # First aggregation should contain "First chunk" + first_aggregation = aggregated_text_responses[0] + assert first_aggregation.content.parts[0].text == "First chunk" + + # Final aggregation should contain "Second chunk" and have error info + final_aggregation = aggregated_text_responses[-1] + assert final_aggregation.content.parts[0].text == "Second chunk" + assert final_aggregation.error_code == types.FinishReason.STOP + + # Verify the function call is preserved between aggregations + function_call_responses = [ + r + for r in responses + if (r.content and r.content.parts and r.content.parts[0].function_call) + ] + assert len(function_call_responses) == 1 + assert ( + function_call_responses[0].content.parts[0].function_call.name + == "divide" + ) diff --git a/tests/unittests/plugins/test_base_plugin.py b/tests/unittests/plugins/test_base_plugin.py new file mode 100644 index 00000000..04b1c3e9 --- /dev/null +++ b/tests/unittests/plugins/test_base_plugin.py @@ -0,0 +1,239 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +from unittest.mock import Mock + +from google.adk.agents.base_agent import BaseAgent +from google.adk.agents.callback_context import CallbackContext +from google.adk.agents.invocation_context import InvocationContext +from google.adk.events.event import Event +from google.adk.models.llm_request import LlmRequest +from google.adk.models.llm_response import LlmResponse +from google.adk.plugins.base_plugin import BasePlugin +from google.adk.tools.base_tool import BaseTool +from google.adk.tools.tool_context import ToolContext +from google.genai import types +import pytest + + +class TestablePlugin(BasePlugin): + __test__ = False + """A concrete implementation of BasePlugin for testing purposes.""" + pass + + +class FullOverridePlugin(BasePlugin): + __test__ = False + + """A plugin that overrides every single callback method for testing.""" + + def __init__(self, name: str = "full_override"): + super().__init__(name) + + async def on_user_message_callback(self, **kwargs) -> str: + return "overridden_on_user_message" + + async def before_run_callback(self, **kwargs) -> str: + return "overridden_before_run" + + async def after_run_callback(self, **kwargs) -> str: + return "overridden_after_run" + + async def on_event_callback(self, **kwargs) -> str: + return "overridden_on_event" + + async def before_agent_callback(self, **kwargs) -> str: + return "overridden_before_agent" + + async def after_agent_callback(self, **kwargs) -> str: + return "overridden_after_agent" + + async def before_tool_callback(self, **kwargs) -> str: + return "overridden_before_tool" + + async def after_tool_callback(self, **kwargs) -> str: + return "overridden_after_tool" + + async def before_model_callback(self, **kwargs) -> str: + return "overridden_before_model" + + async def after_model_callback(self, **kwargs) -> str: + return "overridden_after_model" + + +def test_base_plugin_initialization(): + """Tests that a plugin is initialized with the correct name.""" + plugin_name = "my_test_plugin" + plugin = TestablePlugin(name=plugin_name) + assert plugin.name == plugin_name + + +@pytest.mark.asyncio +async def test_base_plugin_default_callbacks_return_none(): + """Tests that the default (non-overridden) callbacks in BasePlugin exist + + and return None as expected. + """ + plugin = TestablePlugin(name="default_plugin") + + # Mocking all necessary context objects + mock_context = Mock() + mock_user_message = Mock() + + # The default implementations should do nothing and return None. + assert ( + await plugin.on_user_message_callback( + user_message=mock_user_message, + invocation_context=mock_context, + ) + is None + ) + assert ( + await plugin.before_run_callback(invocation_context=mock_context) is None + ) + assert ( + await plugin.after_run_callback(invocation_context=mock_context) is None + ) + assert ( + await plugin.on_event_callback( + invocation_context=mock_context, event=mock_context + ) + is None + ) + assert ( + await plugin.before_agent_callback( + agent=mock_context, callback_context=mock_context + ) + is None + ) + assert ( + await plugin.after_agent_callback( + agent=mock_context, callback_context=mock_context + ) + is None + ) + assert ( + await plugin.before_tool_callback( + tool=mock_context, tool_args={}, tool_context=mock_context + ) + is None + ) + assert ( + await plugin.after_tool_callback( + tool=mock_context, tool_args={}, tool_context=mock_context, result={} + ) + is None + ) + assert ( + await plugin.before_model_callback( + callback_context=mock_context, llm_request=mock_context + ) + is None + ) + assert ( + await plugin.after_model_callback( + callback_context=mock_context, llm_response=mock_context + ) + is None + ) + + +@pytest.mark.asyncio +async def test_base_plugin_all_callbacks_can_be_overridden(): + """Verifies that a user can create a subclass of BasePlugin and that all + + overridden methods are correctly called. + """ + plugin = FullOverridePlugin() + + # Create mock objects for all required arguments. We don't need real + # objects, just placeholders to satisfy the method signatures. + mock_user_message = Mock(spec=types.Content) + mock_invocation_context = Mock(spec=InvocationContext) + mock_callback_context = Mock(spec=CallbackContext) + mock_agent = Mock(spec=BaseAgent) + mock_tool = Mock(spec=BaseTool) + mock_tool_context = Mock(spec=ToolContext) + mock_llm_request = Mock(spec=LlmRequest) + mock_llm_response = Mock(spec=LlmResponse) + mock_event = Mock(spec=Event) + + # Call each method and assert it returns the unique string from the override. + # This proves that the subclass's method was executed. + assert ( + await plugin.on_user_message_callback( + user_message=mock_user_message, + invocation_context=mock_invocation_context, + ) + == "overridden_on_user_message" + ) + assert ( + await plugin.before_run_callback( + invocation_context=mock_invocation_context + ) + == "overridden_before_run" + ) + assert ( + await plugin.after_run_callback( + invocation_context=mock_invocation_context + ) + == "overridden_after_run" + ) + assert ( + await plugin.on_event_callback( + invocation_context=mock_invocation_context, event=mock_event + ) + == "overridden_on_event" + ) + assert ( + await plugin.before_agent_callback( + agent=mock_agent, callback_context=mock_callback_context + ) + == "overridden_before_agent" + ) + assert ( + await plugin.after_agent_callback( + agent=mock_agent, callback_context=mock_callback_context + ) + == "overridden_after_agent" + ) + assert ( + await plugin.before_model_callback( + callback_context=mock_callback_context, llm_request=mock_llm_request + ) + == "overridden_before_model" + ) + assert ( + await plugin.after_model_callback( + callback_context=mock_callback_context, llm_response=mock_llm_response + ) + == "overridden_after_model" + ) + assert ( + await plugin.before_tool_callback( + tool=mock_tool, tool_args={}, tool_context=mock_tool_context + ) + == "overridden_before_tool" + ) + assert ( + await plugin.after_tool_callback( + tool=mock_tool, + tool_args={}, + tool_context=mock_tool_context, + result={}, + ) + == "overridden_after_tool" + ) diff --git a/tests/unittests/plugins/test_plugin_manager.py b/tests/unittests/plugins/test_plugin_manager.py new file mode 100644 index 00000000..76d32a61 --- /dev/null +++ b/tests/unittests/plugins/test_plugin_manager.py @@ -0,0 +1,250 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Unit tests for the PluginManager.""" + +from __future__ import annotations + +from unittest.mock import Mock + +from google.adk.models.llm_response import LlmResponse +from google.adk.plugins.base_plugin import BasePlugin +# Assume the following path to your modules +# You might need to adjust this based on your project structure. +from google.adk.plugins.plugin_manager import PluginCallbackName +from google.adk.plugins.plugin_manager import PluginManager +import pytest + + +# A helper class to use in tests instead of mocks. +# This makes tests more explicit and easier to debug. +class TestPlugin(BasePlugin): + __test__ = False + """ + A test plugin that can be configured to return specific values or raise + exceptions for any callback, and it logs which callbacks were invoked. + """ + + def __init__(self, name: str): + super().__init__(name) + # A log to track the names of callbacks that have been called. + self.call_log: list[PluginCallbackName] = [] + # A map to configure return values for specific callbacks. + self.return_values: dict[PluginCallbackName, any] = {} + # A map to configure exceptions to be raised by specific callbacks. + self.exceptions_to_raise: dict[PluginCallbackName, Exception] = {} + + async def _handle_callback(self, name: PluginCallbackName): + """Generic handler for all callback methods.""" + self.call_log.append(name) + if name in self.exceptions_to_raise: + raise self.exceptions_to_raise[name] + return self.return_values.get(name) + + # Implement all callback methods from the BasePlugin interface. + async def on_user_message_callback(self, **kwargs): + return await self._handle_callback("on_user_message_callback") + + async def before_run_callback(self, **kwargs): + return await self._handle_callback("before_run_callback") + + async def after_run_callback(self, **kwargs): + return await self._handle_callback("after_run_callback") + + async def on_event_callback(self, **kwargs): + return await self._handle_callback("on_event_callback") + + async def before_agent_callback(self, **kwargs): + return await self._handle_callback("before_agent_callback") + + async def after_agent_callback(self, **kwargs): + return await self._handle_callback("after_agent_callback") + + async def before_tool_callback(self, **kwargs): + return await self._handle_callback("before_tool_callback") + + async def after_tool_callback(self, **kwargs): + return await self._handle_callback("after_tool_callback") + + async def before_model_callback(self, **kwargs): + return await self._handle_callback("before_model_callback") + + async def after_model_callback(self, **kwargs): + return await self._handle_callback("after_model_callback") + + +@pytest.fixture +def service() -> PluginManager: + """Provides a clean PluginManager instance for each test.""" + return PluginManager() + + +@pytest.fixture +def plugin1() -> TestPlugin: + """Provides a clean instance of our test plugin named 'plugin1'.""" + return TestPlugin(name="plugin1") + + +@pytest.fixture +def plugin2() -> TestPlugin: + """Provides a clean instance of our test plugin named 'plugin2'.""" + return TestPlugin(name="plugin2") + + +def test_register_and_get_plugin(service: PluginManager, plugin1: TestPlugin): + """Tests successful registration and retrieval of a plugin.""" + service.register_plugin(plugin1) + + assert len(service.plugins) == 1 + assert service.plugins[0] is plugin1 + assert service.get_plugin("plugin1") is plugin1 + + +def test_register_duplicate_plugin_name_raises_value_error( + service: PluginManager, plugin1: TestPlugin +): + """Tests that registering a plugin with a duplicate name raises an error.""" + plugin1_duplicate = TestPlugin(name="plugin1") + service.register_plugin(plugin1) + + with pytest.raises( + ValueError, match="Plugin with name 'plugin1' already registered." + ): + service.register_plugin(plugin1_duplicate) + + +@pytest.mark.asyncio +async def test_early_exit_stops_subsequent_plugins( + service: PluginManager, plugin1: TestPlugin, plugin2: TestPlugin +): + """Tests the core "early exit" logic: if a plugin returns a value, + + subsequent plugins for that callback should not be executed. + """ + # Configure plugin1 to return a value, simulating a cache hit. + mock_response = Mock(spec=LlmResponse) + plugin1.return_values["before_run_callback"] = mock_response + + service.register_plugin(plugin1) + service.register_plugin(plugin2) + + # Execute the callback chain. + result = await service.run_before_run_callback(invocation_context=Mock()) + + # Assert that the final result is the one returned by the first plugin. + assert result is mock_response + # Assert that the first plugin was called. + assert "before_run_callback" in plugin1.call_log + # CRITICAL: Assert that the second plugin was never called. + assert "before_run_callback" not in plugin2.call_log + + +@pytest.mark.asyncio +async def test_normal_flow_all_plugins_are_called( + service: PluginManager, plugin1: TestPlugin, plugin2: TestPlugin +): + """Tests that if no plugin returns a value, all plugins in the chain + + are executed in order. + """ + # By default, plugins are configured to return None. + service.register_plugin(plugin1) + service.register_plugin(plugin2) + + result = await service.run_before_run_callback(invocation_context=Mock()) + + # The final result should be None as no plugin interrupted the flow. + assert result is None + # Both plugins must have been called. + assert "before_run_callback" in plugin1.call_log + assert "before_run_callback" in plugin2.call_log + + +@pytest.mark.asyncio +async def test_plugin_exception_is_wrapped_in_runtime_error( + service: PluginManager, plugin1: TestPlugin +): + """Tests that if a plugin callback raises an exception, the PluginManager + + catches it and raises a descriptive RuntimeError. + """ + # Configure the plugin to raise an error during a specific callback. + original_exception = ValueError("Something went wrong inside the plugin!") + plugin1.exceptions_to_raise["before_run_callback"] = original_exception + service.register_plugin(plugin1) + + with pytest.raises(RuntimeError) as excinfo: + await service.run_before_run_callback(invocation_context=Mock()) + + # Check that the error message is informative. + assert "Error in plugin 'plugin1'" in str(excinfo.value) + assert "before_run_callback" in str(excinfo.value) + # Check that the original exception is chained for better tracebacks. + assert excinfo.value.__cause__ is original_exception + + +@pytest.mark.asyncio +async def test_all_callbacks_are_supported( + service: PluginManager, plugin1: TestPlugin +): + """Tests that all callbacks defined in the BasePlugin interface are supported + + by the PluginManager. + """ + service.register_plugin(plugin1) + mock_context = Mock() + mock_user_message = Mock() + + # Test all callbacks + await service.run_on_user_message_callback( + user_message=mock_user_message, invocation_context=mock_context + ) + await service.run_before_run_callback(invocation_context=mock_context) + await service.run_after_run_callback(invocation_context=mock_context) + await service.run_on_event_callback( + invocation_context=mock_context, event=mock_context + ) + await service.run_before_agent_callback( + agent=mock_context, callback_context=mock_context + ) + await service.run_after_agent_callback( + agent=mock_context, callback_context=mock_context + ) + await service.run_before_tool_callback( + tool=mock_context, tool_args={}, tool_context=mock_context + ) + await service.run_after_tool_callback( + tool=mock_context, tool_args={}, tool_context=mock_context, result={} + ) + await service.run_before_model_callback( + callback_context=mock_context, llm_request=mock_context + ) + await service.run_after_model_callback( + callback_context=mock_context, llm_response=mock_context + ) + + # Verify all callbacks were logged + expected_callbacks = [ + "on_user_message_callback", + "before_run_callback", + "after_run_callback", + "on_event_callback", + "before_agent_callback", + "after_agent_callback", + "before_tool_callback", + "after_tool_callback", + "before_model_callback", + "after_model_callback", + ] + assert set(plugin1.call_log) == set(expected_callbacks) diff --git a/tests/unittests/streaming/test_streaming.py b/tests/unittests/streaming/test_streaming.py index 0754d3df..8e455033 100644 --- a/tests/unittests/streaming/test_streaming.py +++ b/tests/unittests/streaming/test_streaming.py @@ -12,9 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +import asyncio +from typing import AsyncGenerator + from google.adk.agents import Agent from google.adk.agents import LiveRequestQueue -from google.adk.agents.run_config import RunConfig from google.adk.models import LlmResponse from google.genai import types import pytest @@ -50,392 +52,889 @@ def test_streaming(): ), 'Expected at least one response, but got an empty list.' -def test_streaming_with_output_audio_transcription(): - """Test streaming with output audio transcription configuration.""" +def test_live_streaming_function_call_single(): + """Test live streaming with a single function call response.""" + # Create a function call response + function_call = types.Part.from_function_call( + name='get_weather', args={'location': 'San Francisco', 'unit': 'celsius'} + ) + + # Create LLM responses: function call followed by turn completion response1 = LlmResponse( + content=types.Content(role='model', parts=[function_call]), + turn_complete=False, + ) + response2 = LlmResponse( turn_complete=True, ) - mock_model = testing_utils.MockModel.create([response1]) + mock_model = testing_utils.MockModel.create([response1, response2]) + + # Mock function that would be called + def get_weather(location: str, unit: str = 'celsius') -> dict: + return { + 'temperature': 22, + 'condition': 'sunny', + 'location': location, + 'unit': unit, + } root_agent = Agent( name='root_agent', model=mock_model, - tools=[], + tools=[get_weather], ) - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) + # Create a custom runner class that collects all events + class CustomTestRunner(testing_utils.InMemoryRunner): - # Create run config with output audio transcription - run_config = RunConfig( - output_audio_transcription=types.AudioTranscriptionConfig() - ) + def run_live( + self, + live_request_queue: LiveRequestQueue, + run_config: testing_utils.RunConfig = None, + ) -> list[testing_utils.Event]: + collected_responses = [] + async def consume_responses(session: testing_utils.Session): + run_res = self.runner.run_live( + session=session, + live_request_queue=live_request_queue, + run_config=run_config or testing_utils.RunConfig(), + ) + + async for response in run_res: + collected_responses.append(response) + # Collect a reasonable number of events, don't wait for too many + if len(collected_responses) >= 3: + return + + try: + session = self.session + # Add timeout to prevent hanging + asyncio.run(asyncio.wait_for(consume_responses(session), timeout=5.0)) + except (asyncio.TimeoutError, asyncio.CancelledError): + # Return whatever we collected so far + pass + + return collected_responses + + runner = CustomTestRunner(root_agent=root_agent) live_request_queue = LiveRequestQueue() live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') - ) - res_events = runner.run_live(live_request_queue, run_config) - - assert res_events is not None, 'Expected a list of events, got None.' - assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' - - -def test_streaming_with_input_audio_transcription(): - """Test streaming with input audio transcription configuration.""" - response1 = LlmResponse( - turn_complete=True, - ) - - mock_model = testing_utils.MockModel.create([response1]) - - root_agent = Agent( - name='root_agent', - model=mock_model, - tools=[], - ) - - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) - - # Create run config with input audio transcription - run_config = RunConfig( - input_audio_transcription=types.AudioTranscriptionConfig() - ) - - live_request_queue = LiveRequestQueue() - live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') - ) - res_events = runner.run_live(live_request_queue, run_config) - - assert res_events is not None, 'Expected a list of events, got None.' - assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' - - -def test_streaming_with_realtime_input_config(): - """Test streaming with realtime input configuration.""" - response1 = LlmResponse( - turn_complete=True, - ) - - mock_model = testing_utils.MockModel.create([response1]) - - root_agent = Agent( - name='root_agent', - model=mock_model, - tools=[], - ) - - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) - - # Create run config with realtime input config - run_config = RunConfig( - realtime_input_config=types.RealtimeInputConfig( - automatic_activity_detection=types.AutomaticActivityDetection( - disabled=True - ) + blob=types.Blob( + data=b'What is the weather in San Francisco?', mime_type='audio/pcm' ) ) - live_request_queue = LiveRequestQueue() - live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') - ) - res_events = runner.run_live(live_request_queue, run_config) + res_events = runner.run_live(live_request_queue) assert res_events is not None, 'Expected a list of events, got None.' - assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' + assert len(res_events) >= 1, 'Expected at least one event.' + + # Check that we got a function call event + function_call_found = False + function_response_found = False + + for event in res_events: + if event.content and event.content.parts: + for part in event.content.parts: + if part.function_call and part.function_call.name == 'get_weather': + function_call_found = True + assert part.function_call.args['location'] == 'San Francisco' + assert part.function_call.args['unit'] == 'celsius' + elif ( + part.function_response + and part.function_response.name == 'get_weather' + ): + function_response_found = True + assert part.function_response.response['temperature'] == 22 + assert part.function_response.response['condition'] == 'sunny' + + assert function_call_found, 'Expected a function call event.' + # Note: In live streaming, function responses might be handled differently, + # so we check for the function call which is the primary indicator of function calling working -def test_streaming_with_realtime_input_config_vad_enabled(): - """Test streaming with realtime input configuration with VAD enabled.""" +def test_live_streaming_function_call_multiple(): + """Test live streaming with multiple function calls in sequence.""" + # Create multiple function call responses + function_call1 = types.Part.from_function_call( + name='get_weather', args={'location': 'San Francisco'} + ) + function_call2 = types.Part.from_function_call( + name='get_time', args={'timezone': 'PST'} + ) + + # Create LLM responses: two function calls followed by turn completion response1 = LlmResponse( + content=types.Content(role='model', parts=[function_call1]), + turn_complete=False, + ) + response2 = LlmResponse( + content=types.Content(role='model', parts=[function_call2]), + turn_complete=False, + ) + response3 = LlmResponse( turn_complete=True, ) - mock_model = testing_utils.MockModel.create([response1]) + mock_model = testing_utils.MockModel.create([response1, response2, response3]) + + # Mock functions + def get_weather(location: str) -> dict: + return {'temperature': 22, 'condition': 'sunny', 'location': location} + + def get_time(timezone: str) -> dict: + return {'time': '14:30', 'timezone': timezone} root_agent = Agent( name='root_agent', model=mock_model, - tools=[], + tools=[get_weather, get_time], ) - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) + # Use the custom runner + class CustomTestRunner(testing_utils.InMemoryRunner): - # Create run config with realtime input config with VAD enabled - run_config = RunConfig( - realtime_input_config=types.RealtimeInputConfig( - automatic_activity_detection=types.AutomaticActivityDetection( - disabled=False - ) + def run_live( + self, + live_request_queue: LiveRequestQueue, + run_config: testing_utils.RunConfig = None, + ) -> list[testing_utils.Event]: + collected_responses = [] + + async def consume_responses(session: testing_utils.Session): + run_res = self.runner.run_live( + session=session, + live_request_queue=live_request_queue, + run_config=run_config or testing_utils.RunConfig(), + ) + + async for response in run_res: + collected_responses.append(response) + if len(collected_responses) >= 3: + return + + try: + session = self.session + asyncio.run(asyncio.wait_for(consume_responses(session), timeout=5.0)) + except (asyncio.TimeoutError, asyncio.CancelledError): + pass + + return collected_responses + + runner = CustomTestRunner(root_agent=root_agent) + live_request_queue = LiveRequestQueue() + live_request_queue.send_realtime( + blob=types.Blob( + data=b'What is the weather and current time?', mime_type='audio/pcm' ) ) - live_request_queue = LiveRequestQueue() - live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') - ) - res_events = runner.run_live(live_request_queue, run_config) + res_events = runner.run_live(live_request_queue) assert res_events is not None, 'Expected a list of events, got None.' + assert len(res_events) >= 1, 'Expected at least one event.' + + # Check function calls + weather_call_found = False + time_call_found = False + + for event in res_events: + if event.content and event.content.parts: + for part in event.content.parts: + if part.function_call: + if part.function_call.name == 'get_weather': + weather_call_found = True + assert part.function_call.args['location'] == 'San Francisco' + elif part.function_call.name == 'get_time': + time_call_found = True + assert part.function_call.args['timezone'] == 'PST' + + # In live streaming, we primarily check that function calls are generated correctly assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' + weather_call_found or time_call_found + ), 'Expected at least one function call.' -def test_streaming_with_enable_affective_dialog_true(): - """Test streaming with affective dialog enabled.""" +def test_live_streaming_function_call_parallel(): + """Test live streaming with parallel function calls.""" + # Create parallel function calls in the same response + function_call1 = types.Part.from_function_call( + name='get_weather', args={'location': 'San Francisco'} + ) + function_call2 = types.Part.from_function_call( + name='get_weather', args={'location': 'New York'} + ) + + # Create LLM response with parallel function calls response1 = LlmResponse( - turn_complete=True, - ) - - mock_model = testing_utils.MockModel.create([response1]) - - root_agent = Agent( - name='root_agent', - model=mock_model, - tools=[], - ) - - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) - - # Create run config with affective dialog enabled - run_config = RunConfig(enable_affective_dialog=True) - - live_request_queue = LiveRequestQueue() - live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') - ) - res_events = runner.run_live(live_request_queue, run_config) - - assert res_events is not None, 'Expected a list of events, got None.' - assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' - - -def test_streaming_with_enable_affective_dialog_false(): - """Test streaming with affective dialog disabled.""" - response1 = LlmResponse( - turn_complete=True, - ) - - mock_model = testing_utils.MockModel.create([response1]) - - root_agent = Agent( - name='root_agent', - model=mock_model, - tools=[], - ) - - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) - - # Create run config with affective dialog disabled - run_config = RunConfig(enable_affective_dialog=False) - - live_request_queue = LiveRequestQueue() - live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') - ) - res_events = runner.run_live(live_request_queue, run_config) - - assert res_events is not None, 'Expected a list of events, got None.' - assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' - - -def test_streaming_with_proactivity_config(): - """Test streaming with proactivity configuration.""" - response1 = LlmResponse( - turn_complete=True, - ) - - mock_model = testing_utils.MockModel.create([response1]) - - root_agent = Agent( - name='root_agent', - model=mock_model, - tools=[], - ) - - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) - - # Create run config with proactivity config - run_config = RunConfig(proactivity=types.ProactivityConfig()) - - live_request_queue = LiveRequestQueue() - live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') - ) - res_events = runner.run_live(live_request_queue, run_config) - - assert res_events is not None, 'Expected a list of events, got None.' - assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' - - -def test_streaming_with_combined_audio_transcription_configs(): - """Test streaming with both input and output audio transcription configurations.""" - response1 = LlmResponse( - turn_complete=True, - ) - - mock_model = testing_utils.MockModel.create([response1]) - - root_agent = Agent( - name='root_agent', - model=mock_model, - tools=[], - ) - - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) - - # Create run config with both input and output audio transcription - run_config = RunConfig( - input_audio_transcription=types.AudioTranscriptionConfig(), - output_audio_transcription=types.AudioTranscriptionConfig(), - ) - - live_request_queue = LiveRequestQueue() - live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') - ) - res_events = runner.run_live(live_request_queue, run_config) - - assert res_events is not None, 'Expected a list of events, got None.' - assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' - - -def test_streaming_with_all_configs_combined(): - """Test streaming with all the new configurations combined.""" - response1 = LlmResponse( - turn_complete=True, - ) - - mock_model = testing_utils.MockModel.create([response1]) - - root_agent = Agent( - name='root_agent', - model=mock_model, - tools=[], - ) - - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) - - # Create run config with all configurations - run_config = RunConfig( - output_audio_transcription=types.AudioTranscriptionConfig(), - input_audio_transcription=types.AudioTranscriptionConfig(), - realtime_input_config=types.RealtimeInputConfig( - automatic_activity_detection=types.AutomaticActivityDetection( - disabled=True - ) + content=types.Content( + role='model', parts=[function_call1, function_call2] ), - enable_affective_dialog=True, - proactivity=types.ProactivityConfig(), + turn_complete=False, ) - - live_request_queue = LiveRequestQueue() - live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') - ) - res_events = runner.run_live(live_request_queue, run_config) - - assert res_events is not None, 'Expected a list of events, got None.' - assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' - - -def test_streaming_config_validation(): - """Test that run_config values are properly set and accessible.""" - # Test that RunConfig properly validates and stores the configurations - run_config = RunConfig( - output_audio_transcription=types.AudioTranscriptionConfig(), - input_audio_transcription=types.AudioTranscriptionConfig(), - realtime_input_config=types.RealtimeInputConfig( - automatic_activity_detection=types.AutomaticActivityDetection( - disabled=False - ) - ), - enable_affective_dialog=True, - proactivity=types.ProactivityConfig(), - ) - - # Verify configurations are properly set - assert run_config.output_audio_transcription is not None - assert run_config.input_audio_transcription is not None - assert run_config.realtime_input_config is not None - assert ( - run_config.realtime_input_config.automatic_activity_detection.disabled - == False - ) - assert run_config.enable_affective_dialog == True - assert run_config.proactivity is not None - - -def test_streaming_with_multiple_audio_configs(): - """Test streaming with multiple audio transcription configurations.""" - response1 = LlmResponse( + response2 = LlmResponse( turn_complete=True, ) - mock_model = testing_utils.MockModel.create([response1]) + mock_model = testing_utils.MockModel.create([response1, response2]) + + # Mock function + def get_weather(location: str) -> dict: + temperatures = {'San Francisco': 22, 'New York': 15} + return {'temperature': temperatures.get(location, 20), 'location': location} root_agent = Agent( name='root_agent', model=mock_model, - tools=[], + tools=[get_weather], ) - runner = testing_utils.InMemoryRunner( - root_agent=root_agent, response_modalities=['AUDIO'] - ) + # Use the custom runner + class CustomTestRunner(testing_utils.InMemoryRunner): - # Create run config with multiple audio transcription configs - run_config = RunConfig( - input_audio_transcription=types.AudioTranscriptionConfig(), - output_audio_transcription=types.AudioTranscriptionConfig(), - enable_affective_dialog=True, - ) + def run_live( + self, + live_request_queue: LiveRequestQueue, + run_config: testing_utils.RunConfig = None, + ) -> list[testing_utils.Event]: + collected_responses = [] + async def consume_responses(session: testing_utils.Session): + run_res = self.runner.run_live( + session=session, + live_request_queue=live_request_queue, + run_config=run_config or testing_utils.RunConfig(), + ) + + async for response in run_res: + collected_responses.append(response) + if len(collected_responses) >= 3: + return + + try: + session = self.session + asyncio.run(asyncio.wait_for(consume_responses(session), timeout=5.0)) + except (asyncio.TimeoutError, asyncio.CancelledError): + pass + + return collected_responses + + runner = CustomTestRunner(root_agent=root_agent) live_request_queue = LiveRequestQueue() live_request_queue.send_realtime( - blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm') + blob=types.Blob( + data=b'Compare weather in SF and NYC', mime_type='audio/pcm' + ) ) - res_events = runner.run_live(live_request_queue, run_config) + res_events = runner.run_live(live_request_queue) assert res_events is not None, 'Expected a list of events, got None.' + assert len(res_events) >= 1, 'Expected at least one event.' + + # Check parallel function calls + sf_call_found = False + nyc_call_found = False + + for event in res_events: + if event.content and event.content.parts: + for part in event.content.parts: + if part.function_call and part.function_call.name == 'get_weather': + location = part.function_call.args['location'] + if location == 'San Francisco': + sf_call_found = True + elif location == 'New York': + nyc_call_found = True + assert ( - len(res_events) > 0 - ), 'Expected at least one response, but got an empty list.' + sf_call_found and nyc_call_found + ), 'Expected both location function calls.' + + +def test_live_streaming_function_call_with_error(): + """Test live streaming with function call that returns an error.""" + # Create a function call response + function_call = types.Part.from_function_call( + name='get_weather', args={'location': 'Invalid Location'} + ) + + # Create LLM responses + response1 = LlmResponse( + content=types.Content(role='model', parts=[function_call]), + turn_complete=False, + ) + response2 = LlmResponse( + turn_complete=True, + ) + + mock_model = testing_utils.MockModel.create([response1, response2]) + + # Mock function that returns an error for invalid locations + def get_weather(location: str) -> dict: + if location == 'Invalid Location': + return {'error': 'Location not found'} + return {'temperature': 22, 'condition': 'sunny', 'location': location} + + root_agent = Agent( + name='root_agent', + model=mock_model, + tools=[get_weather], + ) + + # Use the custom runner + class CustomTestRunner(testing_utils.InMemoryRunner): + + def run_live( + self, + live_request_queue: LiveRequestQueue, + run_config: testing_utils.RunConfig = None, + ) -> list[testing_utils.Event]: + collected_responses = [] + + async def consume_responses(session: testing_utils.Session): + run_res = self.runner.run_live( + session=session, + live_request_queue=live_request_queue, + run_config=run_config or testing_utils.RunConfig(), + ) + + async for response in run_res: + collected_responses.append(response) + if len(collected_responses) >= 3: + return + + try: + session = self.session + asyncio.run(asyncio.wait_for(consume_responses(session), timeout=5.0)) + except (asyncio.TimeoutError, asyncio.CancelledError): + pass + + return collected_responses + + runner = CustomTestRunner(root_agent=root_agent) + live_request_queue = LiveRequestQueue() + live_request_queue.send_realtime( + blob=types.Blob( + data=b'What is weather in Invalid Location?', mime_type='audio/pcm' + ) + ) + + res_events = runner.run_live(live_request_queue) + + assert res_events is not None, 'Expected a list of events, got None.' + assert len(res_events) >= 1, 'Expected at least one event.' + + # Check that we got the function call (error handling happens at execution time) + function_call_found = False + for event in res_events: + if event.content and event.content.parts: + for part in event.content.parts: + if part.function_call and part.function_call.name == 'get_weather': + function_call_found = True + assert part.function_call.args['location'] == 'Invalid Location' + + assert function_call_found, 'Expected function call event with error case.' + + +def test_live_streaming_function_call_sync_tool(): + """Test live streaming with synchronous function call.""" + # Create a function call response + function_call = types.Part.from_function_call( + name='calculate', args={'x': 5, 'y': 3} + ) + + # Create LLM responses + response1 = LlmResponse( + content=types.Content(role='model', parts=[function_call]), + turn_complete=False, + ) + response2 = LlmResponse( + turn_complete=True, + ) + + mock_model = testing_utils.MockModel.create([response1, response2]) + + # Mock sync function + def calculate(x: int, y: int) -> dict: + return {'result': x + y, 'operation': 'addition'} + + root_agent = Agent( + name='root_agent', + model=mock_model, + tools=[calculate], + ) + + # Use the custom runner + class CustomTestRunner(testing_utils.InMemoryRunner): + + def run_live( + self, + live_request_queue: LiveRequestQueue, + run_config: testing_utils.RunConfig = None, + ) -> list[testing_utils.Event]: + collected_responses = [] + + async def consume_responses(session: testing_utils.Session): + run_res = self.runner.run_live( + session=session, + live_request_queue=live_request_queue, + run_config=run_config or testing_utils.RunConfig(), + ) + + async for response in run_res: + collected_responses.append(response) + if len(collected_responses) >= 3: + return + + try: + session = self.session + asyncio.run(asyncio.wait_for(consume_responses(session), timeout=5.0)) + except (asyncio.TimeoutError, asyncio.CancelledError): + pass + + return collected_responses + + runner = CustomTestRunner(root_agent=root_agent) + live_request_queue = LiveRequestQueue() + live_request_queue.send_realtime( + blob=types.Blob(data=b'Calculate 5 plus 3', mime_type='audio/pcm') + ) + + res_events = runner.run_live(live_request_queue) + + assert res_events is not None, 'Expected a list of events, got None.' + assert len(res_events) >= 1, 'Expected at least one event.' + + # Check function call + function_call_found = False + for event in res_events: + if event.content and event.content.parts: + for part in event.content.parts: + if part.function_call and part.function_call.name == 'calculate': + function_call_found = True + assert part.function_call.args['x'] == 5 + assert part.function_call.args['y'] == 3 + + assert function_call_found, 'Expected calculate function call event.' + + +def test_live_streaming_simple_streaming_tool(): + """Test live streaming with a simple streaming tool (non-video).""" + # Create a function call response for the streaming tool + function_call = types.Part.from_function_call( + name='monitor_stock_price', args={'stock_symbol': 'AAPL'} + ) + + # Create LLM responses + response1 = LlmResponse( + content=types.Content(role='model', parts=[function_call]), + turn_complete=False, + ) + response2 = LlmResponse( + turn_complete=True, + ) + + mock_model = testing_utils.MockModel.create([response1, response2]) + + # Mock simple streaming tool (without return type annotation to avoid parsing issues) + async def monitor_stock_price(stock_symbol: str): + """Mock streaming tool that monitors stock prices.""" + # Simulate some streaming updates + yield f'Stock {stock_symbol} price: $150' + await asyncio.sleep(0.1) + yield f'Stock {stock_symbol} price: $155' + await asyncio.sleep(0.1) + yield f'Stock {stock_symbol} price: $160' + + def stop_streaming(function_name: str): + """Stop the streaming tool.""" + pass + + root_agent = Agent( + name='root_agent', + model=mock_model, + tools=[monitor_stock_price, stop_streaming], + ) + + # Use the custom runner + class CustomTestRunner(testing_utils.InMemoryRunner): + + def run_live( + self, + live_request_queue: LiveRequestQueue, + run_config: testing_utils.RunConfig = None, + ) -> list[testing_utils.Event]: + collected_responses = [] + + async def consume_responses(session: testing_utils.Session): + run_res = self.runner.run_live( + session=session, + live_request_queue=live_request_queue, + run_config=run_config or testing_utils.RunConfig(), + ) + + async for response in run_res: + collected_responses.append(response) + if len(collected_responses) >= 3: + return + + try: + session = self.session + asyncio.run(asyncio.wait_for(consume_responses(session), timeout=5.0)) + except (asyncio.TimeoutError, asyncio.CancelledError): + pass + + return collected_responses + + runner = CustomTestRunner(root_agent=root_agent) + live_request_queue = LiveRequestQueue() + live_request_queue.send_realtime( + blob=types.Blob(data=b'Monitor AAPL stock price', mime_type='audio/pcm') + ) + + res_events = runner.run_live(live_request_queue) + + assert res_events is not None, 'Expected a list of events, got None.' + assert len(res_events) >= 1, 'Expected at least one event.' + + # Check that we got the streaming tool function call + function_call_found = False + for event in res_events: + if event.content and event.content.parts: + for part in event.content.parts: + if ( + part.function_call + and part.function_call.name == 'monitor_stock_price' + ): + function_call_found = True + assert part.function_call.args['stock_symbol'] == 'AAPL' + + assert ( + function_call_found + ), 'Expected monitor_stock_price function call event.' + + +def test_live_streaming_video_streaming_tool(): + """Test live streaming with a video streaming tool.""" + # Create a function call response for the video streaming tool + function_call = types.Part.from_function_call( + name='monitor_video_stream', args={} + ) + + # Create LLM responses + response1 = LlmResponse( + content=types.Content(role='model', parts=[function_call]), + turn_complete=False, + ) + response2 = LlmResponse( + turn_complete=True, + ) + + mock_model = testing_utils.MockModel.create([response1, response2]) + + # Mock video streaming tool (without return type annotation to avoid parsing issues) + async def monitor_video_stream(input_stream: LiveRequestQueue): + """Mock video streaming tool that processes video frames.""" + # Simulate processing a few frames from the input stream + frame_count = 0 + while frame_count < 3: # Process a few frames + try: + # Try to get a frame from the queue with timeout + live_req = await asyncio.wait_for(input_stream.get(), timeout=0.1) + if live_req.blob and live_req.blob.mime_type == 'image/jpeg': + frame_count += 1 + yield f'Processed frame {frame_count}: detected 2 people' + except asyncio.TimeoutError: + # No more frames, simulate detection anyway for testing + frame_count += 1 + yield f'Simulated frame {frame_count}: detected 1 person' + await asyncio.sleep(0.1) + + def stop_streaming(function_name: str): + """Stop the streaming tool.""" + pass + + root_agent = Agent( + name='root_agent', + model=mock_model, + tools=[monitor_video_stream, stop_streaming], + ) + + # Use the custom runner + class CustomTestRunner(testing_utils.InMemoryRunner): + + def run_live( + self, + live_request_queue: LiveRequestQueue, + run_config: testing_utils.RunConfig = None, + ) -> list[testing_utils.Event]: + collected_responses = [] + + async def consume_responses(session: testing_utils.Session): + run_res = self.runner.run_live( + session=session, + live_request_queue=live_request_queue, + run_config=run_config or testing_utils.RunConfig(), + ) + + async for response in run_res: + collected_responses.append(response) + if len(collected_responses) >= 3: + return + + try: + session = self.session + asyncio.run(asyncio.wait_for(consume_responses(session), timeout=5.0)) + except (asyncio.TimeoutError, asyncio.CancelledError): + pass + + return collected_responses + + runner = CustomTestRunner(root_agent=root_agent) + live_request_queue = LiveRequestQueue() + + # Send some mock video frames + live_request_queue.send_realtime( + blob=types.Blob(data=b'fake_jpeg_data_1', mime_type='image/jpeg') + ) + live_request_queue.send_realtime( + blob=types.Blob(data=b'fake_jpeg_data_2', mime_type='image/jpeg') + ) + live_request_queue.send_realtime( + blob=types.Blob(data=b'Monitor video stream', mime_type='audio/pcm') + ) + + res_events = runner.run_live(live_request_queue) + + assert res_events is not None, 'Expected a list of events, got None.' + assert len(res_events) >= 1, 'Expected at least one event.' + + # Check that we got the video streaming tool function call + function_call_found = False + for event in res_events: + if event.content and event.content.parts: + for part in event.content.parts: + if ( + part.function_call + and part.function_call.name == 'monitor_video_stream' + ): + function_call_found = True + + assert ( + function_call_found + ), 'Expected monitor_video_stream function call event.' + + +def test_live_streaming_stop_streaming_tool(): + """Test live streaming with stop_streaming functionality.""" + # Create function calls for starting and stopping a streaming tool + start_function_call = types.Part.from_function_call( + name='monitor_stock_price', args={'stock_symbol': 'TSLA'} + ) + stop_function_call = types.Part.from_function_call( + name='stop_streaming', args={'function_name': 'monitor_stock_price'} + ) + + # Create LLM responses: start streaming, then stop streaming + response1 = LlmResponse( + content=types.Content(role='model', parts=[start_function_call]), + turn_complete=False, + ) + response2 = LlmResponse( + content=types.Content(role='model', parts=[stop_function_call]), + turn_complete=False, + ) + response3 = LlmResponse( + turn_complete=True, + ) + + mock_model = testing_utils.MockModel.create([response1, response2, response3]) + + # Mock streaming tool and stop function + async def monitor_stock_price(stock_symbol: str): + """Mock streaming tool that monitors stock prices.""" + yield f'Started monitoring {stock_symbol}' + while True: # Infinite stream (would be stopped by stop_streaming) + yield f'Stock {stock_symbol} price update' + await asyncio.sleep(0.1) + + def stop_streaming(function_name: str): + """Stop the streaming tool.""" + return f'Stopped streaming for {function_name}' + + root_agent = Agent( + name='root_agent', + model=mock_model, + tools=[monitor_stock_price, stop_streaming], + ) + + # Use the custom runner + class CustomTestRunner(testing_utils.InMemoryRunner): + + def run_live( + self, + live_request_queue: LiveRequestQueue, + run_config: testing_utils.RunConfig = None, + ) -> list[testing_utils.Event]: + collected_responses = [] + + async def consume_responses(session: testing_utils.Session): + run_res = self.runner.run_live( + session=session, + live_request_queue=live_request_queue, + run_config=run_config or testing_utils.RunConfig(), + ) + + async for response in run_res: + collected_responses.append(response) + if len(collected_responses) >= 3: + return + + try: + session = self.session + asyncio.run(asyncio.wait_for(consume_responses(session), timeout=5.0)) + except (asyncio.TimeoutError, asyncio.CancelledError): + pass + + return collected_responses + + runner = CustomTestRunner(root_agent=root_agent) + live_request_queue = LiveRequestQueue() + live_request_queue.send_realtime( + blob=types.Blob(data=b'Monitor TSLA and then stop', mime_type='audio/pcm') + ) + + res_events = runner.run_live(live_request_queue) + + assert res_events is not None, 'Expected a list of events, got None.' + assert len(res_events) >= 1, 'Expected at least one event.' + + # Check that we got both function calls + monitor_call_found = False + stop_call_found = False + + for event in res_events: + if event.content and event.content.parts: + for part in event.content.parts: + if part.function_call: + if part.function_call.name == 'monitor_stock_price': + monitor_call_found = True + assert part.function_call.args['stock_symbol'] == 'TSLA' + elif part.function_call.name == 'stop_streaming': + stop_call_found = True + assert ( + part.function_call.args['function_name'] + == 'monitor_stock_price' + ) + + assert monitor_call_found, 'Expected monitor_stock_price function call event.' + assert stop_call_found, 'Expected stop_streaming function call event.' + + +def test_live_streaming_multiple_streaming_tools(): + """Test live streaming with multiple streaming tools running simultaneously.""" + # Create function calls for multiple streaming tools + stock_function_call = types.Part.from_function_call( + name='monitor_stock_price', args={'stock_symbol': 'NVDA'} + ) + video_function_call = types.Part.from_function_call( + name='monitor_video_stream', args={} + ) + + # Create LLM responses: start both streaming tools + response1 = LlmResponse( + content=types.Content( + role='model', parts=[stock_function_call, video_function_call] + ), + turn_complete=False, + ) + response2 = LlmResponse( + turn_complete=True, + ) + + mock_model = testing_utils.MockModel.create([response1, response2]) + + # Mock streaming tools + async def monitor_stock_price(stock_symbol: str): + """Mock streaming tool that monitors stock prices.""" + yield f'Stock {stock_symbol} price: $800' + await asyncio.sleep(0.1) + yield f'Stock {stock_symbol} price: $805' + + async def monitor_video_stream(input_stream: LiveRequestQueue): + """Mock video streaming tool.""" + yield 'Video monitoring started' + await asyncio.sleep(0.1) + yield 'Detected motion in video stream' + + def stop_streaming(function_name: str): + """Stop the streaming tool.""" + pass + + root_agent = Agent( + name='root_agent', + model=mock_model, + tools=[monitor_stock_price, monitor_video_stream, stop_streaming], + ) + + # Use the custom runner + class CustomTestRunner(testing_utils.InMemoryRunner): + + def run_live( + self, + live_request_queue: LiveRequestQueue, + run_config: testing_utils.RunConfig = None, + ) -> list[testing_utils.Event]: + collected_responses = [] + + async def consume_responses(session: testing_utils.Session): + run_res = self.runner.run_live( + session=session, + live_request_queue=live_request_queue, + run_config=run_config or testing_utils.RunConfig(), + ) + + async for response in run_res: + collected_responses.append(response) + if len(collected_responses) >= 3: + return + + try: + session = self.session + asyncio.run(asyncio.wait_for(consume_responses(session), timeout=5.0)) + except (asyncio.TimeoutError, asyncio.CancelledError): + pass + + return collected_responses + + runner = CustomTestRunner(root_agent=root_agent) + live_request_queue = LiveRequestQueue() + live_request_queue.send_realtime( + blob=types.Blob( + data=b'Monitor both stock and video', mime_type='audio/pcm' + ) + ) + + res_events = runner.run_live(live_request_queue) + + assert res_events is not None, 'Expected a list of events, got None.' + assert len(res_events) >= 1, 'Expected at least one event.' + + # Check that we got both streaming tool function calls + stock_call_found = False + video_call_found = False + + for event in res_events: + if event.content and event.content.parts: + for part in event.content.parts: + if part.function_call: + if part.function_call.name == 'monitor_stock_price': + stock_call_found = True + assert part.function_call.args['stock_symbol'] == 'NVDA' + elif part.function_call.name == 'monitor_video_stream': + video_call_found = True + + assert stock_call_found, 'Expected monitor_stock_price function call event.' + assert video_call_found, 'Expected monitor_video_stream function call event.' diff --git a/tests/unittests/test_runners.py b/tests/unittests/test_runners.py index 8d5bd241..61ee4b01 100644 --- a/tests/unittests/test_runners.py +++ b/tests/unittests/test_runners.py @@ -15,13 +15,20 @@ from typing import Optional from google.adk.agents.base_agent import BaseAgent +from google.adk.agents.invocation_context import InvocationContext from google.adk.agents.llm_agent import LlmAgent from google.adk.artifacts.in_memory_artifact_service import InMemoryArtifactService from google.adk.events.event import Event +from google.adk.plugins.base_plugin import BasePlugin from google.adk.runners import Runner from google.adk.sessions.in_memory_session_service import InMemorySessionService from google.adk.sessions.session import Session from google.genai import types +import pytest + +TEST_APP_ID = "test_app" +TEST_USER_ID = "test_user" +TEST_SESSION_ID = "test_session" class MockAgent(BaseAgent): @@ -72,6 +79,51 @@ class MockLlmAgent(LlmAgent): ) +class MockPlugin(BasePlugin): + """Mock plugin for unit testing.""" + + ON_USER_CALLBACK_MSG = ( + "Modified user message ON_USER_CALLBACK_MSG from MockPlugin" + ) + ON_EVENT_CALLBACK_MSG = "Modified event ON_EVENT_CALLBACK_MSG from MockPlugin" + + def __init__(self): + super().__init__(name="mock_plugin") + self.enable_user_message_callback = False + self.enable_event_callback = False + + async def on_user_message_callback( + self, + *, + invocation_context: InvocationContext, + user_message: types.Content, + ) -> Optional[types.Content]: + if not self.enable_user_message_callback: + return None + return types.Content( + role="model", + parts=[types.Part(text=self.ON_USER_CALLBACK_MSG)], + ) + + async def on_event_callback( + self, *, invocation_context: InvocationContext, event: Event + ) -> Optional[Event]: + if not self.enable_event_callback: + return None + return Event( + invocation_id="", + author="", + content=types.Content( + parts=[ + types.Part( + text=self.ON_EVENT_CALLBACK_MSG, + ) + ], + role=event.content.role, + ), + ) + + class TestRunnerFindAgentToRun: """Tests for Runner._find_agent_to_run method.""" @@ -308,3 +360,73 @@ class TestRunnerFindAgentToRun: # MockAgent inherits from BaseAgent, not LlmAgent, so it should return False result = self.runner._is_transferable_across_agent_tree(non_llm_agent) assert result is False + + +class TestRunnerWithPlugins: + """Tests for Runner with plugins.""" + + def setup_method(self): + self.plugin = MockPlugin() + self.session_service = InMemorySessionService() + self.artifact_service = InMemoryArtifactService() + self.root_agent = MockLlmAgent("root_agent") + self.runner = Runner( + app_name="test_app", + agent=MockLlmAgent("test_agent"), + session_service=self.session_service, + artifact_service=self.artifact_service, + plugins=[self.plugin], + ) + + async def run_test(self, original_user_input="Hello") -> list[Event]: + """Prepares the test by creating a session and running the runner.""" + await self.session_service.create_session( + app_name=TEST_APP_ID, user_id=TEST_USER_ID, session_id=TEST_SESSION_ID + ) + events = [] + async for event in self.runner.run_async( + user_id=TEST_USER_ID, + session_id=TEST_SESSION_ID, + new_message=types.Content( + role="user", parts=[types.Part(text=original_user_input)] + ), + ): + events.append(event) + return events + + @pytest.mark.asyncio + async def test_runner_is_initialized_with_plugins(self): + """Test that the runner is initialized with plugins.""" + await self.run_test() + + assert self.runner.plugin_manager is not None + + @pytest.mark.asyncio + async def test_runner_modifies_user_message_before_execution(self): + """Test that the runner modifies the user message before execution.""" + original_user_input = "original_input" + self.plugin.enable_user_message_callback = True + + await self.run_test(original_user_input=original_user_input) + session = await self.session_service.get_session( + app_name=TEST_APP_ID, user_id=TEST_USER_ID, session_id=TEST_SESSION_ID + ) + generated_event = session.events[0] + modified_user_message = generated_event.content.parts[0].text + + assert modified_user_message == MockPlugin.ON_USER_CALLBACK_MSG + + @pytest.mark.asyncio + async def test_runner_modifies_event_after_execution(self): + """Test that the runner modifies the event after execution.""" + self.plugin.enable_event_callback = True + + events = await self.run_test() + generated_event = events[0] + modified_event_message = generated_event.content.parts[0].text + + assert modified_event_message == MockPlugin.ON_EVENT_CALLBACK_MSG + + +if __name__ == "__main__": + pytest.main([__file__]) diff --git a/tests/unittests/testing_utils.py b/tests/unittests/testing_utils.py index b1d5ff82..810a6c44 100644 --- a/tests/unittests/testing_utils.py +++ b/tests/unittests/testing_utils.py @@ -30,6 +30,8 @@ from google.adk.models.base_llm import BaseLlm from google.adk.models.base_llm_connection import BaseLlmConnection from google.adk.models.llm_request import LlmRequest from google.adk.models.llm_response import LlmResponse +from google.adk.plugins.base_plugin import BasePlugin +from google.adk.plugins.plugin_manager import PluginManager from google.adk.runners import InMemoryRunner as AfInMemoryRunner from google.adk.runners import Runner from google.adk.sessions.in_memory_session_service import InMemorySessionService @@ -57,7 +59,10 @@ class ModelContent(types.Content): async def create_invocation_context( - agent: Agent, user_content: str = '', run_config: RunConfig = None + agent: Agent, + user_content: str = '', + run_config: RunConfig = None, + plugins: list[BasePlugin] = [], ): invocation_id = 'test_id' artifact_service = InMemoryArtifactService() @@ -67,6 +72,7 @@ async def create_invocation_context( artifact_service=artifact_service, session_service=session_service, memory_service=memory_service, + plugin_manager=PluginManager(plugins=plugins), invocation_id=invocation_id, agent=agent, session=await session_service.create_session( @@ -165,6 +171,7 @@ class InMemoryRunner: self, root_agent: Union[Agent, LlmAgent], response_modalities: list[str] = None, + plugins: list[BasePlugin] = [], ): self.root_agent = root_agent self.runner = Runner( @@ -173,6 +180,7 @@ class InMemoryRunner: artifact_service=InMemoryArtifactService(), session_service=InMemorySessionService(), memory_service=InMemoryMemoryService(), + plugins=plugins, ) self.session_id = None diff --git a/tests/unittests/tools/google_api_tool/test_google_api_tool.py b/tests/unittests/tools/google_api_tool/test_google_api_tool.py new file mode 100644 index 00000000..0d9c1f9e --- /dev/null +++ b/tests/unittests/tools/google_api_tool/test_google_api_tool.py @@ -0,0 +1,145 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from unittest import mock + +from google.adk.auth.auth_credential import AuthCredentialTypes +from google.adk.auth.auth_credential import ServiceAccount +from google.adk.auth.auth_credential import ServiceAccountCredential +from google.adk.tools.google_api_tool.google_api_tool import GoogleApiTool +from google.adk.tools.openapi_tool import RestApiTool +from google.adk.tools.tool_context import ToolContext +from google.genai.types import FunctionDeclaration +import pytest + + +@pytest.fixture +def mock_rest_api_tool(): + """Fixture for a mock RestApiTool.""" + mock_tool = mock.MagicMock(spec=RestApiTool) + mock_tool.name = "test_tool" + mock_tool.description = "Test Tool Description" + mock_tool.is_long_running = False + mock_tool._get_declaration.return_value = FunctionDeclaration( + name="test_function", description="Test function description" + ) + mock_tool.run_async.return_value = {"result": "success"} + return mock_tool + + +@pytest.fixture +def mock_tool_context(): + """Fixture for a mock ToolContext.""" + return mock.MagicMock(spec=ToolContext) + + +class TestGoogleApiTool: + """Test suite for the GoogleApiTool class.""" + + def test_init(self, mock_rest_api_tool): + """Test GoogleApiTool initialization.""" + tool = GoogleApiTool(mock_rest_api_tool) + + assert tool.name == "test_tool" + assert tool.description == "Test Tool Description" + assert tool.is_long_running is False + assert tool._rest_api_tool == mock_rest_api_tool + + def test_get_declaration(self, mock_rest_api_tool): + """Test _get_declaration method.""" + tool = GoogleApiTool(mock_rest_api_tool) + + declaration = tool._get_declaration() + + assert isinstance(declaration, FunctionDeclaration) + assert declaration.name == "test_function" + assert declaration.description == "Test function description" + mock_rest_api_tool._get_declaration.assert_called_once() + + @pytest.mark.asyncio + async def test_run_async(self, mock_rest_api_tool, mock_tool_context): + """Test run_async method.""" + tool = GoogleApiTool(mock_rest_api_tool) + args = {"param1": "value1"} + + result = await tool.run_async(args=args, tool_context=mock_tool_context) + + assert result == {"result": "success"} + mock_rest_api_tool.run_async.assert_called_once_with( + args=args, tool_context=mock_tool_context + ) + + def test_configure_auth(self, mock_rest_api_tool): + """Test configure_auth method.""" + tool = GoogleApiTool(mock_rest_api_tool) + client_id = "test_client_id" + client_secret = "test_client_secret" + + tool.configure_auth(client_id=client_id, client_secret=client_secret) + + # Check that auth_credential was set correctly on the rest_api_tool + assert mock_rest_api_tool.auth_credential is not None + assert ( + mock_rest_api_tool.auth_credential.auth_type + == AuthCredentialTypes.OPEN_ID_CONNECT + ) + assert mock_rest_api_tool.auth_credential.oauth2.client_id == client_id + assert ( + mock_rest_api_tool.auth_credential.oauth2.client_secret == client_secret + ) + + @mock.patch( + "google.adk.tools.google_api_tool.google_api_tool.service_account_scheme_credential" + ) + def test_configure_sa_auth( + self, mock_service_account_scheme_credential, mock_rest_api_tool + ): + """Test configure_sa_auth method.""" + # Setup mock return values + mock_auth_scheme = mock.MagicMock() + mock_auth_credential = mock.MagicMock() + mock_service_account_scheme_credential.return_value = ( + mock_auth_scheme, + mock_auth_credential, + ) + + service_account = ServiceAccount( + service_account_credential=ServiceAccountCredential( + type="service_account", + project_id="project_id", + private_key_id="private_key_id", + private_key="private_key", + client_email="client_email", + client_id="client_id", + auth_uri="auth_uri", + token_uri="token_uri", + auth_provider_x509_cert_url="auth_provider_x509_cert_url", + client_x509_cert_url="client_x509_cert_url", + universe_domain="universe_domain", + ), + scopes=["scope1", "scope2"], + ) + + # Create tool and call method + tool = GoogleApiTool(mock_rest_api_tool) + tool.configure_sa_auth(service_account=service_account) + + # Verify service_account_scheme_credential was called correctly + mock_service_account_scheme_credential.assert_called_once_with( + service_account + ) + + # Verify auth_scheme and auth_credential were set correctly on the rest_api_tool + assert mock_rest_api_tool.auth_scheme == mock_auth_scheme + assert mock_rest_api_tool.auth_credential == mock_auth_credential diff --git a/tests/unittests/tools/google_api_tool/test_google_api_toolset.py b/tests/unittests/tools/google_api_tool/test_google_api_toolset.py new file mode 100644 index 00000000..4f5ca1f2 --- /dev/null +++ b/tests/unittests/tools/google_api_tool/test_google_api_toolset.py @@ -0,0 +1,427 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from typing import Optional +from unittest import mock + +from google.adk.agents.readonly_context import ReadonlyContext +from google.adk.auth import OpenIdConnectWithConfig +from google.adk.auth.auth_credential import ServiceAccount +from google.adk.auth.auth_credential import ServiceAccountCredential +from google.adk.tools import BaseTool +from google.adk.tools.base_toolset import ToolPredicate +from google.adk.tools.google_api_tool.google_api_tool import GoogleApiTool +from google.adk.tools.google_api_tool.google_api_toolset import GoogleApiToolset +from google.adk.tools.google_api_tool.googleapi_to_openapi_converter import GoogleApiToOpenApiConverter +from google.adk.tools.openapi_tool import OpenAPIToolset +from google.adk.tools.openapi_tool import RestApiTool +import pytest + +TEST_API_NAME = "calendar" +TEST_API_VERSION = "v3" +DEFAULT_SCOPE = "https://www.googleapis.com/auth/calendar" + + +@pytest.fixture +def mock_rest_api_tool(): + """Fixture for a mock RestApiTool.""" + mock_tool = mock.MagicMock(spec=RestApiTool) + mock_tool.name = "test_tool" + mock_tool.description = "Test Tool Description" + return mock_tool + + +@pytest.fixture +def mock_google_api_tool_instance( + mock_rest_api_tool, +): # Renamed from mock_google_api_tool + """Fixture for a mock GoogleApiTool instance.""" + mock_tool = mock.MagicMock(spec=GoogleApiTool) + mock_tool.name = "test_tool" + mock_tool.description = "Test Tool Description" + mock_tool.rest_api_tool = mock_rest_api_tool + return mock_tool + + +@pytest.fixture +def mock_rest_api_tools(): + """Fixture for a list of mock RestApiTools.""" + tools = [] + for i in range(3): + mock_tool = mock.MagicMock( + spec=RestApiTool, description=f"Test Tool Description {i}" + ) + mock_tool.name = f"test_tool_{i}" + tools.append(mock_tool) + return tools + + +@pytest.fixture +def mock_openapi_toolset_instance(): # Renamed from mock_openapi_toolset + """Fixture for a mock OpenAPIToolset instance.""" + mock_toolset = mock.MagicMock(spec=OpenAPIToolset) + # Mock async methods if they are called + mock_toolset.get_tools = mock.AsyncMock(return_value=[]) + mock_toolset.close = mock.AsyncMock() + return mock_toolset + + +@pytest.fixture +def mock_converter_instance(): # Renamed from mock_converter + """Fixture for a mock GoogleApiToOpenApiConverter instance.""" + mock_conv = mock.MagicMock(spec=GoogleApiToOpenApiConverter) + mock_conv.convert.return_value = { + "components": { + "securitySchemes": { + "oauth2": { + "flows": { + "authorizationCode": { + "scopes": { + DEFAULT_SCOPE: "Full access to Google Calendar" + } + } + } + } + } + } + } + return mock_conv + + +@pytest.fixture +def mock_readonly_context(): + """Fixture for a mock ReadonlyContext.""" + return mock.MagicMock(spec=ReadonlyContext) + + +class TestGoogleApiToolset: + """Test suite for the GoogleApiToolset class.""" + + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.OpenAPIToolset" + ) + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.GoogleApiToOpenApiConverter" + ) + def test_init( + self, + mock_converter_class, + mock_openapi_toolset_class, + mock_converter_instance, + mock_openapi_toolset_instance, + ): + """Test GoogleApiToolset initialization.""" + mock_converter_class.return_value = mock_converter_instance + mock_openapi_toolset_class.return_value = mock_openapi_toolset_instance + + client_id = "test_client_id" + client_secret = "test_client_secret" + + tool_set = GoogleApiToolset( + api_name=TEST_API_NAME, + api_version=TEST_API_VERSION, + client_id=client_id, + client_secret=client_secret, + ) + + assert tool_set.api_name == TEST_API_NAME + assert tool_set.api_version == TEST_API_VERSION + assert tool_set._client_id == client_id + assert tool_set._client_secret == client_secret + assert tool_set._service_account is None + assert tool_set.tool_filter is None + assert tool_set._openapi_toolset == mock_openapi_toolset_instance + + mock_converter_class.assert_called_once_with( + TEST_API_NAME, TEST_API_VERSION + ) + mock_converter_instance.convert.assert_called_once() + spec_dict = mock_converter_instance.convert.return_value + + mock_openapi_toolset_class.assert_called_once() + _, kwargs = mock_openapi_toolset_class.call_args + assert kwargs["spec_dict"] == spec_dict + assert kwargs["spec_str_type"] == "yaml" + assert isinstance(kwargs["auth_scheme"], OpenIdConnectWithConfig) + assert kwargs["auth_scheme"].scopes == [DEFAULT_SCOPE] + + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.GoogleApiTool" + ) + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.OpenAPIToolset" + ) + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.GoogleApiToOpenApiConverter" + ) + async def test_get_tools( + self, + mock_converter_class, + mock_openapi_toolset_class, + mock_google_api_tool_class, + mock_converter_instance, + mock_openapi_toolset_instance, + mock_rest_api_tools, + mock_readonly_context, + ): + """Test get_tools method.""" + mock_converter_class.return_value = mock_converter_instance + mock_openapi_toolset_class.return_value = mock_openapi_toolset_instance + mock_openapi_toolset_instance.get_tools = mock.AsyncMock( + return_value=mock_rest_api_tools + ) + + # Setup mock GoogleApiTool instances to be returned by the constructor + mock_google_api_tool_instances = [ + mock.MagicMock(spec=GoogleApiTool, name=f"google_tool_{i}") + for i in range(len(mock_rest_api_tools)) + ] + mock_google_api_tool_class.side_effect = mock_google_api_tool_instances + + client_id = "cid" + client_secret = "csecret" + sa_mock = mock.MagicMock(spec=ServiceAccount) + + tool_set = GoogleApiToolset( + api_name=TEST_API_NAME, + api_version=TEST_API_VERSION, + client_id=client_id, + client_secret=client_secret, + service_account=sa_mock, + ) + + tools = await tool_set.get_tools(mock_readonly_context) + + assert len(tools) == len(mock_rest_api_tools) + mock_openapi_toolset_instance.get_tools.assert_called_once_with( + mock_readonly_context + ) + + for i, rest_tool in enumerate(mock_rest_api_tools): + mock_google_api_tool_class.assert_any_call( + rest_tool, client_id, client_secret, sa_mock + ) + assert tools[i] is mock_google_api_tool_instances[i] + + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.OpenAPIToolset" + ) + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.GoogleApiToOpenApiConverter" + ) + async def test_get_tools_with_filter_list( + self, + mock_converter_class, + mock_openapi_toolset_class, + mock_openapi_toolset_instance, + mock_rest_api_tools, # Has test_tool_0, test_tool_1, test_tool_2 + mock_readonly_context, + mock_converter_instance, + ): + """Test get_tools method with a list filter.""" + mock_converter_class.return_value = mock_converter_instance + mock_openapi_toolset_class.return_value = mock_openapi_toolset_instance + mock_openapi_toolset_instance.get_tools = mock.AsyncMock( + return_value=mock_rest_api_tools + ) + + tool_filter = ["test_tool_0", "test_tool_2"] + tool_set = GoogleApiToolset( + api_name=TEST_API_NAME, + api_version=TEST_API_VERSION, + tool_filter=tool_filter, + ) + + tools = await tool_set.get_tools(mock_readonly_context) + + assert len(tools) == 2 + assert tools[0].name == "test_tool_0" + assert tools[1].name == "test_tool_2" + + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.OpenAPIToolset" + ) + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.GoogleApiToOpenApiConverter" + ) + async def test_get_tools_with_filter_predicate( + self, + mock_converter_class, + mock_openapi_toolset_class, + mock_converter_instance, + mock_openapi_toolset_instance, + mock_rest_api_tools, # Has test_tool_0, test_tool_1, test_tool_2 + mock_readonly_context, + ): + """Test get_tools method with a predicate filter.""" + mock_converter_class.return_value = mock_converter_instance + mock_openapi_toolset_class.return_value = mock_openapi_toolset_instance + mock_openapi_toolset_instance.get_tools = mock.AsyncMock( + return_value=mock_rest_api_tools + ) + + class MyPredicate(ToolPredicate): + + def __call__( + self, + tool: BaseTool, + readonly_context: Optional[ReadonlyContext] = None, + ) -> bool: + return tool.name == "test_tool_1" + + tool_set = GoogleApiToolset( + api_name=TEST_API_NAME, + api_version=TEST_API_VERSION, + tool_filter=MyPredicate(), + ) + + tools = await tool_set.get_tools(mock_readonly_context) + + assert len(tools) == 1 + assert tools[0].name == "test_tool_1" + + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.OpenAPIToolset" + ) + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.GoogleApiToOpenApiConverter" + ) + def test_configure_auth( + self, + mock_converter_class, + mock_openapi_toolset_class, + mock_converter_instance, + mock_openapi_toolset_instance, + ): + """Test configure_auth method.""" + mock_converter_class.return_value = mock_converter_instance + mock_openapi_toolset_class.return_value = mock_openapi_toolset_instance + + tool_set = GoogleApiToolset( + api_name=TEST_API_NAME, api_version=TEST_API_VERSION + ) + client_id = "test_client_id" + client_secret = "test_client_secret" + + tool_set.configure_auth(client_id, client_secret) + + assert tool_set._client_id == client_id + assert tool_set._client_secret == client_secret + + # To verify its effect, we would ideally call get_tools and check + # how GoogleApiTool is instantiated. This is covered in test_get_tools. + + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.OpenAPIToolset" + ) + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.GoogleApiToOpenApiConverter" + ) + def test_configure_sa_auth( + self, + mock_converter_class, + mock_openapi_toolset_class, + mock_converter_instance, + mock_openapi_toolset_instance, + ): + """Test configure_sa_auth method.""" + mock_converter_class.return_value = mock_converter_instance + mock_openapi_toolset_class.return_value = mock_openapi_toolset_instance + + tool_set = GoogleApiToolset( + api_name=TEST_API_NAME, api_version=TEST_API_VERSION + ) + service_account = ServiceAccount( + service_account_credential=ServiceAccountCredential( + type="service_account", + project_id="project_id", + private_key_id="private_key_id", + private_key=( + "-----BEGIN PRIVATE KEY-----\nprivate_key\n-----END PRIVATE" + " KEY-----\n" + ), + client_email="client_email", + client_id="client_id", + auth_uri="auth_uri", + token_uri="token_uri", + auth_provider_x509_cert_url="auth_provider_x509_cert_url", + client_x509_cert_url="client_x509_cert_url", + universe_domain="universe_domain", + ), + scopes=["scope1", "scope2"], + ) + + tool_set.configure_sa_auth(service_account) + assert tool_set._service_account == service_account + # Effect verification is covered in test_get_tools. + + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.OpenAPIToolset" + ) + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.GoogleApiToOpenApiConverter" + ) + async def test_close( + self, + mock_converter_class, + mock_openapi_toolset_class, + mock_converter_instance, + mock_openapi_toolset_instance, + ): + """Test close method.""" + mock_converter_class.return_value = mock_converter_instance + mock_openapi_toolset_class.return_value = mock_openapi_toolset_instance + + tool_set = GoogleApiToolset( + api_name=TEST_API_NAME, api_version=TEST_API_VERSION + ) + await tool_set.close() + + mock_openapi_toolset_instance.close.assert_called_once() + + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.OpenAPIToolset" + ) + @mock.patch( + "google.adk.tools.google_api_tool.google_api_toolset.GoogleApiToOpenApiConverter" + ) + def test_set_tool_filter( + self, + mock_converter_class, + mock_openapi_toolset_class, + mock_converter_instance, + mock_openapi_toolset_instance, + ): + """Test set_tool_filter method.""" + mock_converter_class.return_value = mock_converter_instance + mock_openapi_toolset_class.return_value = mock_openapi_toolset_instance + + tool_set = GoogleApiToolset( + api_name=TEST_API_NAME, api_version=TEST_API_VERSION + ) + + assert tool_set.tool_filter is None + + new_filter_list = ["tool1", "tool2"] + tool_set.set_tool_filter(new_filter_list) + assert tool_set.tool_filter == new_filter_list + + def new_filter_predicate( + tool_name: str, + tool: RestApiTool, + readonly_context: Optional[ReadonlyContext] = None, + ) -> bool: + return True + + tool_set.set_tool_filter(new_filter_predicate) + assert tool_set.tool_filter == new_filter_predicate diff --git a/tests/unittests/tools/test_enterprise_web_search_tool.py b/tests/unittests/tools/test_enterprise_web_search_tool.py new file mode 100644 index 00000000..390da4a7 --- /dev/null +++ b/tests/unittests/tools/test_enterprise_web_search_tool.py @@ -0,0 +1,98 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from google.adk.agents.invocation_context import InvocationContext +from google.adk.agents.sequential_agent import SequentialAgent +from google.adk.models.llm_request import LlmRequest +from google.adk.sessions.in_memory_session_service import InMemorySessionService +from google.adk.tools.enterprise_search_tool import EnterpriseWebSearchTool +from google.adk.tools.tool_context import ToolContext +from google.genai import types +import pytest + + +async def _create_tool_context() -> ToolContext: + """Creates a ToolContext for testing.""" + session_service = InMemorySessionService() + session = await session_service.create_session( + app_name='test_app', user_id='test_user' + ) + agent = SequentialAgent(name='test_agent') + invocation_context = InvocationContext( + invocation_id='invocation_id', + agent=agent, + session=session, + session_service=session_service, + ) + return ToolContext(invocation_context) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + 'model_name', + [ + 'gemini-2.5-flash', + 'projects/test-project/locations/global/publishers/google/models/gemini-2.5-flash', + ], +) +async def test_process_llm_request_success_with_gemini_models(model_name): + tool = EnterpriseWebSearchTool() + llm_request = LlmRequest( + model=model_name, config=types.GenerateContentConfig() + ) + tool_context = await _create_tool_context() + + await tool.process_llm_request( + tool_context=tool_context, llm_request=llm_request + ) + + assert ( + llm_request.config.tools[0].enterprise_web_search + == types.EnterpriseWebSearch() + ) + + +@pytest.mark.asyncio +async def test_process_llm_request_failure_with_non_gemini_models(): + tool = EnterpriseWebSearchTool() + llm_request = LlmRequest(model='gpt-4o', config=types.GenerateContentConfig()) + tool_context = await _create_tool_context() + + with pytest.raises(ValueError) as exc_info: + await tool.process_llm_request( + tool_context=tool_context, llm_request=llm_request + ) + assert 'is not supported for model' in str(exc_info.value) + + +@pytest.mark.asyncio +async def test_process_llm_request_failure_with_multiple_tools_gemini_1_models(): + tool = EnterpriseWebSearchTool() + llm_request = LlmRequest( + model='gemini-1.5-flash', + config=types.GenerateContentConfig( + tools=[ + types.Tool(google_search=types.GoogleSearch()), + ] + ), + ) + tool_context = await _create_tool_context() + + with pytest.raises(ValueError) as exc_info: + await tool.process_llm_request( + tool_context=tool_context, llm_request=llm_request + ) + assert 'can not be used with other tools in Gemini 1.x.' in str( + exc_info.value + )