From 8df25dec32629ee55c82b37b60e86e2f67f3ccc5 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 27 Sep 2026 20:21:12 +0200 Subject: [PATCH 001/390] Development on 3.1.0.dev7 --- gns3server/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index 78a8ee540..2b8d74b08 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -22,8 +22,8 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "3.1.0a6" -__version_info__ = (3, 1, 0, -99) +__version__ = "3.1.0.dev7" +__version_info__ = (3, 1, 0, 99) if "dev" in __version__: try: From 25125567707c49a4426281297924526a427717d2 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:42:58 +0000 Subject: [PATCH 002/390] fix(typing): resolve mypy errors in config --- gns3server/config.py | 8 ++++++-- pyproject.toml | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gns3server/config.py b/gns3server/config.py index 0baf2fe2f..ed1507f4e 100644 --- a/gns3server/config.py +++ b/gns3server/config.py @@ -48,6 +48,10 @@ class ConfigConflictError(Exception): LIST_OPTION_SEPARATORS = {"additional_images_paths": ";"} +def parser_sections(parser: configparser.ConfigParser) -> dict[str, dict[str, str]]: + return {section: dict(parser[section]) for section in parser.sections()} + + class Config: """ Configuration file management using configparser. @@ -328,7 +332,7 @@ class Config: changed.append(f"{section}.{option}") # validate the merged settings before touching the file on disk - ServerConfig(**merged_parser._sections) + ServerConfig(**parser_sections(merged_parser)) directory_name = os.path.dirname(main_config_file) if directory_name: @@ -414,7 +418,7 @@ class Config: self._watched_files[file] = os.stat(file).st_mtime try: - self._settings = ServerConfig(**config._sections) + self._settings = ServerConfig(**parser_sections(config)) except ValidationError as e: log.critical(f"Could not validate configuration file settings: {e}") raise diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..74a32a924 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -372,7 +372,6 @@ module = [ "gns3server.compute.virtualbox.virtualbox_vm", # 1 "gns3server.compute.vmware.vmware_vm", # 1 "gns3server.compute.vpcs.vpcs_vm", # 2 - "gns3server.config", # 1 "gns3server.controller.appliance", # 2 "gns3server.controller.appliance_manager", # 5 "gns3server.controller.compute", # 2 From f858ae23a6e283f03e41f555db01ff8e6bde63dc Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:41:54 +0000 Subject: [PATCH 003/390] fix(typing): resolve mypy errors in api.routes.index --- gns3server/api/routes/index.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/api/routes/index.py b/gns3server/api/routes/index.py index 365840b8c..23e859bc2 100644 --- a/gns3server/api/routes/index.py +++ b/gns3server/api/routes/index.py @@ -36,7 +36,7 @@ async def root(): @router.get("/debug", response_class=HTMLResponse, deprecated=True, include_in_schema=False) def debug(request: Request): - kwargs = {"gns3_version": __version__, "gns3_host": request.client.host} + kwargs = {"gns3_version": __version__, "gns3_host": request.client.host if request.client else None} return templates.TemplateResponse(request=request, name="index.html", context=kwargs) diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..8da681384 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -359,7 +359,6 @@ module = [ "gns3server.api.routes.controller.snapshots", # 1 "gns3server.api.routes.controller.templates", # 10 "gns3server.api.routes.controller.users", # 14 - "gns3server.api.routes.index", # 1 "gns3server.api.server", # 2 "gns3server.compute.docker.docker_vm", # 3 "gns3server.compute.docker.iol_docker_vm", # 3 From b8ae84031eee359aac0ba03c5d6e68ad3a1cb1d1 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:45:19 +0000 Subject: [PATCH 004/390] fix(typing): resolve mypy errors in compute.docker vm modules --- gns3server/compute/docker/docker_vm.py | 20 +++++++++++++------- gns3server/compute/docker/iol_docker_vm.py | 20 +++++++++++++++----- pyproject.toml | 2 -- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/gns3server/compute/docker/docker_vm.py b/gns3server/compute/docker/docker_vm.py index 7d557dff2..08559b990 100644 --- a/gns3server/compute/docker/docker_vm.py +++ b/gns3server/compute/docker/docker_vm.py @@ -227,7 +227,11 @@ class DockerVM(BaseNode): return display display += 1 - @BaseNode.name.setter + @property + def name(self): + return self._name + + @name.setter def name(self, new_name): """ Sets the name of this Qemu VM. @@ -737,13 +741,15 @@ class DockerVM(BaseNode): params["Env"].append("{}={}".format(var_name, formatted)) if self._environment: - for e in self._environment.strip().split("\n"): - e = e.strip() - if e.split("=")[0] == "": - self.project.emit("log.warning", {"message": f"{self.name} has invalid environment variable: {e}"}) + for env in self._environment.strip().split("\n"): + env = env.strip() + if env.split("=")[0] == "": + self.project.emit( + "log.warning", {"message": f"{self.name} has invalid environment variable: {env}"} + ) continue - if not e.startswith("GNS3_"): - formatted = self._format_env(variables, e) + if not env.startswith("GNS3_"): + formatted = self._format_env(variables, env) vm_name = self._name.replace(",", ",,") project_path = self.project.path.replace(",", ",,") formatted = formatted.replace("%vm-name%", '"' + vm_name.replace('"', '\\"') + '"') diff --git a/gns3server/compute/docker/iol_docker_vm.py b/gns3server/compute/docker/iol_docker_vm.py index ff0ab2b00..070195e6b 100644 --- a/gns3server/compute/docker/iol_docker_vm.py +++ b/gns3server/compute/docker/iol_docker_vm.py @@ -92,8 +92,8 @@ class IOLDockerVM(VendorDockerVM): # controller-allocated application id (MACs would flip to the fallback # hash, colliding with the allocation pool) and any pending # startup-config delivered by a PUT. - _application_id = None - _startup_config_content = None + _application_id: int | None = None + _startup_config_content: str | None = None _startup_config_dirty = False def _parse_vendor_environment(self): @@ -119,7 +119,7 @@ class IOLDockerVM(VendorDockerVM): pass @property - def application_id(self) -> int: + def application_id(self) -> int | None: """ IOL application ID: drives interface MACs (aabb.cc{app}{iface}) and the NVRAM file name. Allocated by the controller from the IOL Docker @@ -178,6 +178,8 @@ class IOLDockerVM(VendorDockerVM): initial configuration dialog. """ + if self._startup_config_content is None: + return content = self._startup_config_content.replace("%h", self._name) nvram_file = self._iol_nvram_file() os.makedirs(os.path.dirname(nvram_file), exist_ok=True) @@ -189,7 +191,11 @@ class IOLDockerVM(VendorDockerVM): raise DockerError(f"Could not write IOL startup-config to NVRAM of container '{self._name}': {e}") log.debug("IOL container '%s': startup-config written to %s", self._name, nvram_file) - @DockerVM.name.setter + @property + def name(self): + return self._name + + @name.setter def name(self, new_name): """ Override: keep the hostname line inside the NVRAM in sync with the @@ -228,7 +234,11 @@ class IOLDockerVM(VendorDockerVM): result["startup_config_content"] = self._startup_config_content return result - @DockerVM.adapters.setter + @property + def adapters(self): + return len(self._ethernet_adapters) + + @adapters.setter def adapters(self, adapters): """ Override: one IOL adapter is a 4-port unit — the IOU model. The diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..4b0d7a76c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -361,8 +361,6 @@ module = [ "gns3server.api.routes.controller.users", # 14 "gns3server.api.routes.index", # 1 "gns3server.api.server", # 2 - "gns3server.compute.docker.docker_vm", # 3 - "gns3server.compute.docker.iol_docker_vm", # 3 "gns3server.compute.dynamips.nodes.router", # 2 "gns3server.compute.iou.iou_vm", # 4 "gns3server.compute.iou.utils.iou_export", # 2 From 667b0531f6feff818527c0c8113eb81476e6da96 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:41:28 +0000 Subject: [PATCH 005/390] fix(typing): resolve mypy errors in compute.project --- gns3server/compute/project.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/compute/project.py b/gns3server/compute/project.py index 6f683d5bc..8e6ef7648 100644 --- a/gns3server/compute/project.py +++ b/gns3server/compute/project.py @@ -466,7 +466,7 @@ class Project: ) # Non-recursive: list only the current directory level - files = [] + files: list[dict] = [] try: scandir_iter = os.scandir(target_path) except PermissionError: diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..cbf8d4d6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -367,7 +367,6 @@ module = [ "gns3server.compute.iou.iou_vm", # 4 "gns3server.compute.iou.utils.iou_export", # 2 "gns3server.compute.iou.utils.iou_import", # 2 - "gns3server.compute.project", # 1 "gns3server.compute.qemu.qemu_vm", # 2 "gns3server.compute.virtualbox.virtualbox_vm", # 1 "gns3server.compute.vmware.vmware_vm", # 1 From fdfb2d559192e0dcba474e3616c6a7e8dd1bded3 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:43:42 +0000 Subject: [PATCH 006/390] fix(typing): resolve mypy errors in compute.vmware.vmware_vm --- gns3server/compute/vmware/vmware_vm.py | 6 +++++- pyproject.toml | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gns3server/compute/vmware/vmware_vm.py b/gns3server/compute/vmware/vmware_vm.py index d36074f0b..b56b420a2 100644 --- a/gns3server/compute/vmware/vmware_vm.py +++ b/gns3server/compute/vmware/vmware_vm.py @@ -952,7 +952,11 @@ class VMwareVM(BaseNode): await self._stop_remote_console() await self._start_console() - @BaseNode.console_type.setter + @property + def console_type(self): + return self._console_type + + @console_type.setter def console_type(self, new_console_type): """ Sets the console type for this VMware VM. diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..d12703ee3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -370,7 +370,6 @@ module = [ "gns3server.compute.project", # 1 "gns3server.compute.qemu.qemu_vm", # 2 "gns3server.compute.virtualbox.virtualbox_vm", # 1 - "gns3server.compute.vmware.vmware_vm", # 1 "gns3server.compute.vpcs.vpcs_vm", # 2 "gns3server.config", # 1 "gns3server.controller.appliance", # 2 From d1df96e0a62550d84851dd26e57d686cb9632a7f Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:43:20 +0000 Subject: [PATCH 007/390] fix(typing): resolve mypy errors in utils.asyncio.embed_shell --- gns3server/utils/asyncio/embed_shell.py | 5 ++--- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/gns3server/utils/asyncio/embed_shell.py b/gns3server/utils/asyncio/embed_shell.py index 3efd0bdbc..7059c9e29 100644 --- a/gns3server/utils/asyncio/embed_shell.py +++ b/gns3server/utils/asyncio/embed_shell.py @@ -236,12 +236,11 @@ class ShellConnection(TelnetConnection): async def disconnected(self): pass - @asyncio.coroutine - def window_size_changed(self, columns, rows): + async def window_size_changed(self, columns, rows): self._size = Size(rows=rows, columns=columns) self._cb.terminal_size_changed() if self._window_size_changed_callback: - yield from self._window_size_changed_callback(columns, rows) + await self._window_size_changed_callback(columns, rows) async def feed(self, data): data = data.decode() diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..f85a8ea85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -421,7 +421,6 @@ module = [ "gns3server.services.computes", # 4 "gns3server.services.templates", # 18 "gns3server.utils.asyncio.aiozipstream", # 8 - "gns3server.utils.asyncio.embed_shell", # 1 "gns3server.utils.encryption", # 2 "gns3server.utils.http_client", # 4 "gns3server.utils.images", # 4 From 21643fe89d4a0fabfabd1f71aa96df515cb78c42 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:56:59 +0000 Subject: [PATCH 008/390] fix(typing): resolve mypy errors in controller.compute --- gns3server/controller/compute.py | 14 +++++++------- pyproject.toml | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gns3server/controller/compute.py b/gns3server/controller/compute.py index 6c22d16b2..f42f2e3a0 100644 --- a/gns3server/controller/compute.py +++ b/gns3server/controller/compute.py @@ -216,6 +216,13 @@ class Compute: """ return self._host + @host.setter + def host(self, host): + self._host = host + self._host_ip_cache = None # invalidate; re-resolve on next access + if self._console_host is None: + self._console_host = host + @property def host_ip(self): """ @@ -228,13 +235,6 @@ class Compute: self._host_ip_cache = "0.0.0.0" return self._host_ip_cache - @host.setter - def host(self, host): - self._host = host - self._host_ip_cache = None # invalidate; re-resolve on next access - if self._console_host is None: - self._console_host = host - @property def console_host(self): return self._console_host diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..51eaeee42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -375,7 +375,6 @@ module = [ "gns3server.config", # 1 "gns3server.controller.appliance", # 2 "gns3server.controller.appliance_manager", # 5 - "gns3server.controller.compute", # 2 "gns3server.controller.project", # 2 "gns3server.controller.topology", # 1 "gns3server.db.models.acl", # 1 From 525ef8ca573337c9ee33e3a1a115d8e213f17788 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:44:08 +0000 Subject: [PATCH 009/390] fix(typing): resolve mypy errors in compute.qemu.qemu_vm --- gns3server/compute/qemu/qemu_vm.py | 12 ++++++++++-- pyproject.toml | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gns3server/compute/qemu/qemu_vm.py b/gns3server/compute/qemu/qemu_vm.py index 25721b309..465a7bc03 100644 --- a/gns3server/compute/qemu/qemu_vm.py +++ b/gns3server/compute/qemu/qemu_vm.py @@ -189,7 +189,11 @@ class QemuVM(BaseNode): log.debug(f'QEMU VM "{self._name}" [{self._id}] has been created') - @BaseNode.name.setter + @property + def name(self): + return self._name + + @name.setter def name(self, new_name): """ Sets the name of this Qemu VM. @@ -1864,7 +1868,11 @@ class QemuVM(BaseNode): return " ".join(self._build_command()) - @BaseNode.console_type.setter + @property + def console_type(self): + return self._console_type + + @console_type.setter def console_type(self, new_console_type): """ Sets the console type for this QEMU VM. diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..c00d93afd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -368,7 +368,6 @@ module = [ "gns3server.compute.iou.utils.iou_export", # 2 "gns3server.compute.iou.utils.iou_import", # 2 "gns3server.compute.project", # 1 - "gns3server.compute.qemu.qemu_vm", # 2 "gns3server.compute.virtualbox.virtualbox_vm", # 1 "gns3server.compute.vmware.vmware_vm", # 1 "gns3server.compute.vpcs.vpcs_vm", # 2 From 798edca81d8d61d1be93ceb30afdd0ce7c3c6eb7 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 12:40:51 +0300 Subject: [PATCH 010/390] Remove qemu_vm typing ignore from pyproject.toml --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a95f406c0..5027880e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -365,7 +365,6 @@ module = [ "gns3server.compute.iou.utils.iou_export", # 2 "gns3server.compute.iou.utils.iou_import", # 2 "gns3server.compute.project", # 1 - "gns3server.compute.qemu.qemu_vm", # 2 "gns3server.compute.virtualbox.virtualbox_vm", # 1 "gns3server.compute.vpcs.vpcs_vm", # 2 "gns3server.controller.appliance", # 2 From 6bff55d3c710784c35a9d439b5f8f91a9df28233 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 12:41:51 +0300 Subject: [PATCH 011/390] Remove gns3server.compute.project from pyproject.toml Removed 'gns3server.compute.project' from the list. --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5027880e6..5f0789a77 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -364,7 +364,6 @@ module = [ "gns3server.compute.iou.iou_vm", # 4 "gns3server.compute.iou.utils.iou_export", # 2 "gns3server.compute.iou.utils.iou_import", # 2 - "gns3server.compute.project", # 1 "gns3server.compute.virtualbox.virtualbox_vm", # 1 "gns3server.compute.vpcs.vpcs_vm", # 2 "gns3server.controller.appliance", # 2 From 046dff4d0819d2224ccb6a0638947a9f4dd7ba33 Mon Sep 17 00:00:00 2001 From: Cristi Date: Mon, 28 Sep 2026 16:01:36 +0300 Subject: [PATCH 012/390] fix(images): reconcile the image inventory with filesystem changes --- docs/README.md | 10 + gns3server/api/routes/controller/images.py | 127 ++-- gns3server/controller/appliance_manager.py | 12 +- gns3server/core/tasks.py | 32 +- gns3server/db/models/__init__.py | 2 +- gns3server/db/models/images.py | 19 +- gns3server/db/repositories/images.py | 160 ++++- gns3server/db/repositories/templates.py | 40 +- gns3server/db/tasks.py | 169 +---- ...a2b7c401_image_inventory_reconciliation.py | 50 ++ gns3server/schemas/__init__.py | 2 +- gns3server/schemas/config.py | 2 + gns3server/schemas/controller/images.py | 23 + gns3server/schemas/controller/settings.py | 1 + gns3server/services/image_reconciliation.py | 450 +++++++++++++ gns3server/services/templates.py | 3 +- gns3server/utils/image_inventory.py | 96 +++ gns3server/utils/images.py | 144 ++-- .../api/routes/controller/test_image_sync.py | 130 ++++ tests/api/routes/controller/test_images.py | 11 +- tests/conftest.py | 33 +- tests/services/test_image_reconciliation.py | 628 ++++++++++++++++++ 22 files changed, 1809 insertions(+), 335 deletions(-) create mode 100644 gns3server/db_migrations/versions/d9e8a2b7c401_image_inventory_reconciliation.py create mode 100644 gns3server/services/image_reconciliation.py create mode 100644 gns3server/utils/image_inventory.py create mode 100644 tests/api/routes/controller/test_image_sync.py create mode 100644 tests/services/test_image_reconciliation.py diff --git a/docs/README.md b/docs/README.md index ea1581292..6c0887b2a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -59,6 +59,16 @@ docs/ ## Features +### Image inventory synchronization +Image Manager's **Sync Images** action reconciles the catalog with the configured +image directories. Automatic synchronization uses filesystem events and periodic +scans (`auto_discover_images`, `image_sync_interval`, default 900 seconds). +New and changed images are checksummed; missing records retain their IDs and +template associations and become available again when restored at the same path. +The `/v3/images/sync` API supports dry-run and forced checksum verification. +Database migration `d9e8a2b7c401` is required when upgrading an existing catalog. +Atomic image publication requires filesystem hard-link support. + ### Controller + Compute Setup (`features/compute-controller-setup.md`) Architecture and minimum configuration for setting up GNS3 Controller with remote Compute nodes. Covers compute node config, controller registration, and multi-compute deployment. diff --git a/gns3server/api/routes/controller/images.py b/gns3server/api/routes/controller/images.py index fe27c20d8..d639e69fa 100644 --- a/gns3server/api/routes/controller/images.py +++ b/gns3server/api/routes/controller/images.py @@ -21,12 +21,14 @@ API routes for images. import os import logging import urllib.parse +import tempfile -from fastapi import APIRouter, Request, Depends, status +from fastapi import APIRouter, Request, Response, Depends, Query, status from fastapi.encoders import jsonable_encoder from starlette.requests import ClientDisconnect from sqlalchemy.orm.exc import MultipleResultsFound -from typing import List, Optional +from sqlalchemy.exc import SQLAlchemyError +from typing import List, Optional, Literal from gns3server import schemas from gns3server.config import Config @@ -36,6 +38,8 @@ from gns3server.db.repositories.images import ImagesRepository from gns3server.db.repositories.templates import TemplatesRepository from gns3server.db.repositories.rbac import RbacRepository from gns3server.controller import Controller +from gns3server.services.image_reconciliation import get_image_reconciliation_service +from gns3server.utils.image_inventory import contained_path, image_lock, publish_image, fingerprint, ImageLockBusy from gns3server.controller.controller_error import ( ControllerError, ControllerNotFoundError, @@ -51,6 +55,37 @@ log = logging.getLogger(__name__) router = APIRouter() + +def image_destination(image_path): + root = os.path.realpath(os.path.expanduser(Config.instance().settings.Server.images_path)) + full_path = os.path.abspath(os.path.join(root, image_path)) + if not contained_path(os.path.realpath(full_path), root): + raise ControllerForbiddenError(f"Cannot write image, '{image_path}' is forbidden") + return full_path + + +@router.post("/sync", response_model=schemas.ImageSyncJob, status_code=status.HTTP_202_ACCEPTED, + dependencies=[Depends(has_privilege("Image.Allocate"))]) +async def sync_images(options: schemas.ImageSyncRequest, request: Request, response: Response): + """Reconcile configured image directories without deleting files or references.""" + try: + job = await get_image_reconciliation_service(request.app).start(**options.model_dump()) + except ImageLockBusy: + raise ControllerError("Image synchronization is already running or shutting down") + response.headers["Location"] = str(request.url_for("get_image_sync_job", job_id=job["job_id"])) + return job + + +@router.get("/sync/jobs/{job_id}", response_model=schemas.ImageSyncJob, + dependencies=[Depends(has_privilege("Image.Audit"))]) +async def get_image_sync_job(job_id: str, request: Request, + offset: int = Query(0, ge=0), limit: int = Query(100, ge=1, le=1000)): + """Get progress and a page of errors (first 1,000 errors retained per job).""" + job = await get_image_reconciliation_service(request.app).get_job(job_id, offset, limit) + if job is None: + raise ControllerNotFoundError(f"Image synchronization job '{job_id}' not found") + return job + @router.post( "/qemu/{image_path:path}", response_model=schemas.Image, @@ -76,33 +111,32 @@ async def create_qemu_image( disk_image_path = urllib.parse.unquote(image_path) image_dir, image_name = os.path.split(disk_image_path) # check if the path is within the default images directory - base_images_directory = os.path.expanduser(Config.instance().settings.Server.images_path) - full_path = os.path.abspath(os.path.join(base_images_directory, image_dir, image_name)) - if os.path.commonprefix([base_images_directory, full_path]) != base_images_directory: - raise ControllerForbiddenError(f"Cannot write disk image, '{disk_image_path}' is forbidden") + disk_image_path = image_destination(disk_image_path) if not image_dir: # put the image in the default images directory for Qemu directory = default_images_directory(image_type="qemu") os.makedirs(directory, exist_ok=True) - disk_image_path = os.path.abspath(os.path.join(directory, disk_image_path)) + disk_image_path = image_destination(os.path.join(directory, image_name)) - if await images_repo.get_image(disk_image_path): - raise ControllerBadRequestError(f"Disk image '{disk_image_path}' already exists") - - options = jsonable_encoder(image_data, exclude_unset=True) - # FIXME: should we have the create_disk_image in the compute code since - # this code is used to create images on the controller? - await Qemu.instance().create_disk_image(disk_image_path, options) - - image_info = await read_image_info(disk_image_path, "qemu") - - image = await images_repo.get_image(disk_image_path) - if image: - # the image has already been added to the database - return image - else: - return await images_repo.add_image(**image_info) + async with image_lock(disk_image_path): + if os.path.lexists(disk_image_path): + raise ControllerBadRequestError(f"Disk image '{disk_image_path}' already exists") + os.makedirs(os.path.dirname(disk_image_path), exist_ok=True) + fd, temporary = tempfile.mkstemp(prefix=".gns3-create-", suffix=".tmp", dir=os.path.dirname(disk_image_path)) + os.close(fd) + try: + options = jsonable_encoder(image_data, exclude_unset=True) + await Qemu.instance().create_disk_image(temporary, options) + image_info = await read_image_info(temporary, "qemu", allow_raw_image=allow_raw_image) + publish_image(temporary, disk_image_path) + image_info.update(path=disk_image_path, image_name=image_name, file_fingerprint=fingerprint(disk_image_path)) + return await images_repo.save_verified_image(image_info) + except (OSError, InvalidImageError, SQLAlchemyError) as e: + raise ControllerError(f"Could not create disk image '{disk_image_path}': {e}") from e + finally: + if os.path.exists(temporary): + os.unlink(temporary) @router.get( "", @@ -111,7 +145,8 @@ async def create_qemu_image( ) async def get_images( images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)), - image_type: Optional[schemas.ImageType] = None + image_type: Optional[schemas.ImageType] = None, + availability: Optional[Literal["unknown", "available", "missing", "unavailable", "invalid"]] = None ) -> List[schemas.Image]: """ Return all images. @@ -119,7 +154,7 @@ async def get_images( Required privilege: Image.Audit """ - return await images_repo.get_images(image_type) + return await images_repo.get_images(image_type, availability) @router.post( @@ -149,10 +184,7 @@ async def upload_image( image_path = urllib.parse.unquote(image_path) image_dir, image_name = os.path.split(image_path) # check if the path is within the default images directory - base_images_directory = os.path.expanduser(Config.instance().settings.Server.images_path) - full_path = os.path.abspath(os.path.join(base_images_directory, image_dir, image_name)) - if os.path.commonprefix([base_images_directory, full_path]) != base_images_directory: - raise ControllerForbiddenError(f"Cannot write image, '{image_path}' is forbidden") + full_path = image_destination(image_path) # If the client sends X-MD5-Checksum, check for a duplicate before consuming the upload stream checksum_header = request.headers.get("X-MD5-Checksum") @@ -168,7 +200,10 @@ async def upload_image( try: allow_raw_image = Config.instance().settings.Server.allow_raw_images image = await write_image(image_path, full_path, request.stream(), images_repo, allow_raw_image=allow_raw_image) - except (OSError, InvalidImageError, ClientDisconnect) as e: + except (OSError, InvalidImageError, ClientDisconnect, SQLAlchemyError) as e: + service = getattr(request.app.state, "image_reconciliation", None) + if service: + service.dirty.set() raise ControllerError(f"Could not save image '{image_path}': {e}") if install_appliances: @@ -206,7 +241,9 @@ async def prune_images( # a single pass over all projects' node properties protects every # referenced file name at once referenced_filenames = Controller.instance().collect_referenced_image_filenames() - await images_repo.prune_images(list(skip_images) + list(referenced_filenames)) + await images_repo.prune_images( + list(skip_images) + list(referenced_filenames), + is_in_use=Controller.instance().find_projects_using_image) @router.post( @@ -232,6 +269,9 @@ async def install_images( skip_images = get_builtin_disks() images = await images_repo.get_images() for image in images: + if not await images_repo.is_usable(image): + skipped.append({"name": image.filename, "reason": "image is missing, changed or unreadable; synchronize images first"}) + continue if skip_images and image.filename in skip_images: log.debug(f"Skipping image '{image.path}' for image installation") continue @@ -318,11 +358,20 @@ async def delete_image( if project_names: raise ControllerError(f"Image '{image_path}' is used by one or more projects: {', '.join(project_names)}") - try: - os.remove(image.path) - except OSError: - log.warning(f"Could not delete image file {image.path}") - - success = await images_repo.delete_image(image_path) - if not success: - raise ControllerError(f"Image '{image_path}' could not be deleted") + path = image.path + revision = (image.image_id, image.checksum, image.file_fingerprint) + async with image_lock(path): + image = await images_repo.get_image(path, refresh=True) + if image is None or (image.image_id, image.checksum, image.file_fingerprint) != revision: + raise ControllerError(f"Image '{image_path}' changed while waiting for deletion; refresh and retry") + # Recheck usage after waiting for a concurrent writer/scanner. + if await images_repo.get_image_templates(image.image_id) or Controller.instance().find_projects_using_image(image.filename): + raise ControllerError(f"Image '{image_path}' is in use") + try: + os.remove(image.path) + except FileNotFoundError: + pass + except OSError as e: + raise ControllerError(f"Could not delete image file '{image.path}': {e}") from e + if not await images_repo.delete_image_exact(image.image_id): + raise ControllerError(f"Image '{image_path}' could not be deleted") diff --git a/gns3server/controller/appliance_manager.py b/gns3server/controller/appliance_manager.py index e411b9852..7f6969d52 100644 --- a/gns3server/controller/appliance_manager.py +++ b/gns3server/controller/appliance_manager.py @@ -35,6 +35,7 @@ from ..utils.http_client import HTTPClient from .controller_error import ControllerBadRequestError, ControllerNotFoundError, ControllerError from .appliance_to_template import ApplianceToTemplate from ..utils.images import InvalidImageError, write_image, read_image_info +from ..utils.image_inventory import image_lock from gns3server import schemas from gns3server.schemas.controller.appliances import ApplianceModel @@ -184,13 +185,14 @@ class ApplianceManager: # check if the image is on disk but it not yet in the database image_path = os.path.join(image_dir, appliance_file) if os.path.exists(image_path): - image_info = await read_image_info(image_path) - if image_info.get("checksum") == image_checksum: - log.info(f"Adding image '{image_path}' to the database") + async with image_lock(image_path): + image_info = await read_image_info(image_path, allow_raw_image=True) + if image_info["checksum"] != image_checksum: + raise ControllerError(f"Image '{image_path}' does not match the appliance checksum") try: - await images_repo.add_image(**image_info) + await images_repo.save_verified_image(image_info) except SQLAlchemyError as e: - log.warning(f"Error while adding image '{image['path']}' to the database: {e}") + raise ControllerError(f"Could not register image '{image_path}': {e}") from e else: # download the image if there is a direct download URL direct_download_url = image.get("direct_download_url") diff --git a/gns3server/core/tasks.py b/gns3server/core/tasks.py index 0b745a067..dfea5e7ab 100644 --- a/gns3server/core/tasks.py +++ b/gns3server/core/tasks.py @@ -26,22 +26,22 @@ from gns3server.compute import MODULES from gns3server.compute.port_manager import PortManager from gns3server.compute.marker.marker_manager import MarkerManager from gns3server.utils.http_client import HTTPClient -from gns3server.db.tasks import connect_to_db, get_computes, disconnect_from_db, discover_images_on_filesystem +from gns3server.db.tasks import connect_to_db, get_computes, disconnect_from_db +from gns3server.services.image_reconciliation import get_image_reconciliation_service import logging log = logging.getLogger(__name__) -auto_discover_images_task_handle = None - - @asynccontextmanager async def lifespan(app: FastAPI): await startup(app) - yield - await shutdown(app) + try: + yield + finally: + await shutdown(app) async def startup(app: FastAPI) -> None: @@ -66,19 +66,7 @@ async def startup(app: FastAPI) -> None: await Controller.instance().start(computes) - # Because with a large image collection - # without md5sum already computed we start the - # computing with server start - from gns3server.compute.qemu import Qemu - - if Config.instance().settings.Server.auto_discover_images is True: - # Start the discovering new images on file system 5 seconds after the server has started - # to give it a chance to process API requests - global auto_discover_images_task_handle - auto_discover_images_task_handle = asyncio.get_event_loop().call_later( - 5, - lambda: asyncio.create_task(discover_images_on_filesystem(app)) - ) + get_image_reconciliation_service(app).start_background() for module in MODULES: log.debug(f"Loading module {module.__name__}") @@ -107,8 +95,10 @@ async def shutdown(app: FastAPI) -> None: Tasks to be performed when the server is exiting. """ - if auto_discover_images_task_handle is not None and not auto_discover_images_task_handle.cancelled(): - auto_discover_images_task_handle.cancel() + service = getattr(app.state, "image_reconciliation", None) + if service is not None: + await service.close() + del app.state.image_reconciliation await HTTPClient.close_session() await MarkerManager.instance().stop() # Kill resident sharkd sessions (marker replay) and drop their /tmp diff --git a/gns3server/db/models/__init__.py b/gns3server/db/models/__init__.py index cd538b80d..e5e234be4 100644 --- a/gns3server/db/models/__init__.py +++ b/gns3server/db/models/__init__.py @@ -21,7 +21,7 @@ from .users import User, UserGroup from .roles import Role from .privileges import Privilege from .computes import Compute -from .images import Image +from .images import Image, ImageSyncJob from .pools import Resource, ResourcePool from .llm_model_configs import LLMModelConfig from .api_keys import ApiKey diff --git a/gns3server/db/models/images.py b/gns3server/db/models/images.py index 529afe4bf..73b872087 100644 --- a/gns3server/db/models/images.py +++ b/gns3server/db/models/images.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from sqlalchemy import Table, Column, String, ForeignKey, BigInteger, Integer +from sqlalchemy import Table, Column, String, ForeignKey, BigInteger, Integer, DateTime, JSON, Boolean from sqlalchemy.orm import relationship from .base import Base, BaseTable, GUID @@ -40,4 +40,21 @@ class Image(BaseTable): image_size = Column(BigInteger) checksum = Column(String, index=True) checksum_algorithm = Column(String) + availability = Column(String, nullable=False, default="unknown", server_default="unknown") + file_fingerprint = Column(String) + last_seen_at = Column(DateTime) + last_verified_at = Column(DateTime) + last_error = Column(String) templates = relationship("Template", secondary=image_template_map, back_populates="images") + + +class ImageSyncJob(BaseTable): + __tablename__ = "image_sync_jobs" + + job_id = Column(String, primary_key=True) + status = Column(String, nullable=False) + dry_run = Column(Boolean, nullable=False) + force_checksum = Column(Boolean, nullable=False) + finished_at = Column(DateTime) + counts = Column(JSON, nullable=False) + errors = Column(JSON, nullable=False) diff --git a/gns3server/db/repositories/images.py b/gns3server/db/repositories/images.py index 8f6c64dc9..a34c116f8 100644 --- a/gns3server/db/repositories/images.py +++ b/gns3server/db/repositories/images.py @@ -16,10 +16,14 @@ # along with this program. If not, see . import os +import asyncio +from datetime import datetime, timezone -from typing import Optional, List +from typing import Optional, List, Callable from sqlalchemy import select, delete, update from sqlalchemy.ext.asyncio import AsyncSession +from sqlalchemy.exc import IntegrityError +from gns3server.utils.image_inventory import fingerprint, image_lock, normalized_path from .base import BaseRepository @@ -36,18 +40,21 @@ class ImagesRepository(BaseRepository): super().__init__(db_session) - async def get_image(self, image_path: str) -> Optional[models.Image]: + async def get_image(self, image_path: str, *, refresh: bool = False) -> Optional[models.Image]: """ Get an image by its path. """ image_dir, image_name = os.path.split(image_path) - if image_dir: + if os.path.isabs(image_path): + query = select(models.Image).where(models.Image.path == image_path) + elif image_dir: query = select(models.Image).\ - where(models.Image.filename == image_name, models.Image.path.endswith(image_path)) + where(models.Image.filename == image_name, + models.Image.path.endswith(os.sep + image_path, autoescape=True)) else: query = select(models.Image).where(models.Image.filename == image_name) - result = await self._db_session.execute(query) + result = await self._db_session.execute(query.execution_options(populate_existing=refresh)) return result.scalars().one_or_none() async def get_image_by_checksum(self, checksum: str, image_dir: str = None) -> Optional[models.Image]: @@ -55,17 +62,28 @@ class ImagesRepository(BaseRepository): Get an image by its checksum. """ - if image_dir: - query = select(models.Image).\ - where(models.Image.checksum == checksum, models.Image.path.startswith(image_dir)) - result = await self._db_session.execute(query) - return result.scalars().one_or_none() - else: - query = select(models.Image).where(models.Image.checksum == checksum) - result = await self._db_session.execute(query) - return result.scalars().first() + query = select(models.Image).where(models.Image.checksum == checksum).order_by(models.Image.image_id) + result = await self._db_session.execute(query) + for image in result.scalars().all(): + if image_dir and normalized_path(os.path.dirname(image.path)) != normalized_path(image_dir): + continue + if await self.is_usable(image): + return image + return None - async def get_images(self, image_type=None) -> List[models.Image]: + async def is_usable(self, image: models.Image) -> bool: + """Validate a checksum candidate without trusting stale catalog/sidecar data.""" + from gns3server.utils.images import inspect_image_file, InvalidImageError + try: + current = await asyncio.to_thread(fingerprint, image.path) + if image.availability == "available" and image.file_fingerprint == current: + return True + info = await asyncio.to_thread(inspect_image_file, image.path, image.image_type, True) + return info["checksum"] == image.checksum and info["image_size"] == image.image_size + except (OSError, InvalidImageError): + return False + + async def get_images(self, image_type=None, availability=None) -> List[models.Image]: """ Get all images. """ @@ -74,6 +92,8 @@ class ImagesRepository(BaseRepository): query = select(models.Image).where(models.Image.image_type == image_type) else: query = select(models.Image) + if availability: + query = query.where(models.Image.availability == availability) result = await self._db_session.execute(query) return result.scalars().all() @@ -89,7 +109,8 @@ class ImagesRepository(BaseRepository): result = await self._db_session.execute(query) return result.scalars().all() - async def add_image(self, image_name, image_type, image_size, path, checksum, checksum_algorithm) -> models.Image: + async def add_image(self, image_name, image_type, image_size, path, checksum, checksum_algorithm, + file_fingerprint=None) -> models.Image: """ Create a new image. """ @@ -101,11 +122,17 @@ class ImagesRepository(BaseRepository): image_size=image_size, path=path, checksum=checksum, - checksum_algorithm=checksum_algorithm + checksum_algorithm=checksum_algorithm, + file_fingerprint=file_fingerprint, + availability="available" if file_fingerprint else "unknown", ) self._db_session.add(db_image) - await self._db_session.commit() + try: + await self._db_session.commit() + except Exception: + await self._db_session.rollback() + raise await self._db_session.refresh(db_image) return db_image @@ -125,15 +152,69 @@ class ImagesRepository(BaseRepository): await self._db_session.refresh(image_db) # force refresh of updated_at value return image_db + async def save_verified_image(self, info: dict) -> models.Image: + """Upsert an exact path, preserving template associations and the image ID. + + Callers coordinate publication/inspection with image_lock(). Each commit + is short, and a concurrent insert from a legacy caller is retried safely. + """ + values = dict(info) + values["filename"] = values.pop("image_name") + values.update(availability="available", last_error=None, + last_seen_at=datetime.now(timezone.utc).replace(tzinfo=None), + last_verified_at=datetime.now(timezone.utc).replace(tzinfo=None)) + for attempt in range(2): + try: + image = (await self._db_session.execute( + select(models.Image).where(models.Image.path == info["path"]) + .execution_options(populate_existing=True))).scalar_one_or_none() + if image is None: + # A legacy spelling (e.g. /images/QEMU/./disk.qcow2) can + # refer to the same destination restored by an API upload. + candidates = (await self._db_session.execute(select(models.Image).where( + models.Image.filename == values["filename"]))).scalars().all() + aliases = [candidate for candidate in candidates + if normalized_path(candidate.path) == normalized_path(info["path"])] + if len(aliases) > 1: + from sqlalchemy.exc import MultipleResultsFound + raise MultipleResultsFound("Ambiguous image path aliases; manual review required") + if aliases: + image = aliases[0] + values["path"] = image.path + if image is None: + image = models.Image(**values) + self._db_session.add(image) + else: + for key, value in values.items(): + setattr(image, key, value) + await self._db_session.commit() + await self._db_session.refresh(image) + return image + except IntegrityError: + await self._db_session.rollback() + if attempt: + raise + except Exception: + await self._db_session.rollback() + raise + + async def delete_image_exact(self, image_id: int) -> bool: + result = await self._db_session.execute(delete(models.Image).where(models.Image.image_id == image_id)) + await self._db_session.commit() + return result.rowcount > 0 + async def delete_image(self, image_path: str) -> bool: """ Delete an image. """ image_dir, image_name = os.path.split(image_path) - if image_dir: + if os.path.isabs(image_path): + query = delete(models.Image).where(models.Image.path == image_path) + elif image_dir: query = delete(models.Image).\ - where(models.Image.filename == image_name, models.Image.path.endswith(image_path)).\ + where(models.Image.filename == image_name, + models.Image.path.endswith(os.sep + image_path, autoescape=True)).\ execution_options(synchronize_session=False) else: query = delete(models.Image).where(models.Image.filename == image_name) @@ -141,7 +222,8 @@ class ImagesRepository(BaseRepository): await self._db_session.commit() return result.rowcount > 0 - async def prune_images(self, skip_images: list[str] = None) -> int: + async def prune_images(self, skip_images: list[str] = None, + is_in_use: Optional[Callable] = None) -> int: """ Prune images not attached to any template. """ @@ -149,18 +231,32 @@ class ImagesRepository(BaseRepository): query = select(models.Image).\ filter(~models.Image.templates.any()) result = await self._db_session.execute(query) - images = result.scalars().all() + # Snapshot scalar values; commits can expire ORM instances. + images = [(image.image_id, image.filename, image.path, image.checksum, image.file_fingerprint) + for image in result.scalars().all()] images_deleted = 0 - for image in images: - if skip_images and image.filename in skip_images: - log.debug(f"Skipping image '{image.path}' for pruning") + errors = [] + for image_id, filename, path, checksum, file_fingerprint in images: + if skip_images and filename in skip_images: continue - try: - log.debug(f"Deleting image '{image.path}'") - os.remove(image.path) - except OSError: - log.warning(f"Could not delete image file {image.path}") - if await self.delete_image(image.path): - images_deleted += 1 + async with image_lock(path): + current = await self.get_image(path, refresh=True) + if current is None or (current.image_id, current.checksum, current.file_fingerprint) != ( + image_id, checksum, file_fingerprint): + continue # A concurrent request removed or replaced this image. + if await self.get_image_templates(image_id) or (is_in_use and is_in_use(filename)): + continue + try: + os.remove(path) + except FileNotFoundError: + pass + except OSError as e: + errors.append(f"{path}: {e}") + continue + if await self.delete_image_exact(image_id): + images_deleted += 1 log.info(f"{images_deleted} image(s) have been deleted") + if errors: + from gns3server.controller.controller_error import ControllerError + raise ControllerError("Could not delete image files: " + "; ".join(errors)) return images_deleted diff --git a/gns3server/db/repositories/templates.py b/gns3server/db/repositories/templates.py index a08b58053..cb2d90372 100644 --- a/gns3server/db/repositories/templates.py +++ b/gns3server/db/repositories/templates.py @@ -29,6 +29,8 @@ from .base import BaseRepository import gns3server.db.models as models from gns3server import schemas +from gns3server.utils.image_inventory import image_lock +from gns3server.controller.controller_error import ControllerNotFoundError log = logging.getLogger(__name__) @@ -129,17 +131,22 @@ class TemplatesRepository(BaseRepository): await self._db_session.refresh(db_template) return db_template - async def get_image(self, image_path: str) -> Optional[models.Image]: + async def get_image(self, image_path: str, *, include_unavailable: bool = False) -> Optional[models.Image]: """ Get an image by its path. """ image_dir, image_name = os.path.split(image_path) - if image_dir: + if os.path.isabs(image_path): + query = select(models.Image).where(models.Image.path == image_path) + elif image_dir: query = select(models.Image).\ - where(models.Image.filename == image_name, models.Image.path.endswith(image_path)) + where(models.Image.filename == image_name, + models.Image.path.endswith(os.sep + image_path, autoescape=True)) else: query = select(models.Image).where(models.Image.filename == image_name) + if not include_unavailable: + query = query.where(models.Image.availability.in_(["unknown", "available"])) query = query.order_by(models.Image.image_id) result = await self._db_session.execute(query) images = result.scalars().all() @@ -160,18 +167,23 @@ class TemplatesRepository(BaseRepository): Add an image to template. """ - query = select(models.Template).\ - options(selectinload(models.Template.images)).\ - where(models.Template.template_id == template_id) - result = await self._db_session.execute(query) - template_in_db = result.scalars().first() - if not template_in_db: - return None + async with image_lock(image.path): + exists = (await self._db_session.execute(select(models.Image.image_id).where( + models.Image.image_id == image.image_id))).scalar_one_or_none() + if exists is None: + raise ControllerNotFoundError(f"Image '{image.path}' was removed while creating the template") + query = select(models.Template).\ + options(selectinload(models.Template.images)).\ + where(models.Template.template_id == template_id) + result = await self._db_session.execute(query) + template_in_db = result.scalars().first() + if not template_in_db: + return None - template_in_db.images.append(image) - await self._db_session.commit() - await self._db_session.refresh(template_in_db) - return template_in_db + template_in_db.images.append(image) + await self._db_session.commit() + await self._db_session.refresh(template_in_db) + return template_in_db async def remove_image_from_template( self, diff --git a/gns3server/db/tasks.py b/gns3server/db/tasks.py index 285d95b54..4072644df 100644 --- a/gns3server/db/tasks.py +++ b/gns3server/db/tasks.py @@ -15,8 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import asyncio -import time import os from fastapi import FastAPI @@ -31,13 +29,10 @@ from alembic import command, config from alembic.script import ScriptDirectory from alembic.runtime.migration import MigrationContext from alembic.util.exc import CommandError -from watchdog.observers import Observer -from watchdog.events import FileSystemEvent, PatternMatchingEventHandler from gns3server.db.repositories.computes import ComputesRepository from gns3server.db.repositories.images import ImagesRepository -from gns3server.utils.images import md5sum, discover_images, read_image_info, InvalidImageError -from gns3server.utils.asyncio import wait_run_in_executor +from gns3server.utils.images import read_image_info from gns3server import schemas from .models import Base @@ -138,7 +133,14 @@ async def connect_to_db(app: FastAPI) -> None: log.info("Created new database and stamped to head revision") elif db_state == 'new_with_llm_configs': # Database already has llm_model_configs table (from Base.metadata.create_all) - # Just stamp the version + # Older unversioned metadata databases lack inventory fields. + # Ensure the additive schema before stamping the current head. + def upgrade_inventory(connection): + from alembic.operations import Operations + from gns3server.db_migrations.versions.d9e8a2b7c401_image_inventory_reconciliation import upgrade + with Operations.context(MigrationContext.configure(connection)): + upgrade() + await conn.run_sync(upgrade_inventory) await conn.run_sync(run_stamp, alembic_cfg) await conn.commit() log.info("Database has llm_model_configs table, stamped to head revision") @@ -182,144 +184,24 @@ async def get_computes(app: FastAPI) -> List[dict]: return computes -async def discover_images_on_filesystem(app: FastAPI) -> None: - - async with AsyncSession(app.state._db_engine) as db_session: - images_repository = ImagesRepository(db_session) - db_images = await images_repository.get_images() - existing_image_paths = [] - for db_image in db_images: - try: - image = schemas.Image.model_validate(db_image) - existing_image_paths.append(image.path) - except ValidationError as e: - log.error(f"Could not load image '{db_image.filename}' from database: {e}") - continue - for image_type in ("qemu", "ios", "iou"): - discovered_images = await discover_images(image_type, existing_image_paths) - for image in discovered_images: - log.info(f"Adding discovered image '{image['path']}' to the database") - try: - await images_repository.add_image(**image) - except SQLAlchemyError as e: - log.warning(f"Error while adding image '{image['path']}' to the database: {e}") - - # monitor if images have been manually added - asyncio.create_task(monitor_images_on_filesystem(app)) - - async def update_disk_checksums(updated_disks: List[str]) -> None: - """ - Update the checksum of a list of disks in the database. - - :param updated_disks: list of updated disks - """ - + """Refresh complete metadata after a server-managed disk modification.""" from gns3server.api.server import app - async with AsyncSession(app.state._db_engine) as db_session: - images_repository = ImagesRepository(db_session) - for path in updated_disks: - image = await images_repository.get_image(path) - if image: - log.info(f"Updating image '{path}' in the database") - checksum = await wait_run_in_executor(md5sum, path, cache_to_md5file=False) - if image.checksum != checksum: - await images_repository.update_image(path, checksum, "md5") - -class EventHandler(PatternMatchingEventHandler): - """ - Watchdog event handler. - """ - - def __init__(self, queue: asyncio.Queue, loop: asyncio.BaseEventLoop, **kwargs): - - self._loop = loop - self._queue = queue - - # ignore temporary files, md5sum files, hidden files and directories - super().__init__(ignore_patterns=["*.tmp", "*.md5sum", ".*"], ignore_directories = True, **kwargs) - - def on_closed(self, event: FileSystemEvent) -> None: - # monitor for closed files (e.g. when a file has finished to be copied) - if "/lib/" in event.src_path or "/lib64/" in event.src_path: - return # ignore custom IOU libraries - self._loop.call_soon_threadsafe(self._queue.put_nowait, event) - -class EventIterator(object): - """ - Watchdog Event iterator. - """ - - def __init__(self, queue: asyncio.Queue): - self.queue = queue - - def __aiter__(self): - return self - - async def __anext__(self): - - item = await self.queue.get() - if item is None: - raise StopAsyncIteration - return item - -async def monitor_images_on_filesystem(app: FastAPI): - - def watchdog( - path: str, - queue: asyncio.Queue, - loop: asyncio.BaseEventLoop, - app: FastAPI, recursive: bool = False - ) -> None: - """ - Thread to monitor a directory for new images. - """ - - handler = EventHandler(queue, loop) - observer = Observer() - observer.schedule(handler, str(path), recursive=recursive) - observer.start() - log.info(f"Monitoring for new images in '{path}'") - while True: - time.sleep(1) - # stop when the app is exiting - if app.state.exiting: - observer.stop() - observer.join(10) - log.info(f"Stopping monitoring for new images in '{path}'") - loop.call_soon_threadsafe(queue.put_nowait, None) - break - - queue = asyncio.Queue() - loop = asyncio.get_event_loop() - server_config = Config.instance().settings.Server - image_dir = os.path.expanduser(server_config.images_path) - asyncio.get_event_loop().run_in_executor(None, watchdog,image_dir, queue, loop, app, True) - - async for filesystem_event in EventIterator(queue): - # read the file system event from the queue - image_path = filesystem_event.src_path - expected_image_type = None - if "IOU" in image_path: - expected_image_type = "iou" - elif "QEMU" in image_path: - expected_image_type = "qemu" - elif "IOS" in image_path: - expected_image_type = "ios" - async with AsyncSession(app.state._db_engine) as db_session: - images_repository = ImagesRepository(db_session) - try: - image = await read_image_info(image_path, expected_image_type) - except InvalidImageError as e: - log.warning(str(e)) - continue - try: - if await images_repository.get_image(image_path): - continue - await images_repository.add_image(**image) - log.info(f"Discovered image '{image_path}' has been added to the database") - except SQLAlchemyError as e: - log.warning(f"Error while adding image '{image_path}' to the database: {e}") + from gns3server.utils.image_inventory import image_lock + for path in updated_disks: + async with image_lock(path): + async with AsyncSession(app.state._db_engine, expire_on_commit=False) as session: + repository = ImagesRepository(session) + image = await repository.get_image(path) + if image: + info = await read_image_info(path, image.image_type, allow_raw_image=True) + try: + os.unlink(path + ".md5sum") + except FileNotFoundError: + pass + except OSError as e: + log.warning("Could not invalidate checksum cache for '%s': %s", path, e) + await repository.save_verified_image(info) async def get_user_llm_config_full(user_id: str, app: FastAPI) -> Optional[dict]: @@ -415,4 +297,3 @@ async def get_user_llm_config_full(user_id: str, app: FastAPI) -> Optional[dict] except Exception as e: log.error(f"Failed to retrieve LLM config for user {user_id}: {e}", exc_info=True) return None - diff --git a/gns3server/db_migrations/versions/d9e8a2b7c401_image_inventory_reconciliation.py b/gns3server/db_migrations/versions/d9e8a2b7c401_image_inventory_reconciliation.py new file mode 100644 index 000000000..aaef4e91e --- /dev/null +++ b/gns3server/db_migrations/versions/d9e8a2b7c401_image_inventory_reconciliation.py @@ -0,0 +1,50 @@ +"""Track image availability and persistent synchronization jobs. + +Revision ID: d9e8a2b7c401 +Revises: c7e4a9f1d2b6 +""" +from alembic import op +import sqlalchemy as sa + +revision = "d9e8a2b7c401" +down_revision = "c7e4a9f1d2b6" +branch_labels = None +depends_on = None + + +def upgrade(): + # Startup also uses this for unversioned databases previously created from + # metadata, which may already contain some/all of these additive fields. + inspector = sa.inspect(op.get_bind()) + existing = {column["name"] for column in inspector.get_columns("images")} + for column in ( + sa.Column("availability", sa.String(), nullable=False, server_default="unknown"), + sa.Column("file_fingerprint", sa.String()), + sa.Column("last_seen_at", sa.DateTime()), + sa.Column("last_verified_at", sa.DateTime()), + sa.Column("last_error", sa.String()), + ): + if column.name not in existing: + op.add_column("images", column) + if inspector.has_table("image_sync_jobs"): + return + op.create_table( + "image_sync_jobs", + sa.Column("job_id", sa.String(), primary_key=True), + sa.Column("status", sa.String(), nullable=False), + sa.Column("dry_run", sa.Boolean(), nullable=False), + sa.Column("force_checksum", sa.Boolean(), nullable=False), + sa.Column("finished_at", sa.DateTime()), + sa.Column("counts", sa.JSON(), nullable=False), + sa.Column("errors", sa.JSON(), nullable=False), + sa.Column("created_at", sa.DateTime(), server_default=sa.func.current_timestamp()), + sa.Column("updated_at", sa.DateTime(), server_default=sa.func.current_timestamp()), + ) + + +def downgrade(): + op.drop_table("image_sync_jobs") + # Do not rebuild images: dropping the old table during a SQLite batch + # rebuild would cascade-delete image_template_map entries with FK enabled. + for name in ("last_error", "last_verified_at", "last_seen_at", "file_fingerprint", "availability"): + op.drop_column("images", name) diff --git a/gns3server/schemas/__init__.py b/gns3server/schemas/__init__.py index bc8cca5b9..af96a5f7a 100644 --- a/gns3server/schemas/__init__.py +++ b/gns3server/schemas/__init__.py @@ -23,7 +23,7 @@ from .version import Version from .controller.links import LinkCreate, LinkUpdate, Link, UDPPortInfo, EthernetPortInfo, LinkCapture, MarkerCreate, MarkerUpdate, MarkerDefinitionCreate from .controller.computes import ComputeCreate, ComputeUpdate, ComputeVirtualBoxVM, ComputeVMwareVM, ComputeDockerImage, AutoIdlePC, Compute from .controller.templates import TemplateCreate, TemplateUpdate, TemplateUsage, Template -from .controller.images import Image, ImageType +from .controller.images import Image, ImageType, ImageSyncRequest, ImageSyncJob from .controller.appliances import ApplianceVersion, ApplianceVersionV8, Appliance from .controller.drawings import Drawing from .controller.gns3vm import GNS3VM diff --git a/gns3server/schemas/config.py b/gns3server/schemas/config.py index 227129b28..c92a6516d 100644 --- a/gns3server/schemas/config.py +++ b/gns3server/schemas/config.py @@ -197,6 +197,8 @@ class ServerSettings(BaseModel): True, description="Allow raw images to be uploaded to the server") auto_discover_images: bool = Field( True, description="Automatically discover images in the images directory") + image_sync_interval: int = Field( + 900, ge=10, description="Seconds between automatic image inventory scans") report_errors: bool = Field( True, description="Automatically send crash reports to the GNS3 team") additional_images_paths: List[str] = Field( diff --git a/gns3server/schemas/controller/images.py b/gns3server/schemas/controller/images.py index 417bc086f..328fd2c4a 100644 --- a/gns3server/schemas/controller/images.py +++ b/gns3server/schemas/controller/images.py @@ -16,6 +16,8 @@ from pydantic import ConfigDict, BaseModel, Field from enum import Enum +from datetime import datetime +from typing import Optional, Literal from .base import DateTimeModelMixin @@ -38,7 +40,28 @@ class ImageBase(BaseModel): image_size: int = Field(..., description="Image size in bytes") checksum: str = Field(..., description="Checksum value") checksum_algorithm: str = Field(..., description="Checksum algorithm") + availability: Literal["unknown", "available", "missing", "unavailable", "invalid"] = "unknown" + last_seen_at: Optional[datetime] = None + last_verified_at: Optional[datetime] = None + last_error: Optional[str] = None class Image(DateTimeModelMixin, ImageBase): model_config = ConfigDict(from_attributes=True) + + +class ImageSyncRequest(BaseModel): + model_config = ConfigDict(extra="forbid") + dry_run: bool = False + force_checksum: bool = False + + +class ImageSyncJob(DateTimeModelMixin): + model_config = ConfigDict(from_attributes=True) + job_id: str + status: Literal["queued", "running", "completed", "partial", "failed", "cancelled", "interrupted"] + dry_run: bool + force_checksum: bool + finished_at: Optional[datetime] = None + counts: dict[str, int] + errors: list[dict[str, str]] diff --git a/gns3server/schemas/controller/settings.py b/gns3server/schemas/controller/settings.py index 73bace5bf..fd84cf398 100644 --- a/gns3server/schemas/controller/settings.py +++ b/gns3server/schemas/controller/settings.py @@ -117,6 +117,7 @@ class ServerSettingsUpdate(BaseModel): default_symbol_theme: Optional[BuiltinSymbolTheme] = None allow_raw_images: Optional[bool] = None auto_discover_images: Optional[bool] = None + image_sync_interval: Optional[int] = Field(None, ge=10) report_errors: Optional[bool] = None additional_images_paths: Optional[List[str]] = None console_start_port_range: Optional[int] = Field(None, gt=0, le=65535) diff --git a/gns3server/services/image_reconciliation.py b/gns3server/services/image_reconciliation.py new file mode 100644 index 000000000..cc7db82cf --- /dev/null +++ b/gns3server/services/image_reconciliation.py @@ -0,0 +1,450 @@ +"""Recoverable controller image inventory, shared by manual and automatic sync.""" + +import asyncio +import logging +import os +import stat +import threading +import uuid +from datetime import datetime, timezone + +from sqlalchemy import select, update, delete +from sqlalchemy.ext.asyncio import AsyncSession +from watchdog.events import FileSystemEventHandler +from watchdog.observers import Observer + +from gns3server.config import Config +from gns3server.db.models import Image, ImageSyncJob +from gns3server.db.repositories.images import ImagesRepository +from gns3server.utils.image_inventory import ( + ImageLock, ImageLockBusy, contained_path, fingerprint, image_lock, normalized_path, +) +from gns3server.utils.images import inspect_image_file, InvalidImageError, ImageChangedError + +log = logging.getLogger(__name__) +COUNTERS = ("scanned", "added", "updated", "unchanged", "missing", "unavailable", + "invalid", "deferred", "out_of_scope", "errors", "bytes_hashed") +RAW_EXTENSIONS = {".raw", ".img", ".iso", ".fd", ".vhd", ".vdi", ".bin"} + + +def utcnow(): + return datetime.now(timezone.utc).replace(tzinfo=None) + + +def ignored(name): + return name.startswith(".") or name.endswith((".tmp", ".md5sum")) + + +def configured_roots(): + settings = Config.instance().settings.Server + roots = sorted({normalized_path(p) for p in [settings.images_path, *settings.additional_images_paths]}) + # Keep parent roots only, avoiding duplicate scans and conflicting absence passes. + return [root for root in roots if not any(root != other and contained_path(root, other) for other in roots)] + + +def root_identity(root): + info = os.stat(root) + # Opening the directory tests readability, not just existence. + with os.scandir(root): + pass + return info.st_dev, info.st_ino, os.path.realpath(root) + + +def enumerate_root(root): + """Observe a root without creating directories or silently dropping failures.""" + files, errors = {}, [] + try: + root_stat = os.stat(root) + if not stat.S_ISDIR(root_stat.st_mode): + raise NotADirectoryError(root) + for directory, dirs, names in os.walk(root, onerror=lambda e: errors.append( + {"path": str(e.filename or root), "reason": str(e)}), followlinks=False): + dirs[:] = [name for name in dirs if not ignored(name) and name not in ("lib", "lib64") + and not os.path.islink(os.path.join(directory, name))] + for name in names: + if ignored(name): + continue + path = normalized_path(os.path.join(directory, name)) + try: + files[path] = fingerprint(path) + except OSError as e: + errors.append({"path": path, "reason": str(e)}) + # A mount/root replacement during traversal makes the absence pass unsafe. + after = os.stat(root) + if (root_stat.st_dev, root_stat.st_ino) != (after.st_dev, after.st_ino): + errors.append({"path": root, "reason": "Image root changed during scan"}) + except OSError as e: + errors.append({"path": root, "reason": str(e)}) + return files, errors + + +class InventoryEvents(FileSystemEventHandler): + def __init__(self, loop, dirty): + self.loop, self.dirty = loop, dirty + self._pending = False + self._lock = threading.Lock() + + def _mark_dirty(self): + with self._lock: + self._pending = False + self.dirty.set() + + def on_any_event(self, event): + if event.event_type not in ("created", "modified", "closed", "deleted", "moved"): + return + paths = [event.src_path, getattr(event, "dest_path", "")] + if any(path and not ignored(os.path.basename(path)) for path in paths): + # A single dirty bit coalesces events with bounded memory, including + # directory renames and bursts. The next scan observes current state. + with self._lock: + if self._pending: + return + self._pending = True + self.loop.call_soon_threadsafe(self._mark_dirty) + + +class ImageReconciliationService: + def __init__(self, engine, settle_seconds=1.0): + self.engine = engine + self.settle_seconds = settle_seconds + self.task = None + self.scheduler = None + self.observer = None + self.dirty = asyncio.Event() + self.stopping = threading.Event() + self._watched_roots = None + self._catalog_paths = {} + self._ambiguous_paths = set() + + async def start(self, dry_run=False, force_checksum=False): + if self.stopping.is_set(): + raise ImageLockBusy("Image synchronization is shutting down") + lock = ImageLock("image-inventory", wait=False) + await lock.__aenter__() + try: + async with AsyncSession(self.engine, expire_on_commit=False) as session: + # The OS lock proves no previous worker using this catalog is + # active. Recover jobs abandoned by a crash before admitting one. + await session.execute(update(ImageSyncJob).where( + ImageSyncJob.status.in_(["queued", "running"])).values( + status="interrupted", finished_at=utcnow())) + job = ImageSyncJob(job_id=str(uuid.uuid4()), status="queued", dry_run=dry_run, + force_checksum=force_checksum, + counts=dict.fromkeys(COUNTERS, 0), errors=[]) + session.add(job) + # Bound history; active jobs are never removed. + old_jobs = select(ImageSyncJob.job_id).where( + ImageSyncJob.status.notin_(["queued", "running"])).order_by( + ImageSyncJob.created_at.desc()).offset(99) + await session.execute(delete(ImageSyncJob).where(ImageSyncJob.job_id.in_(old_jobs))) + await session.commit() + await session.refresh(job) + result = job.asdict() + self.task = asyncio.create_task(self._run(result, lock), name="image-inventory-sync") + self.task.add_done_callback(self._finished) + return result + except BaseException: + await lock.__aexit__() + raise + + @staticmethod + def _finished(task): + if not task.cancelled() and task.exception() is not None: + log.error("Could not persist image synchronization outcome: %s", task.exception()) + + async def get_job(self, job_id, offset=0, limit=100): + # A client can resume polling after a restart even with automatic scans + # disabled. Do not leave an abandoned job looking permanently active. + try: + async with ImageLock("image-inventory", wait=False): + async with AsyncSession(self.engine) as session: + await session.execute(update(ImageSyncJob).where( + ImageSyncJob.status.in_(["queued", "running"])).values( + status="interrupted", finished_at=utcnow())) + await session.commit() + except ImageLockBusy: + pass + async with AsyncSession(self.engine) as session: + job = await session.get(ImageSyncJob, job_id) + if job is None: + return None + result = job.asdict() + result["errors"] = result["errors"][offset:offset + limit] + return result + + async def _persist(self, job): + async with AsyncSession(self.engine) as session: + await session.execute(update(ImageSyncJob).where(ImageSyncJob.job_id == job["job_id"]).values( + status=job["status"], counts=dict(job["counts"]), errors=list(job["errors"]), + finished_at=job.get("finished_at"))) + await session.commit() + + def _error(self, job, path, reason): + job["counts"]["errors"] += 1 + # The total count remains accurate even when detailed errors are capped. + if len(job["errors"]) < 1000: + job["errors"].append({"path": path, "reason": str(reason)}) + + async def _inspect(self, path, expected, allow_raw): + worker = asyncio.create_task(asyncio.to_thread( + inspect_image_file, path, expected, allow_raw, self.stopping)) + try: + return await asyncio.shield(worker) + except asyncio.CancelledError: + self.stopping.set() + try: + await worker + except (OSError, InvalidImageError): + pass + raise + + async def _state(self, row, availability, reason, dry_run): + if row is None or dry_run: + return + async with AsyncSession(self.engine) as session: + # Revision guard for legacy writers not yet taking the path lock. + await session.execute(update(Image).where( + Image.image_id == row["image_id"], Image.path == row["path"], + Image.file_fingerprint == row["file_fingerprint"], + Image.checksum == row["checksum"]).values(availability=availability, last_error=str(reason))) + await session.commit() + + async def _row(self, path): + async with AsyncSession(self.engine) as session: + stored = self._catalog_paths.get(normalized_path(path), path) + row = (await session.execute(select(Image).where(Image.path.in_([stored, path])))).scalar_one_or_none() + return row.asdict() if row else None + + async def _file(self, path, observed, job, root): + if path in self._ambiguous_paths: + job["counts"]["deferred"] += 1 + return + async with image_lock(path): + row = await self._row(path) + counts = job["counts"] + counts["scanned"] += 1 + try: + if not contained_path(os.path.realpath(path), root): + raise OSError("Image path resolves outside its configured root") + current = await asyncio.to_thread(fingerprint, path) + if current != observed: + raise ImageChangedError("File changed during settling interval") + if row and row["availability"] == "available" and row["file_fingerprint"] == current and not job["force_checksum"]: + counts["unchanged"] += 1 + return + expected = row["image_type"] if row else None + main_root = normalized_path(Config.instance().settings.Server.images_path) + if not expected and contained_path(path, main_root): + component = os.path.relpath(path, main_root).split(os.sep)[0] + expected = {"QEMU": "qemu", "IOS": "ios", "IOU": "iou"}.get(component) + allow_raw = Config.instance().settings.Server.allow_raw_images and ( + expected == "qemu" or + (expected in (None, "qemu") and os.path.splitext(path)[1].lower() in RAW_EXTENSIONS)) + info = await self._inspect(path, expected, allow_raw) + if row: + # Preserve legacy path spelling as well as image identity. + info["path"] = row["path"] + counts["bytes_hashed"] += info["image_size"] + if self.stopping.is_set(): + raise asyncio.CancelledError + if await asyncio.to_thread(fingerprint, path) != info["file_fingerprint"]: + raise ImageChangedError("File changed before catalog update") + if not job["dry_run"]: + # Do not leave stale sidecars for legacy compute consumers. + try: + os.unlink(path + ".md5sum") + except FileNotFoundError: + pass + except OSError as e: + self._error(job, path + ".md5sum", e) + async with AsyncSession(self.engine, expire_on_commit=False) as session: + await ImagesRepository(session).save_verified_image(info) + counts["updated" if row else "added"] += 1 + except ImageChangedError as e: + counts["deferred"] += 1 + await self._state(row, "unavailable", e, job["dry_run"]) + except InvalidImageError as e: + counts["invalid"] += 1 + await self._state(row, "invalid", e, job["dry_run"]) + self._error(job, path, e) + except OSError as e: + if self.stopping.is_set(): + raise asyncio.CancelledError from e + counts["unavailable"] += 1 + await self._state(row, "unavailable", e, job["dry_run"]) + self._error(job, path, e) + + async def _run(self, job, lock): + job["status"] = "running" + try: + await self._persist(job) + async with AsyncSession(self.engine) as session: + paths = (await session.execute(select(Image.path))).scalars().all() + self._catalog_paths = {} + self._ambiguous_paths = set() + roots = configured_roots() + for path in paths: + normalized = normalized_path(path) + if not any(contained_path(path, root) for root in roots): + job["counts"]["out_of_scope"] += 1 + self._error(job, path, "Catalog path is outside the configured image directories; record retained") + if normalized in self._catalog_paths: + self._ambiguous_paths.add(normalized) + self._error(job, path, "Multiple catalog paths resolve to the same image; manual review required") + self._catalog_paths[normalized] = path + for root in roots: + if self.stopping.is_set(): + raise asyncio.CancelledError + resolved_root = os.path.realpath(root) + try: + identity = await asyncio.to_thread(root_identity, root) + except OSError: + identity = None + files, errors = await asyncio.to_thread(enumerate_root, root) + if resolved_root != os.path.realpath(root): + errors.append({"path": root, "reason": "Image root target changed during scan"}) + for error in errors: + self._error(job, error["path"], error["reason"]) + # One settling wait per root, not one per large image collection. + if files and self.settle_seconds: + await asyncio.sleep(self.settle_seconds) + for path, observed in files.items(): + if self.stopping.is_set(): + raise asyncio.CancelledError + try: + await self._file(path, observed, job, resolved_root) + except Exception as e: + self._error(job, path, e) + log.warning("Could not reconcile image %s: %s", path, e) + if job["counts"]["scanned"] % 25 == 0: + await self._persist(job) + try: + if identity != await asyncio.to_thread(root_identity, root): + raise OSError("Image root changed during reconciliation") + except OSError as e: + errors.append({"path": root, "reason": str(e)}) + self._error(job, root, e) + async with AsyncSession(self.engine) as session: + rows = [image.asdict() for image in (await session.execute(select(Image))).scalars()] + for row in rows: + if self.stopping.is_set(): + raise asyncio.CancelledError + path = row["path"] + if not contained_path(path, root) or normalized_path(path) in files or normalized_path(path) in self._ambiguous_paths: + continue + async with image_lock(path): + row = await self._row(path) + if row is None: + continue + if errors: + job["counts"]["unavailable"] += 1 + await self._state(row, "unavailable", "Image root was not completely scanned", job["dry_run"]) + continue + try: + if not contained_path(os.path.realpath(path), resolved_root): + raise OSError("Image path resolves outside its configured root") + await asyncio.to_thread(fingerprint, path) + except FileNotFoundError: + try: + if identity != await asyncio.to_thread(root_identity, root): + raise OSError("Image root changed during reconciliation") + except OSError as e: + job["counts"]["unavailable"] += 1 + await self._state(row, "unavailable", e, job["dry_run"]) + self._error(job, root, e) + else: + job["counts"]["missing"] += 1 + await self._state(row, "missing", "Image file is missing", job["dry_run"]) + except OSError as e: + job["counts"]["unavailable"] += 1 + await self._state(row, "unavailable", e, job["dry_run"]) + self._error(job, path, e) + if self.stopping.is_set(): + raise asyncio.CancelledError + job["status"] = "partial" if job["counts"]["errors"] or job["counts"]["deferred"] else "completed" + except asyncio.CancelledError: + job["status"] = "cancelled" + except Exception as e: + job["status"] = "failed" + self._error(job, "", e) + log.exception("Image reconciliation failed") + finally: + job["finished_at"] = utcnow() + try: + await self._persist(job) + finally: + await lock.__aexit__() + + async def _watch(self): + roots = configured_roots() if Config.instance().settings.Server.auto_discover_images else [] + # Include availability in the signature so newly mounted roots get watched. + roots = [root for root in roots if os.path.isdir(root)] + if roots == self._watched_roots: + return + if self.observer: + self.observer.stop() + await asyncio.to_thread(self.observer.join) + self.observer = None + self._watched_roots = roots + if roots: + observer = Observer() + handler = InventoryEvents(asyncio.get_running_loop(), self.dirty) + try: + for root in roots: + observer.schedule(handler, root, recursive=True) + observer.start() + self.observer = observer + except OSError: + observer.stop() + if observer.is_alive(): + await asyncio.to_thread(observer.join) + self._watched_roots = None + log.warning("Image watcher unavailable; periodic scanning remains active", exc_info=True) + + async def _automatic(self): + await asyncio.sleep(5) + while not self.stopping.is_set(): + try: + await self._watch() + self.dirty.clear() + if Config.instance().settings.Server.auto_discover_images: + try: + await self.start() + await asyncio.shield(self.task) + except ImageLockBusy: + pass + try: + await asyncio.wait_for(self.dirty.wait(), Config.instance().settings.Server.image_sync_interval) + await asyncio.sleep(1) # debounce bursts of file/directory events + except asyncio.TimeoutError: + pass + except asyncio.CancelledError: + break + except Exception: + log.exception("Automatic image synchronization failed; will retry") + await asyncio.sleep(10) + + def start_background(self): + self.scheduler = asyncio.create_task(self._automatic(), name="image-inventory-scheduler") + + async def close(self): + self.stopping.set() + if self.scheduler: + self.scheduler.cancel() + await asyncio.gather(self.scheduler, return_exceptions=True) + if self.observer: + self.observer.stop() + await asyncio.to_thread(self.observer.join) + self.observer = None + if self.task and not self.task.done(): + # Cooperative cancellation also covers a task not yet entered; its + # finally block must run to release the already-acquired job lock. + await asyncio.gather(self.task, return_exceptions=True) + + +def get_image_reconciliation_service(app): + service = getattr(app.state, "image_reconciliation", None) + if service is None: + service = ImageReconciliationService(app.state._db_engine) + app.state.image_reconciliation = service + return service diff --git a/gns3server/services/templates.py b/gns3server/services/templates.py index 66b793566..2d2771d26 100644 --- a/gns3server/services/templates.py +++ b/gns3server/services/templates.py @@ -276,7 +276,8 @@ class TemplatesService: if not image_path: return - image = await self._templates_repo.get_image(image_path) + # Removing an association must also find missing/invalid image rows. + image = await self._templates_repo.get_image(image_path, include_unavailable=True) if image is None: return await self._templates_repo.remove_image_from_template(template_id, image) diff --git a/gns3server/utils/image_inventory.py b/gns3server/utils/image_inventory.py new file mode 100644 index 000000000..fcab6fe09 --- /dev/null +++ b/gns3server/utils/image_inventory.py @@ -0,0 +1,96 @@ +"""Filesystem primitives shared by image writers and inventory reconciliation.""" + +import asyncio +import hashlib +import os +import stat + +from gns3server.config import Config + + +def normalized_path(path): + return os.path.normcase(os.path.abspath(os.path.expanduser(path))) + + +def contained_path(path, root): + try: + return os.path.commonpath((normalized_path(path), normalized_path(root))) == normalized_path(root) + except ValueError: + return False + + +def fingerprint(path): + info = os.stat(path, follow_symlinks=False) + if not stat.S_ISREG(info.st_mode): + raise OSError(f"Not a regular image file: {path}") + return stat_fingerprint(info) + + +def stat_fingerprint(info): + # Store as text: inode/device numbers need not fit a signed SQL BIGINT. + return ":".join(str(value) for value in ( + info.st_dev, info.st_ino, info.st_size, info.st_mtime_ns, info.st_ctime_ns)) + + +class ImageLockBusy(Exception): + pass + + +class ImageLock: + """Advisory lock shared by controller processes using the same config directory. + + Lock files are deliberately retained: unlinking them permits two processes to + lock different inodes for the same name. OS locks are released on process exit. + """ + + def __init__(self, key, wait=True): + self.key = key + self.wait = wait + self._file = None + + async def __aenter__(self): + directory = os.path.join(Config.instance().config_dir, ".image-locks") + os.makedirs(directory, exist_ok=True) + path = os.path.join(directory, hashlib.sha256(self.key.encode()).hexdigest() + ".lock") + self._file = open(path, "a+b") + if os.name == "nt" and os.fstat(self._file.fileno()).st_size == 0: + self._file.write(b"\0") + self._file.flush() + try: + while True: + try: + if os.name == "nt": + import msvcrt + self._file.seek(0) + msvcrt.locking(self._file.fileno(), msvcrt.LK_NBLCK, 1) + else: + import fcntl + fcntl.flock(self._file, fcntl.LOCK_EX | fcntl.LOCK_NB) + return self + except (BlockingIOError, PermissionError): + if not self.wait: + raise ImageLockBusy(self.key) + await asyncio.sleep(0.05) + except BaseException: + self._file.close() + self._file = None + raise + + async def __aexit__(self, *args): + if self._file is not None: + self._file.close() + self._file = None + + +def image_lock(path): + return ImageLock("image:" + normalized_path(os.path.realpath(path))) + + +def publish_image(temporary, destination): + """Atomically publish a complete file without replacing an existing image. + + Both paths must be on the same filesystem. Hard linking provides the atomic + no-overwrite operation that os.replace()/shutil.move() cannot provide. + """ + os.link(temporary, destination) + os.unlink(temporary) diff --git a/gns3server/utils/images.py b/gns3server/utils/images.py index a1074191d..1c21b0886 100644 --- a/gns3server/utils/images.py +++ b/gns3server/utils/images.py @@ -18,7 +18,10 @@ import os import hashlib import stat import aiofiles -import shutil +import asyncio +import tempfile + +from gns3server.utils.image_inventory import fingerprint, stat_fingerprint, image_lock, publish_image, contained_path try: import importlib_resources @@ -123,31 +126,40 @@ def get_builtin_disks() -> List[str]: return builtin_disks -async def read_image_info(path: str, expected_image_type: str = None) -> dict: +def inspect_image_file(path, expected_image_type=None, allow_raw_image=False, stopped_event=None): + """Read a stable regular file once, never trusting checksum sidecars.""" + before = fingerprint(path) + flags = os.O_RDONLY | getattr(os, "O_BINARY", 0) | getattr(os, "O_NOFOLLOW", 0) + with os.fdopen(os.open(path, flags), "rb") as f: + info = os.fstat(f.fileno()) + if not stat.S_ISREG(info.st_mode) or stat_fingerprint(info) != before: + raise ImageChangedError(f"Image changed while opening: {path}") + header = f.read(7) + if len(header) < 7: + raise InvalidImageError(f"Image '{path}' is too small to be valid") + image_type = check_valid_image_header(path, header, allow_raw_image) + if expected_image_type and image_type != expected_image_type: + raise InvalidImageError(f"Detected image type for '{path}' is {image_type}, expected {expected_image_type}") + digest = hashlib.md5(header) + while True: + if stopped_event is not None and stopped_event.is_set(): + raise InterruptedError("Image inspection cancelled") + chunk = f.read(1024 * 1024) + if not chunk: + break + digest.update(chunk) + if stat_fingerprint(os.fstat(f.fileno())) != before or fingerprint(path) != before: + raise ImageChangedError(f"Image changed while reading: {path}") + return dict(image_name=os.path.basename(path), image_type=image_type, + image_size=info.st_size, path=path, checksum=digest.hexdigest(), + checksum_algorithm="md5", file_fingerprint=before) - header_magic_len = 7 + +async def read_image_info(path: str, expected_image_type: str = None, allow_raw_image=False) -> dict: try: - async with aiofiles.open(path, "rb") as f: - image_header = await f.read(header_magic_len) # read the first 7 bytes of the file - if len(image_header) >= header_magic_len: - detected_image_type = check_valid_image_header(path, image_header) - if expected_image_type and detected_image_type != expected_image_type: - raise InvalidImageError(f"Detected image type for '{path}' is {detected_image_type}, " - f"expected type is {expected_image_type}") - else: - raise InvalidImageError(f"Image '{path}' is too small to be valid") + return await asyncio.to_thread(inspect_image_file, path, expected_image_type, allow_raw_image) except OSError as e: - raise InvalidImageError(f"Cannot read image '{path}': {e}") - - image_info = { - "image_name": os.path.basename(path), - "image_type": detected_image_type, - "image_size": os.stat(path).st_size, - "path": path, - "checksum": await wait_run_in_executor(md5sum, path, cache_to_md5file=False), - "checksum_algorithm": "md5", - } - return image_info + raise InvalidImageError(f"Cannot read image '{path}': {e}") from e async def discover_images(image_type: str, skip_image_paths: list = None) -> List[dict]: @@ -239,7 +251,7 @@ def images_directories(image_type, include_parent_directory=True): return [force_unix_path(p) for p in paths if os.path.exists(p)] -def md5sum(path, working_dir=None, stopped_event=None, cache_to_md5file=True): +def md5sum(path, working_dir=None, stopped_event=None, cache_to_md5file=True, use_cache=True): """ Return the md5sum of an image and cache it on disk @@ -258,7 +270,7 @@ def md5sum(path, working_dir=None, stopped_event=None, cache_to_md5file=True): else: md5sum_file = path + ".md5sum" - if os.path.exists(md5sum_file): + if use_cache and os.path.exists(md5sum_file): try: with open(md5sum_file) as f: md5 = f.read().strip() @@ -315,6 +327,10 @@ class InvalidImageError(Exception): return self._message +class ImageChangedError(InvalidImageError): + """An observation must be retried because the file is still changing.""" + + def check_valid_image_header(path: str, data: bytes, allow_raw_image: bool = False) -> str: if data[:7] == b'\x7fELF\x01\x02\x01': @@ -343,57 +359,53 @@ async def write_image( ) -> models.Image: image_dir, image_name = os.path.split(image_filename) - # Store the file under its final name only when the upload is completed - tmp_path = image_path + ".tmp" - log.info(f"Writing image file to '{tmp_path}'") + # HTTP chunk boundaries need not align with the seven-byte image header. + iterator = stream.__aiter__() + prefix = bytearray() + async for chunk in iterator: + prefix.extend(chunk) + if len(prefix) >= 7: + break + if len(prefix) < 7: + raise InvalidImageError("The image content is empty or too small to be valid") + image_type = check_valid_image_header(image_path, prefix, allow_raw_image or not check_image_header) + if not image_dir: + image_path = os.path.abspath(os.path.join(default_images_directory(image_type), image_name)) + root = os.path.realpath(os.path.expanduser(Config.instance().settings.Server.images_path)) + if not contained_path(os.path.realpath(image_path), root): + raise InvalidImageError(f"Image destination is outside the configured image directory: {image_path}") os.makedirs(os.path.dirname(image_path), exist_ok=True) + descriptor, tmp_path = tempfile.mkstemp(prefix=".gns3-upload-", suffix=".tmp", dir=os.path.dirname(image_path)) + os.close(descriptor) checksum = hashlib.md5() - header_magic_len = 7 - image_type = None - image_size = 0 try: async with aiofiles.open(tmp_path, "wb") as f: - async for chunk in stream: - if check_image_header and len(chunk) >= header_magic_len: - check_image_header = False - image_type = check_valid_image_header(image_path, chunk, allow_raw_image) + await f.write(prefix) + checksum.update(prefix) + async for chunk in iterator: await f.write(chunk) checksum.update(chunk) - image_size = os.path.getsize(tmp_path) - if not image_size or image_size < header_magic_len: - raise InvalidImageError("The image content is empty or too small to be valid") - - if not image_dir: - directory = default_images_directory(image_type) - os.makedirs(directory, exist_ok=True) - image_path = os.path.abspath(os.path.join(directory, image_filename)) - - if os.path.exists(image_path): - raise InvalidImageError(f"File '{image_path}' already exists, " - f"please choose a different name or remove the existing image") - - checksum = checksum.hexdigest() - image_dir = os.path.dirname(image_path) - duplicate_image = await images_repo.get_image_by_checksum(checksum, image_dir) - if duplicate_image: - raise InvalidImageError(f"Image '{duplicate_image.filename}' with the " - f"same checksum already exists in '{image_dir}'") - - shutil.move(tmp_path, image_path) - os.chmod(image_path, stat.S_IWRITE | stat.S_IREAD | stat.S_IEXEC) + async with image_lock(image_path): + if os.path.lexists(image_path): + raise InvalidImageError(f"File '{image_path}' already exists, " + f"please choose a different name or remove the existing image") + checksum = checksum.hexdigest() + duplicate_image = await images_repo.get_image_by_checksum(checksum, os.path.dirname(image_path)) + if duplicate_image: + raise InvalidImageError(f"Image '{duplicate_image.filename}' with the same checksum " + f"already exists in '{os.path.dirname(image_path)}'") + os.chmod(tmp_path, stat.S_IWRITE | stat.S_IREAD | stat.S_IEXEC) + publish_image(tmp_path, image_path) + # Complete files survive a database failure so the next scan can + # recover them. Never compensate by unlinking a published image. + return await images_repo.save_verified_image(dict( + image_name=image_name, image_type=image_type, image_size=image_size, + path=image_path, checksum=checksum, checksum_algorithm="md5", + file_fingerprint=fingerprint(image_path))) finally: try: if os.path.exists(tmp_path): os.remove(tmp_path) except OSError: log.warning(f"Could not remove '{tmp_path}'") - - return await images_repo.add_image( - image_name, - image_type, - image_size, - image_path, - checksum, - checksum_algorithm="md5" - ) diff --git a/tests/api/routes/controller/test_image_sync.py b/tests/api/routes/controller/test_image_sync.py new file mode 100644 index 000000000..13d9fa7ca --- /dev/null +++ b/tests/api/routes/controller/test_image_sync.py @@ -0,0 +1,130 @@ +import os +from pathlib import Path +from unittest.mock import AsyncMock, patch + +import pytest +import pytest_asyncio + +from gns3server.db.repositories.images import ImagesRepository +from gns3server.services.image_reconciliation import ImageReconciliationService +from gns3server.services import auth_service +from gns3server.services.authentication import DEFAULT_JWT_SECRET_KEY + +pytestmark = pytest.mark.asyncio +QCOW = b"QFI\xfb\x00\x00\x00" + + +@pytest_asyncio.fixture +async def sync_service(app, db_engine, db_session, monkeypatch): + service = ImageReconciliationService(db_engine, settle_seconds=0) + monkeypatch.setattr(app.state, "image_reconciliation", service, raising=False) + try: + yield service + finally: + await service.close() + + +class TestImageSyncRoutes: + async def test_manual_sync_with_auto_discovery_disabled(self, app, client, sync_service, config, images_dir): + assert not config.settings.Server.auto_discover_images + path = Path(images_dir) / "QEMU" / "manual.qcow2" + path.write_bytes(QCOW) + response = await client.post("/v3/images/sync", json={}) + assert response.status_code == 202 + assert response.json()["job_id"] in response.headers["Location"] + await sync_service.task + job = await client.get(response.headers["Location"]) + assert job.status_code == 200 + assert job.json()["status"] == "completed" + assert job.json()["counts"]["added"] == 1 + listed = await client.get("/v3/images", params={"availability": "available"}) + assert any(image["path"] == str(path) for image in listed.json()) + path.unlink() + await client.post("/v3/images/sync", json={}) + await sync_service.task + missing = await client.get("/v3/images", params={"availability": "missing"}) + assert any(image["path"] == str(path) for image in missing.json()) + + async def test_dry_run_and_request_validation(self, client, sync_service, images_dir): + path = Path(images_dir) / "QEMU" / "preview.qcow2" + path.write_bytes(QCOW) + response = await client.post("/v3/images/sync", json={"dry_run": True, "force_checksum": True}) + assert response.status_code == 202 + await sync_service.task + result = await client.get(response.headers["Location"], params={"offset": 0, "limit": 1}) + assert result.json()["counts"]["added"] == 1 + listed = await client.get("/v3/images") + assert all(image["path"] != str(path) for image in listed.json()) + assert (await client.post("/v3/images/sync", json={"path": "/etc"})).status_code == 422 + assert (await client.get(response.headers["Location"], params={"limit": 1001})).status_code == 422 + assert (await client.get("/v3/images/sync/jobs/does-not-exist")).status_code == 404 + + async def test_overlapping_sync_is_conflict(self, client, sync_service): + from gns3server.utils.image_inventory import ImageLock + async with ImageLock("image-inventory"): + response = await client.post("/v3/images/sync", json={}) + assert response.status_code == 409 + + async def test_delete_and_prune_keep_rows_on_permission_error(self, client, db_session, images_dir): + response = await client.post("/v3/images/upload/protected.qcow2", content=QCOW) + assert response.status_code == 201 + path = response.json()["path"] + with patch("gns3server.api.routes.controller.images.os.remove", side_effect=PermissionError("denied")): + response = await client.delete("/v3/images/protected.qcow2") + assert response.status_code == 409 + response = await client.delete("/v3/images/prune") + assert response.status_code == 409 + assert os.path.exists(path) + assert await ImagesRepository(db_session).get_image(path) is not None + os.unlink(path) + assert (await client.delete("/v3/images/protected.qcow2")).status_code == 204 + + async def test_create_does_not_overwrite_unindexed_file(self, client, images_dir): + path = Path(images_dir) / "QEMU" / "existing.qcow2" + path.write_bytes(QCOW + b"preserve me") + response = await client.post("/v3/images/qemu/existing.qcow2", json={"format": "qcow2", "size": 1}) + assert response.status_code == 400 + assert path.read_bytes() == QCOW + b"preserve me" + + async def test_upload_rejects_path_prefix_sibling_and_symlink(self, client, images_dir, tmp_path): + sibling = images_dir + "-outside/escape.qcow2" + response = await client.post("/v3/images/upload/" + sibling, content=QCOW) + assert response.status_code == 403 + assert not os.path.exists(sibling) + link = Path(images_dir) / "external" + link.symlink_to(tmp_path, target_is_directory=True) + response = await client.post("/v3/images/upload/external/escape.qcow2", content=QCOW) + assert response.status_code == 403 + assert not (tmp_path / "escape.qcow2").exists() + + async def test_sync_requires_allocate_privilege(self, client, sync_service, test_user): + token = auth_service.create_access_token(test_user.username, secret_key=DEFAULT_JWT_SECRET_KEY) + with patch("gns3server.db.repositories.rbac.RbacRepository.check_user_has_privilege", new=AsyncMock(return_value=False)): + response = await client.post("/v3/images/sync", json={}, headers={"Authorization": f"Bearer {token}"}) + assert response.status_code == 403 + assert "Image.Allocate" in response.text + response = await client.get("/v3/images/sync/jobs/test", headers={"Authorization": f"Bearer {token}"}) + assert response.status_code == 403 + assert "Image.Audit" in response.text + response = await client.post("/v3/images/sync", json={}, headers={"Authorization": ""}) + assert response.status_code == 401 + + async def test_template_can_detach_missing_image(self, app, client, sync_service, db_session): + uploaded = await client.post('/v3/images/upload/detach-missing.qcow2', content=QCOW) + assert uploaded.status_code == 201 + image = uploaded.json() + image_id = (await ImagesRepository(db_session).get_image(image['path'])).image_id + created = await client.post('/v3/templates', json={ + 'name': 'Detach missing image', 'compute_id': 'local', + 'template_type': 'qemu', 'hda_disk_image': image['filename'], + }) + assert created.status_code == 201 + template_id = created.json()['template_id'] + os.unlink(image['path']) + await client.post('/v3/images/sync', json={}) + await sync_service.task + updated = await client.put(f'/v3/templates/{template_id}', json={'hda_disk_image': ''}) + assert updated.status_code == 200 + assert not await ImagesRepository(db_session).get_image_templates(image_id) + # Detaching a template does not silently remove the missing catalog row. + assert await ImagesRepository(db_session).get_image(image['path']) is not None diff --git a/tests/api/routes/controller/test_images.py b/tests/api/routes/controller/test_images.py index ea0b2f587..fc50b5320 100644 --- a/tests/api/routes/controller/test_images.py +++ b/tests/api/routes/controller/test_images.py @@ -111,14 +111,17 @@ class TestImageRoutes: async def test_create_image(self, app: FastAPI, client: AsyncClient, images_dir) -> None: - Qemu.instance().create_disk_image = AsyncioMagicMock() + async def create_disk(path, options): + with open(path, "wb") as f: + f.write(b'QFI\xfb\x00\x00\x00') + + Qemu.instance().create_disk_image = AsyncioMagicMock(side_effect=create_disk) path = os.path.join(os.path.join(images_dir, "QEMU", "new_image.qcow2")) - with open(path, "wb+") as f: - f.write(b'QFI\xfb\x00\x00\x00') image_name = os.path.basename(path) response = await client.post( app.url_path_for("create_qemu_image", image_path=image_name), json={"format": "qcow2", "size": 30}) assert response.status_code == status.HTTP_201_CREATED + assert os.path.isfile(path) @pytest.mark.parametrize( "image_type, fixture_name, valid_request", @@ -473,4 +476,4 @@ class TestImageRoutes: templates = await templates_repo.get_templates() assert len(templates) == 1 assert templates[0].name == "Empty VM" - await templates_repo.delete_template(templates[0].template_id) \ No newline at end of file + await templates_repo.delete_template(templates[0].template_id) diff --git a/tests/conftest.py b/tests/conftest.py index b0994ebb8..e9865007d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import pytest +import asyncio import pytest_asyncio import tempfile import shutil @@ -100,12 +101,32 @@ async def base_client(app: FastAPI, db_session: AsyncSession) -> AsyncGenerator[ app.dependency_overrides[get_db_session] = _get_test_db - async with AsyncClient( - base_url="http://test-api", - headers={"Content-Type": "application/json"}, - transport=ASGIWebSocketTransport(app=app) - ) as async_client: - yield async_client + # AnyIO cancel scopes must be entered and exited by the same task. Recent + # pytest-asyncio versions finalize yield fixtures in a different task. + ready = asyncio.get_running_loop().create_future() + finished = asyncio.Event() + + async def own_client(): + try: + async with AsyncClient( + base_url="http://test-api", + headers={"Content-Type": "application/json"}, + transport=ASGIWebSocketTransport(app=app) + ) as async_client: + ready.set_result(async_client) + await finished.wait() + except BaseException as e: + if not ready.done(): + ready.set_exception(e) + raise + + owner = asyncio.create_task(own_client()) + try: + yield await ready + finally: + finished.set() + await owner + app.dependency_overrides.pop(get_db_session, None) @pytest_asyncio.fixture(loop_scope="class", scope="class") diff --git a/tests/services/test_image_reconciliation.py b/tests/services/test_image_reconciliation.py new file mode 100644 index 000000000..94d4e7946 --- /dev/null +++ b/tests/services/test_image_reconciliation.py @@ -0,0 +1,628 @@ +import asyncio +import hashlib +import os +import sys +import threading +import subprocess +from types import SimpleNamespace +from pathlib import Path +from unittest.mock import patch, AsyncMock + +import pytest +import pytest_asyncio +from sqlalchemy import select, text, event +from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine +from sqlalchemy.exc import SQLAlchemyError +from watchdog.events import FileMovedEvent, FileDeletedEvent, FileModifiedEvent + +from gns3server.db.models import Base, Image, ImageSyncJob, Template +from gns3server.db.models.images import image_template_map +from gns3server.db.repositories.images import ImagesRepository +from gns3server.services.image_reconciliation import ImageReconciliationService, InventoryEvents, enumerate_root +from gns3server.utils.image_inventory import ImageLockBusy, image_lock, fingerprint +from gns3server.utils.images import write_image, inspect_image_file, md5sum, InvalidImageError + +pytestmark = pytest.mark.asyncio +QCOW = b"QFI\xfb\x00\x00\x00" + + +@pytest_asyncio.fixture +async def inventory(tmp_path, config): + engine = create_async_engine(f"sqlite+aiosqlite:///{tmp_path / 'catalog.db'}") + @event.listens_for(engine.sync_engine, "connect") + def foreign_keys(connection, record): + connection.execute("PRAGMA foreign_keys=ON") + async with engine.connect() as conn: + with patch("gns3server.services.authentication.AuthService.hash_password", return_value="test"): + await conn.run_sync(Base.metadata.create_all) + await conn.commit() + service = ImageReconciliationService(engine, settle_seconds=0) + try: + yield service + finally: + await service.close() + await engine.dispose() + + +def image_file(config, name="QEMU/image.qcow2", data=QCOW): + path = Path(config.settings.Server.images_path) / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_bytes(data) + return path + + +async def scan(service, **kwargs): + job = await service.start(**kwargs) + await service.task + return await service.get_job(job["job_id"]) + + +async def rows(service): + async with AsyncSession(service.engine) as session: + return [image.asdict() for image in (await session.execute(select(Image))).scalars()] + + +async def test_add_change_missing_restore_preserves_identity_and_template(inventory, config): + path = image_file(config) + assert (await scan(inventory))["counts"]["added"] == 1 + original = (await rows(inventory))[0] + async with AsyncSession(inventory.engine) as session: + image = await session.get(Image, original["image_id"]) + session.add(Template(name="Keep this reference", images=[image])) + await session.commit() + path.write_bytes(QCOW + b"changed") + assert (await scan(inventory))["counts"]["updated"] == 1 + changed = (await rows(inventory))[0] + assert changed["image_id"] == original["image_id"] + assert changed["image_size"] == len(QCOW + b"changed") + assert changed["checksum"] == hashlib.md5(QCOW + b"changed").hexdigest() + path.unlink() + assert (await scan(inventory))["counts"]["missing"] == 1 + assert (await rows(inventory))[0]["availability"] == "missing" + path.write_bytes(QCOW) + await scan(inventory) + restored = (await rows(inventory))[0] + assert restored["image_id"] == original["image_id"] + assert restored["availability"] == "available" + async with AsyncSession(inventory.engine) as session: + assert len((await session.execute(select(image_template_map))).all()) == 1 + + +async def test_fingerprints_skip_hashing_and_force_bypasses_sidecars(inventory, config): + path = image_file(config) + await scan(inventory) + with patch("gns3server.services.image_reconciliation.inspect_image_file", side_effect=AssertionError("unnecessary hash")): + result = await scan(inventory) + assert result["status"] == "completed" + assert result["counts"]["unchanged"] == 1 + assert result["counts"]["bytes_hashed"] == 0 + path.write_bytes(QCOW[:-1] + b"x") # same-size modification + sidecar = Path(str(path) + ".md5sum") + sidecar.write_text("0" * 32) + assert md5sum(str(path), cache_to_md5file=False) == "0" * 32 + assert md5sum(str(path), cache_to_md5file=False, use_cache=False) == hashlib.md5(path.read_bytes()).hexdigest() + result = await scan(inventory, force_checksum=True) + assert result["counts"]["bytes_hashed"] == len(QCOW) + assert (await rows(inventory))[0]["checksum"] == hashlib.md5(path.read_bytes()).hexdigest() + assert not sidecar.exists() + + +async def test_dry_run_does_not_write_catalog_or_sidecar(inventory, config): + path = image_file(config) + sidecar = Path(str(path) + ".md5sum") + sidecar.write_text("0" * 32) + result = await scan(inventory, dry_run=True, force_checksum=True) + assert result["counts"]["added"] == 1 + assert await rows(inventory) == [] + assert sidecar.read_text() == "0" * 32 + await scan(inventory) + before = await rows(inventory) + path.unlink() + assert (await scan(inventory, dry_run=True))["counts"]["missing"] == 1 + assert await rows(inventory) == before + + +@pytest.mark.parametrize("failure", ["missing_root", "partial_walk", "unreadable_file"]) +async def test_failed_scopes_do_not_remove_rows(inventory, config, failure): + path = image_file(config) + await scan(inventory) + root = str(config.settings.Server.images_path) + if failure == "missing_root": + os.rename(root, root + "-offline") + result = await scan(inventory) + elif failure == "partial_walk": + with patch("gns3server.services.image_reconciliation.enumerate_root", return_value=( + {}, [{"path": root, "reason": "Permission denied"}])): + result = await scan(inventory) + else: + with patch("gns3server.services.image_reconciliation.inspect_image_file", side_effect=PermissionError("denied")): + result = await scan(inventory, force_checksum=True) + assert result["status"] == "partial" + assert result["counts"]["missing"] == 0 + assert len(await rows(inventory)) == 1 + assert (await rows(inventory))[0]["availability"] == "unavailable" + + +async def test_extra_nested_and_overlapping_roots(inventory, config, tmp_path): + extra = tmp_path / "extra" + extra.mkdir() + (extra / "image.qcow2").write_bytes(QCOW) + image_file(config, "QEMU/nested/image.qcow2") + image_file(config, "legacy.qcow2") + config.settings.Server.additional_images_paths = [str(extra), str(extra), config.settings.Server.images_path] + result = await scan(inventory) + assert result["counts"]["added"] == 3 + assert len(await rows(inventory)) == 3 + + +async def test_rename_retains_old_reference(inventory, config): + path = image_file(config) + await scan(inventory) + old = (await rows(inventory))[0] + path.rename(path.with_name("renamed.qcow2")) + result = await scan(inventory) + assert result["counts"]["added"] == result["counts"]["missing"] == 1 + assert next(row for row in await rows(inventory) if row["image_id"] == old["image_id"])["availability"] == "missing" + + +async def test_symlinks_hidden_files_and_libraries_are_not_imported(inventory, config, tmp_path): + outside = tmp_path / "outside.qcow2" + outside.write_bytes(QCOW) + path = image_file(config) + path.unlink() + path.symlink_to(outside) + image_file(config, ".hidden/hidden.qcow2") + image_file(config, "IOU/lib/library.so") + image_file(config, "QEMU/upload.tmp") + result = await scan(inventory) + assert result["counts"]["added"] == 0 + assert outside.read_bytes() == QCOW + + +@pytest.mark.parametrize("name,data,expected", [ + ("QEMU/disk.raw", b"raw image bytes", "qemu"), + ("IOS/ios.bin", b"\x7fELF\x01\x02\x01", "ios"), + ("IOU/iou.bin", b"\x7fELF\x02\x01\x01", "iou"), +]) +async def test_image_types_and_raw_policy(inventory, config, name, data, expected): + image_file(config, name, data) + result = await scan(inventory) + assert result["counts"]["added"] == 1 + assert (await rows(inventory))[0]["image_type"] == expected + + +async def test_invalid_replacement_not_usable(inventory, config): + path = image_file(config) + await scan(inventory) + path.write_bytes(b"bad") + assert (await scan(inventory))["counts"]["invalid"] == 1 + async with AsyncSession(inventory.engine) as session: + repo = ImagesRepository(session) + assert await repo.get_image_by_checksum(hashlib.md5(QCOW).hexdigest()) is None + assert (await rows(inventory))[0]["checksum"] == hashlib.md5(QCOW).hexdigest() + + +async def test_changed_during_inspection_is_deferred(inventory, config): + path = image_file(config) + original = inspect_image_file + def replace_after_hash(*args): + info = original(*args) + path.write_bytes(QCOW + b"still copying") + return info + with patch("gns3server.services.image_reconciliation.inspect_image_file", side_effect=replace_after_hash): + result = await scan(inventory) + assert result["counts"]["deferred"] == 1 + assert await rows(inventory) == [] + assert (await scan(inventory))["counts"]["added"] == 1 + + +async def test_per_file_database_failure_does_not_poison_next_file(inventory, config): + image_file(config, "QEMU/first.qcow2") + image_file(config, "QEMU/second.qcow2") + original = ImagesRepository.save_verified_image + calls = 0 + async def fail_first(repo, info): + nonlocal calls + calls += 1 + if calls == 1: + # Real failed SQL statement in the file's session. + await repo._db_session.execute(text("INSERT INTO nonexistent_image_table VALUES (1)")) + return await original(repo, info) + with patch.object(ImagesRepository, "save_verified_image", fail_first): + result = await scan(inventory) + assert result["status"] == "partial" + assert result["counts"]["added"] == 1 + assert (await scan(inventory))["counts"]["added"] == 1 + assert len(await rows(inventory)) == 2 + + +async def test_overlapping_jobs_rejected_and_interrupted_job_recovers(inventory, config): + path = image_file(config) + async with image_lock(str(path)): + job = await inventory.start() + other = ImageReconciliationService(inventory.engine, settle_seconds=0) + with pytest.raises(ImageLockBusy): + await other.start() + await inventory.task + async with AsyncSession(inventory.engine) as session: + stale = await session.get(ImageSyncJob, job["job_id"]) + stale.status = "running" + await session.commit() + await scan(inventory) + assert (await inventory.get_job(job["job_id"]))["status"] == "interrupted" + + +async def test_close_immediately_releases_lock_and_finishes_job(inventory, config): + image_file(config) + job = await inventory.start() + await inventory.close() + assert (await inventory.get_job(job["job_id"]))["status"] == "cancelled" + other = ImageReconciliationService(inventory.engine, settle_seconds=0) + try: + assert (await scan(other))["status"] == "completed" + finally: + await other.close() + + +async def test_watcher_coalesces_move_delete_modify_events(): + dirty = asyncio.Event() + handler = InventoryEvents(asyncio.get_running_loop(), dirty) + for event in [FileMovedEvent("/images/upload.tmp", "/images/new.qcow2"), + FileDeletedEvent("/images/deleted.qcow2"), FileModifiedEvent("/images/changed.qcow2")]: + dirty.clear() + handler.dispatch(event) + await asyncio.sleep(0) + assert dirty.is_set() + dirty.clear() + handler.dispatch(FileModifiedEvent("/images/new.qcow2.md5sum")) + await asyncio.sleep(0) + assert not dirty.is_set() + + +async def stream(data, chunk_size=1): + for offset in range(0, len(data), chunk_size): + yield data[offset:offset + chunk_size] + + +async def test_upload_fragmented_header_and_missing_row_reuse(inventory, config): + path = image_file(config) + await scan(inventory) + old_id = (await rows(inventory))[0]["image_id"] + path.unlink() + await scan(inventory) + async with AsyncSession(inventory.engine, expire_on_commit=False) as session: + image = await write_image("QEMU/image.qcow2", str(path), stream(QCOW), ImagesRepository(session)) + assert image.image_id == old_id + assert image.availability == "available" + assert path.read_bytes() == QCOW + assert not list(path.parent.glob("*.tmp")) + + +async def test_upload_db_failure_is_recovered_by_scan(inventory, config): + path = Path(config.settings.Server.images_path) / "QEMU/orphan.qcow2" + async with AsyncSession(inventory.engine, expire_on_commit=False) as session: + repo = ImagesRepository(session) + with patch.object(repo, "save_verified_image", side_effect=SQLAlchemyError("commit failed")): + with pytest.raises(SQLAlchemyError): + await write_image("QEMU/orphan.qcow2", str(path), stream(QCOW), repo) + assert path.read_bytes() == QCOW + assert (await scan(inventory))["counts"]["added"] == 1 + + +async def test_concurrent_uploads_never_overwrite(inventory, config): + path = Path(config.settings.Server.images_path) / "QEMU/same.qcow2" + async def upload(data): + async with AsyncSession(inventory.engine, expire_on_commit=False) as session: + return await write_image("QEMU/same.qcow2", str(path), stream(data), ImagesRepository(session)) + result = await asyncio.gather(upload(QCOW), upload(QCOW + b"different"), return_exceptions=True) + assert sum(isinstance(item, InvalidImageError) for item in result) == 1 + assert len(await rows(inventory)) == 1 + assert (await rows(inventory))[0]["checksum"] == hashlib.md5(path.read_bytes()).hexdigest() + + +async def test_checksum_lookup_ignores_missing_duplicate(inventory, config): + first = image_file(config, "QEMU/first.qcow2") + second = image_file(config, "QEMU/second.qcow2") + await scan(inventory) + first.unlink() + # No sync is needed to reject a stale candidate at the point of use. + async with AsyncSession(inventory.engine) as session: + image = await ImagesRepository(session).get_image_by_checksum(hashlib.md5(QCOW).hexdigest(), str(second.parent)) + assert image.path == str(second) + + +async def test_path_matching_does_not_interpret_sql_wildcards(inventory, config): + path = image_file(config, "QEMU/name_%/disk.qcow2") + image_file(config, "QEMU/name_AB/disk.qcow2") + await scan(inventory) + async with AsyncSession(inventory.engine) as session: + repo = ImagesRepository(session) + assert (await repo.get_image("name_%/disk.qcow2")).path == str(path) + assert await repo.get_image("me_%/disk.qcow2") is None + + +async def test_migration_roundtrip_preserves_rows_and_relationships(inventory, config): + from alembic import command + from alembic.config import Config + image_file(config) + await scan(inventory) + original = (await rows(inventory))[0] + async with AsyncSession(inventory.engine) as session: + image = await session.get(Image, original["image_id"]) + session.add(Template(name="Migration reference", images=[image])) + await session.commit() + + def migrate(connection): + cfg = Config() + cfg.set_main_option("script_location", "gns3server:db_migrations") + cfg.attributes["connection"] = connection + command.stamp(cfg, "d9e8a2b7c401") + command.downgrade(cfg, "c7e4a9f1d2b6") + assert connection.execute(text("SELECT count(*) FROM image_template_map")).scalar_one() == 1 + assert connection.execute(text("SELECT image_id FROM images")).scalar_one() == original["image_id"] + command.upgrade(cfg, "head") + assert connection.execute(text("PRAGMA foreign_key_check")).all() == [] + + async with inventory.engine.connect() as connection: + await connection.run_sync(migrate) + await connection.commit() + migrated = (await rows(inventory))[0] + assert migrated["availability"] == "unknown" + assert migrated["file_fingerprint"] is None + assert migrated["image_id"] == original["image_id"] + await scan(inventory) + assert (await rows(inventory))[0]["availability"] == "available" + + +@pytest.mark.skipif(sys.platform != "linux", reason="Native Linux watcher integration") +async def test_native_watcher_covers_extra_roots_and_stops(inventory, config, tmp_path): + extra = tmp_path / "extra-watch" + extra.mkdir() + config.settings.Server.additional_images_paths = [str(extra)] + config.settings.Server.auto_discover_images = True + await inventory._watch() + observer = inventory.observer + assert observer.is_alive() + inventory.dirty.clear() + temporary = extra / "incoming.tmp" + temporary.write_bytes(QCOW) + temporary.rename(extra / "finished.qcow2") + await asyncio.wait_for(inventory.dirty.wait(), 5) + assert (await scan(inventory))["counts"]["added"] == 1 + inventory.dirty.clear() + (extra / "finished.qcow2").unlink() + await asyncio.wait_for(inventory.dirty.wait(), 5) + assert (await scan(inventory))["counts"]["missing"] == 1 + await inventory.close() + assert not observer.is_alive() + + +@pytest.mark.skipif(os.name == "nt", reason="POSIX lock integration") +async def test_image_lock_excludes_another_process(config, tmp_path): + path = str(tmp_path / "image.qcow2") + code = ( + "import fcntl, sys; f = open(sys.argv[1], 'a+b'); " + "fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)" + ) + async with image_lock(path) as lock: + lock_path = lock._file.name + result = await asyncio.to_thread(subprocess.run, [sys.executable, "-c", code, lock_path], capture_output=True) + assert result.returncode != 0 + assert b"BlockingIOError" in result.stderr + result = await asyncio.to_thread(subprocess.run, [sys.executable, "-c", code, lock_path], capture_output=True) + assert result.returncode == 0 + + +async def test_shutdown_during_hash_waits_for_worker_before_releasing_lock(inventory, config): + image_file(config) + entered = threading.Event() + exited = threading.Event() + def slow_hash(path, expected, raw, stopped): + entered.set() + stopped.wait(5) + exited.set() + raise InterruptedError("stopped") + with patch("gns3server.services.image_reconciliation.inspect_image_file", side_effect=slow_hash): + job = await inventory.start() + assert await asyncio.to_thread(entered.wait, 5) + await inventory.close() + assert exited.is_set() + assert (await inventory.get_job(job["job_id"]))["status"] == "cancelled" + assert await rows(inventory) == [] + + +async def test_appliance_fallback_repairs_existing_row_and_rejects_wrong_content(inventory, config): + from gns3server.controller.appliance_manager import ApplianceManager + from gns3server.controller.controller_error import ControllerError + path = image_file(config) + await scan(inventory) + old_id = (await rows(inventory))[0]["image_id"] + data = QCOW + b"replacement" + path.write_bytes(data) + appliance = SimpleNamespace(images=[{"filename": path.name, "md5sum": hashlib.md5(data).hexdigest()}]) + async with AsyncSession(inventory.engine, expire_on_commit=False) as session: + await ApplianceManager()._find_appliance_version_images( + appliance, {"images": {"hda_disk_image": path.name}}, ImagesRepository(session), str(path.parent)) + assert (await rows(inventory))[0]["image_id"] == old_id + appliance.images[0]["md5sum"] = "0" * 32 + async with AsyncSession(inventory.engine, expire_on_commit=False) as session: + with pytest.raises(ControllerError, match="checksum"): + await ApplianceManager()._find_appliance_version_images( + appliance, {"images": {"hda_disk_image": path.name}}, ImagesRepository(session), str(path.parent)) + + +async def test_legacy_path_spelling_preserves_identity(inventory, config): + path = image_file(config) + legacy_path = str(path.parent) + os.sep + "." + os.sep + path.name + async with AsyncSession(inventory.engine, expire_on_commit=False) as session: + original = await ImagesRepository(session).add_image(path.name, "qemu", len(QCOW), legacy_path, "0" * 32, "md5") + original_id = original.image_id + await scan(inventory) + images = await rows(inventory) + assert len(images) == 1 + assert images[0]["image_id"] == original_id + assert images[0]["path"] == legacy_path + assert images[0]["checksum"] == hashlib.md5(QCOW).hexdigest() + + +async def test_root_disappearing_during_scan_does_not_mark_images_missing(inventory, config): + first = image_file(config, "QEMU/first.qcow2") + image_file(config, "QEMU/second.qcow2") + await scan(inventory) + first.unlink() + root = config.settings.Server.images_path + original = inventory._file + async def disconnect_root(*args): + await original(*args) + os.rename(root, root + "-disconnected") + with patch.object(inventory, "_file", side_effect=disconnect_root): + result = await scan(inventory) + assert result["status"] == "partial" + assert result["counts"]["missing"] == 0 + images = await rows(inventory) + assert next(image for image in images if image["path"] == str(first))["availability"] == "unavailable" + + +async def test_polling_recovers_crashed_job_without_starting_a_scan(inventory, config): + image_file(config) + job = await scan(inventory) + async with AsyncSession(inventory.engine) as session: + row = await session.get(ImageSyncJob, job["job_id"]) + row.status = "running" + await session.commit() + assert not config.settings.Server.auto_discover_images + assert (await inventory.get_job(job["job_id"]))["status"] == "interrupted" + + +async def test_periodic_scan_recovers_without_watcher_events(inventory, config): + config.settings.Server.auto_discover_images = True + image_file(config) + # Use a short interval and initial wait in the service, leaving asyncio's + # event-loop scheduling and database operations intact. + real_sleep = asyncio.sleep + async def short_sleep(seconds): + await real_sleep(0.01) + scans = [] + original_start = inventory.start + async def observed_start(*args, **kwargs): + job = await original_start(*args, **kwargs) + scans.append(job["job_id"]) + return job + async def missed_event(*args, **kwargs): + # Consume/close the unused Event.wait coroutine, then simulate a timeout. + args[0].close() + await real_sleep(0.01) + raise asyncio.TimeoutError + with patch.object(inventory, "_watch", new=AsyncMock()), \ + patch.object(inventory, "start", side_effect=observed_start), \ + patch("gns3server.services.image_reconciliation.asyncio.sleep", side_effect=short_sleep), \ + patch("gns3server.services.image_reconciliation.asyncio.wait_for", side_effect=missed_event): + inventory.start_background() + for _ in range(500): + if len(scans) >= 2: + break + await real_sleep(0.01) + await inventory.close() + assert len(scans) >= 2 + assert len(await rows(inventory)) == 1 + + +async def test_unchanged_collection_avoids_hashing_and_keeps_loop_responsive(inventory, config): + import time + for index in range(200): + image_file(config, f"QEMU/bulk/{index}.qcow2", QCOW + b"x" * 65536) + samples = [] + done = asyncio.Event() + async def heartbeat(): + previous = time.monotonic() + while not done.is_set(): + await asyncio.sleep(0.01) + current = time.monotonic() + samples.append(current - previous) + previous = current + pulse = asyncio.create_task(heartbeat()) + try: + first = await scan(inventory) + second = await scan(inventory) + finally: + done.set() + await pulse + assert first["counts"]["added"] == 200 + assert second["counts"]["unchanged"] == 200 + assert second["counts"]["bytes_hashed"] == 0 + assert len(samples) > 2 + # Generous stall threshold; this checks responsiveness rather than host speed. + assert max(samples) < 2 + + +async def test_startup_upgrades_unversioned_existing_catalog(inventory, config, monkeypatch): + from alembic import command + from alembic.config import Config + from fastapi import FastAPI + from gns3server.db.tasks import connect_to_db, disconnect_from_db + image_file(config) + await scan(inventory) + original_id = (await rows(inventory))[0]["image_id"] + + def remove_inventory_schema(connection): + cfg = Config() + cfg.set_main_option("script_location", "gns3server:db_migrations") + cfg.attributes["connection"] = connection + command.stamp(cfg, "d9e8a2b7c401") + command.downgrade(cfg, "c7e4a9f1d2b6") + connection.execute(text("DROP TABLE alembic_version")) + + async with inventory.engine.connect() as connection: + await connection.run_sync(remove_inventory_schema) + await connection.commit() + monkeypatch.setenv("GNS3_DATABASE_URI", str(inventory.engine.url)) + app = FastAPI() + await connect_to_db(app) + try: + restored = (await rows(inventory))[0] + assert restored["image_id"] == original_id + assert restored["availability"] == "unknown" + finally: + await disconnect_from_db(app) + + +@pytest.mark.parametrize("operation", ["delete", "prune"]) +@pytest.mark.parametrize("reuse_id", [False, True]) +async def test_delete_preserves_replacement_created_while_waiting_for_lock(inventory, config, operation, reuse_id): + from contextlib import asynccontextmanager + from sqlalchemy import delete + from gns3server.api.routes.controller.images import delete_image + from gns3server.controller.controller_error import ControllerError + + path = image_file(config) + await scan(inventory) + original = (await rows(inventory))[0] + replacement = QCOW + b"replacement uploaded by another request" + replacement_id = original["image_id"] if reuse_id else original["image_id"] + 100 + + @asynccontextmanager + async def concurrent_replacement(locked_path): + assert locked_path == str(path) + async with AsyncSession(inventory.engine) as writer: + await writer.execute(delete(Image).where(Image.image_id == original["image_id"])) + path.write_bytes(replacement) + info = inspect_image_file(str(path)) + info["filename"] = info.pop("image_name") + writer.add(Image(image_id=replacement_id, **info)) + await writer.commit() + yield + + module = "gns3server.api.routes.controller.images" if operation == "delete" else "gns3server.db.repositories.images" + with patch(module + ".image_lock", concurrent_replacement), patch( + "gns3server.api.routes.controller.images.Controller.instance", + return_value=SimpleNamespace(find_projects_using_image=lambda filename: []), + ): + async with AsyncSession(inventory.engine, expire_on_commit=False) as session: + repository = ImagesRepository(session) + if operation == "delete": + with pytest.raises(ControllerError, match="changed"): + await delete_image(str(path), repository) + else: + assert await repository.prune_images() == 0 + assert path.read_bytes() == replacement + assert (await rows(inventory))[0]["image_id"] == replacement_id From 6ffa39642f1d891122f97b079768cdcd03c99f55 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:45:50 +0000 Subject: [PATCH 013/390] fix(typing): resolve mypy errors in agent.mcp --- gns3server/agent/mcp/__init__.py | 54 +++++++++++++++-------------- pyproject.toml | 1 - tests/agent/mcp/test_tool_params.py | 3 ++ 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/gns3server/agent/mcp/__init__.py b/gns3server/agent/mcp/__init__.py index 9b9026253..e89babc77 100644 --- a/gns3server/agent/mcp/__init__.py +++ b/gns3server/agent/mcp/__init__.py @@ -405,22 +405,24 @@ async def project_stats( @mcp.tool() async def project_update( project_id: Annotated[str, Field(description="UUID of the project to update")], - name: Annotated[str, Field(description="New project name")] = None, - auto_close: Annotated[bool, Field(description="Close project when last client leaves")] = None, - auto_open: Annotated[bool, Field(description="Project opens when GNS3 starts")] = None, - auto_start: Annotated[bool, Field(description="Project starts when opened")] = None, - scene_width: Annotated[int, Field(description="Width of the drawing area")] = None, - scene_height: Annotated[int, Field(description="Height of the drawing area")] = None, - zoom: Annotated[int, Field(description="Zoom of the drawing area")] = None, - show_layers: Annotated[bool, Field(description="Show layers on the drawing area")] = None, - snap_to_grid: Annotated[bool, Field(description="Snap to grid on the drawing area")] = None, - show_grid: Annotated[bool, Field(description="Show the grid on the drawing area")] = None, - grid_size: Annotated[int, Field(description="Grid size for the drawing area for nodes")] = None, - drawing_grid_size: Annotated[int, Field(description="Grid size for the drawing area for drawings")] = None, - show_interface_labels: Annotated[bool, Field(description="Show interface labels on the drawing area")] = None, + name: Annotated[str | None, Field(description="New project name")] = None, + auto_close: Annotated[bool | None, Field(description="Close project when last client leaves")] = None, + auto_open: Annotated[bool | None, Field(description="Project opens when GNS3 starts")] = None, + auto_start: Annotated[bool | None, Field(description="Project starts when opened")] = None, + scene_width: Annotated[int | None, Field(description="Width of the drawing area")] = None, + scene_height: Annotated[int | None, Field(description="Height of the drawing area")] = None, + zoom: Annotated[int | None, Field(description="Zoom of the drawing area")] = None, + show_layers: Annotated[bool | None, Field(description="Show layers on the drawing area")] = None, + snap_to_grid: Annotated[bool | None, Field(description="Snap to grid on the drawing area")] = None, + show_grid: Annotated[bool | None, Field(description="Show the grid on the drawing area")] = None, + grid_size: Annotated[int | None, Field(description="Grid size for the drawing area for nodes")] = None, + drawing_grid_size: Annotated[int | None, Field(description="Grid size for the drawing area for drawings")] = None, + show_interface_labels: Annotated[ + bool | None, Field(description="Show interface labels on the drawing area") + ] = None, ) -> list[dict[str, Any]]: """Update a project's properties (name, auto_close, auto_open, etc.).""" - params = {"project_id": project_id} + params: dict[str, Any] = {"project_id": project_id} local_vars = { "name": name, "auto_close": auto_close, @@ -449,7 +451,7 @@ async def project_duplicate( reset_mac_addresses: Annotated[bool, Field(description="Reset MAC addresses for this project")] = False, ) -> list[dict[str, Any]]: """Duplicate a project.""" - params = {"project_id": project_id, "name": name} + params: dict[str, Any] = {"project_id": project_id, "name": name} if reset_mac_addresses: params["reset_mac_addresses"] = reset_mac_addresses return await asyncio.to_thread(_run_handler_sync, duplicate_project_handler, params) @@ -523,7 +525,7 @@ async def node_start( ] = None, ) -> list[dict[str, Any]]: """Start one or more nodes. Provide node_id for single, or node_ids for batch.""" - params = {"project_id": project_id} + params: dict[str, Any] = {"project_id": project_id} if node_ids: params["node_ids"] = node_ids else: @@ -540,7 +542,7 @@ async def node_stop( ] = None, ) -> list[dict[str, Any]]: """Stop one or more nodes. Provide node_id for single, or node_ids for batch.""" - params = {"project_id": project_id} + params: dict[str, Any] = {"project_id": project_id} if node_ids: params["node_ids"] = node_ids else: @@ -557,7 +559,7 @@ async def node_suspend( ] = None, ) -> list[dict[str, Any]]: """Suspend one or more nodes. Provide node_id for single, or node_ids for batch.""" - params = {"project_id": project_id} + params: dict[str, Any] = {"project_id": project_id} if node_ids: params["node_ids"] = node_ids else: @@ -635,7 +637,7 @@ async def node_delete( ] = None, ) -> list[dict[str, Any]]: """Delete one or more nodes from a project. Provide node_id for single, or node_ids for batch.""" - params = {"project_id": project_id} + params: dict[str, Any] = {"project_id": project_id} if node_ids: params["node_ids"] = node_ids else: @@ -756,7 +758,7 @@ async def link_create( "fields": fields, }, ) - params = {"project_id": project_id, "nodes": nodes, "link_type": link_type, "fields": fields} + params: dict[str, Any] = {"project_id": project_id, "nodes": nodes, "link_type": link_type, "fields": fields} if filters: params["filters"] = filters return await asyncio.to_thread(_run_handler_sync, create_link_handler, params) @@ -771,7 +773,7 @@ async def link_delete( ] = None, ) -> list[dict[str, Any]]: """Delete one or more links from a project.""" - params = {"project_id": project_id} + params: dict[str, Any] = {"project_id": project_id} if link_ids: params["link_ids"] = link_ids else: @@ -1201,7 +1203,7 @@ async def link_reset( while keeping the filter configuration intact. Filters are preserved but their internal application state resets. """ - params = {"project_id": project_id} + params: dict[str, Any] = {"project_id": project_id} if link_ids: params["link_ids"] = link_ids else: @@ -1222,7 +1224,7 @@ async def link_capture_start( ] = None, ) -> list[dict[str, Any]]: """Start packet capture on one or more links.""" - params = { + params: dict[str, Any] = { "project_id": project_id, "data_link_type": data_link_type, "capture_file_name": capture_file_name, @@ -1245,7 +1247,7 @@ async def link_capture_stop( ] = None, ) -> list[dict[str, Any]]: """Stop packet capture on one or more links.""" - params = {"project_id": project_id} + params: dict[str, Any] = {"project_id": project_id} if link_ids: params["link_ids"] = link_ids else: @@ -1273,7 +1275,7 @@ async def link_capture_download( - The ticket expires after 10 minutes: call this tool again to get a fresh one; do not reuse an old URL. """ - params = {"project_id": project_id} + params: dict[str, Any] = {"project_id": project_id} if link_ids: params["link_ids"] = link_ids else: @@ -1555,7 +1557,7 @@ async def drawing_update( rotation: Annotated[int | None, Field(description="Rotation angle in degrees, -359 to 359")] = None, ) -> list[dict[str, Any]]: """Update a drawing's properties (svg, position, lock state, rotation, etc.).""" - params = {"project_id": project_id, "drawing_id": drawing_id} + params: dict[str, Any] = {"project_id": project_id, "drawing_id": drawing_id} local_vars = {"svg": svg, "locked": locked, "x": x, "y": y, "z": z, "rotation": rotation} for key, val in local_vars.items(): if val is not None: diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..453b3bfd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -315,7 +315,6 @@ module = [ "gns3server.agent.gns3_copilot.utils.custom_netmiko.scripts.list_netmiko_telnet_devices", # 1 "gns3server.agent.gns3_copilot.utils.message_converters", # 2 "gns3server.agent.gns3_copilot.utils.parse_tool_content", # 1 - "gns3server.agent.mcp", # 34 "gns3server.agent.mcp.appliances", # 1 "gns3server.agent.web_wireshark.docker_client", # 5 "gns3server.agent.web_wireshark.manage_wireshark", # 1 diff --git a/tests/agent/mcp/test_tool_params.py b/tests/agent/mcp/test_tool_params.py index 258436462..05c7de063 100644 --- a/tests/agent/mcp/test_tool_params.py +++ b/tests/agent/mcp/test_tool_params.py @@ -193,6 +193,9 @@ def _initial_params_keys(fn_node): and isinstance(stmt.value, ast.Dict) ): return _dict_literal_keys(stmt.value) + if isinstance(stmt, ast.AnnAssign): + if isinstance(stmt.target, ast.Name) and stmt.target.id == "params" and isinstance(stmt.value, ast.Dict): + return _dict_literal_keys(stmt.value) return None From 3fc1d2793745ae682305b748f1d1dedf4fa0a5e9 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:46:59 +0000 Subject: [PATCH 014/390] fix(typing): resolve mypy errors in utils.zipfile_zstd --- gns3server/utils/zipfile_zstd/__init__.py | 2 +- gns3server/utils/zipfile_zstd/_zipfile.py | 11 ++++++++--- pyproject.toml | 2 -- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gns3server/utils/zipfile_zstd/__init__.py b/gns3server/utils/zipfile_zstd/__init__.py index 4aae04421..f43df1493 100644 --- a/gns3server/utils/zipfile_zstd/__init__.py +++ b/gns3server/utils/zipfile_zstd/__init__.py @@ -2,7 +2,7 @@ from . import _zipfile from zipfile import * -from zipfile import ( +from ._zipfile import ( ZIP_ZSTANDARD, ZSTANDARD_VERSION, ) diff --git a/gns3server/utils/zipfile_zstd/_zipfile.py b/gns3server/utils/zipfile_zstd/_zipfile.py index 2d5d200fa..e4bb61b03 100644 --- a/gns3server/utils/zipfile_zstd/_zipfile.py +++ b/gns3server/utils/zipfile_zstd/_zipfile.py @@ -1,13 +1,18 @@ -import zipfile +import zipfile as _zipfile_module import zstandard as zstd import inspect +from typing import Any from ._patcher import patch +zipfile: Any = _zipfile_module -zipfile.ZIP_ZSTANDARD = 93 +ZIP_ZSTANDARD = 93 +ZSTANDARD_VERSION = 20 + +zipfile.ZIP_ZSTANDARD = ZIP_ZSTANDARD zipfile.compressor_names[zipfile.ZIP_ZSTANDARD] = "zstandard" -zipfile.ZSTANDARD_VERSION = 20 +zipfile.ZSTANDARD_VERSION = ZSTANDARD_VERSION @patch(zipfile, "_check_compression") diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..64d92894e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -427,8 +427,6 @@ module = [ "gns3server.utils.images", # 4 "gns3server.utils.packet_filter_validation", # 16 "gns3server.utils.websocket_to_websocket", # 12 - "gns3server.utils.zipfile_zstd", # 2 "gns3server.utils.zipfile_zstd._patcher", # 1 - "gns3server.utils.zipfile_zstd._zipfile", # 5 ] ignore_errors = true From 644ed6333451c2b20559a7b0c1541f3efd5fd647 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:13:29 +0000 Subject: [PATCH 015/390] fix(typing): resolve mypy errors in agent.gns3_copilot.agent_service --- .../agent/gns3_copilot/agent_service.py | 37 ++++++++----------- pyproject.toml | 1 - 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/gns3server/agent/gns3_copilot/agent_service.py b/gns3server/agent/gns3_copilot/agent_service.py index bf916b043..32c71c981 100644 --- a/gns3server/agent/gns3_copilot/agent_service.py +++ b/gns3server/agent/gns3_copilot/agent_service.py @@ -256,17 +256,16 @@ class AgentService: ) # Ensure checkpointer is initialized - if not self._checkpointer_conn: - await self._get_checkpointer() + checkpointer = await self._get_checkpointer() # Get or create chat session - repo = ChatSessionsRepository(self._checkpointer_conn) + repo = ChatSessionsRepository(checkpointer.conn) session = await repo.get_session_by_thread(session_id) is_new_session = session is None if is_new_session: # Create new session - copilot_mode = llm_config.get("copilot_mode", "teaching_assistant").lower() + copilot_mode = (llm_config or {}).get("copilot_mode", "teaching_assistant").lower() session = await repo.create_session( thread_id=session_id, user_id=user_id or "", @@ -290,7 +289,7 @@ class AgentService: # Build config - only thread-safe identifiers # Determine recursion_limit based on copilot_mode - copilot_mode = llm_config.get("copilot_mode", "teaching_assistant").lower() + copilot_mode = (llm_config or {}).get("copilot_mode", "teaching_assistant").lower() if copilot_mode == "troubleshooting_injection": recursion_limit = 100 # Need more recursion depth for fault injection workflow log.debug("Using extended recursion_limit for troubleshooting_injection mode: 100") @@ -453,10 +452,10 @@ class AgentService: yield chunk else: # Use stateless converter for other events - chunk = self._convert_event_to_chunk(event, session_id) - if chunk: - log.debug("Yielding chunk: type=%s", chunk.get("type")) - yield chunk + converted = self._convert_event_to_chunk(event, session_id) + if converted: + log.debug("Yielding chunk: type=%s", converted.get("type")) + yield converted # Check if stream was aborted and yield tool_end events for aborted tools from gns3server.agent.gns3_copilot.agent.gns3_copilot import ( @@ -624,10 +623,9 @@ class AgentService: Returns: List of session dictionaries """ - if not self._checkpointer_conn: - await self._get_checkpointer() + checkpointer = await self._get_checkpointer() - repo = ChatSessionsRepository(self._checkpointer_conn) + repo = ChatSessionsRepository(checkpointer.conn) sessions = await repo.list_sessions(user_id=user_id, copilot_mode=copilot_mode, limit=limit) return [s.to_dict() for s in sessions] @@ -641,10 +639,9 @@ class AgentService: Returns: True if deleted, False if not found """ - if not self._checkpointer_conn: - await self._get_checkpointer() + checkpointer = await self._get_checkpointer() - repo = ChatSessionsRepository(self._checkpointer_conn) + repo = ChatSessionsRepository(checkpointer.conn) return await repo.delete_session(session_id) async def rename_session(self, session_id: str, new_title: str) -> Optional[Dict[str, Any]]: @@ -658,10 +655,9 @@ class AgentService: Returns: Updated session dictionary or None """ - if not self._checkpointer_conn: - await self._get_checkpointer() + checkpointer = await self._get_checkpointer() - repo = ChatSessionsRepository(self._checkpointer_conn) + repo = ChatSessionsRepository(checkpointer.conn) session = await repo.update_session(thread_id=session_id, title=new_title) return session.to_dict() if session else None @@ -676,10 +672,9 @@ class AgentService: Returns: Updated session dictionary or None """ - if not self._checkpointer_conn: - await self._get_checkpointer() + checkpointer = await self._get_checkpointer() - repo = ChatSessionsRepository(self._checkpointer_conn) + repo = ChatSessionsRepository(checkpointer.conn) session = await repo.pin_session(thread_id=session_id, pinned=pinned) return session.to_dict() if session else None diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..54ecf647b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -297,7 +297,6 @@ module = [ "gns3server.agent", # 2 "gns3server.agent.gns3_copilot.agent.context_manager", # 5 "gns3server.agent.gns3_copilot.agent.model_factory", # 4 - "gns3server.agent.gns3_copilot.agent_service", # 8 "gns3server.agent.gns3_copilot.chat_sessions_repository", # 8 "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 "gns3server.agent.gns3_copilot.gns3_client.connector_factory", # 1 From b8a51fdefc016f5d5d1ef5367b9067d9187d8f5a Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:41:05 +0000 Subject: [PATCH 016/390] fix(typing): resolve mypy errors in api.routes.compute.qemu_nodes --- gns3server/api/routes/compute/qemu_nodes.py | 44 +++++++++++---------- pyproject.toml | 1 - 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/gns3server/api/routes/compute/qemu_nodes.py b/gns3server/api/routes/compute/qemu_nodes.py index 4f8498847..6f1794fb9 100644 --- a/gns3server/api/routes/compute/qemu_nodes.py +++ b/gns3server/api/routes/compute/qemu_nodes.py @@ -23,7 +23,7 @@ import os from fastapi import APIRouter, WebSocket, Depends, Body, Path, status, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse -from typing import Union +from typing import Any, Union from uuid import UUID from gns3server import schemas @@ -36,7 +36,9 @@ import logging log = logging.getLogger(__name__) -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or Qemu node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or Qemu node"} +} router = APIRouter(responses=responses) @@ -64,29 +66,29 @@ async def create_qemu_node(project_id: UUID, node_data: schemas.QemuCreate) -> s """ qemu = Qemu.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) - disk_images_to_reset = set(node_data.pop("disk_images_to_reset", [])) + data = jsonable_encoder(node_data, exclude_unset=True) + disk_images_to_reset = set(data.pop("disk_images_to_reset", [])) vm = await qemu.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.pop("node_id", None), - linked_clone=node_data.get("linked_clone", True), - qemu_path=node_data.pop("qemu_path", None), - console=node_data.pop("console", None), - console_type=node_data.pop("console_type", "telnet"), - aux=node_data.get("aux"), - aux_type=node_data.pop("aux_type", "none"), - platform=node_data.pop("platform", None), + data.pop("node_id", None), + linked_clone=data.get("linked_clone", True), + qemu_path=data.pop("qemu_path", None), + console=data.pop("console", None), + console_type=data.pop("console_type", "telnet"), + aux=data.get("aux"), + aux_type=data.pop("aux_type", "none"), + platform=data.pop("platform", None), ) # update the disk image with the backing file if provided # this is needed when duplicating a node that uses backed disk images drives = ["a", "b", "c", "d"] for drive in drives: - disk_image_backing_file = node_data.get(f"hd{drive}_disk_image_backing_file") + disk_image_backing_file = data.get(f"hd{drive}_disk_image_backing_file") if disk_image_backing_file: log.debug(f"Updating disk image for drive {drive} with backing file {disk_image_backing_file}") - node_data[f"hd{drive}_disk_image"] = disk_image_backing_file + data[f"hd{drive}_disk_image"] = disk_image_backing_file # Validate every explicitly replaced disk before removing its stale # overlay. Other unresolved disks may still make this create request fail, @@ -94,7 +96,7 @@ async def create_qemu_node(project_id: UUID, node_data: schemas.QemuCreate) -> s for drive in drives: disk_image_property = f"hd{drive}_disk_image" if disk_image_property in disk_images_to_reset: - replacement_image = node_data.get(disk_image_property) + replacement_image = data.get(disk_image_property) if replacement_image: vm.manager.get_abs_image_path(replacement_image, vm.working_dir) local_disk_name = f"hd{drive}_disk.qcow2" @@ -107,11 +109,11 @@ async def create_qemu_node(project_id: UUID, node_data: schemas.QemuCreate) -> s log.info( "Removing stale linked-clone disk '%s' before using replacement image '%s'", local_disk, - node_data.get(disk_image_property), + data.get(disk_image_property), ) vm.delete_disk_image(local_disk_name) - for name, value in node_data.items(): + for name, value in data.items(): if hasattr(vm, name) and getattr(vm, name) != value: setattr(vm, name, value) @@ -133,10 +135,10 @@ async def update_qemu_node(node_data: schemas.QemuUpdate, node: QemuVM = Depends Update a Qemu node. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) # update the console first to avoid issue if updating console type - node.console = node_data.pop("console", node.console) - for name, value in node_data.items(): + node.console = data.pop("console", node.console) + for name, value in data.items(): if hasattr(node, name) and getattr(node, name) != value: await node.update_property(name, value) node.updated() diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..009f1406e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -335,7 +335,6 @@ module = [ "gns3server.api.routes.compute.nat_nodes", # 10 "gns3server.api.routes.compute.notifications", # 4 "gns3server.api.routes.compute.projects", # 7 - "gns3server.api.routes.compute.qemu_nodes", # 18 "gns3server.api.routes.compute.virtualbox_nodes", # 20 "gns3server.api.routes.compute.vmware_nodes", # 10 "gns3server.api.routes.compute.vpcs_nodes", # 9 From ecff4beb6500940b255009390eb31726a0085b6b Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:27:53 +0000 Subject: [PATCH 017/390] fix(typing): resolve mypy errors in api.routes.controller.links --- gns3server/api/routes/controller/links.py | 18 ++++++++------ gns3server/controller/link.py | 30 +++++++++++++++++++++-- pyproject.toml | 1 - 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/gns3server/api/routes/controller/links.py b/gns3server/api/routes/controller/links.py index 1ee60a891..2f5eddee3 100644 --- a/gns3server/api/routes/controller/links.py +++ b/gns3server/api/routes/controller/links.py @@ -26,7 +26,7 @@ import aiohttp from fastapi import APIRouter, Depends, Request, status, WebSocket from fastapi.responses import FileResponse, StreamingResponse from fastapi.encoders import jsonable_encoder -from typing import List, Union +from typing import Any, List, Union from uuid import UUID, uuid4 from gns3server.controller import Controller @@ -46,7 +46,9 @@ import logging log = logging.getLogger(__name__) -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or link"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or link"} +} router = APIRouter(responses=responses) @@ -91,7 +93,7 @@ async def get_links(project_id: UUID) -> List[schemas.Link]: }, dependencies=[Depends(has_privilege("Link.Allocate"))], ) -async def create_link(project_id: UUID, link_data: schemas.LinkCreate) -> schemas.Link: +async def create_link(project_id: UUID, link_create: schemas.LinkCreate) -> schemas.Link: """ Create a new link. @@ -100,7 +102,7 @@ async def create_link(project_id: UUID, link_data: schemas.LinkCreate) -> schema project = await Controller.instance().get_loaded_project(str(project_id)) link = await project.add_link() - link_data = jsonable_encoder(link_data, exclude_unset=True) + link_data = jsonable_encoder(link_create, exclude_unset=True) if "filters" in link_data: await link.update_filters(link_data["filters"]) if "link_style" in link_data: @@ -156,14 +158,14 @@ async def get_link(link: Link = Depends(dep_link)) -> schemas.Link: response_model_exclude_unset=True, dependencies=[Depends(has_privilege("Link.Modify"))], ) -async def update_link(link_data: schemas.LinkUpdate, link: Link = Depends(dep_link)) -> schemas.Link: +async def update_link(link_update: schemas.LinkUpdate, link: Link = Depends(dep_link)) -> schemas.Link: """ Update a link. Required privilege: Link.Modify """ - link_data = jsonable_encoder(link_data, exclude_unset=True) + link_data = jsonable_encoder(link_update, exclude_unset=True) if "filters" in link_data: await link.update_filters(link_data["filters"]) if "link_style" in link_data: @@ -293,7 +295,7 @@ async def stream_pcap(request: Request, link: Link = Depends(dep_link)) -> Strea pcap_streaming_url = link.pcap_streaming_url() headers = multidict.MultiDict(request.headers) headers["Host"] = compute.host - headers["Router-Host"] = request.client.host + headers["Router-Host"] = request.client.host if request.client else "" body = await request.body() async def compute_pcap_stream(): @@ -487,7 +489,7 @@ async def update_marker(marker_name: str, marker_data: schemas.MarkerUpdate, lin response_model=Union[schemas.UDPPortInfo, schemas.EthernetPortInfo], dependencies=[Depends(has_privilege("Link.Audit"))], ) -async def get_iface(link: Link = Depends(dep_link)) -> Union[schemas.UDPPortInfo, schemas.EthernetPortInfo]: +async def get_iface(link: Link = Depends(dep_link)) -> dict: """ Return iface info for links to Cloud or NAT devices. diff --git a/gns3server/controller/link.py b/gns3server/controller/link.py index 72c6552d5..2a7ec02d8 100644 --- a/gns3server/controller/link.py +++ b/gns3server/controller/link.py @@ -365,7 +365,21 @@ class Link: raise NotImplementedError - async def start_marker(self, name, bpf, tag=None, direction=None, capture_node_id=None, enabled=True): + async def start_marker( + self, + name, + bpf, + tag=None, + direction=None, + data_link_type="DLT_EN10MB", + capture_node_id=None, + color=None, + highlight_duration=None, + enabled=True, + inherited_from=None, + dump=True, + memory_only=False, + ): """ Attach a traffic-insight marker to this link (base — UDPLink overrides). """ @@ -377,7 +391,19 @@ class Link: """ raise NotImplementedError - async def update_marker(self, name, bpf=None, tag=None, enabled=None, direction=_UNSET): + async def update_marker( + self, + name, + bpf=None, + tag=None, + enabled=None, + direction=_UNSET, + color=None, + highlight_duration=None, + inherited=False, + dump=True, + memory_only=False, + ): """ Update an existing marker's BPF, tag, or enabled flag. diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..012165f3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -349,7 +349,6 @@ module = [ "gns3server.api.routes.controller.drawings", # 1 "gns3server.api.routes.controller.groups", # 6 "gns3server.api.routes.controller.images", # 9 - "gns3server.api.routes.controller.links", # 27 "gns3server.api.routes.controller.llm_model_configs", # 32 "gns3server.api.routes.controller.nodes", # 13 "gns3server.api.routes.controller.pools", # 8 From 6f3e5cfc2b548a4bbf912d38b30042b1ef345012 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:18:34 +0000 Subject: [PATCH 018/390] fix(typing): resolve mypy errors in schemas.controller.templates.dynamips_templates --- .../templates/dynamips_templates.py | 73 ++++++++++--------- pyproject.toml | 1 - 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/gns3server/schemas/controller/templates/dynamips_templates.py b/gns3server/schemas/controller/templates/dynamips_templates.py index 90180d99b..69505051d 100644 --- a/gns3server/schemas/controller/templates/dynamips_templates.py +++ b/gns3server/schemas/controller/templates/dynamips_templates.py @@ -30,12 +30,12 @@ from typing import Optional from enum import Enum -class DynamipsTemplate(TemplateBase): +class DynamipsTemplateBase(TemplateBase): category: Optional[Category] = Category.router default_name_format: Optional[str] = "R{0}" symbol: Optional[str] = "router" - platform: DynamipsPlatform = Field(..., description="Cisco router platform") - image: str = Field(..., description="Path to the IOS image") + platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") + image: Optional[str] = Field(None, description="Path to the IOS image") exec_area: Optional[int] = Field(64, ge=0, description="Exec area value") mmap: Optional[bool] = Field(True, description="MMAP feature") mac_addr: Optional[str] = Field( @@ -67,7 +67,12 @@ class DynamipsTemplate(TemplateBase): wic2: Optional[DynamipsWics] = Field(None, description="Network module WIC slot 2") -class C7200DynamipsTemplate(DynamipsTemplate): +class DynamipsTemplate(DynamipsTemplateBase): + platform: DynamipsPlatform = Field(..., description="Cisco router platform") + image: str = Field(..., description="Path to the IOS image") + + +class C7200DynamipsTemplateUpdate(DynamipsTemplateBase): ram: Optional[int] = Field(512, gt=0, description="Amount of RAM in MB") nvram: Optional[int] = Field(512, gt=0, description="Amount of NVRAM in KB") npe: Optional[DynamipsNPE] = Field(DynamipsNPE.npe_400, description="NPE model") @@ -75,33 +80,33 @@ class C7200DynamipsTemplate(DynamipsTemplate): sparsemem: Optional[bool] = Field(True, description="Sparse memory feature") -class C7200DynamipsTemplateUpdate(C7200DynamipsTemplate): - platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") - image: Optional[str] = Field(None, description="Path to the IOS image") +class C7200DynamipsTemplate(C7200DynamipsTemplateUpdate): + platform: DynamipsPlatform = Field(..., description="Cisco router platform") + image: str = Field(..., description="Path to the IOS image") -class C3725DynamipsTemplate(DynamipsTemplate): +class C3725DynamipsTemplateUpdate(DynamipsTemplateBase): ram: Optional[int] = Field(128, gt=0, description="Amount of RAM in MB") nvram: Optional[int] = Field(256, gt=0, description="Amount of NVRAM in KB") iomem: Optional[int] = Field(5, ge=0, le=100, description="I/O memory percentage") sparsemem: Optional[bool] = Field(True, description="Sparse memory feature") -class C3725DynamipsTemplateUpdate(C3725DynamipsTemplate): - platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") - image: Optional[str] = Field(None, description="Path to the IOS image") +class C3725DynamipsTemplate(C3725DynamipsTemplateUpdate): + platform: DynamipsPlatform = Field(..., description="Cisco router platform") + image: str = Field(..., description="Path to the IOS image") -class C3745DynamipsTemplate(DynamipsTemplate): +class C3745DynamipsTemplateUpdate(DynamipsTemplateBase): ram: Optional[int] = Field(256, gt=0, description="Amount of RAM in MB") nvram: Optional[int] = Field(256, gt=0, description="Amount of NVRAM in KB") iomem: Optional[int] = Field(5, ge=0, le=100, description="I/O memory percentage") sparsemem: Optional[bool] = Field(True, description="Sparse memory feature") -class C3745DynamipsTemplateUpdate(C3745DynamipsTemplate): - platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") - image: Optional[str] = Field(None, description="Path to the IOS image") +class C3745DynamipsTemplate(C3745DynamipsTemplateUpdate): + platform: DynamipsPlatform = Field(..., description="Cisco router platform") + image: str = Field(..., description="Path to the IOS image") class C3600ChassisType(str, Enum): @@ -110,29 +115,29 @@ class C3600ChassisType(str, Enum): chassis_3660 = "3660" -class C3600DynamipsTemplate(DynamipsTemplate): - chassis: Optional[C3600ChassisType] = Field("c3660", description="Chassis type") +class C3600DynamipsTemplateUpdate(DynamipsTemplateBase): + chassis: Optional[C3600ChassisType] = Field(C3600ChassisType.chassis_3660, description="Chassis type") ram: Optional[int] = Field(192, gt=0, description="Amount of RAM in MB") nvram: Optional[int] = Field(128, gt=0, description="Amount of NVRAM in KB") iomem: Optional[int] = Field(5, ge=0, le=100, description="I/O memory percentage") sparsemem: Optional[bool] = Field(True, description="Sparse memory feature") -class C3600DynamipsTemplateUpdate(C3600DynamipsTemplate): - platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") - image: Optional[str] = Field(None, description="Path to the IOS image") +class C3600DynamipsTemplate(C3600DynamipsTemplateUpdate): + platform: DynamipsPlatform = Field(..., description="Cisco router platform") + image: str = Field(..., description="Path to the IOS image") -class C2691DynamipsTemplate(DynamipsTemplate): +class C2691DynamipsTemplateUpdate(DynamipsTemplateBase): ram: Optional[int] = Field(192, gt=0, description="Amount of RAM in MB") nvram: Optional[int] = Field(256, gt=0, description="Amount of NVRAM in KB") iomem: Optional[int] = Field(5, ge=0, le=100, description="I/O memory percentage") sparsemem: Optional[bool] = Field(True, description="Sparse memory feature") -class C2691DynamipsTemplateUpdate(C2691DynamipsTemplate): - platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") - image: Optional[str] = Field(None, description="Path to the IOS image") +class C2691DynamipsTemplate(C2691DynamipsTemplateUpdate): + platform: DynamipsPlatform = Field(..., description="Cisco router platform") + image: str = Field(..., description="Path to the IOS image") class C2600ChassisType(str, Enum): @@ -147,17 +152,17 @@ class C2600ChassisType(str, Enum): chassis_2651xm = "2651XM" -class C2600DynamipsTemplate(DynamipsTemplate): - chassis: Optional[C2600ChassisType] = Field("2651XM", description="Chassis type") +class C2600DynamipsTemplateUpdate(DynamipsTemplateBase): + chassis: Optional[C2600ChassisType] = Field(C2600ChassisType.chassis_2651xm, description="Chassis type") ram: Optional[int] = Field(160, gt=0, description="Amount of RAM in MB") nvram: Optional[int] = Field(128, gt=0, description="Amount of NVRAM in KB") iomem: Optional[int] = Field(15, ge=0, le=100, description="I/O memory percentage") sparsemem: Optional[bool] = Field(True, description="Sparse memory feature") -class C2600DynamipsTemplateUpdate(C2600DynamipsTemplate): - platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") - image: Optional[str] = Field(None, description="Path to the IOS image") +class C2600DynamipsTemplate(C2600DynamipsTemplateUpdate): + platform: DynamipsPlatform = Field(..., description="Cisco router platform") + image: str = Field(..., description="Path to the IOS image") class C1700ChassisType(str, Enum): @@ -168,14 +173,14 @@ class C1700ChassisType(str, Enum): chassis_1760 = "1760" -class C1700DynamipsTemplate(DynamipsTemplate): - chassis: Optional[C1700ChassisType] = Field("1760", description="Chassis type") +class C1700DynamipsTemplateUpdate(DynamipsTemplateBase): + chassis: Optional[C1700ChassisType] = Field(C1700ChassisType.chassis_1760, description="Chassis type") ram: Optional[int] = Field(160, gt=0, description="Amount of RAM in MB") nvram: Optional[int] = Field(128, gt=0, description="Amount of NVRAM in KB") iomem: Optional[int] = Field(15, ge=0, le=100, description="I/O memory percentage") sparsemem: Optional[bool] = Field(False, description="Sparse memory feature") -class C1700DynamipsTemplateUpdate(C1700DynamipsTemplate): - platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") - image: Optional[str] = Field(None, description="Path to the IOS image") +class C1700DynamipsTemplate(C1700DynamipsTemplateUpdate): + platform: DynamipsPlatform = Field(..., description="Cisco router platform") + image: str = Field(..., description="Path to the IOS image") diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..6ef05f21c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -412,7 +412,6 @@ module = [ "gns3server.schemas.controller.projects", # 2 "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 - "gns3server.schemas.controller.templates.dynamips_templates", # 17 "gns3server.schemas.controller.templates.iou_templates", # 1 "gns3server.schemas.controller.templates.virtualbox_templates", # 1 "gns3server.schemas.controller.templates.vmware_templates", # 1 From db265f9524adda0c6ff80d88d6b5beb3ff7b8c9e Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:53:18 +0000 Subject: [PATCH 019/390] fix(typing): resolve mypy errors in db models --- gns3server/db/models/acl.py | 2 +- gns3server/db/models/base.py | 5 ++--- pyproject.toml | 8 -------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/gns3server/db/models/acl.py b/gns3server/db/models/acl.py index 32f7f7248..fc75eedac 100644 --- a/gns3server/db/models/acl.py +++ b/gns3server/db/models/acl.py @@ -29,7 +29,7 @@ class ACE(BaseTable): __tablename__ = "acl" ace_id = Column(GUID, primary_key=True, default=generate_uuid) - ace_type: str = Column(String) + ace_type = Column(String) path = Column(String) propagate = Column(Boolean, default=True) allowed = Column(Boolean, default=True) diff --git a/gns3server/db/models/base.py b/gns3server/db/models/base.py index cf726ec79..1802c1771 100644 --- a/gns3server/db/models/base.py +++ b/gns3server/db/models/base.py @@ -21,11 +21,10 @@ from fastapi.encoders import jsonable_encoder from sqlalchemy import Column, DateTime, func, inspect from sqlalchemy.types import TypeDecorator, CHAR, VARCHAR from sqlalchemy.dialects.postgresql import UUID -from sqlalchemy.orm import as_declarative +from sqlalchemy.orm import DeclarativeBase -@as_declarative() -class Base: +class Base(DeclarativeBase): def asdict(self): return {c.key: getattr(self, c.key) for c in inspect(self).mapper.column_attrs} diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..86926fc9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -378,13 +378,6 @@ module = [ "gns3server.controller.compute", # 2 "gns3server.controller.project", # 2 "gns3server.controller.topology", # 1 - "gns3server.db.models.acl", # 1 - "gns3server.db.models.images", # 1 - "gns3server.db.models.pools", # 1 - "gns3server.db.models.privileges", # 2 - "gns3server.db.models.roles", # 1 - "gns3server.db.models.templates", # 22 - "gns3server.db.models.users", # 3 "gns3server.db.repositories.api_keys", # 8 "gns3server.db.repositories.computes", # 10 "gns3server.db.repositories.images", # 14 @@ -394,7 +387,6 @@ module = [ "gns3server.db.repositories.templates", # 6 "gns3server.db.repositories.users", # 12 "gns3server.db.tasks", # 12 - "gns3server.db_migrations.env", # 1 "gns3server.schemas.compute.atm_switch_nodes", # 5 "gns3server.schemas.compute.cloud_nodes", # 1 "gns3server.schemas.compute.docker_nodes", # 2 From 4802c865fc821f94d0256560b85bfbeb098a4046 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:44:31 +0000 Subject: [PATCH 020/390] fix(typing): resolve mypy errors in compute.iou.iou_vm --- gns3server/compute/iou/iou_vm.py | 16 ++++++++++++---- pyproject.toml | 1 - 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gns3server/compute/iou/iou_vm.py b/gns3server/compute/iou/iou_vm.py index 4e329aad5..b0f99a4c2 100644 --- a/gns3server/compute/iou/iou_vm.py +++ b/gns3server/compute/iou/iou_vm.py @@ -139,8 +139,8 @@ class IOUVM(BaseNode): # Class-level caches shared across all IOU VM instances using the same image. # These avoid redundant subprocess calls during project loading when multiple # IOU nodes use the same image. - _loader_cache = {} # image path -> loader command list - _default_values_cache = {} # image path -> (ram, nvram) + _loader_cache: dict[str, list[str]] = {} # image path -> loader command list + _default_values_cache: dict[str, tuple[int, int]] = {} # image path -> (ram, nvram) """ IOU VM implementation. @@ -464,7 +464,11 @@ class IOUVM(BaseNode): ) self._nvram = nvram - @BaseNode.name.setter + @property + def name(self): + return self._name + + @name.setter def name(self, new_name): """ Sets the name of this IOU VM. @@ -949,7 +953,11 @@ class IOUVM(BaseNode): return True return False - @BaseNode.console_type.setter + @property + def console_type(self): + return self._console_type + + @console_type.setter def console_type(self, new_console_type): """ Sets the console type for this IOU VM. diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..9cc4483c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -364,7 +364,6 @@ module = [ "gns3server.compute.docker.docker_vm", # 3 "gns3server.compute.docker.iol_docker_vm", # 3 "gns3server.compute.dynamips.nodes.router", # 2 - "gns3server.compute.iou.iou_vm", # 4 "gns3server.compute.iou.utils.iou_export", # 2 "gns3server.compute.iou.utils.iou_import", # 2 "gns3server.compute.project", # 1 From 9f36fb4500a61ac23c8bd3ea6f9684e9734a8c56 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:15:52 +0000 Subject: [PATCH 021/390] fix(typing): resolve mypy errors in services.authentication --- gns3server/services/authentication.py | 12 +++++++----- pyproject.toml | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gns3server/services/authentication.py b/gns3server/services/authentication.py index 3d165c55d..c507c01a8 100644 --- a/gns3server/services/authentication.py +++ b/gns3server/services/authentication.py @@ -73,21 +73,23 @@ class AuthService: encoded_jwt = jwt.encode({"alg": algorithm}, to_encode, key) return encoded_jwt - def create_access_token(self, username, token_version: int = 0, secret_key: str = None, expires_in: int = 0) -> str: + def create_access_token( + self, username, token_version: int = 0, secret_key: Optional[str] = None, expires_in: int = 0 + ) -> str: if not expires_in: expires_in = Config.instance().settings.Controller.jwt_access_token_expire_minutes return self._create_token(username, token_version, "access", expires_in, secret_key) def create_refresh_token( - self, username, token_version: int = 0, secret_key: str = None, expires_in: int = 0 + self, username, token_version: int = 0, secret_key: Optional[str] = None, expires_in: int = 0 ) -> str: if not expires_in: expires_in = Config.instance().settings.Controller.jwt_refresh_token_expire_minutes return self._create_token(username, token_version, "refresh", expires_in, secret_key) - def get_token_data(self, token: str, secret_key: str = None) -> TokenData: + def get_token_data(self, token: str, secret_key: Optional[str] = None) -> TokenData: def auth_error(detail: str) -> HTTPException: return HTTPException( @@ -105,7 +107,7 @@ class AuthService: key = OctKey.import_key(secret_key) try: payload = jwt.decode(token, key, algorithms=[algorithm]) - username: str = payload.claims.get("sub") + username: Optional[str] = payload.claims.get("sub") if username is None: raise auth_error("Invalid token: missing subject claim") # Validate the exp claim — joserfc does not validate time-based claims by default @@ -123,5 +125,5 @@ class AuthService: raise auth_error(f"Invalid token ({type(e).__name__})") return token_data - def get_username_from_token(self, token: str, secret_key: str = None) -> Optional[str]: + def get_username_from_token(self, token: str, secret_key: Optional[str] = None) -> Optional[str]: return self.get_token_data(token, secret_key).username diff --git a/pyproject.toml b/pyproject.toml index 21c8a9ba6..8535a81b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -417,7 +417,6 @@ module = [ "gns3server.schemas.controller.templates.virtualbox_templates", # 1 "gns3server.schemas.controller.templates.vmware_templates", # 1 "gns3server.schemas.qemu_disk_image", # 2 - "gns3server.services.authentication", # 5 "gns3server.services.computes", # 4 "gns3server.services.templates", # 18 "gns3server.utils.asyncio.aiozipstream", # 8 From 755556c1465281bbefea3a01f5f0559467b9e4b1 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:06:25 +0000 Subject: [PATCH 022/390] fix(typing): resolve mypy errors in agent.web_wireshark.manage_wireshark --- gns3server/agent/web_wireshark/manage_wireshark.py | 5 +---- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/gns3server/agent/web_wireshark/manage_wireshark.py b/gns3server/agent/web_wireshark/manage_wireshark.py index 559eaadd9..5203a98d9 100755 --- a/gns3server/agent/web_wireshark/manage_wireshark.py +++ b/gns3server/agent/web_wireshark/manage_wireshark.py @@ -81,10 +81,7 @@ from gns3server.utils.uuid_validator import validate_uuid if __name__ == "__main__": sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) -try: - from gns3server.agent.web_wireshark.manager import WebWiresharkManager -except ImportError: - from manager import WebWiresharkManager +from gns3server.agent.web_wireshark.manager import WebWiresharkManager logger = logging.getLogger(__name__) diff --git a/pyproject.toml b/pyproject.toml index 5f0789a77..40c6db04a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -318,7 +318,6 @@ module = [ "gns3server.agent.mcp", # 34 "gns3server.agent.mcp.appliances", # 1 "gns3server.agent.web_wireshark.docker_client", # 5 - "gns3server.agent.web_wireshark.manage_wireshark", # 1 "gns3server.agent.web_wireshark.manager", # 9 "gns3server.agent.web_wireshark.stats", # 4 "gns3server.api.routes.compute.atm_switch_nodes", # 9 From 81d77bb6891a811e7c31e5598d4cca2fed6ee970 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:20:52 +0000 Subject: [PATCH 023/390] fix(typing): resolve mypy errors in agent.web_wireshark.stats --- gns3server/agent/web_wireshark/stats.py | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/agent/web_wireshark/stats.py b/gns3server/agent/web_wireshark/stats.py index 78dc7b0c0..de9b66091 100644 --- a/gns3server/agent/web_wireshark/stats.py +++ b/gns3server/agent/web_wireshark/stats.py @@ -7,7 +7,7 @@ about Web Wireshark containers and sessions. import logging import subprocess -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional logger = logging.getLogger(__name__) @@ -30,7 +30,7 @@ async def collect_webwireshark_stats(projects: List) -> Dict: """ from .manager import WebWiresharkManager - stats = {"total_containers": 0, "running_containers": 0, "active_sessions": 0, "containers": []} + stats: Dict[str, Any] = {"total_containers": 0, "running_containers": 0, "active_sessions": 0, "containers": []} # Create a single manager instance and reuse it manager = WebWiresharkManager() diff --git a/pyproject.toml b/pyproject.toml index 40c6db04a..e2446fda0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -319,7 +319,6 @@ module = [ "gns3server.agent.mcp.appliances", # 1 "gns3server.agent.web_wireshark.docker_client", # 5 "gns3server.agent.web_wireshark.manager", # 9 - "gns3server.agent.web_wireshark.stats", # 4 "gns3server.api.routes.compute.atm_switch_nodes", # 9 "gns3server.api.routes.compute.capabilities", # 1 "gns3server.api.routes.compute.cloud_nodes", # 14 From 7f2d1bc78983317158c09e79d4845e86835d9c7b Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:10:36 +0000 Subject: [PATCH 024/390] fix(typing): resolve mypy errors in agent.web_wireshark.manager --- gns3server/agent/web_wireshark/manager.py | 16 ++++++++-------- pyproject.toml | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gns3server/agent/web_wireshark/manager.py b/gns3server/agent/web_wireshark/manager.py index e17cf65c0..16f057d75 100644 --- a/gns3server/agent/web_wireshark/manager.py +++ b/gns3server/agent/web_wireshark/manager.py @@ -84,7 +84,7 @@ class WebWiresharkManager: logger.warning(f"Container {container_id[:12]} health check failed: {e}") return False - async def _exec_in_container(self, container_id: str, command: str, timeout: int = None) -> tuple: + async def _exec_in_container(self, container_id: str, command: str, timeout: Optional[int] = None) -> tuple: """Execute command in container with timeout. Args: @@ -197,7 +197,7 @@ class WebWiresharkManager: stdout, _ = await proc.communicate() # Build parent->children mapping - children_map = {} + children_map: dict[int, list[int]] = {} for line in stdout.decode().strip().split("\n"): parts = line.split(None, 2) if len(parts) < 3: @@ -326,7 +326,7 @@ class WebWiresharkManager: return # Build parent->children mapping and collect process info - children_map = {} # ppid -> [pid] + children_map: dict[int, list[int]] = {} # ppid -> [pid] process_info = {} # pid -> (ppid, command) for line in stdout.decode().strip().split("\n"): @@ -480,7 +480,7 @@ class WebWiresharkManager: logger.debug(f"Cannot get URL from Config: {e}") return None - async def _get_container_gateway_ip(self, container_id: str = None) -> Optional[str]: + async def _get_container_gateway_ip(self, container_id: Optional[str] = None) -> Optional[str]: """Get the Docker bridge gateway IP for container to access host. Args: @@ -519,7 +519,7 @@ class WebWiresharkManager: return None - async def get_container_ip(self, container_name: str, container_id: str = None) -> Optional[str]: + async def get_container_ip(self, container_name: str, container_id: Optional[str] = None) -> Optional[str]: """Get the container IP address in the wireshark network. Args: @@ -626,7 +626,7 @@ class WebWiresharkManager: project_id: str, image: str = "gns3/web-wireshark:latest", memory: str = "2g", - memory_swap: str = None, + memory_swap: Optional[str] = None, cpus: float = 1.0, pids_limit: int = 1000, ) -> str: @@ -935,10 +935,10 @@ class WebWiresharkManager: project_id: str, link_id: str, jwt_token: str, - capture_stream_url: str = None, + capture_stream_url: Optional[str] = None, image: str = "gns3/web-wireshark:latest", memory: str = "2g", - memory_swap: str = None, + memory_swap: Optional[str] = None, cpus: float = 1.0, pids_limit: int = 1000, ): diff --git a/pyproject.toml b/pyproject.toml index e2446fda0..2611beb26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -318,7 +318,6 @@ module = [ "gns3server.agent.mcp", # 34 "gns3server.agent.mcp.appliances", # 1 "gns3server.agent.web_wireshark.docker_client", # 5 - "gns3server.agent.web_wireshark.manager", # 9 "gns3server.api.routes.compute.atm_switch_nodes", # 9 "gns3server.api.routes.compute.capabilities", # 1 "gns3server.api.routes.compute.cloud_nodes", # 14 From 890093de01f2401d4c98aa5f5e510276971994e6 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:01:12 +0000 Subject: [PATCH 025/390] fix(typing): resolve mypy errors in agent.gns3_copilot.gns3_client.connector_factory --- gns3server/agent/gns3_copilot/gns3_client/connector_factory.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/agent/gns3_copilot/gns3_client/connector_factory.py b/gns3server/agent/gns3_copilot/gns3_client/connector_factory.py index c57dc8fee..32a4e2e45 100644 --- a/gns3server/agent/gns3_copilot/gns3_client/connector_factory.py +++ b/gns3server/agent/gns3_copilot/gns3_client/connector_factory.py @@ -347,7 +347,7 @@ def get_gns3_server_host() -> str: host = get_gns3_server_host() print(f"GNS3 server host: {host}") """ - url = _detect_url_for_api() + url = _detect_url_for_api() or DEFAULT_GNS3_URL # Extract host from URL # URL format: protocol://host:port diff --git a/pyproject.toml b/pyproject.toml index 5f0789a77..46137effe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -300,7 +300,6 @@ module = [ "gns3server.agent.gns3_copilot.agent_service", # 8 "gns3server.agent.gns3_copilot.chat_sessions_repository", # 8 "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 - "gns3server.agent.gns3_copilot.gns3_client.connector_factory", # 1 "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 "gns3server.agent.gns3_copilot.skills.loader", # 1 "gns3server.agent.gns3_copilot.skills.manager", # 4 From 97f71269d361139b6f39ee20964b153aedd96c5a Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:05:01 +0000 Subject: [PATCH 026/390] fix(typing): resolve mypy errors in agent.gns3_copilot.gns3_client.project_inventory --- .../agent/gns3_copilot/gns3_client/project_inventory.py | 6 +++--- pyproject.toml | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gns3server/agent/gns3_copilot/gns3_client/project_inventory.py b/gns3server/agent/gns3_copilot/gns3_client/project_inventory.py index b1f958767..aeefd304a 100644 --- a/gns3server/agent/gns3_copilot/gns3_client/project_inventory.py +++ b/gns3server/agent/gns3_copilot/gns3_client/project_inventory.py @@ -49,7 +49,7 @@ def build_nodes_inventory(nodes: list[dict[str, Any]], server_host: str | None) """ inventory: dict[str, Any] = {} for n in nodes: - inventory[n.get("name")] = { + inventory[n.get("name") or ""] = { "server": server_host, "name": n.get("name"), "node_id": n.get("node_id"), @@ -68,7 +68,7 @@ def build_nodes_inventory(nodes: list[dict[str, Any]], server_host: str | None) return inventory -def build_links_summary(nodes: list[dict[str, Any]], links: list[dict[str, Any]]) -> list[dict[str, str]]: +def build_links_summary(nodes: list[dict[str, Any]], links: list[dict[str, Any]]) -> list[dict[str, Any]]: """ Build a human/LLM-friendly link list resolving node and port names. @@ -76,7 +76,7 @@ def build_links_summary(nodes: list[dict[str, Any]], links: list[dict[str, Any]] Links whose endpoints cannot be resolved are skipped, mirroring the original Project.links_summary behavior. """ - summary: list[dict[str, str]] = [] + summary: list[dict[str, Any]] = [] for link in links: if not link.get("nodes"): continue diff --git a/pyproject.toml b/pyproject.toml index 46137effe..7b0ff58a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -300,7 +300,6 @@ module = [ "gns3server.agent.gns3_copilot.agent_service", # 8 "gns3server.agent.gns3_copilot.chat_sessions_repository", # 8 "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 - "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 "gns3server.agent.gns3_copilot.skills.loader", # 1 "gns3server.agent.gns3_copilot.skills.manager", # 4 "gns3server.agent.gns3_copilot.tools_v2.config_tools_nornir", # 6 From e8bff79370fbad37954761083f8e6b4803be7c73 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:26:26 +0000 Subject: [PATCH 027/390] fix(typing): resolve mypy errors in agent.gns3_copilot.tools_v2.config_tools_nornir --- gns3server/agent/gns3_copilot/tools_v2/config_tools_nornir.py | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/agent/gns3_copilot/tools_v2/config_tools_nornir.py b/gns3server/agent/gns3_copilot/tools_v2/config_tools_nornir.py index db215c6bf..ed15f0589 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/config_tools_nornir.py +++ b/gns3server/agent/gns3_copilot/tools_v2/config_tools_nornir.py @@ -78,7 +78,7 @@ try: # so we use importlib to get the actual module import importlib - sd = importlib.import_module("netmiko.ssh_dispatcher") + sd: Any = importlib.import_module("netmiko.ssh_dispatcher") # Recalculate platforms lists to include custom device types sd.platforms = list(sd.CLASS_MAPPER.keys()) @@ -196,7 +196,7 @@ class ExecuteMultipleDeviceConfigCommands(BaseTool): # Validate input device_configs_list, project_id = self._validate_tool_input(tool_input) - if isinstance(device_configs_list, list) and len(device_configs_list) > 0 and "error" in device_configs_list[0]: + if len(device_configs_list) > 0 and "error" in device_configs_list[0]: return device_configs_list # Filter forbidden commands and store blocked commands info diff --git a/pyproject.toml b/pyproject.toml index 5f0789a77..21a5c54ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -304,7 +304,6 @@ module = [ "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 "gns3server.agent.gns3_copilot.skills.loader", # 1 "gns3server.agent.gns3_copilot.skills.manager", # 4 - "gns3server.agent.gns3_copilot.tools_v2.config_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.display_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.gns3_packet_filter", # 1 "gns3server.agent.gns3_copilot.tools_v2.gns3_start_node", # 3 From c7c7e3b5839e0825aa11262a9cdae4102919e901 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:00:35 +0000 Subject: [PATCH 028/390] fix(typing): resolve mypy errors in agent.gns3_copilot.skills.loader --- gns3server/agent/gns3_copilot/skills/loader.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/agent/gns3_copilot/skills/loader.py b/gns3server/agent/gns3_copilot/skills/loader.py index 655d76263..0295e2520 100644 --- a/gns3server/agent/gns3_copilot/skills/loader.py +++ b/gns3server/agent/gns3_copilot/skills/loader.py @@ -248,7 +248,7 @@ class SkillsLoader: continue # Use device_type from YAML content as the key # Fallback to filename stem if device_type not present - skill_key = skill_data.get("device_type") if isinstance(skill_data, dict) else None + skill_key = skill_data.get("device_type") if not skill_key: skill_key = yaml_file.stem logger.warning(f"No device_type in {yaml_file}, using filename '{skill_key}' as key") diff --git a/pyproject.toml b/pyproject.toml index 5f0789a77..0c02c3d5a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -302,7 +302,6 @@ module = [ "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 "gns3server.agent.gns3_copilot.gns3_client.connector_factory", # 1 "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 - "gns3server.agent.gns3_copilot.skills.loader", # 1 "gns3server.agent.gns3_copilot.skills.manager", # 4 "gns3server.agent.gns3_copilot.tools_v2.config_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.display_tools_nornir", # 6 From 35b360ca752dbf6bd53090b892e450926603ccfd Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:26:36 +0000 Subject: [PATCH 029/390] fix(typing): resolve mypy errors in agent.gns3_copilot.tools_v2.display_tools_nornir --- .../agent/gns3_copilot/tools_v2/display_tools_nornir.py | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/agent/gns3_copilot/tools_v2/display_tools_nornir.py b/gns3server/agent/gns3_copilot/tools_v2/display_tools_nornir.py index 8c4a5281d..a8eb41bc4 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/display_tools_nornir.py +++ b/gns3server/agent/gns3_copilot/tools_v2/display_tools_nornir.py @@ -78,7 +78,7 @@ try: # so we use importlib to get the actual module import importlib - sd = importlib.import_module("netmiko.ssh_dispatcher") + sd: Any = importlib.import_module("netmiko.ssh_dispatcher") # Recalculate platforms lists to include custom device types sd.platforms = list(sd.CLASS_MAPPER.keys()) @@ -199,7 +199,7 @@ class ExecuteMultipleDeviceCommands(BaseTool): # Validate input device_configs_list, project_id = self._validate_tool_input(tool_input) - if isinstance(device_configs_list, list) and len(device_configs_list) > 0 and "error" in device_configs_list[0]: + if len(device_configs_list) > 0 and "error" in device_configs_list[0]: return device_configs_list # Filter forbidden commands and store blocked commands info diff --git a/pyproject.toml b/pyproject.toml index 21a5c54ac..49c8063be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -304,7 +304,6 @@ module = [ "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 "gns3server.agent.gns3_copilot.skills.loader", # 1 "gns3server.agent.gns3_copilot.skills.manager", # 4 - "gns3server.agent.gns3_copilot.tools_v2.display_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.gns3_packet_filter", # 1 "gns3server.agent.gns3_copilot.tools_v2.gns3_start_node", # 3 "gns3server.agent.gns3_copilot.tools_v2.gns3_stop_node", # 3 From d6ae597f366bdbf1e70ac02fdf1e08e364cf3a43 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:21:57 +0000 Subject: [PATCH 030/390] fix(typing): resolve mypy errors in agent.gns3_copilot.skills.manager --- .../agent/gns3_copilot/skills/manager.py | 18 ++++++++++-------- pyproject.toml | 1 - 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gns3server/agent/gns3_copilot/skills/manager.py b/gns3server/agent/gns3_copilot/skills/manager.py index 473fb2b09..1a511ec29 100644 --- a/gns3server/agent/gns3_copilot/skills/manager.py +++ b/gns3server/agent/gns3_copilot/skills/manager.py @@ -37,8 +37,10 @@ from typing import Optional, Dict, Any try: import git + + GIT_AVAILABLE = True except ImportError: - git = None + GIT_AVAILABLE = False from gns3server.config import Config from .loader import SkillsLoader @@ -66,7 +68,7 @@ class SkillsManager: - Version tracking """ - def __init__(self, repo_url: str = None, branch: str = "main", auto_update: bool = False): + def __init__(self, repo_url: Optional[str] = None, branch: str = "main", auto_update: bool = False): """ Initialize the skills manager. @@ -90,7 +92,7 @@ class SkillsManager: self._repo: Optional["git.Repo"] = None self._prompt_count = 0 - if git is None: + if not GIT_AVAILABLE: logger.warning("GitPython is not installed. Skills management features will be limited.") def initialize(self) -> bool: @@ -134,7 +136,7 @@ class SkillsManager: - Up to date → nothing - Network error → use existing files, log warning """ - if git is None or self._repo is None: + if not GIT_AVAILABLE or self._repo is None: return # Check for uncommitted changes @@ -173,7 +175,7 @@ class SkillsManager: Returns: True if successful, False otherwise """ - if git is None: + if not GIT_AVAILABLE: logger.error("GitPython is not installed. Cannot clone repository.") return False @@ -347,7 +349,7 @@ class SkillsManager: Returns: Commit hash as string, or empty string if not available """ - if git is None or self._repo is None: + if not GIT_AVAILABLE or self._repo is None: try: self._repo = git.Repo(self.local_path) except Exception: @@ -409,7 +411,7 @@ class SkillsManager: Returns: True if successful, False otherwise """ - if git is None: + if not GIT_AVAILABLE: logger.error("GitPython is not installed. Cannot rollback.") return False @@ -436,7 +438,7 @@ class SkillsManager: Returns: List of commit information dictionaries """ - if git is None: + if not GIT_AVAILABLE: return [] try: diff --git a/pyproject.toml b/pyproject.toml index 0c02c3d5a..bab14b8c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -302,7 +302,6 @@ module = [ "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 "gns3server.agent.gns3_copilot.gns3_client.connector_factory", # 1 "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 - "gns3server.agent.gns3_copilot.skills.manager", # 4 "gns3server.agent.gns3_copilot.tools_v2.config_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.display_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.gns3_packet_filter", # 1 From 67f68c9676cdaa1d044d2d2c46a30903ad840caa Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:00:48 +0000 Subject: [PATCH 031/390] fix(typing): resolve mypy errors in agent.gns3_copilot.tools_v2.packet_analysis_tool --- gns3server/agent/gns3_copilot/tools_v2/packet_analysis_tool.py | 3 ++- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/agent/gns3_copilot/tools_v2/packet_analysis_tool.py b/gns3server/agent/gns3_copilot/tools_v2/packet_analysis_tool.py index b9c35d141..c5f30bf79 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/packet_analysis_tool.py +++ b/gns3server/agent/gns3_copilot/tools_v2/packet_analysis_tool.py @@ -143,7 +143,8 @@ class PacketAnalysisTool(BaseTool): stderr=subprocess.DEVNULL, text=True, ) - tshark.stdout.close() + if tshark.stdout is not None: + tshark.stdout.close() stdout, _ = grep.communicate(timeout=30) tshark.wait(timeout=5) except Exception as e: diff --git a/pyproject.toml b/pyproject.toml index 5f0789a77..8b3471880 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -310,7 +310,6 @@ module = [ "gns3server.agent.gns3_copilot.tools_v2.gns3_start_node", # 3 "gns3server.agent.gns3_copilot.tools_v2.gns3_stop_node", # 3 "gns3server.agent.gns3_copilot.tools_v2.gns3_suspend_node", # 3 - "gns3server.agent.gns3_copilot.tools_v2.packet_analysis_tool", # 1 "gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko", # 9 "gns3server.agent.gns3_copilot.utils.custom_netmiko.scripts.list_netmiko_telnet_devices", # 1 "gns3server.agent.gns3_copilot.utils.message_converters", # 2 From d2fd2383836e51e55f825f86e4e845de1b8c3b39 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:00:42 +0000 Subject: [PATCH 032/390] fix(typing): resolve mypy errors in agent.gns3_copilot.tools_v2.gns3_packet_filter --- gns3server/agent/gns3_copilot/tools_v2/gns3_packet_filter.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/agent/gns3_copilot/tools_v2/gns3_packet_filter.py b/gns3server/agent/gns3_copilot/tools_v2/gns3_packet_filter.py index d94a0fc1d..be7af824f 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/gns3_packet_filter.py +++ b/gns3server/agent/gns3_copilot/tools_v2/gns3_packet_filter.py @@ -286,7 +286,7 @@ class GNS3PacketFilterTool(BaseTool): # Check if output contains "Invalid" indicating syntax error if "Invalid" in result.stdout or "Invalid" in result.stderr: - error_lines = [] + error_lines: list[str] = [] if "Invalid" in result.stderr: error_lines.extend(line for line in result.stderr.split("\n") if "Invalid" in line) if "Invalid" in result.stdout: diff --git a/pyproject.toml b/pyproject.toml index 49c8063be..785afbae0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -304,7 +304,6 @@ module = [ "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 "gns3server.agent.gns3_copilot.skills.loader", # 1 "gns3server.agent.gns3_copilot.skills.manager", # 4 - "gns3server.agent.gns3_copilot.tools_v2.gns3_packet_filter", # 1 "gns3server.agent.gns3_copilot.tools_v2.gns3_start_node", # 3 "gns3server.agent.gns3_copilot.tools_v2.gns3_stop_node", # 3 "gns3server.agent.gns3_copilot.tools_v2.gns3_suspend_node", # 3 From f8144494f61a22330728a50cc3e04d650ddcea01 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:11:09 +0000 Subject: [PATCH 033/390] fix(typing): resolve mypy errors in agent.gns3_copilot.tools_v2.vpcs_tools_netmiko --- .../agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py | 8 ++++---- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gns3server/agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py b/gns3server/agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py index 3a8789cda..1315730c7 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py +++ b/gns3server/agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py @@ -68,7 +68,7 @@ try: # CRITICAL: Update netmiko.ssh_dispatcher platforms lists import importlib - sd = importlib.import_module("netmiko.ssh_dispatcher") + sd: Any = importlib.import_module("netmiko.ssh_dispatcher") # Recalculate platforms lists to include custom device types sd.platforms = list(sd.CLASS_MAPPER.keys()) @@ -179,7 +179,7 @@ class VPCSCommands(BaseTool): # Validate input device_configs_list, project_id = self._validate_tool_input(tool_input) - if isinstance(device_configs_list, list) and len(device_configs_list) > 0 and "error" in device_configs_list[0]: + if len(device_configs_list) > 0 and "error" in device_configs_list[0]: return device_configs_list # Create a mapping of device names to their commands @@ -386,7 +386,7 @@ class VPCSCommands(BaseTool): def _prepare_device_hosts_data( self, device_configs_list: list[dict[str, Any]], - project_id: str, + project_id: str | None, jwt_token: str | None = None, url: str | None = None, ) -> dict[str, dict[str, Any]]: @@ -415,7 +415,7 @@ class VPCSCommands(BaseTool): device_ports = get_device_ports_from_topology(device_names, project_id=project_id, jwt_token=jwt_token, url=url) # Build Nornir inventory hosts data - hosts_data = {} + hosts_data: dict[str, Any] = {} for device_name in device_names: if device_name not in device_ports: logger.error("Device '%s' not found in topology", device_name) diff --git a/pyproject.toml b/pyproject.toml index 8b3471880..80399d488 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -310,7 +310,6 @@ module = [ "gns3server.agent.gns3_copilot.tools_v2.gns3_start_node", # 3 "gns3server.agent.gns3_copilot.tools_v2.gns3_stop_node", # 3 "gns3server.agent.gns3_copilot.tools_v2.gns3_suspend_node", # 3 - "gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko", # 9 "gns3server.agent.gns3_copilot.utils.custom_netmiko.scripts.list_netmiko_telnet_devices", # 1 "gns3server.agent.gns3_copilot.utils.message_converters", # 2 "gns3server.agent.gns3_copilot.utils.parse_tool_content", # 1 From 5bb7896242f00890e2610690e14403c6e92cbe0d Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:42:04 +0000 Subject: [PATCH 034/390] fix(typing): resolve mypy errors in api.routes.compute.capabilities --- gns3server/api/routes/compute/capabilities.py | 3 ++- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/api/routes/compute/capabilities.py b/gns3server/api/routes/compute/capabilities.py index f472f6231..42154d4e1 100644 --- a/gns3server/api/routes/compute/capabilities.py +++ b/gns3server/api/routes/compute/capabilities.py @@ -39,7 +39,8 @@ def get_capabilities(request: Request) -> dict: node_types.extend(module.node_types()) # record the controller hostname or IP address - request.app.state.controller_host = request.client.host + if request.client: + request.app.state.controller_host = request.client.host return { "version": __version__, diff --git a/pyproject.toml b/pyproject.toml index 5f0789a77..fadae6ec9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -322,7 +322,6 @@ module = [ "gns3server.agent.web_wireshark.manager", # 9 "gns3server.agent.web_wireshark.stats", # 4 "gns3server.api.routes.compute.atm_switch_nodes", # 9 - "gns3server.api.routes.compute.capabilities", # 1 "gns3server.api.routes.compute.cloud_nodes", # 14 "gns3server.api.routes.compute.compute", # 1 "gns3server.api.routes.compute.dependencies.authentication", # 3 From f94a0cae0d8f026f5c4c790ae90350c961b4f088 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:41:45 +0000 Subject: [PATCH 035/390] fix(typing): resolve mypy errors in api.routes.compute.compute --- gns3server/api/routes/compute/compute.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/api/routes/compute/compute.py b/gns3server/api/routes/compute/compute.py index 1a862787c..c98b1a256 100644 --- a/gns3server/api/routes/compute/compute.py +++ b/gns3server/api/routes/compute/compute.py @@ -163,7 +163,7 @@ def compute_statistics() -> dict: @router.get("/qemu/capabilities") async def get_qemu_capabilities() -> dict: - capabilities = {"kvm": []} + capabilities: dict[str, list] = {"kvm": []} kvms = await Qemu.get_kvm_archs() if kvms: capabilities["kvm"] = kvms diff --git a/pyproject.toml b/pyproject.toml index fadae6ec9..5900a66ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -323,7 +323,6 @@ module = [ "gns3server.agent.web_wireshark.stats", # 4 "gns3server.api.routes.compute.atm_switch_nodes", # 9 "gns3server.api.routes.compute.cloud_nodes", # 14 - "gns3server.api.routes.compute.compute", # 1 "gns3server.api.routes.compute.dependencies.authentication", # 3 "gns3server.api.routes.compute.docker_nodes", # 26 "gns3server.api.routes.compute.dynamips_nodes", # 9 From 777258ff68017cdd50fe441595b8e922015ba931 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:58:15 +0000 Subject: [PATCH 036/390] fix(typing): resolve mypy errors in api.routes.controller.api_keys --- gns3server/api/routes/controller/api_keys.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/api/routes/controller/api_keys.py b/gns3server/api/routes/controller/api_keys.py index 235cbe7de..a3bfa4b14 100644 --- a/gns3server/api/routes/controller/api_keys.py +++ b/gns3server/api/routes/controller/api_keys.py @@ -39,7 +39,7 @@ API_KEY_PREFIX = "gns3_" API_KEY_BYTES = 32 -def _generate_api_key(api_key_id: UUID = None) -> tuple[str, str, str, UUID]: +def _generate_api_key(api_key_id: UUID | None = None) -> tuple[str, str, str, UUID]: if api_key_id is None: api_key_id = uuid4() random_bytes = secrets.token_hex(API_KEY_BYTES) diff --git a/pyproject.toml b/pyproject.toml index 5f0789a77..b911216f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -340,7 +340,6 @@ module = [ "gns3server.api.routes.compute.vmware_nodes", # 10 "gns3server.api.routes.compute.vpcs_nodes", # 9 "gns3server.api.routes.controller.acl", # 5 - "gns3server.api.routes.controller.api_keys", # 1 "gns3server.api.routes.controller.chat", # 1 "gns3server.api.routes.controller.computes", # 6 "gns3server.api.routes.controller.controller", # 10 From 6526beeb3d3c170f48c471bfb423c5157316e7cf Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:57:51 +0000 Subject: [PATCH 037/390] fix(typing): resolve mypy errors in api.routes.controller.chat --- gns3server/api/routes/controller/chat.py | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/api/routes/controller/chat.py b/gns3server/api/routes/controller/chat.py index cc796fe26..e55e722f7 100644 --- a/gns3server/api/routes/controller/chat.py +++ b/gns3server/api/routes/controller/chat.py @@ -23,7 +23,7 @@ Nested under projects: /v3/projects/{project_id}/chat/... import json import logging import uuid -from typing import List, Optional +from typing import Any, List, Optional from fastapi import APIRouter, Depends, HTTPException, Request, status from fastapi.responses import StreamingResponse @@ -40,7 +40,7 @@ from .dependencies.authentication import get_current_active_user log = logging.getLogger(__name__) -responses = {404: {"model": schemas.ErrorMessage, "description": "Resource not found"}} +responses: dict[int | str, dict[str, Any]] = {404: {"model": schemas.ErrorMessage, "description": "Resource not found"}} router = APIRouter(responses=responses) diff --git a/pyproject.toml b/pyproject.toml index b911216f7..98edf55b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -340,7 +340,6 @@ module = [ "gns3server.api.routes.compute.vmware_nodes", # 10 "gns3server.api.routes.compute.vpcs_nodes", # 9 "gns3server.api.routes.controller.acl", # 5 - "gns3server.api.routes.controller.chat", # 1 "gns3server.api.routes.controller.computes", # 6 "gns3server.api.routes.controller.controller", # 10 "gns3server.api.routes.controller.dependencies.authentication", # 11 From 5fb2c277a9a8980b169706a0ebe22697f3456e97 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:16:05 +0000 Subject: [PATCH 038/390] fix(typing): resolve mypy errors in api.routes.compute.notifications --- gns3server/api/routes/compute/notifications.py | 5 +++-- pyproject.toml | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gns3server/api/routes/compute/notifications.py b/gns3server/api/routes/compute/notifications.py index 2c6ca4ad5..ee533037b 100644 --- a/gns3server/api/routes/compute/notifications.py +++ b/gns3server/api/routes/compute/notifications.py @@ -39,14 +39,15 @@ async def project_ws_notifications(websocket: Union[None, WebSocket] = Depends(w """ if websocket: - log.info(f"New client {websocket.client.host}:{websocket.client.port} has connected to compute WebSocket") + client = f"{websocket.client.host}:{websocket.client.port}" if websocket.client else "unknown" + log.info(f"New client {client} has connected to compute WebSocket") try: with NotificationManager.instance().queue() as queue: while True: notification = await queue.get_json(5) await websocket.send_text(notification) except (ConnectionClosed, WebSocketDisconnect): - log.info(f"Client {websocket.client.host}:{websocket.client.port} has disconnected from compute WebSocket") + log.info(f"Client {client} has disconnected from compute WebSocket") except WebSocketException as e: log.warning(f"Error while sending to controller event to WebSocket client: {e}") diff --git a/pyproject.toml b/pyproject.toml index 5900a66ff..ec44a2882 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -331,7 +331,6 @@ module = [ "gns3server.api.routes.compute.frame_relay_switch_nodes", # 9 "gns3server.api.routes.compute.iou_nodes", # 15 "gns3server.api.routes.compute.nat_nodes", # 10 - "gns3server.api.routes.compute.notifications", # 4 "gns3server.api.routes.compute.projects", # 7 "gns3server.api.routes.compute.qemu_nodes", # 18 "gns3server.api.routes.compute.virtualbox_nodes", # 20 From bbdd9bf8617d738f80143d033921d807da35717e Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:57:45 +0000 Subject: [PATCH 039/390] fix(typing): resolve mypy errors in api.routes.controller.drawings --- gns3server/api/routes/controller/drawings.py | 6 ++++-- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gns3server/api/routes/controller/drawings.py b/gns3server/api/routes/controller/drawings.py index 42e989f0f..6df9ddd91 100644 --- a/gns3server/api/routes/controller/drawings.py +++ b/gns3server/api/routes/controller/drawings.py @@ -20,7 +20,7 @@ API routes for drawings. from fastapi import APIRouter, Depends, status from fastapi.encoders import jsonable_encoder -from typing import List +from typing import Any, List from uuid import UUID from gns3server.controller import Controller @@ -30,7 +30,9 @@ from gns3server import schemas from .dependencies.database import get_repository from .dependencies.rbac import has_privilege -responses = {404: {"model": schemas.ErrorMessage, "description": "Project or drawing not found"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Project or drawing not found"} +} router = APIRouter(responses=responses) diff --git a/pyproject.toml b/pyproject.toml index 98edf55b8..1b09de56e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -344,7 +344,6 @@ module = [ "gns3server.api.routes.controller.controller", # 10 "gns3server.api.routes.controller.dependencies.authentication", # 11 "gns3server.api.routes.controller.dependencies.database", # 2 - "gns3server.api.routes.controller.drawings", # 1 "gns3server.api.routes.controller.groups", # 6 "gns3server.api.routes.controller.images", # 9 "gns3server.api.routes.controller.links", # 27 From 943bd6732cd630b91c36c34d85c859133d69da6e Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:53:39 +0000 Subject: [PATCH 040/390] fix(typing): resolve mypy errors in utils.encryption --- gns3server/utils/encryption.py | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/utils/encryption.py b/gns3server/utils/encryption.py index 1f95f497b..38719a60e 100644 --- a/gns3server/utils/encryption.py +++ b/gns3server/utils/encryption.py @@ -48,7 +48,7 @@ def init_encryption(secrets_dir: str) -> None: os.makedirs(secrets_dir, exist_ok=True) with open(encryption_key_path, "w", encoding="utf-8") as f: # Use Fernet's base64-encoded key format - f.write(key.decode() if isinstance(key, bytes) else key) + f.write(key.decode()) # Set restrictive permissions (owner read/write only) os.chmod(encryption_key_path, 0o600) except OSError as e: @@ -58,7 +58,7 @@ def init_encryption(secrets_dir: str) -> None: try: with open(encryption_key_path, encoding="utf-8") as f: key_content = f.read().strip() - key_bytes = key_content.encode() if isinstance(key_content, str) else key_content + key_bytes = key_content.encode() _fernet = Fernet(key_bytes) log.debug("Encryption initialized successfully") except OSError as e: diff --git a/pyproject.toml b/pyproject.toml index 5f0789a77..b992dcbb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -413,7 +413,6 @@ module = [ "gns3server.services.computes", # 4 "gns3server.services.templates", # 18 "gns3server.utils.asyncio.aiozipstream", # 8 - "gns3server.utils.encryption", # 2 "gns3server.utils.http_client", # 4 "gns3server.utils.images", # 4 "gns3server.utils.packet_filter_validation", # 16 From ab5572a0c1bbe5ab5c44483696f09f73b6d90e57 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:10:05 +0000 Subject: [PATCH 041/390] fix(typing): resolve mypy errors in utils.images --- gns3server/utils/images.py | 10 +++++----- pyproject.toml | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gns3server/utils/images.py b/gns3server/utils/images.py index c06e22bec..06b4ae9be 100644 --- a/gns3server/utils/images.py +++ b/gns3server/utils/images.py @@ -126,7 +126,7 @@ def get_builtin_disks() -> List[str]: return builtin_disks -async def read_image_info(path: str, expected_image_type: str = None) -> dict: +async def read_image_info(path: str, expected_image_type: str | None = None) -> dict: header_magic_len = 7 try: @@ -155,7 +155,7 @@ async def read_image_info(path: str, expected_image_type: str = None) -> dict: return image_info -async def discover_images(image_type: str, skip_image_paths: list = None) -> List[dict]: +async def discover_images(image_type: str, skip_image_paths: list | None = None) -> List[dict]: """ Scan directories for available images """ @@ -378,9 +378,9 @@ async def write_image( f"File '{image_path}' already exists, please choose a different name or remove the existing image" ) - checksum = checksum.hexdigest() + checksum_hex = checksum.hexdigest() image_dir = os.path.dirname(image_path) - duplicate_image = await images_repo.get_image_by_checksum(checksum, image_dir) + duplicate_image = await images_repo.get_image_by_checksum(checksum_hex, image_dir) if duplicate_image: raise InvalidImageError( f"Image '{duplicate_image.filename}' with the same checksum already exists in '{image_dir}'" @@ -396,5 +396,5 @@ async def write_image( log.warning(f"Could not remove '{tmp_path}'") return await images_repo.add_image( - image_name, image_type, image_size, image_path, checksum, checksum_algorithm="md5" + image_name, image_type, image_size, image_path, checksum_hex, checksum_algorithm="md5" ) diff --git a/pyproject.toml b/pyproject.toml index b992dcbb1..719f116dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -414,7 +414,6 @@ module = [ "gns3server.services.templates", # 18 "gns3server.utils.asyncio.aiozipstream", # 8 "gns3server.utils.http_client", # 4 - "gns3server.utils.images", # 4 "gns3server.utils.packet_filter_validation", # 16 "gns3server.utils.websocket_to_websocket", # 12 "gns3server.utils.zipfile_zstd", # 2 From 94bf56040b38ace8847f444142b3bc67c980de01 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:24:56 +0000 Subject: [PATCH 042/390] fix(typing): resolve mypy errors in utils.packet_filter_validation --- gns3server/utils/packet_filter_validation.py | 10 +++++----- pyproject.toml | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gns3server/utils/packet_filter_validation.py b/gns3server/utils/packet_filter_validation.py index cc2634546..1b9481ffd 100644 --- a/gns3server/utils/packet_filter_validation.py +++ b/gns3server/utils/packet_filter_validation.py @@ -15,7 +15,7 @@ class FilterValidationError(Exception): pass -def validate_bpf_syntax(bpf_expression: str) -> Dict[str, Optional[str]]: +def validate_bpf_syntax(bpf_expression: str) -> Dict[str, Any]: """ Validate BPF filter expression syntax using tcpdump. @@ -78,7 +78,7 @@ def validate_filter_parameters(filter_type: str, values: List[Any]) -> None: """ # Define validation rules based on ubridge implementation - VALIDATION_RULES = { + VALIDATION_RULES: Dict[str, Dict[str, Any]] = { "frequency_drop": { "params_count": 1, "ranges": [(-1, 32767)], # min, max @@ -173,11 +173,11 @@ def filter_inactive_filters(filters: Dict[str, List[Any]]) -> Dict[str, List[Any active_filters = {} for filter_type, values in filters.items(): - if not values or (isinstance(values, list) and len(values) == 0): + if not values: continue # Normalize values (strip strings, convert to int) - normalized_values = [] + normalized_values: List[Any] = [] for value in values: if isinstance(value, str): normalized_values.append(value.strip("\n ")) @@ -228,7 +228,7 @@ def validate_all_filters(filters: Dict[str, List[Any]]) -> None: return for filter_type, values in filters.items(): - if not values or (isinstance(values, list) and len(values) == 0): + if not values: continue validate_filter_parameters(filter_type, values) diff --git a/pyproject.toml b/pyproject.toml index 719f116dc..97426df7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -414,7 +414,6 @@ module = [ "gns3server.services.templates", # 18 "gns3server.utils.asyncio.aiozipstream", # 8 "gns3server.utils.http_client", # 4 - "gns3server.utils.packet_filter_validation", # 16 "gns3server.utils.websocket_to_websocket", # 12 "gns3server.utils.zipfile_zstd", # 2 "gns3server.utils.zipfile_zstd._patcher", # 1 From a251ca73acd5f04ed4614578e7ae5879da338f19 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:20:39 +0000 Subject: [PATCH 043/390] fix(typing): resolve mypy errors in agent.gns3_copilot.agent.context_manager --- gns3server/agent/gns3_copilot/agent/context_manager.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/agent/gns3_copilot/agent/context_manager.py b/gns3server/agent/gns3_copilot/agent/context_manager.py index 79c526dbf..5337c3d95 100644 --- a/gns3server/agent/gns3_copilot/agent/context_manager.py +++ b/gns3server/agent/gns3_copilot/agent/context_manager.py @@ -140,7 +140,7 @@ def estimate_tool_tokens(tools: list[Any]) -> int: for tool in tools: try: # Build tool schema in OpenAI format - tool_schema = { + tool_schema: dict[str, Any] = { "type": "function", "function": { "name": tool.name, diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..909ed64d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -295,7 +295,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] # Remove modules from this list one small PR at a time. Never add new ones. module = [ "gns3server.agent", # 2 - "gns3server.agent.gns3_copilot.agent.context_manager", # 5 "gns3server.agent.gns3_copilot.agent.model_factory", # 4 "gns3server.agent.gns3_copilot.chat_sessions_repository", # 8 "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 From cd7f5ab8e95b65c004f91d0e99316f776d6cbf83 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:20:33 +0000 Subject: [PATCH 044/390] fix(typing): resolve mypy errors in agent.gns3_copilot.agent.model_factory --- gns3server/agent/gns3_copilot/agent/model_factory.py | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/agent/gns3_copilot/agent/model_factory.py b/gns3server/agent/gns3_copilot/agent/model_factory.py index cfdc26854..f790646bd 100644 --- a/gns3server/agent/gns3_copilot/agent/model_factory.py +++ b/gns3server/agent/gns3_copilot/agent/model_factory.py @@ -110,7 +110,7 @@ def create_base_model( try: # Prepare parameters for init_chat_model - init_params = { + init_params: dict[str, Any] = { "model": config_vars["model_name"], "model_provider": config_vars["model_provider"], "api_key": config_vars["api_key"], @@ -177,7 +177,7 @@ def create_title_model( try: # Prepare parameters for init_chat_model - init_params = { + init_params: dict[str, Any] = { "model": config_vars["model_name"], "model_provider": config_vars["model_provider"], "api_key": config_vars["api_key"], diff --git a/pyproject.toml b/pyproject.toml index 909ed64d9..ee3fb2bbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -295,7 +295,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] # Remove modules from this list one small PR at a time. Never add new ones. module = [ "gns3server.agent", # 2 - "gns3server.agent.gns3_copilot.agent.model_factory", # 4 "gns3server.agent.gns3_copilot.chat_sessions_repository", # 8 "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 "gns3server.agent.gns3_copilot.gns3_client.connector_factory", # 1 From 5cb1b8e3d2ddcf9bfeedd0d820bbdf85e3631702 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:05:22 +0000 Subject: [PATCH 045/390] fix(typing): resolve mypy errors in agent.gns3_copilot.utils.message_converters --- gns3server/agent/gns3_copilot/utils/message_converters.py | 5 +++-- pyproject.toml | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gns3server/agent/gns3_copilot/utils/message_converters.py b/gns3server/agent/gns3_copilot/utils/message_converters.py index 8bf18f668..367b2d956 100644 --- a/gns3server/agent/gns3_copilot/utils/message_converters.py +++ b/gns3server/agent/gns3_copilot/utils/message_converters.py @@ -37,6 +37,7 @@ from typing import Dict from langchain_core.messages import AIMessage from langchain_core.messages import HumanMessage from langchain_core.messages import SystemMessage +from langchain_core.messages import ToolCall from langchain_core.messages import ToolMessage @@ -86,7 +87,7 @@ def convert_langchain_to_openai(lc_message) -> Dict[str, Any]: tool_calls = [] for tc in lc_message.tool_calls: # Convert to dict if it's an object - tc_dict = tc if isinstance(tc, dict) else tc.model_dump() + tc_dict = tc tool_calls.append( { "id": tc_dict.get("id", str(uuid.uuid4())), @@ -139,7 +140,7 @@ def convert_openai_to_langchain(msg: Dict[str, Any]): # Restore tool calls if present if "tool_calls" in msg and msg["tool_calls"]: - tool_calls = [] + tool_calls: list[ToolCall] = [] for tc in msg["tool_calls"]: tool_calls.append( { diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..25a160936 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -312,7 +312,6 @@ module = [ "gns3server.agent.gns3_copilot.tools_v2.packet_analysis_tool", # 1 "gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko", # 9 "gns3server.agent.gns3_copilot.utils.custom_netmiko.scripts.list_netmiko_telnet_devices", # 1 - "gns3server.agent.gns3_copilot.utils.message_converters", # 2 "gns3server.agent.gns3_copilot.utils.parse_tool_content", # 1 "gns3server.agent.mcp.appliances", # 1 "gns3server.agent.web_wireshark.docker_client", # 5 From 4ae6b5338d8988d1dacdf2e25fe1ca6ba9fc7b55 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:01:01 +0000 Subject: [PATCH 046/390] fix(typing): resolve mypy errors in agent.gns3_copilot.utils.parse_tool_content --- gns3server/agent/gns3_copilot/utils/parse_tool_content.py | 4 +--- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/gns3server/agent/gns3_copilot/utils/parse_tool_content.py b/gns3server/agent/gns3_copilot/utils/parse_tool_content.py index 4ea17912d..350a6bf50 100644 --- a/gns3server/agent/gns3_copilot/utils/parse_tool_content.py +++ b/gns3server/agent/gns3_copilot/utils/parse_tool_content.py @@ -214,9 +214,7 @@ def parse_tool_content( return content # Handle unsupported types - error_msg = ( # type: ignore[unreachable] - f"Content must be str, dict, list, int, float, bool, or None, got {type(content).__name__}" - ) + error_msg = f"Content must be str, dict, list, int, float, bool, or None, got {type(content).__name__}" logger.error(error_msg) if strict_mode: diff --git a/pyproject.toml b/pyproject.toml index 25a160936..3e96ccbdd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -312,7 +312,6 @@ module = [ "gns3server.agent.gns3_copilot.tools_v2.packet_analysis_tool", # 1 "gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko", # 9 "gns3server.agent.gns3_copilot.utils.custom_netmiko.scripts.list_netmiko_telnet_devices", # 1 - "gns3server.agent.gns3_copilot.utils.parse_tool_content", # 1 "gns3server.agent.mcp.appliances", # 1 "gns3server.agent.web_wireshark.docker_client", # 5 "gns3server.agent.web_wireshark.manage_wireshark", # 1 From 094fcf27479b8fc1567df41904f3ee872c942473 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:15:05 +0000 Subject: [PATCH 047/390] fix(typing): resolve mypy errors in schemas.compute.atm_switch_nodes --- gns3server/schemas/compute/atm_switch_nodes.py | 4 ++-- pyproject.toml | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/gns3server/schemas/compute/atm_switch_nodes.py b/gns3server/schemas/compute/atm_switch_nodes.py index 9a9db0845..9d126bfe9 100644 --- a/gns3server/schemas/compute/atm_switch_nodes.py +++ b/gns3server/schemas/compute/atm_switch_nodes.py @@ -26,8 +26,8 @@ class ATMSwitchBase(BaseModel): Common ATM switch properties. """ - name: str = None - node_id: UUID = None + name: Optional[str] = None + node_id: Optional[UUID] = None usage: Optional[str] = None mappings: Optional[dict] = None diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..093342909 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -374,13 +374,10 @@ module = [ "gns3server.db.repositories.templates", # 6 "gns3server.db.repositories.users", # 12 "gns3server.db.tasks", # 12 - "gns3server.schemas.compute.atm_switch_nodes", # 5 "gns3server.schemas.compute.cloud_nodes", # 1 "gns3server.schemas.compute.docker_nodes", # 2 - "gns3server.schemas.compute.dynamips_nodes", # 1 "gns3server.schemas.compute.frame_relay_switch_nodes", # 5 "gns3server.schemas.compute.iou_nodes", # 3 - "gns3server.schemas.compute.nat_nodes", # 1 "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 "gns3server.schemas.compute.vmware_nodes", # 3 From 672ef2e3cec155adb361a7660d91ef75920e3070 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:48:29 +0000 Subject: [PATCH 048/390] fix(typing): resolve mypy errors in schemas.compute.dynamips_nodes --- gns3server/schemas/compute/dynamips_nodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/schemas/compute/dynamips_nodes.py b/gns3server/schemas/compute/dynamips_nodes.py index d01020a28..6292b400b 100644 --- a/gns3server/schemas/compute/dynamips_nodes.py +++ b/gns3server/schemas/compute/dynamips_nodes.py @@ -124,7 +124,6 @@ class DynamipsBase(BaseModel): node_id: Optional[UUID] = None name: Optional[str] = None dynamips_id: Optional[int] = Field(None, description="Dynamips internal ID") - platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") ram: Optional[int] = Field(None, gt=0, description="Amount of RAM in MB") nvram: Optional[int] = Field(None, gt=0, description="Amount of NVRAM in KB") image: Optional[str] = Field(None, description="Path to the IOS image") @@ -185,11 +184,12 @@ class DynamipsUpdate(DynamipsBase): Properties to update a Dynamips node. """ - pass + platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") class Dynamips(DynamipsBase): name: str + platform: Optional[DynamipsPlatform] = Field(None, description="Cisco router platform") node_id: UUID project_id: UUID dynamips_id: int From a3c4c954315b8b06961a69d0f908bb208e434d9e Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:47:28 +0000 Subject: [PATCH 049/390] fix(typing): resolve mypy errors in schemas.compute.nat_nodes --- gns3server/schemas/compute/nat_nodes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gns3server/schemas/compute/nat_nodes.py b/gns3server/schemas/compute/nat_nodes.py index 95a703320..e3c569251 100644 --- a/gns3server/schemas/compute/nat_nodes.py +++ b/gns3server/schemas/compute/nat_nodes.py @@ -89,7 +89,7 @@ class NATBase(BaseModel): Common NAT node properties. """ - name: str + name: Optional[str] = None node_id: Optional[UUID] = None usage: Optional[str] = None ports_mapping: Optional[List[Union[EthernetPort, TAPPort, UDPPort]]] = Field( @@ -102,7 +102,7 @@ class NATCreate(NATBase): Properties to create a NAT node. """ - pass + name: str class NATUpdate(NATBase): @@ -110,10 +110,11 @@ class NATUpdate(NATBase): Properties to update a NAT node. """ - name: Optional[str] = None + pass class NAT(NATBase): + name: str project_id: UUID node_id: UUID ports_mapping: List[Union[EthernetPort, TAPPort, UDPPort]] From 2d712e0a9089e8c31d0c5dd21f9364ced90a613c Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:00:38 +0000 Subject: [PATCH 050/390] fix(typing): resolve mypy errors in agent.gns3_copilot.utils.custom_netmiko.scripts.list_netmiko_telnet_devices --- .../utils/custom_netmiko/scripts/list_netmiko_telnet_devices.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/agent/gns3_copilot/utils/custom_netmiko/scripts/list_netmiko_telnet_devices.py b/gns3server/agent/gns3_copilot/utils/custom_netmiko/scripts/list_netmiko_telnet_devices.py index 3e951f10a..d4f7b1a38 100644 --- a/gns3server/agent/gns3_copilot/utils/custom_netmiko/scripts/list_netmiko_telnet_devices.py +++ b/gns3server/agent/gns3_copilot/utils/custom_netmiko/scripts/list_netmiko_telnet_devices.py @@ -169,7 +169,7 @@ def group_devices_by_brand(device_types: List[str]) -> Dict[str, List[str]]: Returns: Dictionary mapping brand names to device type lists """ - brands = {} + brands: dict[str, list[str]] = {} for device_type in device_types: brand = extract_brand_name(device_type) diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..11b04bee1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -311,7 +311,6 @@ module = [ "gns3server.agent.gns3_copilot.tools_v2.gns3_suspend_node", # 3 "gns3server.agent.gns3_copilot.tools_v2.packet_analysis_tool", # 1 "gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko", # 9 - "gns3server.agent.gns3_copilot.utils.custom_netmiko.scripts.list_netmiko_telnet_devices", # 1 "gns3server.agent.gns3_copilot.utils.message_converters", # 2 "gns3server.agent.gns3_copilot.utils.parse_tool_content", # 1 "gns3server.agent.mcp.appliances", # 1 From d25cb5cdca7d70eb37d098712dafecfa61942207 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:06:15 +0000 Subject: [PATCH 051/390] fix(typing): resolve mypy errors in agent.mcp.appliances --- gns3server/agent/mcp/appliances.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/agent/mcp/appliances.py b/gns3server/agent/mcp/appliances.py index 45a9b472a..6e3a3ecf5 100644 --- a/gns3server/agent/mcp/appliances.py +++ b/gns3server/agent/mcp/appliances.py @@ -108,7 +108,7 @@ def install_appliance_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) if version: request_params["version"] = version response = conn.http_call("post", url, params=request_params) - result = {"message": f"Appliance {appliance_id} installed"} + result: dict[str, Any] = {"message": f"Appliance {appliance_id} installed"} if response.content: # the install endpoint returns the created template (201); tolerate an # empty body in case an older server still replies with 204 diff --git a/pyproject.toml b/pyproject.toml index 11b04bee1..f41720a60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -313,7 +313,6 @@ module = [ "gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko", # 9 "gns3server.agent.gns3_copilot.utils.message_converters", # 2 "gns3server.agent.gns3_copilot.utils.parse_tool_content", # 1 - "gns3server.agent.mcp.appliances", # 1 "gns3server.agent.web_wireshark.docker_client", # 5 "gns3server.agent.web_wireshark.manage_wireshark", # 1 "gns3server.agent.web_wireshark.manager", # 9 From c154d1c41e20519660998ed61ee2dc0bf7baf4f1 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:21:26 +0000 Subject: [PATCH 052/390] fix(typing): resolve mypy errors in agent.web_wireshark.docker_client --- gns3server/agent/web_wireshark/docker_client.py | 17 ++++++++++++----- pyproject.toml | 1 - 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gns3server/agent/web_wireshark/docker_client.py b/gns3server/agent/web_wireshark/docker_client.py index d27873fa5..00f62edd2 100644 --- a/gns3server/agent/web_wireshark/docker_client.py +++ b/gns3server/agent/web_wireshark/docker_client.py @@ -23,9 +23,16 @@ This module handles Docker API operations via aiohttp Unix socket. import asyncio import logging +import sys +from typing import Any import aiohttp +if sys.version_info >= (3, 11): + from asyncio import timeout as async_timeout +else: + from async_timeout import timeout as async_timeout + from gns3server.utils import parse_version logger = logging.getLogger(__name__) @@ -132,7 +139,7 @@ class DockerHTTPClient: url = f"http://docker/v{self._api_version}/{endpoint}" try: - async with asyncio.timeout(self.REQUEST_TIMEOUT): + async with async_timeout(self.REQUEST_TIMEOUT): async with session.request(method, url, **kwargs) as response: if response.status >= 300: error_text = await response.text() @@ -157,9 +164,9 @@ class DockerHTTPClient: return await self._request(method, endpoint, check_connection=False, **kwargs) raise - async def create_network(self, name: str, driver: str = "bridge", subnet: str = None): + async def create_network(self, name: str, driver: str = "bridge", subnet: str | None = None): """Create Docker network.""" - data = {"Name": name, "Driver": driver} + data: dict[str, Any] = {"Name": name, "Driver": driver} if subnet: data["IPAM"] = {"Config": [{"Subnet": subnet}]} await self._request("POST", "networks/create", json=data) @@ -175,7 +182,7 @@ class DockerHTTPClient: async def create_container(self, name: str, image: str, **kwargs): """Create container.""" - data = {"Image": image, "name": name, "HostConfig": {}, "NetworkingConfig": {}} + data: dict[str, Any] = {"Image": image, "name": name, "HostConfig": {}, "NetworkingConfig": {}} # Handle network config if "network" in kwargs: @@ -248,7 +255,7 @@ class DockerHTTPClient: url = f"http://docker/v{self._api_version}/containers/{container_name}/top?ps_args=aux" try: - async with asyncio.timeout(self.REQUEST_TIMEOUT): + async with async_timeout(self.REQUEST_TIMEOUT): async with session.get(url) as response: if response.status >= 300: error_text = await response.text() diff --git a/pyproject.toml b/pyproject.toml index f41720a60..a9da73a8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -313,7 +313,6 @@ module = [ "gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko", # 9 "gns3server.agent.gns3_copilot.utils.message_converters", # 2 "gns3server.agent.gns3_copilot.utils.parse_tool_content", # 1 - "gns3server.agent.web_wireshark.docker_client", # 5 "gns3server.agent.web_wireshark.manage_wireshark", # 1 "gns3server.agent.web_wireshark.manager", # 9 "gns3server.agent.web_wireshark.stats", # 4 From 10edb109df6e4ebd5e2b0755dcf03270dfccdf73 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:10:38 +0000 Subject: [PATCH 053/390] fix(typing): resolve mypy errors in api.routes.compute.dependencies.authentication --- .../api/routes/compute/dependencies/authentication.py | 9 +++++---- pyproject.toml | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gns3server/api/routes/compute/dependencies/authentication.py b/gns3server/api/routes/compute/dependencies/authentication.py index 14ba07f91..0412a4136 100644 --- a/gns3server/api/routes/compute/dependencies/authentication.py +++ b/gns3server/api/routes/compute/dependencies/authentication.py @@ -91,9 +91,9 @@ async def ws_compute_authentication(websocket: WebSocket) -> Union[None, WebSock if not separator: raise invalid_user_credentials_exc - username = secrets.compare_digest(username, server_settings.compute_username) - password = secrets.compare_digest(password, server_settings.compute_password.get_secret_value()) - if not (username and password): + username_valid = secrets.compare_digest(username, server_settings.compute_username) + password_valid = secrets.compare_digest(password, server_settings.compute_password.get_secret_value()) + if not (username_valid and password_valid): raise invalid_user_credentials_exc except HTTPException as e: @@ -101,5 +101,6 @@ async def ws_compute_authentication(websocket: WebSocket) -> Union[None, WebSock websocket_error = {"action": "log.error", "event": {"message": err_msg}} await websocket.send_json(websocket_error) log.error(err_msg) - return await websocket.close(code=1008) + await websocket.close(code=1008) + return None return websocket diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..ce388d188 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -323,7 +323,6 @@ module = [ "gns3server.api.routes.compute.capabilities", # 1 "gns3server.api.routes.compute.cloud_nodes", # 14 "gns3server.api.routes.compute.compute", # 1 - "gns3server.api.routes.compute.dependencies.authentication", # 3 "gns3server.api.routes.compute.docker_nodes", # 26 "gns3server.api.routes.compute.dynamips_nodes", # 9 "gns3server.api.routes.compute.ethernet_hub_nodes", # 9 From 8aa07a8c25839b6b3fb57d5b81fdbd0ceb0bdaca Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:40:13 +0000 Subject: [PATCH 054/390] fix(typing): resolve mypy errors in api.routes.compute.atm_switch_nodes --- .../api/routes/compute/atm_switch_nodes.py | 23 +++++++++++-------- pyproject.toml | 1 - 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/gns3server/api/routes/compute/atm_switch_nodes.py b/gns3server/api/routes/compute/atm_switch_nodes.py index 65bc1157d..1282a162d 100644 --- a/gns3server/api/routes/compute/atm_switch_nodes.py +++ b/gns3server/api/routes/compute/atm_switch_nodes.py @@ -18,6 +18,7 @@ API routes for ATM switch nodes. """ +from typing import Any import os from fastapi import APIRouter, Depends, Body, Path, status, HTTPException @@ -29,7 +30,9 @@ from gns3server import schemas from gns3server.compute.dynamips import Dynamips from gns3server.compute.dynamips.nodes.atm_switch import ATMSwitch -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or ATM switch node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or ATM switch node"} +} router = APIRouter(responses=responses) @@ -57,13 +60,13 @@ async def create_atm_switch(project_id: UUID, node_data: schemas.ATMSwitchCreate # Use the Dynamips ATM switch to simulate this node dynamips_manager = Dynamips.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) node = await dynamips_manager.create_node( - node_data.get("name"), + data.get("name"), str(project_id), - node_data.get("node_id"), + data.get("node_id"), node_type="atm_switch", - mappings=node_data.get("mappings"), + mappings=data.get("mappings"), ) return node.asdict() @@ -97,11 +100,11 @@ async def update_atm_switch( Update an ATM switch node. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) - if "name" in node_data and node.name != node_data["name"]: - await node.set_name(node_data["name"]) - if "mappings" in node_data: - node.mappings = node_data["mappings"] + data = jsonable_encoder(node_data, exclude_unset=True) + if "name" in data and node.name != data["name"]: + await node.set_name(data["name"]) + if "mappings" in data: + node.mappings = data["mappings"] node.updated() return node.asdict() diff --git a/pyproject.toml b/pyproject.toml index a9da73a8b..6f7bba3ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -316,7 +316,6 @@ module = [ "gns3server.agent.web_wireshark.manage_wireshark", # 1 "gns3server.agent.web_wireshark.manager", # 9 "gns3server.agent.web_wireshark.stats", # 4 - "gns3server.api.routes.compute.atm_switch_nodes", # 9 "gns3server.api.routes.compute.capabilities", # 1 "gns3server.api.routes.compute.cloud_nodes", # 14 "gns3server.api.routes.compute.compute", # 1 From bb0f29b8e6f352373d2b692de282ce1f8d2190f8 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:43:01 +0000 Subject: [PATCH 055/390] fix(typing): resolve mypy errors in api.routes.compute.docker_nodes --- gns3server/api/routes/compute/docker_nodes.py | 14 ++++++++------ pyproject.toml | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gns3server/api/routes/compute/docker_nodes.py b/gns3server/api/routes/compute/docker_nodes.py index 6091cf37b..9dee90dda 100644 --- a/gns3server/api/routes/compute/docker_nodes.py +++ b/gns3server/api/routes/compute/docker_nodes.py @@ -24,14 +24,16 @@ from fastapi import APIRouter, WebSocket, Depends, Body, status, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse from uuid import UUID -from typing import Union +from typing import Any, Union from gns3server import schemas from gns3server.compute.docker import Docker from gns3server.compute.docker.docker_vm import DockerVM from .dependencies.authentication import compute_authentication, ws_compute_authentication -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or Docker node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or Docker node"} +} router = APIRouter(responses=responses) @@ -53,13 +55,13 @@ def dep_node(project_id: UUID, node_id: UUID) -> DockerVM: responses={409: {"model": schemas.ErrorMessage, "description": "Could not create Docker node"}}, dependencies=[Depends(compute_authentication)], ) -async def create_docker_node(project_id: UUID, node_data: schemas.DockerCreate) -> schemas.Docker: +async def create_docker_node(project_id: UUID, node_create: schemas.DockerCreate) -> schemas.Docker: """ Create a new Docker node. """ docker_manager = Docker.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + node_data = jsonable_encoder(node_create, exclude_unset=True) container = await docker_manager.create_node( node_data.pop("name"), str(project_id), @@ -124,7 +126,7 @@ def get_docker_node(node: DockerVM = Depends(dep_node)) -> schemas.Docker: @router.put("/{node_id}", response_model=schemas.Docker, dependencies=[Depends(compute_authentication)]) -async def update_docker_node(node_data: schemas.DockerUpdate, node: DockerVM = Depends(dep_node)) -> schemas.Docker: +async def update_docker_node(node_update: schemas.DockerUpdate, node: DockerVM = Depends(dep_node)) -> schemas.Docker: """ Update a Docker node. """ @@ -152,7 +154,7 @@ async def update_docker_node(node_data: schemas.DockerUpdate, node: DockerVM = D ] changed = False - node_data = jsonable_encoder(node_data, exclude_unset=True) + node_data = jsonable_encoder(node_update, exclude_unset=True) for prop in props: # hasattr: startup_config_content only exists on IOLDockerVM if prop in node_data and hasattr(node, prop) and node_data[prop] != getattr(node, prop): diff --git a/pyproject.toml b/pyproject.toml index ce388d188..902af10ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -323,7 +323,6 @@ module = [ "gns3server.api.routes.compute.capabilities", # 1 "gns3server.api.routes.compute.cloud_nodes", # 14 "gns3server.api.routes.compute.compute", # 1 - "gns3server.api.routes.compute.docker_nodes", # 26 "gns3server.api.routes.compute.dynamips_nodes", # 9 "gns3server.api.routes.compute.ethernet_hub_nodes", # 9 "gns3server.api.routes.compute.ethernet_switch_nodes", # 16 From 50a749af36a8b422a9a1cd0d9125ead4878c1263 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:50:26 +0000 Subject: [PATCH 056/390] fix(typing): resolve mypy errors in api.routes.compute.cloud_nodes --- gns3server/api/routes/compute/cloud_nodes.py | 30 +++++++++++--------- pyproject.toml | 1 - 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/gns3server/api/routes/compute/cloud_nodes.py b/gns3server/api/routes/compute/cloud_nodes.py index 7baf8ca17..d0a4ead9e 100644 --- a/gns3server/api/routes/compute/cloud_nodes.py +++ b/gns3server/api/routes/compute/cloud_nodes.py @@ -23,14 +23,16 @@ import os from fastapi import APIRouter, Depends, Path, status, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse -from typing import Union +from typing import Any, Union from uuid import UUID from gns3server import schemas from gns3server.compute.builtin import Builtin from gns3server.compute.builtin.nodes.cloud import Cloud -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or cloud node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or cloud node"} +} router = APIRouter(responses=responses) @@ -57,21 +59,21 @@ async def create_cloud(project_id: UUID, node_data: schemas.CloudCreate) -> sche """ builtin_manager = Builtin.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) node = await builtin_manager.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.get("node_id"), + data.get("node_id"), node_type="cloud", - ports=node_data.get("ports_mapping"), + ports=data.get("ports_mapping"), ) # add the remote console settings - node.remote_console_host = node_data.get("remote_console_host", node.remote_console_host) - node.remote_console_port = node_data.get("remote_console_port", node.remote_console_port) - node.remote_console_type = node_data.get("remote_console_type", node.remote_console_type) - node.remote_console_http_path = node_data.get("remote_console_http_path", node.remote_console_http_path) - node.usage = node_data.get("usage", "") + node.remote_console_host = data.get("remote_console_host", node.remote_console_host) + node.remote_console_port = data.get("remote_console_port", node.remote_console_port) + node.remote_console_type = data.get("remote_console_type", node.remote_console_type) + node.remote_console_http_path = data.get("remote_console_http_path", node.remote_console_http_path) + node.usage = data.get("usage", "") return node.asdict() @@ -90,8 +92,8 @@ async def update_cloud(node_data: schemas.CloudUpdate, node: Cloud = Depends(dep Update a cloud node. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) - for name, value in node_data.items(): + data = jsonable_encoder(node_data, exclude_unset=True) + for name, value in data.items(): if hasattr(node, name) and getattr(node, name) != value: setattr(node, name, value) node.updated() @@ -178,7 +180,7 @@ async def update_cloud_nio( nio = node.get_nio(port_number) nio.filters.clear() - if nio_data.filters: + if isinstance(nio_data, schemas.UDPNIO) and nio_data.filters: nio.filters = nio_data.filters # NIO type is a Union (Ethernet/TAP/UDP); only UDPNIO carries markers. nio.markers = getattr(nio_data, "markers", None) or {} diff --git a/pyproject.toml b/pyproject.toml index 6f7bba3ca..adfb6373b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -317,7 +317,6 @@ module = [ "gns3server.agent.web_wireshark.manager", # 9 "gns3server.agent.web_wireshark.stats", # 4 "gns3server.api.routes.compute.capabilities", # 1 - "gns3server.api.routes.compute.cloud_nodes", # 14 "gns3server.api.routes.compute.compute", # 1 "gns3server.api.routes.compute.dependencies.authentication", # 3 "gns3server.api.routes.compute.docker_nodes", # 26 From 904672559e742eec5ce0bfb42f2c91789a894a12 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:50:51 +0000 Subject: [PATCH 057/390] fix(typing): resolve mypy errors in api.routes.compute.dynamips_nodes --- .../api/routes/compute/dynamips_nodes.py | 25 +++++++++++-------- pyproject.toml | 1 - 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/gns3server/api/routes/compute/dynamips_nodes.py b/gns3server/api/routes/compute/dynamips_nodes.py index ce1c1b42b..ccfcd58fb 100644 --- a/gns3server/api/routes/compute/dynamips_nodes.py +++ b/gns3server/api/routes/compute/dynamips_nodes.py @@ -23,7 +23,7 @@ import os from fastapi import APIRouter, WebSocket, Body, Depends, status, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse -from typing import List, Union +from typing import Any, List, Optional, Union from uuid import UUID from gns3server.compute.dynamips import Dynamips @@ -32,7 +32,9 @@ from gns3server import schemas from .dependencies.authentication import compute_authentication, ws_compute_authentication -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or Dynamips node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or Dynamips node"} +} router = APIRouter(responses=responses) @@ -64,25 +66,26 @@ async def create_router(project_id: UUID, node_data: schemas.DynamipsCreate) -> dynamips_manager = Dynamips.instance() platform = node_data.platform + chassis: Optional[str] if not node_data.chassis and platform in DEFAULT_CHASSIS: chassis = DEFAULT_CHASSIS[platform] else: chassis = node_data.chassis - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) vm = await dynamips_manager.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.get("node_id"), - dynamips_id=node_data.get("dynamips_id"), + data.get("node_id"), + dynamips_id=data.get("dynamips_id"), platform=platform, - console=node_data.get("console"), - console_type=node_data.get("console_type", "telnet"), - aux=node_data.get("aux"), - aux_type=node_data.pop("aux_type", "none"), + console=data.get("console"), + console_type=data.get("console_type", "telnet"), + aux=data.get("aux"), + aux_type=data.pop("aux_type", "none"), chassis=chassis, node_type="dynamips", ) - await dynamips_manager.update_vm_settings(vm, node_data) + await dynamips_manager.update_vm_settings(vm, data) return vm.asdict() diff --git a/pyproject.toml b/pyproject.toml index 902af10ce..fb001c18a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -323,7 +323,6 @@ module = [ "gns3server.api.routes.compute.capabilities", # 1 "gns3server.api.routes.compute.cloud_nodes", # 14 "gns3server.api.routes.compute.compute", # 1 - "gns3server.api.routes.compute.dynamips_nodes", # 9 "gns3server.api.routes.compute.ethernet_hub_nodes", # 9 "gns3server.api.routes.compute.ethernet_switch_nodes", # 16 "gns3server.api.routes.compute.frame_relay_switch_nodes", # 9 From 5ed85340af6b25f3e69db58eb1d929d720c7a550 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:40:39 +0000 Subject: [PATCH 058/390] fix(typing): resolve mypy errors in api.routes.compute.ethernet_switch_nodes --- .../routes/compute/ethernet_switch_nodes.py | 37 ++++++++++--------- pyproject.toml | 1 - 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/gns3server/api/routes/compute/ethernet_switch_nodes.py b/gns3server/api/routes/compute/ethernet_switch_nodes.py index bedfac0b6..9c7736e9c 100644 --- a/gns3server/api/routes/compute/ethernet_switch_nodes.py +++ b/gns3server/api/routes/compute/ethernet_switch_nodes.py @@ -22,6 +22,7 @@ through uBridge's ``brctl`` module (see ``gns3server.compute.builtin.nodes.ethernet_switch``). """ +from typing import Any import os from fastapi import APIRouter, Depends, Body, Path, status, HTTPException @@ -33,7 +34,9 @@ from gns3server.compute.builtin import Builtin from gns3server.compute.builtin.nodes.ethernet_switch import EthernetSwitch from gns3server import schemas -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or Ethernet switch node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or Ethernet switch node"} +} router = APIRouter(responses=responses) @@ -60,17 +63,17 @@ async def create_ethernet_switch(project_id: UUID, node_data: schemas.EthernetSw """ builtin_manager = Builtin.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) node = await builtin_manager.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.get("node_id"), - console=node_data.get("console"), - console_type=node_data.get("console_type"), + data.get("node_id"), + console=data.get("console"), + console_type=data.get("console_type"), node_type="ethernet_switch", - ports=node_data.get("ports_mapping"), + ports=data.get("ports_mapping"), ) - node.usage = node_data.get("usage", "") + node.usage = data.get("usage", "") return node.asdict() @@ -100,16 +103,16 @@ async def update_ethernet_switch( Update an Ethernet switch. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) - if "name" in node_data and node.name != node_data["name"]: - node.name = node_data["name"] - if "usage" in node_data: - node.usage = node_data["usage"] - if "ports_mapping" in node_data: - node.ports_mapping = node_data["ports_mapping"] + data = jsonable_encoder(node_data, exclude_unset=True) + if "name" in data and node.name != data["name"]: + node.name = data["name"] + if "usage" in data: + node.usage = data["usage"] + if "ports_mapping" in data: + node.ports_mapping = data["ports_mapping"] await node.update_port_settings() - if "console_type" in node_data: - node.console_type = node_data["console_type"] + if "console_type" in data: + node.console_type = data["console_type"] node.updated() return node.asdict() diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..5b647cde1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -327,7 +327,6 @@ module = [ "gns3server.api.routes.compute.docker_nodes", # 26 "gns3server.api.routes.compute.dynamips_nodes", # 9 "gns3server.api.routes.compute.ethernet_hub_nodes", # 9 - "gns3server.api.routes.compute.ethernet_switch_nodes", # 16 "gns3server.api.routes.compute.frame_relay_switch_nodes", # 9 "gns3server.api.routes.compute.iou_nodes", # 15 "gns3server.api.routes.compute.nat_nodes", # 10 From cacbc18ad11b544191817257a32a5d6804a8e90f Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:40:31 +0000 Subject: [PATCH 059/390] fix(typing): resolve mypy errors in api.routes.compute.ethernet_hub_nodes --- .../api/routes/compute/ethernet_hub_nodes.py | 23 +++++++++++-------- pyproject.toml | 1 - 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/gns3server/api/routes/compute/ethernet_hub_nodes.py b/gns3server/api/routes/compute/ethernet_hub_nodes.py index 350105789..150d18e64 100644 --- a/gns3server/api/routes/compute/ethernet_hub_nodes.py +++ b/gns3server/api/routes/compute/ethernet_hub_nodes.py @@ -18,6 +18,7 @@ API routes for Ethernet hub nodes. """ +from typing import Any import os from fastapi import APIRouter, Depends, Body, Path, status, HTTPException @@ -29,7 +30,9 @@ from gns3server.compute.dynamips import Dynamips from gns3server.compute.dynamips.nodes.ethernet_hub import EthernetHub from gns3server import schemas -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or Ethernet hub node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or Ethernet hub node"} +} router = APIRouter(responses=responses) @@ -57,13 +60,13 @@ async def create_ethernet_hub(project_id: UUID, node_data: schemas.EthernetHubCr # Use the Dynamips Ethernet hub to simulate this node dynamips_manager = Dynamips.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) node = await dynamips_manager.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.get("node_id"), + data.get("node_id"), node_type="ethernet_hub", - ports=node_data.get("ports_mapping"), + ports=data.get("ports_mapping"), ) return node.asdict() @@ -97,11 +100,11 @@ async def update_ethernet_hub( Update an Ethernet hub. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) - if "name" in node_data and node.name != node_data["name"]: - await node.set_name(node_data["name"]) - if "ports_mapping" in node_data: - node.ports_mapping = node_data["ports_mapping"] + data = jsonable_encoder(node_data, exclude_unset=True) + if "name" in data and node.name != data["name"]: + await node.set_name(data["name"]) + if "ports_mapping" in data: + node.ports_mapping = data["ports_mapping"] node.updated() return node.asdict() diff --git a/pyproject.toml b/pyproject.toml index fb001c18a..1ec09fbe7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -323,7 +323,6 @@ module = [ "gns3server.api.routes.compute.capabilities", # 1 "gns3server.api.routes.compute.cloud_nodes", # 14 "gns3server.api.routes.compute.compute", # 1 - "gns3server.api.routes.compute.ethernet_hub_nodes", # 9 "gns3server.api.routes.compute.ethernet_switch_nodes", # 16 "gns3server.api.routes.compute.frame_relay_switch_nodes", # 9 "gns3server.api.routes.compute.iou_nodes", # 15 From 9218f3fc7260c123a156c9cebb01cef6d4f0fb80 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:50:35 +0000 Subject: [PATCH 060/390] fix(typing): resolve mypy errors in api.routes.compute.iou_nodes --- gns3server/api/routes/compute/iou_nodes.py | 34 ++++++++++++---------- pyproject.toml | 1 - 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/gns3server/api/routes/compute/iou_nodes.py b/gns3server/api/routes/compute/iou_nodes.py index 0282d0f0f..5285c07b5 100644 --- a/gns3server/api/routes/compute/iou_nodes.py +++ b/gns3server/api/routes/compute/iou_nodes.py @@ -23,7 +23,7 @@ import os from fastapi import APIRouter, WebSocket, Depends, Body, status, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse -from typing import Union +from typing import Any, Union from uuid import UUID from gns3server import schemas @@ -32,7 +32,9 @@ from gns3server.compute.iou.iou_vm import IOUVM from .dependencies.authentication import compute_authentication, ws_compute_authentication -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or IOU node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or IOU node"} +} router = APIRouter(responses=responses) @@ -60,18 +62,18 @@ async def create_iou_node(project_id: UUID, node_data: schemas.IOUCreate) -> sch """ iou = IOU.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) vm = await iou.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.get("node_id"), - application_id=node_data.get("application_id"), - path=node_data.get("path"), - console=node_data.get("console"), - console_type=node_data.get("console_type", "telnet"), + data.get("node_id"), + application_id=data.get("application_id"), + path=data.get("path"), + console=data.get("console"), + console_type=data.get("console_type", "telnet"), ) - for name, value in node_data.items(): + for name, value in data.items(): if hasattr(vm, name) and getattr(vm, name) != value: if name == "application_id": continue # we must ignore this to avoid overwriting the application_id allocated by the controller @@ -79,7 +81,7 @@ async def create_iou_node(project_id: UUID, node_data: schemas.IOUCreate) -> sch continue if name == "private_config_content" and (vm.private_config_content and len(vm.private_config_content) > 0): continue - if node_data.get("use_default_iou_values") and (name == "ram" or name == "nvram"): + if data.get("use_default_iou_values") and (name == "ram" or name == "nvram"): continue setattr(vm, name, value) return vm.asdict() @@ -100,8 +102,8 @@ async def update_iou_node(node_data: schemas.IOUUpdate, node: IOUVM = Depends(de Update an IOU node. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) - for name, value in node_data.items(): + data = jsonable_encoder(node_data, exclude_unset=True) + for name, value in data.items(): if hasattr(node, name) and getattr(node, name) != value: if name == "application_id": continue # we must ignore this to avoid overwriting the application_id allocated by the IOU manager @@ -147,8 +149,8 @@ async def start_iou_node(start_data: schemas.IOUStart, node: IOUVM = Depends(dep Start an IOU node. """ - start_data = jsonable_encoder(start_data, exclude_unset=True) - for name, value in start_data.items(): + start_values = jsonable_encoder(start_data, exclude_unset=True) + for name, value in start_values.items(): if hasattr(node, name) and getattr(node, name) != value: setattr(node, name, value) @@ -223,7 +225,7 @@ async def update_iou_node_nio( nio = node.get_nio(adapter_number, port_number) nio.filters.clear() - if nio_data.filters: + if isinstance(nio_data, schemas.UDPNIO) and nio_data.filters: nio.filters = nio_data.filters # NIO type is a Union (Ethernet/TAP/UDP); only UDPNIO carries markers. nio.markers = getattr(nio_data, "markers", None) or {} diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..83e1d60ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -329,7 +329,6 @@ module = [ "gns3server.api.routes.compute.ethernet_hub_nodes", # 9 "gns3server.api.routes.compute.ethernet_switch_nodes", # 16 "gns3server.api.routes.compute.frame_relay_switch_nodes", # 9 - "gns3server.api.routes.compute.iou_nodes", # 15 "gns3server.api.routes.compute.nat_nodes", # 10 "gns3server.api.routes.compute.notifications", # 4 "gns3server.api.routes.compute.projects", # 7 From fed8aab86ccc6a25b0ee979aad304a6680ee2cc7 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:56:36 +0000 Subject: [PATCH 061/390] fix(typing): resolve mypy errors in api.routes.compute.projects --- gns3server/api/routes/compute/projects.py | 16 ++++++++-------- pyproject.toml | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gns3server/api/routes/compute/projects.py b/gns3server/api/routes/compute/projects.py index 7c1248cc5..729510055 100644 --- a/gns3server/api/routes/compute/projects.py +++ b/gns3server/api/routes/compute/projects.py @@ -44,7 +44,7 @@ from gns3server import schemas router = APIRouter() # How many clients have subscribed to notifications -_notifications_listening = {} +_notifications_listening: dict[str, int] = {} def dep_project(project_id: UUID) -> Project: @@ -74,12 +74,12 @@ def create_compute_project(project_data: schemas.ProjectCreate) -> schemas.Proje """ pm = ProjectManager.instance() - project_data = jsonable_encoder(project_data, exclude_unset=True) + data = jsonable_encoder(project_data, exclude_unset=True) project = pm.create_project( - name=project_data.get("name"), - path=project_data.get("path"), - project_id=project_data.get("project_id"), - variables=project_data.get("variables", None), + name=data.get("name"), + path=data.get("path"), + project_id=data.get("project_id"), + variables=data.get("variables", None), ) return project.asdict() @@ -261,7 +261,7 @@ async def create_batch_nios( # This is what makes builtin L2 nodes (ethernet_switch/hub/cloud/nat) # start their uBridge concurrently during project open instead of one # at a time (~0.5s each for fork + socket connect). - per_node = {} + per_node: dict[str, list[schemas.BatchNIOEntry]] = {} for entry in batch.nios: per_node.setdefault(entry.node_id, []).append(entry) @@ -308,7 +308,7 @@ async def update_batch_nios( # Group entries by node so that different nodes' uBridge processes are # updated in parallel (each node has its own AF_UNIX socket). Within a # node entries are serial to respect the per-node uBridge command lock. - per_node = {} + per_node: dict[str, list[schemas.BatchNIOEntry]] = {} for entry in batch.nios: per_node.setdefault(entry.node_id, []).append(entry) diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..86053514c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -332,7 +332,6 @@ module = [ "gns3server.api.routes.compute.iou_nodes", # 15 "gns3server.api.routes.compute.nat_nodes", # 10 "gns3server.api.routes.compute.notifications", # 4 - "gns3server.api.routes.compute.projects", # 7 "gns3server.api.routes.compute.virtualbox_nodes", # 20 "gns3server.api.routes.compute.vmware_nodes", # 10 "gns3server.api.routes.compute.vpcs_nodes", # 9 From 04ca7ffd9bdf4dfee91ab36aab9715bd1d6a2dc9 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:40:21 +0000 Subject: [PATCH 062/390] fix(typing): resolve mypy errors in api.routes.compute.frame_relay_switch_nodes --- .../compute/frame_relay_switch_nodes.py | 23 +++++++++++-------- pyproject.toml | 1 - 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/gns3server/api/routes/compute/frame_relay_switch_nodes.py b/gns3server/api/routes/compute/frame_relay_switch_nodes.py index f425b3200..bd8bb1f18 100644 --- a/gns3server/api/routes/compute/frame_relay_switch_nodes.py +++ b/gns3server/api/routes/compute/frame_relay_switch_nodes.py @@ -18,6 +18,7 @@ API routes for Frame Relay switch nodes. """ +from typing import Any import os from fastapi import APIRouter, Depends, Body, Path, status, HTTPException @@ -29,7 +30,9 @@ from gns3server import schemas from gns3server.compute.dynamips import Dynamips from gns3server.compute.dynamips.nodes.frame_relay_switch import FrameRelaySwitch -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or Frame Relay switch node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or Frame Relay switch node"} +} router = APIRouter(responses=responses) @@ -59,13 +62,13 @@ async def create_frame_relay_switch( # Use the Dynamips Frame Relay switch to simulate this node dynamips_manager = Dynamips.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) node = await dynamips_manager.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.get("node_id"), + data.get("node_id"), node_type="frame_relay_switch", - mappings=node_data.get("mappings"), + mappings=data.get("mappings"), ) return node.asdict() @@ -99,11 +102,11 @@ async def update_frame_relay_switch( Update an Frame Relay switch node. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) - if "name" in node_data and node.name != node_data["name"]: - await node.set_name(node_data["name"]) - if "mappings" in node_data: - node.mappings = node_data["mappings"] + data = jsonable_encoder(node_data, exclude_unset=True) + if "name" in data and node.name != data["name"]: + await node.set_name(data["name"]) + if "mappings" in data: + node.mappings = data["mappings"] node.updated() return node.asdict() diff --git a/pyproject.toml b/pyproject.toml index 5b647cde1..8184ef8bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -327,7 +327,6 @@ module = [ "gns3server.api.routes.compute.docker_nodes", # 26 "gns3server.api.routes.compute.dynamips_nodes", # 9 "gns3server.api.routes.compute.ethernet_hub_nodes", # 9 - "gns3server.api.routes.compute.frame_relay_switch_nodes", # 9 "gns3server.api.routes.compute.iou_nodes", # 15 "gns3server.api.routes.compute.nat_nodes", # 10 "gns3server.api.routes.compute.notifications", # 4 From 0ff63bfd90c1e55502eba20d7beb9af88c0eae81 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:50:17 +0000 Subject: [PATCH 063/390] fix(typing): resolve mypy errors in api.routes.compute.nat_nodes --- gns3server/api/routes/compute/nat_nodes.py | 22 ++++++++++++---------- pyproject.toml | 1 - 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/gns3server/api/routes/compute/nat_nodes.py b/gns3server/api/routes/compute/nat_nodes.py index 60654b603..37d8b4401 100644 --- a/gns3server/api/routes/compute/nat_nodes.py +++ b/gns3server/api/routes/compute/nat_nodes.py @@ -23,14 +23,16 @@ import os from fastapi import APIRouter, Depends, Path, status, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse -from typing import Union +from typing import Any, Union from uuid import UUID from gns3server import schemas from gns3server.compute.builtin import Builtin from gns3server.compute.builtin.nodes.nat import Nat -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or NAT node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or NAT node"} +} router = APIRouter(responses=responses) @@ -57,16 +59,16 @@ async def create_nat_node(project_id: UUID, node_data: schemas.NATCreate) -> sch """ builtin_manager = Builtin.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) node = await builtin_manager.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.get("node_id"), + data.get("node_id"), node_type="nat", - ports=node_data.get("ports_mapping"), + ports=data.get("ports_mapping"), ) - node.usage = node_data.get("usage", "") + node.usage = data.get("usage", "") return node.asdict() @@ -85,8 +87,8 @@ async def update_nat_node(node_data: schemas.NATUpdate, node: Nat = Depends(dep_ Update a NAT node. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) - for name, value in node_data.items(): + data = jsonable_encoder(node_data, exclude_unset=True) + for name, value in data.items(): if hasattr(node, name) and getattr(node, name) != value: setattr(node, name, value) node.updated() @@ -170,7 +172,7 @@ async def update_nat_node_nio( nio = node.get_nio(port_number) nio.filters.clear() - if nio_data.filters: + if isinstance(nio_data, schemas.UDPNIO) and nio_data.filters: nio.filters = nio_data.filters await node.update_nio(port_number, nio) return nio.asdict() diff --git a/pyproject.toml b/pyproject.toml index 83e1d60ed..853a4d851 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -329,7 +329,6 @@ module = [ "gns3server.api.routes.compute.ethernet_hub_nodes", # 9 "gns3server.api.routes.compute.ethernet_switch_nodes", # 16 "gns3server.api.routes.compute.frame_relay_switch_nodes", # 9 - "gns3server.api.routes.compute.nat_nodes", # 10 "gns3server.api.routes.compute.notifications", # 4 "gns3server.api.routes.compute.projects", # 7 "gns3server.api.routes.compute.virtualbox_nodes", # 20 From e0c4cb8122b3692cb34f18de622eda1b8d5cb3dc Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:40:57 +0000 Subject: [PATCH 064/390] fix(typing): resolve mypy errors in api.routes.compute.vmware_nodes --- gns3server/api/routes/compute/vmware_nodes.py | 28 ++++++++++--------- pyproject.toml | 1 - 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/gns3server/api/routes/compute/vmware_nodes.py b/gns3server/api/routes/compute/vmware_nodes.py index 0f339883e..61849da30 100644 --- a/gns3server/api/routes/compute/vmware_nodes.py +++ b/gns3server/api/routes/compute/vmware_nodes.py @@ -24,7 +24,7 @@ from fastapi import APIRouter, WebSocket, Depends, Path, status from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse from uuid import UUID -from typing import Union +from typing import Any, Union from gns3server import schemas from gns3server.compute.vmware import VMware @@ -32,7 +32,9 @@ from gns3server.compute.vmware.vmware_vm import VMwareVM from .dependencies.authentication import compute_authentication, ws_compute_authentication -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or VMware node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or VMware node"} +} router = APIRouter(responses=responses, deprecated=True) @@ -60,18 +62,18 @@ async def create_vmware_node(project_id: UUID, node_data: schemas.VMwareCreate) """ vmware_manager = VMware.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) vm = await vmware_manager.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.get("node_id"), - node_data.pop("vmx_path"), - linked_clone=node_data.pop("linked_clone"), - console=node_data.get("console", None), - console_type=node_data.get("console_type", "telnet"), + data.get("node_id"), + data.pop("vmx_path"), + linked_clone=data.pop("linked_clone"), + console=data.get("console", None), + console_type=data.get("console_type", "telnet"), ) - for name, value in node_data.items(): + for name, value in data.items(): if name != "node_id": if hasattr(vm, name) and getattr(vm, name) != value: setattr(vm, name, value) @@ -94,10 +96,10 @@ async def update_vmware_node(node_data: schemas.VMwareUpdate, node: VMwareVM = D Update a VMware node. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) # update the console first to avoid issue if updating console type - node.console = node_data.pop("console", node.console) - for name, value in node_data.items(): + node.console = data.pop("console", node.console) + for name, value in data.items(): if hasattr(node, name) and getattr(node, name) != value: setattr(node, name, value) diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..1e37e2c29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -334,7 +334,6 @@ module = [ "gns3server.api.routes.compute.notifications", # 4 "gns3server.api.routes.compute.projects", # 7 "gns3server.api.routes.compute.virtualbox_nodes", # 20 - "gns3server.api.routes.compute.vmware_nodes", # 10 "gns3server.api.routes.compute.vpcs_nodes", # 9 "gns3server.api.routes.controller.acl", # 5 "gns3server.api.routes.controller.api_keys", # 1 From a86cae541e1e3903221fdf183c9b168d4608990a Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:40:48 +0000 Subject: [PATCH 065/390] fix(typing): resolve mypy errors in api.routes.compute.vpcs_nodes --- gns3server/api/routes/compute/vpcs_nodes.py | 26 +++++++++++---------- pyproject.toml | 1 - 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/gns3server/api/routes/compute/vpcs_nodes.py b/gns3server/api/routes/compute/vpcs_nodes.py index 826571dec..a9f96bdc5 100644 --- a/gns3server/api/routes/compute/vpcs_nodes.py +++ b/gns3server/api/routes/compute/vpcs_nodes.py @@ -23,7 +23,7 @@ import os from fastapi import APIRouter, WebSocket, Depends, Body, Path, status, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse -from typing import Union +from typing import Any, Union from uuid import UUID from gns3server import schemas @@ -31,7 +31,9 @@ from gns3server.compute.vpcs import VPCS from gns3server.compute.vpcs.vpcs_vm import VPCSVM from .dependencies.authentication import compute_authentication, ws_compute_authentication -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or VMware node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or VMware node"} +} router = APIRouter(responses=responses) @@ -59,14 +61,14 @@ async def create_vpcs_node(project_id: UUID, node_data: schemas.VPCSCreate) -> s """ vpcs = VPCS.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) vm = await vpcs.create_node( - node_data["name"], + data["name"], str(project_id), - node_data.get("node_id"), - console=node_data.get("console"), - console_type=node_data.get("console_type", "telnet"), - startup_script=node_data.get("startup_script"), + data.get("node_id"), + console=data.get("console"), + console_type=data.get("console_type", "telnet"), + startup_script=data.get("startup_script"), ) return vm.asdict() @@ -87,14 +89,14 @@ async def update_vpcs_node(node_data: schemas.VPCSUpdate, node: VPCSVM = Depends Update a VPCS node. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) - name = node_data.get("name", node.name) + data = jsonable_encoder(node_data, exclude_unset=True) + name = data.get("name", node.name) if node.name != name: node.name = name - console = node_data.get("console", node.console) + console = data.get("console", node.console) if node.console != console: node.console = console - console_type = node_data.get("console_type", node.console_type) + console_type = data.get("console_type", node.console_type) if node.console_type != console_type: node.console_type = console_type node.updated() diff --git a/pyproject.toml b/pyproject.toml index 1e37e2c29..1341dc2e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -334,7 +334,6 @@ module = [ "gns3server.api.routes.compute.notifications", # 4 "gns3server.api.routes.compute.projects", # 7 "gns3server.api.routes.compute.virtualbox_nodes", # 20 - "gns3server.api.routes.compute.vpcs_nodes", # 9 "gns3server.api.routes.controller.acl", # 5 "gns3server.api.routes.controller.api_keys", # 1 "gns3server.api.routes.controller.chat", # 1 From 83b80b8c522d4b2f4ea26702d1c82291737fee98 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:41:14 +0000 Subject: [PATCH 066/390] fix(typing): resolve mypy errors in api.routes.compute.virtualbox_nodes --- .../api/routes/compute/virtualbox_nodes.py | 48 ++++++++++--------- pyproject.toml | 1 - 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/gns3server/api/routes/compute/virtualbox_nodes.py b/gns3server/api/routes/compute/virtualbox_nodes.py index ec040d3e4..9f137d066 100644 --- a/gns3server/api/routes/compute/virtualbox_nodes.py +++ b/gns3server/api/routes/compute/virtualbox_nodes.py @@ -24,7 +24,7 @@ from fastapi import APIRouter, WebSocket, Depends, Path, status from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse from uuid import UUID -from typing import Union +from typing import Any, Union from gns3server import schemas from gns3server.compute.virtualbox import VirtualBox @@ -33,7 +33,9 @@ from gns3server.compute.virtualbox.virtualbox_vm import VirtualBoxVM from .dependencies.authentication import compute_authentication, ws_compute_authentication -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or VirtualBox node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or VirtualBox node"} +} router = APIRouter(responses=responses, deprecated=True) @@ -61,24 +63,24 @@ async def create_virtualbox_node(project_id: UUID, node_data: schemas.VirtualBox """ vbox_manager = VirtualBox.instance() - node_data = jsonable_encoder(node_data, exclude_unset=True) + data = jsonable_encoder(node_data, exclude_unset=True) vm = await vbox_manager.create_node( - node_data.pop("name"), + data.pop("name"), str(project_id), - node_data.get("node_id"), - node_data.pop("vmname"), - linked_clone=node_data.pop("linked_clone", False), - console=node_data.get("console", None), - console_type=node_data.get("console_type", "telnet"), - adapters=node_data.get("adapters", 0), + data.get("node_id"), + data.pop("vmname"), + linked_clone=data.pop("linked_clone", False), + console=data.get("console", None), + console_type=data.get("console_type", "telnet"), + adapters=data.get("adapters", 0), ) - if "ram" in node_data: - ram = node_data.pop("ram") + if "ram" in data: + ram = data.pop("ram") if ram != vm.ram: await vm.set_ram(ram) - for name, value in node_data.items(): + for name, value in data.items(): if name != "node_id": if hasattr(vm, name) and getattr(vm, name) != value: setattr(vm, name, value) @@ -103,10 +105,10 @@ async def update_virtualbox_node( Update a VirtualBox node. """ - node_data = jsonable_encoder(node_data, exclude_unset=True) - if "name" in node_data: - name = node_data.pop("name") - vmname = node_data.pop("vmname", None) + data = jsonable_encoder(node_data, exclude_unset=True) + if "name" in data: + name = data.pop("name") + vmname = data.pop("vmname", None) if name != node.name: oldname = node.name node.name = name @@ -118,20 +120,20 @@ async def update_virtualbox_node( node.updated() raise e - if "adapters" in node_data: - adapters = node_data.pop("adapters") + if "adapters" in data: + adapters = data.pop("adapters") if adapters != node.adapters: await node.set_adapters(adapters) - if "ram" in node_data: - ram = node_data.pop("ram") + if "ram" in data: + ram = data.pop("ram") if ram != node.ram: await node.set_ram(ram) # update the console first to avoid issue if updating console type - node.console = node_data.pop("console", node.console) + node.console = data.pop("console", node.console) - for name, value in node_data.items(): + for name, value in data.items(): if hasattr(node, name) and getattr(node, name) != value: setattr(node, name, value) diff --git a/pyproject.toml b/pyproject.toml index 86053514c..5a022c067 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -332,7 +332,6 @@ module = [ "gns3server.api.routes.compute.iou_nodes", # 15 "gns3server.api.routes.compute.nat_nodes", # 10 "gns3server.api.routes.compute.notifications", # 4 - "gns3server.api.routes.compute.virtualbox_nodes", # 20 "gns3server.api.routes.compute.vmware_nodes", # 10 "gns3server.api.routes.compute.vpcs_nodes", # 9 "gns3server.api.routes.controller.acl", # 5 From d8262857489ef1bba2c1aaa0be9e5f1424955d12 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:27:42 +0000 Subject: [PATCH 067/390] fix(typing): resolve mypy errors in api.routes.controller.computes --- gns3server/api/routes/controller/computes.py | 13 +++++++------ pyproject.toml | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gns3server/api/routes/controller/computes.py b/gns3server/api/routes/controller/computes.py index b1173eba7..c62c859ac 100644 --- a/gns3server/api/routes/controller/computes.py +++ b/gns3server/api/routes/controller/computes.py @@ -23,6 +23,7 @@ from typing import Any, List, Union, Optional from uuid import UUID from gns3server.controller import Controller +import gns3server.db.models as models from gns3server.db.repositories.computes import ComputesRepository from gns3server.db.repositories.rbac import RbacRepository from gns3server.services.computes import ComputesService @@ -31,7 +32,7 @@ from gns3server import schemas from .dependencies.database import get_repository from .dependencies.rbac import has_privilege -responses = {404: {"model": schemas.ErrorMessage, "description": "Compute not found"}} +responses: dict[int | str, dict[str, Any]] = {404: {"model": schemas.ErrorMessage, "description": "Compute not found"}} router = APIRouter(responses=responses) @@ -51,14 +52,14 @@ async def create_compute( compute_create: schemas.ComputeCreate, computes_repo: ComputesRepository = Depends(get_repository(ComputesRepository)), connect: Optional[bool] = False, -) -> schemas.Compute: +) -> models.Compute: """ Create a new compute on the controller. Required privilege: Compute.Allocate """ - return await ComputesService(computes_repo).create_compute(compute_create, connect) + return await ComputesService(computes_repo).create_compute(compute_create, bool(connect)) @router.post( @@ -86,7 +87,7 @@ async def connect_compute(compute_id: Union[str, UUID]) -> None: ) async def get_compute( compute_id: Union[str, UUID], computes_repo: ComputesRepository = Depends(get_repository(ComputesRepository)) -) -> schemas.Compute: +) -> Union[models.Compute, dict]: """ Return a compute from the controller. @@ -104,7 +105,7 @@ async def get_compute( ) async def get_computes( computes_repo: ComputesRepository = Depends(get_repository(ComputesRepository)), -) -> List[schemas.Compute]: +) -> List[models.Compute]: """ Return all computes known by the controller. @@ -124,7 +125,7 @@ async def update_compute( compute_id: Union[str, UUID], compute_update: schemas.ComputeUpdate, computes_repo: ComputesRepository = Depends(get_repository(ComputesRepository)), -) -> schemas.Compute: +) -> models.Compute: """ Update a compute on the controller. diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..c92abe8a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -339,7 +339,6 @@ module = [ "gns3server.api.routes.controller.acl", # 5 "gns3server.api.routes.controller.api_keys", # 1 "gns3server.api.routes.controller.chat", # 1 - "gns3server.api.routes.controller.computes", # 6 "gns3server.api.routes.controller.controller", # 10 "gns3server.api.routes.controller.dependencies.authentication", # 11 "gns3server.api.routes.controller.dependencies.database", # 2 From 58609bae7bfe2c6d7ae43113c4c44121387f7188 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:57:36 +0000 Subject: [PATCH 068/390] fix(typing): resolve mypy errors in api.routes.controller.controller --- .../api/routes/controller/controller.py | 25 ++++++++----------- pyproject.toml | 1 - 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/gns3server/api/routes/controller/controller.py b/gns3server/api/routes/controller/controller.py index 843cad739..3afd00a77 100644 --- a/gns3server/api/routes/controller/controller.py +++ b/gns3server/api/routes/controller/controller.py @@ -20,7 +20,7 @@ import os import time import psutil -from fastapi import APIRouter, Request, Depends, WebSocket, WebSocketDisconnect, status +from fastapi import APIRouter, FastAPI, Request, Depends, WebSocket, WebSocketDisconnect, status from fastapi.responses import StreamingResponse from fastapi.encoders import jsonable_encoder from fastapi.routing import Mount @@ -64,7 +64,7 @@ def get_version(request: Request) -> dict: # compute subapp controller_host = None for route in request.app.routes: - if isinstance(route, Mount) and route.name == "compute": + if isinstance(route, Mount) and route.name == "compute" and isinstance(route.app, FastAPI): controller_host = route.app.state.controller_host local_server = Config.instance().settings.Server.local @@ -129,7 +129,7 @@ async def shutdown() -> None: try: future.result() except Exception as e: - log.error(f"Could not close project: {e}", exc_info=1) + log.error(f"Could not close project: {e}", exc_info=True) continue # then shutdown the server itself @@ -191,8 +191,8 @@ async def statistics() -> dict: # Node statistics - distinguish open vs closed project nodes open_project_nodes = [] closed_project_nodes = [] - node_by_type = {} - node_by_status = {} + node_by_type: Dict[str, int] = {} + node_by_status: Dict[str, int] = {} for project in projects: nodes = project.nodes.values() @@ -264,9 +264,8 @@ async def controller_http_notifications(request: Request) -> StreamingResponse: from gns3server.api.server import app - log.info( - f"New client {request.client.host}:{request.client.port} has connected to controller HTTP notification stream" - ) + client = f"{request.client.host}:{request.client.port}" if request.client else "unknown" + log.info(f"New client {client} has connected to controller HTTP notification stream") async def event_stream(): try: @@ -275,10 +274,7 @@ async def controller_http_notifications(request: Request) -> StreamingResponse: msg = await queue.get_json(5) yield f"{msg}\n".encode("utf-8") finally: - log.info( - f"Client {request.client.host}:{request.client.port} has disconnected from controller HTTP " - f"notification stream" - ) + log.info(f"Client {client} has disconnected from controller HTTP notification stream") return StreamingResponse(event_stream(), media_type="application/json") @@ -294,14 +290,15 @@ async def controller_ws_notifications( if current_user is None: return - log.info(f"New client {websocket.client.host}:{websocket.client.port} has connected to controller WebSocket") + client = f"{websocket.client.host}:{websocket.client.port}" if websocket.client else "unknown" + log.info(f"New client {client} has connected to controller WebSocket") try: with Controller.instance().notification.controller_queue() as queue: while True: notification = await queue.get_json(5) await websocket.send_text(notification) except (ConnectionClosed, WebSocketDisconnect): - log.info(f"Client {websocket.client.host}:{websocket.client.port} has disconnected from controller WebSocket") + log.info(f"Client {client} has disconnected from controller WebSocket") except WebSocketException as e: log.warning(f"Error while sending to controller event to WebSocket client: {e}") diff --git a/pyproject.toml b/pyproject.toml index c92abe8a9..ec594233a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -339,7 +339,6 @@ module = [ "gns3server.api.routes.controller.acl", # 5 "gns3server.api.routes.controller.api_keys", # 1 "gns3server.api.routes.controller.chat", # 1 - "gns3server.api.routes.controller.controller", # 10 "gns3server.api.routes.controller.dependencies.authentication", # 11 "gns3server.api.routes.controller.dependencies.database", # 2 "gns3server.api.routes.controller.drawings", # 1 From a648bf3780f416e788b980619ba2c6489edffd52 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:58:46 +0000 Subject: [PATCH 069/390] fix(typing): resolve mypy errors in api.routes.controller.dependencies.database --- gns3server/api/routes/controller/dependencies/database.py | 6 +++--- pyproject.toml | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gns3server/api/routes/controller/dependencies/database.py b/gns3server/api/routes/controller/dependencies/database.py index 2e859106b..86375507d 100644 --- a/gns3server/api/routes/controller/dependencies/database.py +++ b/gns3server/api/routes/controller/dependencies/database.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from typing import Callable, Type +from typing import AsyncGenerator, Callable, Type from fastapi import Depends from starlette.requests import HTTPConnection from sqlalchemy.ext.asyncio import AsyncSession @@ -22,7 +22,7 @@ from sqlalchemy.ext.asyncio import AsyncSession from gns3server.db.repositories.base import BaseRepository -async def get_db_session(request: HTTPConnection) -> AsyncSession: +async def get_db_session(request: HTTPConnection) -> AsyncGenerator[AsyncSession, None]: async with AsyncSession(request.app.state._db_engine, expire_on_commit=False) as session: try: @@ -32,7 +32,7 @@ async def get_db_session(request: HTTPConnection) -> AsyncSession: def get_repository(repo: Type[BaseRepository]) -> Callable: - def get_repo(db_session: AsyncSession = Depends(get_db_session)) -> Type[BaseRepository]: + def get_repo(db_session: AsyncSession = Depends(get_db_session)) -> BaseRepository: return repo(db_session) return get_repo diff --git a/pyproject.toml b/pyproject.toml index ec594233a..cc334a895 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -340,7 +340,6 @@ module = [ "gns3server.api.routes.controller.api_keys", # 1 "gns3server.api.routes.controller.chat", # 1 "gns3server.api.routes.controller.dependencies.authentication", # 11 - "gns3server.api.routes.controller.dependencies.database", # 2 "gns3server.api.routes.controller.drawings", # 1 "gns3server.api.routes.controller.groups", # 6 "gns3server.api.routes.controller.images", # 9 From 0872576b46738fb1224d4dafa3e9505553aa279d Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:17:02 +0000 Subject: [PATCH 070/390] fix(typing): resolve mypy errors in api.routes.controller.acl --- gns3server/api/routes/controller/acl.py | 13 +++++++------ pyproject.toml | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gns3server/api/routes/controller/acl.py b/gns3server/api/routes/controller/acl.py index beb7bea07..ccc6b7a1d 100644 --- a/gns3server/api/routes/controller/acl.py +++ b/gns3server/api/routes/controller/acl.py @@ -25,13 +25,14 @@ from fastapi import APIRouter, Depends, Request, status from fastapi.routing import APIRoute, _IncludedRouter from starlette.routing import BaseRoute, Mount from uuid import UUID -from typing import Iterator, List, Sequence +from typing import Iterator, List, Optional, Sequence from gns3server import schemas from gns3server.controller.controller_error import ControllerBadRequestError, ControllerNotFoundError from gns3server.controller import Controller +import gns3server.db.models as models from gns3server.db.repositories.users import UsersRepository from gns3server.db.repositories.rbac import RbacRepository from gns3server.db.repositories.images import ImagesRepository @@ -96,7 +97,7 @@ async def endpoints( endpoints = [{"endpoint": "/", "name": "All endpoints", "endpoint_type": "root"}] def add_to_endpoints(endpoint: str, name: str, endpoint_type: str) -> None: - if endpoint not in endpoints: + if not any(e["endpoint"] == endpoint for e in endpoints): endpoints.append({"endpoint": endpoint, "name": name, "endpoint_type": endpoint_type}) # projects @@ -175,7 +176,7 @@ async def endpoints( @router.get("", response_model=List[schemas.ACE], dependencies=[Depends(has_privilege("ACE.Audit"))]) -async def get_aces(rbac_repo: RbacRepository = Depends(get_repository(RbacRepository))) -> List[schemas.ACE]: +async def get_aces(rbac_repo: RbacRepository = Depends(get_repository(RbacRepository))) -> List[models.ACE]: """ Get all ACL entries. @@ -193,7 +194,7 @@ async def get_aces(rbac_repo: RbacRepository = Depends(get_repository(RbacReposi ) async def create_ace( request: Request, ace_create: schemas.ACECreate, rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)) -) -> schemas.ACE: +) -> models.ACE: """ Create a new ACL entry. @@ -224,7 +225,7 @@ async def create_ace( async def get_ace( ace_id: UUID, rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)), -) -> schemas.ACE: +) -> models.ACE: """ Get an ACL entry. @@ -240,7 +241,7 @@ async def get_ace( @router.put("/{ace_id}", response_model=schemas.ACE, dependencies=[Depends(has_privilege("ACE.Modify"))]) async def update_ace( ace_id: UUID, ace_update: schemas.ACEUpdate, rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)) -) -> schemas.ACE: +) -> Optional[models.ACE]: """ Update an ACL entry. diff --git a/pyproject.toml b/pyproject.toml index 1341dc2e1..4a80c0871 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -334,7 +334,6 @@ module = [ "gns3server.api.routes.compute.notifications", # 4 "gns3server.api.routes.compute.projects", # 7 "gns3server.api.routes.compute.virtualbox_nodes", # 20 - "gns3server.api.routes.controller.acl", # 5 "gns3server.api.routes.controller.api_keys", # 1 "gns3server.api.routes.controller.chat", # 1 "gns3server.api.routes.controller.computes", # 6 From 93419fc33a0ceab75f5288b7fa126c04766fd713 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:26:18 +0000 Subject: [PATCH 071/390] fix(typing): resolve mypy errors in api.routes.controller.nodes --- gns3server/api/routes/controller/nodes.py | 47 +++++++++-------------- pyproject.toml | 1 - 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/gns3server/api/routes/controller/nodes.py b/gns3server/api/routes/controller/nodes.py index 0938ab087..8cd7c0ade 100644 --- a/gns3server/api/routes/controller/nodes.py +++ b/gns3server/api/routes/controller/nodes.py @@ -27,7 +27,7 @@ from fastapi import APIRouter, Depends, WebSocket, WebSocketDisconnect, Request, from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse from fastapi.routing import APIRoute -from typing import List, Callable, Optional +from typing import Any, List, Callable, Optional from uuid import UUID from gns3server.controller import Controller @@ -47,7 +47,7 @@ import logging log = logging.getLogger(__name__) -node_locks = {} +node_locks: dict[str, dict[str, Any]] = {} class NodeConcurrency(APIRoute): @@ -84,7 +84,9 @@ class NodeConcurrency(APIRoute): return custom_route_handler -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or node"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or node"} +} router = APIRouter(route_class=NodeConcurrency, responses=responses) @@ -127,7 +129,7 @@ def _check_node_type(node: Node, *required_types: str) -> None: }, dependencies=[Depends(has_privilege("Node.Allocate"))], ) -async def create_node(node_data: schemas.NodeCreate, project: Project = Depends(dep_project)) -> schemas.Node: +async def create_node(node_create: schemas.NodeCreate, project: Project = Depends(dep_project)) -> schemas.Node: """ Create a new node. @@ -135,8 +137,8 @@ async def create_node(node_data: schemas.NodeCreate, project: Project = Depends( """ controller = Controller.instance() - compute = controller.get_compute(str(node_data.compute_id)) - node_data = jsonable_encoder(node_data, exclude_unset=True) + compute = controller.get_compute(str(node_create.compute_id)) + node_data = jsonable_encoder(node_create, exclude_unset=True) node = await project.add_node(compute, node_data.pop("name"), node_data.pop("node_id", None), **node_data) return node.asdict() @@ -274,14 +276,14 @@ async def get_node(node: Node = Depends(dep_node)) -> schemas.Node: response_model_exclude_unset=True, dependencies=[Depends(has_privilege("Node.Modify"))], ) -async def update_node(node_data: schemas.NodeUpdate, node: Node = Depends(dep_node)) -> schemas.Node: +async def update_node(node_update: schemas.NodeUpdate, node: Node = Depends(dep_node)) -> schemas.Node: """ Update a node. Required privilege: Node.Modify """ - node_data = jsonable_encoder(node_data, exclude_unset=True) + node_data = jsonable_encoder(node_update, exclude_unset=True) # Ignore these because we only use them when creating a node node_data.pop("node_id", None) @@ -654,9 +656,8 @@ async def ws_console( return compute = node.compute - log.info( - f"New client {websocket.client.host}:{websocket.client.port} has connected to controller console WebSocket" - ) + client = f"{websocket.client.host}:{websocket.client.port}" if websocket.client else "unknown" + log.info(f"New client {client} has connected to controller console WebSocket") compute_host = compute.host try: @@ -690,9 +691,7 @@ async def ws_console( await ws_console_compute.send_bytes(msg["bytes"]) except WebSocketDisconnect: pass - log.info( - f"Client {websocket.client.host}:{websocket.client.port} has disconnected from controller console WebSocket" - ) + log.info(f"Client {client} has disconnected from controller console WebSocket") async def ws_send(ws_console_compute): """ @@ -709,10 +708,7 @@ async def ws_console( break except WebSocketDisconnect: # the client disconnected while the compute was still streaming console output - log.info( - f"Client {websocket.client.host}:{websocket.client.port} has disconnected from controller" - f" console WebSocket" - ) + log.info(f"Client {client} has disconnected from controller console WebSocket") try: # forward WebSocket data in both directions between the client and the compute console WebSocket @@ -763,9 +759,8 @@ async def vnc_console( return compute = node.compute - log.info( - f"New client {websocket.client.host}:{websocket.client.port} has connected to controller VNC console WebSocket" - ) + client = f"{websocket.client.host}:{websocket.client.port}" if websocket.client else "unknown" + log.info(f"New client {client} has connected to controller VNC console WebSocket") compute_host = compute.host try: @@ -796,10 +791,7 @@ async def vnc_console( await vnc_console_compute.send_bytes(data) except WebSocketDisconnect: pass - log.info( - f"Client {websocket.client.host}:{websocket.client.port} has disconnected from controller" - f" VNC console WebSocket" - ) + log.info(f"Client {client} has disconnected from controller VNC console WebSocket") async def vnc_send(vnc_console_compute): """ @@ -814,10 +806,7 @@ async def vnc_console( break except WebSocketDisconnect: # the client disconnected while the compute was still streaming VNC console output - log.info( - f"Client {websocket.client.host}:{websocket.client.port} has disconnected from controller" - f" VNC console WebSocket" - ) + log.info(f"Client {client} has disconnected from controller VNC console WebSocket") try: # forward WebSocket data in both directions between the client and the compute VNC console WebSocket diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..6040d3cfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -347,7 +347,6 @@ module = [ "gns3server.api.routes.controller.groups", # 6 "gns3server.api.routes.controller.images", # 9 "gns3server.api.routes.controller.llm_model_configs", # 32 - "gns3server.api.routes.controller.nodes", # 13 "gns3server.api.routes.controller.pools", # 8 "gns3server.api.routes.controller.privileges", # 1 "gns3server.api.routes.controller.projects", # 16 From 2cf90dfce64dfb0306bcdfbc9f291225b90d7da4 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:58:39 +0000 Subject: [PATCH 072/390] fix(typing): resolve mypy errors in api.routes.controller.privileges --- gns3server/api/routes/controller/privileges.py | 3 ++- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/api/routes/controller/privileges.py b/gns3server/api/routes/controller/privileges.py index a070a6ee6..1f34ec1ff 100644 --- a/gns3server/api/routes/controller/privileges.py +++ b/gns3server/api/routes/controller/privileges.py @@ -16,6 +16,7 @@ API route for privileges """ from typing import List +import gns3server.db.models as models from gns3server.db.repositories.rbac import RbacRepository from .dependencies.database import get_repository from fastapi import APIRouter, Depends @@ -33,7 +34,7 @@ router = APIRouter() ) async def get_privileges( rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)), -) -> List[schemas.Privilege]: +) -> List[models.Privilege]: """ Get all privileges. diff --git a/pyproject.toml b/pyproject.toml index 6040d3cfd..8d12aad82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -348,7 +348,6 @@ module = [ "gns3server.api.routes.controller.images", # 9 "gns3server.api.routes.controller.llm_model_configs", # 32 "gns3server.api.routes.controller.pools", # 8 - "gns3server.api.routes.controller.privileges", # 1 "gns3server.api.routes.controller.projects", # 16 "gns3server.api.routes.controller.roles", # 5 "gns3server.api.routes.controller.snapshots", # 1 From c340b18ba2467b80df4cdf3544cf513afa39262d Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:16:38 +0000 Subject: [PATCH 073/390] fix(typing): resolve mypy errors in api.routes.controller.roles --- gns3server/api/routes/controller/roles.py | 13 +++++++------ pyproject.toml | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gns3server/api/routes/controller/roles.py b/gns3server/api/routes/controller/roles.py index aab6e5a00..3f6e854a1 100644 --- a/gns3server/api/routes/controller/roles.py +++ b/gns3server/api/routes/controller/roles.py @@ -21,7 +21,7 @@ API routes for roles. from fastapi import APIRouter, Depends, status from uuid import UUID -from typing import List +from typing import List, Optional from gns3server import schemas from gns3server.controller.controller_error import ( @@ -31,6 +31,7 @@ from gns3server.controller.controller_error import ( ControllerForbiddenError, ) +import gns3server.db.models as models from gns3server.db.repositories.rbac import RbacRepository from .dependencies.database import get_repository from .dependencies.rbac import has_privilege @@ -43,7 +44,7 @@ router = APIRouter() @router.get("", response_model=List[schemas.Role], dependencies=[Depends(has_privilege("Role.Audit"))]) -async def get_roles(rbac_repo: RbacRepository = Depends(get_repository(RbacRepository))) -> List[schemas.Role]: +async def get_roles(rbac_repo: RbacRepository = Depends(get_repository(RbacRepository))) -> List[models.Role]: """ Get all roles. @@ -61,7 +62,7 @@ async def get_roles(rbac_repo: RbacRepository = Depends(get_repository(RbacRepos ) async def create_role( role_create: schemas.RoleCreate, rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)) -) -> schemas.Role: +) -> Optional[models.Role]: """ Create a new role. @@ -78,7 +79,7 @@ async def create_role( async def get_role( role_id: UUID, rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)), -) -> schemas.Role: +) -> models.Role: """ Get a role. @@ -94,7 +95,7 @@ async def get_role( @router.put("/{role_id}", response_model=schemas.Role, dependencies=[Depends(has_privilege("Role.Modify"))]) async def update_role( role_id: UUID, role_update: schemas.RoleUpdate, rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)) -) -> schemas.Role: +) -> Optional[models.Role]: """ Update a role. @@ -142,7 +143,7 @@ async def delete_role( ) async def get_role_privileges( role_id: UUID, rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)) -) -> List[schemas.Privilege]: +) -> List[models.Privilege]: """ Get all role privileges. diff --git a/pyproject.toml b/pyproject.toml index 8d12aad82..8eb27c2a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -349,7 +349,6 @@ module = [ "gns3server.api.routes.controller.llm_model_configs", # 32 "gns3server.api.routes.controller.pools", # 8 "gns3server.api.routes.controller.projects", # 16 - "gns3server.api.routes.controller.roles", # 5 "gns3server.api.routes.controller.snapshots", # 1 "gns3server.api.routes.controller.templates", # 10 "gns3server.api.routes.controller.users", # 14 From 68d96193eca97fe81f92646d6f89411441e4e1e2 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:22:44 +0000 Subject: [PATCH 074/390] fix(typing): resolve mypy errors in api.routes.controller.groups --- gns3server/api/routes/controller/groups.py | 13 +++++++------ gns3server/schemas/controller/users.py | 2 +- pyproject.toml | 1 - 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gns3server/api/routes/controller/groups.py b/gns3server/api/routes/controller/groups.py index 606835419..1b5de02d2 100644 --- a/gns3server/api/routes/controller/groups.py +++ b/gns3server/api/routes/controller/groups.py @@ -21,7 +21,7 @@ API routes for user groups. from fastapi import APIRouter, Depends, status from uuid import UUID -from typing import List +from typing import List, Optional from gns3server import schemas from gns3server.controller.controller_error import ( @@ -31,6 +31,7 @@ from gns3server.controller.controller_error import ( ControllerForbiddenError, ) +import gns3server.db.models as models from gns3server.db.repositories.users import UsersRepository from gns3server.db.repositories.rbac import RbacRepository @@ -47,7 +48,7 @@ router = APIRouter() @router.get("", response_model=List[schemas.UserGroup], dependencies=[Depends(has_privilege("Group.Audit"))]) async def get_user_groups( users_repo: UsersRepository = Depends(get_repository(UsersRepository)), -) -> List[schemas.UserGroup]: +) -> List[models.UserGroup]: """ Get all user groups. @@ -65,7 +66,7 @@ async def get_user_groups( ) async def create_user_group( user_group_create: schemas.UserGroupCreate, users_repo: UsersRepository = Depends(get_repository(UsersRepository)) -) -> schemas.UserGroup: +) -> models.UserGroup: """ Create a new user group. @@ -82,7 +83,7 @@ async def create_user_group( async def get_user_group( user_group_id: UUID, users_repo: UsersRepository = Depends(get_repository(UsersRepository)), -) -> schemas.UserGroup: +) -> models.UserGroup: """ Get a user group. @@ -100,7 +101,7 @@ async def update_user_group( user_group_id: UUID, user_group_update: schemas.UserGroupUpdate, users_repo: UsersRepository = Depends(get_repository(UsersRepository)), -) -> schemas.UserGroup: +) -> Optional[models.UserGroup]: """ Update a user group. @@ -148,7 +149,7 @@ async def delete_user_group( ) async def get_user_group_members( user_group_id: UUID, users_repo: UsersRepository = Depends(get_repository(UsersRepository)) -) -> List[schemas.User]: +) -> List[models.User]: """ Get all user group members. diff --git a/gns3server/schemas/controller/users.py b/gns3server/schemas/controller/users.py index 4fed51d49..8d8b90c13 100644 --- a/gns3server/schemas/controller/users.py +++ b/gns3server/schemas/controller/users.py @@ -80,7 +80,7 @@ class UserGroupCreate(UserGroupBase): Properties to create a user group. """ - name: Optional[str] = Field(..., min_length=3, pattern="[a-zA-Z0-9_-]+$") + name: str = Field(..., min_length=3, pattern="[a-zA-Z0-9_-]+$") class UserGroupUpdate(UserGroupBase): diff --git a/pyproject.toml b/pyproject.toml index cc334a895..5fbc2e327 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -341,7 +341,6 @@ module = [ "gns3server.api.routes.controller.chat", # 1 "gns3server.api.routes.controller.dependencies.authentication", # 11 "gns3server.api.routes.controller.drawings", # 1 - "gns3server.api.routes.controller.groups", # 6 "gns3server.api.routes.controller.images", # 9 "gns3server.api.routes.controller.llm_model_configs", # 32 "gns3server.api.routes.controller.nodes", # 13 From ebe6dee916c1605e48e2b1ec7d700708ea11383a Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:57:39 +0000 Subject: [PATCH 075/390] fix(typing): resolve mypy errors in api.routes.controller.snapshots --- gns3server/api/routes/controller/snapshots.py | 6 ++++-- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gns3server/api/routes/controller/snapshots.py b/gns3server/api/routes/controller/snapshots.py index f85b5d9ef..4ec8c467c 100644 --- a/gns3server/api/routes/controller/snapshots.py +++ b/gns3server/api/routes/controller/snapshots.py @@ -24,7 +24,7 @@ import logging log = logging.getLogger() from fastapi import APIRouter, Depends, status -from typing import List +from typing import Any, List from uuid import UUID from gns3server.controller.project import Project @@ -35,7 +35,9 @@ from gns3server.controller import Controller from .dependencies.database import get_repository from .dependencies.rbac import has_privilege -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project or snapshot"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project or snapshot"} +} router = APIRouter(responses=responses) diff --git a/pyproject.toml b/pyproject.toml index 8eb27c2a8..8026bab8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -349,7 +349,6 @@ module = [ "gns3server.api.routes.controller.llm_model_configs", # 32 "gns3server.api.routes.controller.pools", # 8 "gns3server.api.routes.controller.projects", # 16 - "gns3server.api.routes.controller.snapshots", # 1 "gns3server.api.routes.controller.templates", # 10 "gns3server.api.routes.controller.users", # 14 "gns3server.api.server", # 2 From 908a1eb3e698b152f4112849183a9ded8d18b441 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:47:23 +0000 Subject: [PATCH 076/390] fix(typing): resolve mypy errors in schemas.compute.cloud_nodes --- gns3server/schemas/compute/cloud_nodes.py | 7 ++++--- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gns3server/schemas/compute/cloud_nodes.py b/gns3server/schemas/compute/cloud_nodes.py index 4cda4ce23..8fee188a1 100644 --- a/gns3server/schemas/compute/cloud_nodes.py +++ b/gns3server/schemas/compute/cloud_nodes.py @@ -126,7 +126,7 @@ class CloudBase(BaseModel): Common cloud node properties. """ - name: str + name: Optional[str] = None node_id: Optional[UUID] = None usage: Optional[str] = None remote_console_host: Optional[str] = Field(None, description="Remote console host or IP") @@ -144,7 +144,7 @@ class CloudCreate(CloudBase): Properties to create a cloud node. """ - pass + name: str class CloudUpdate(CloudBase): @@ -152,10 +152,11 @@ class CloudUpdate(CloudBase): Properties to update a cloud node. """ - name: Optional[str] = None + pass class Cloud(CloudBase): + name: str project_id: UUID node_id: UUID ports_mapping: List[Union[EthernetPort, TAPPort, UDPPort]] diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..f6d5a8e23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -375,7 +375,6 @@ module = [ "gns3server.db.repositories.users", # 12 "gns3server.db.tasks", # 12 "gns3server.schemas.compute.atm_switch_nodes", # 5 - "gns3server.schemas.compute.cloud_nodes", # 1 "gns3server.schemas.compute.docker_nodes", # 2 "gns3server.schemas.compute.dynamips_nodes", # 1 "gns3server.schemas.compute.frame_relay_switch_nodes", # 5 From 2b704025e327ed58ceabbc0d976d1a5882c6cc13 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:54:35 +0000 Subject: [PATCH 077/390] fix(typing): resolve mypy errors in schemas.compute.docker_nodes --- gns3server/schemas/compute/docker_nodes.py | 11 +++++++---- pyproject.toml | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gns3server/schemas/compute/docker_nodes.py b/gns3server/schemas/compute/docker_nodes.py index 4359df723..1745b6d2e 100644 --- a/gns3server/schemas/compute/docker_nodes.py +++ b/gns3server/schemas/compute/docker_nodes.py @@ -41,8 +41,8 @@ class DockerBase(BaseModel): # the canonical "no path" value is "/" (the creation default) return value or "/" - name: str - image: str = Field(..., description="Docker image name") + name: Optional[str] = None + image: Optional[str] = Field(None, description="Docker image name") node_id: Optional[UUID] = None console: Optional[int] = Field(None, gt=0, le=65535, description="Console TCP port") console_type: Optional[ConsoleType] = Field(None, description="Console type") @@ -76,6 +76,8 @@ class DockerCreate(DockerBase): Properties to create a Docker node. """ + name: str + image: str = Field(..., description="Docker image name") application_id: Optional[int] = Field( None, ge=1, le=1022, description="IOL application ID for iol-runner images (allocated by the controller)" ) @@ -93,11 +95,12 @@ class DockerUpdate(DockerBase): Properties to update a Docker node. """ - name: Optional[str] = None - image: Optional[str] = Field(None, description="Docker image name") + pass class Docker(DockerBase): + name: str + image: str = Field(..., description="Docker image name") container_id: str = Field( ..., min_length=12, max_length=64, pattern="^[a-f0-9]+$", description="Docker container ID (read only)" ) diff --git a/pyproject.toml b/pyproject.toml index f6d5a8e23..e608c2e55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -375,7 +375,6 @@ module = [ "gns3server.db.repositories.users", # 12 "gns3server.db.tasks", # 12 "gns3server.schemas.compute.atm_switch_nodes", # 5 - "gns3server.schemas.compute.docker_nodes", # 2 "gns3server.schemas.compute.dynamips_nodes", # 1 "gns3server.schemas.compute.frame_relay_switch_nodes", # 5 "gns3server.schemas.compute.iou_nodes", # 3 From abb564a2fa4213611cf5e4c5f8d5d7832f4e06a6 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:15:18 +0000 Subject: [PATCH 078/390] fix(typing): resolve mypy errors in schemas.compute.frame_relay_switch_nodes --- gns3server/schemas/compute/frame_relay_switch_nodes.py | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/schemas/compute/frame_relay_switch_nodes.py b/gns3server/schemas/compute/frame_relay_switch_nodes.py index 67db0bf3e..fbb86b553 100644 --- a/gns3server/schemas/compute/frame_relay_switch_nodes.py +++ b/gns3server/schemas/compute/frame_relay_switch_nodes.py @@ -26,8 +26,8 @@ class FrameRelaySwitchBase(BaseModel): Common Frame Relay switch properties. """ - name: str = None - node_id: UUID = None + name: Optional[str] = None + node_id: Optional[UUID] = None usage: Optional[str] = None mappings: Optional[dict] = None diff --git a/pyproject.toml b/pyproject.toml index e608c2e55..2d68270a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -376,7 +376,6 @@ module = [ "gns3server.db.tasks", # 12 "gns3server.schemas.compute.atm_switch_nodes", # 5 "gns3server.schemas.compute.dynamips_nodes", # 1 - "gns3server.schemas.compute.frame_relay_switch_nodes", # 5 "gns3server.schemas.compute.iou_nodes", # 3 "gns3server.schemas.compute.nat_nodes", # 1 "gns3server.schemas.compute.qemu_nodes", # 1 From aa7941411f7a06748936b0fef8569cd869de4bcb Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:08:23 +0000 Subject: [PATCH 079/390] fix(typing): resolve mypy errors in schemas.compute.iou_nodes --- gns3server/schemas/compute/iou_nodes.py | 17 ++++++++++------- pyproject.toml | 1 - 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gns3server/schemas/compute/iou_nodes.py b/gns3server/schemas/compute/iou_nodes.py index f4dd42ce5..e51fa1a28 100644 --- a/gns3server/schemas/compute/iou_nodes.py +++ b/gns3server/schemas/compute/iou_nodes.py @@ -26,9 +26,9 @@ class IOUBase(BaseModel): Common IOU node properties. """ - name: str - path: str = Field(..., description="IOU executable path") - application_id: int = Field(..., description="Application ID for running IOU executable") + name: Optional[str] = None + path: Optional[str] = Field(None, description="IOU executable path") + application_id: Optional[int] = Field(None, description="Application ID for running IOU executable") node_id: Optional[UUID] = None usage: Optional[str] = Field(None, description="How to use the node") console: Optional[int] = Field(None, gt=0, le=65535, description="Console TCP port") @@ -52,7 +52,9 @@ class IOUCreate(IOUBase): Properties to create an IOU node. """ - pass + name: str + path: str = Field(..., description="IOU executable path") + application_id: int = Field(..., description="Application ID for running IOU executable") class IOUUpdate(IOUBase): @@ -60,12 +62,13 @@ class IOUUpdate(IOUBase): Properties to update an IOU node. """ - name: Optional[str] = None - path: Optional[str] = Field(None, description="IOU executable path") - application_id: Optional[int] = Field(None, description="Application ID for running IOU executable") + pass class IOU(IOUBase): + name: str + path: str = Field(..., description="IOU executable path") + application_id: int = Field(..., description="Application ID for running IOU executable") project_id: UUID = Field(..., description="Project ID") node_directory: str = Field(..., description="Path to the node working directory (read only)") command_line: str = Field(..., description="Last command line used to start IOU (read only)") diff --git a/pyproject.toml b/pyproject.toml index 2d68270a4..4c502006b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -376,7 +376,6 @@ module = [ "gns3server.db.tasks", # 12 "gns3server.schemas.compute.atm_switch_nodes", # 5 "gns3server.schemas.compute.dynamips_nodes", # 1 - "gns3server.schemas.compute.iou_nodes", # 3 "gns3server.schemas.compute.nat_nodes", # 1 "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 From 898205a33bf0d87c3df4c117111fdcbaf0bf40f5 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:08:30 +0000 Subject: [PATCH 080/390] fix(typing): resolve mypy errors in schemas.compute.vmware_nodes --- gns3server/schemas/compute/vmware_nodes.py | 17 ++++++++++------- pyproject.toml | 1 - 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gns3server/schemas/compute/vmware_nodes.py b/gns3server/schemas/compute/vmware_nodes.py index ee670a2bc..f838419a3 100644 --- a/gns3server/schemas/compute/vmware_nodes.py +++ b/gns3server/schemas/compute/vmware_nodes.py @@ -62,9 +62,9 @@ class VMwareBase(BaseModel): Common VMware node properties. """ - name: str - vmx_path: str = Field(..., description="Path to the vmx file") - linked_clone: bool = Field(..., description="Whether the VM is a linked clone or not") + name: Optional[str] = None + vmx_path: Optional[str] = None + linked_clone: Optional[bool] = None node_id: Optional[UUID] = None usage: Optional[str] = Field(None, description="How to use the node") console: Optional[int] = Field(None, gt=0, le=65535, description="Console TCP port") @@ -83,7 +83,9 @@ class VMwareCreate(VMwareBase): Properties to create a VMware node. """ - pass + name: str + vmx_path: str = Field(..., description="Path to the vmx file") + linked_clone: bool = Field(..., description="Whether the VM is a linked clone or not") class VMwareUpdate(VMwareBase): @@ -91,12 +93,13 @@ class VMwareUpdate(VMwareBase): Properties to update a VMware node. """ - name: Optional[str] = None - vmx_path: Optional[str] = None - linked_clone: Optional[bool] = None + pass class VMware(VMwareBase): + name: str + vmx_path: str = Field(..., description="Path to the vmx file") + linked_clone: bool = Field(..., description="Whether the VM is a linked clone or not") project_id: UUID = Field(..., description="Project ID") node_directory: Optional[str] = Field(None, description="Path to the node working directory (read only)") status: NodeStatus = Field(..., description="Container status (read only)") diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..bbcbfa968 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -383,7 +383,6 @@ module = [ "gns3server.schemas.compute.nat_nodes", # 1 "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 - "gns3server.schemas.compute.vmware_nodes", # 3 "gns3server.schemas.compute.vpcs_nodes", # 1 "gns3server.schemas.controller.appliances", # 1 "gns3server.schemas.controller.computes", # 6 From 87f209f5485369d04fde428dcdf23aba1b47d7e6 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:47:34 +0000 Subject: [PATCH 081/390] fix(typing): resolve mypy errors in schemas.compute.qemu_nodes --- gns3server/schemas/compute/qemu_nodes.py | 6 ++++-- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gns3server/schemas/compute/qemu_nodes.py b/gns3server/schemas/compute/qemu_nodes.py index 4596677c8..275ac92bb 100644 --- a/gns3server/schemas/compute/qemu_nodes.py +++ b/gns3server/schemas/compute/qemu_nodes.py @@ -155,7 +155,7 @@ class QemuBase(BaseModel): Common Qemu node properties. """ - name: str + name: Optional[str] = None node_id: Optional[UUID] = None usage: Optional[str] = Field(None, description="How to use the node") linked_clone: Optional[bool] = Field(None, description="Whether the VM is a linked clone or not") @@ -219,6 +219,7 @@ class QemuCreate(QemuBase): Properties to create a Qemu node. """ + name: str disk_images_to_reset: Optional[List[str]] = Field( None, description="Disk image properties whose stale linked-clone overlays must be recreated", @@ -230,10 +231,11 @@ class QemuUpdate(QemuBase): Properties to update a Qemu node. """ - name: Optional[str] = None + pass class Qemu(QemuBase): + name: str project_id: UUID = Field(..., description="Project ID") node_directory: str = Field(..., description="Path to the node working directory (read only)") command_line: str = Field(..., description="Last command line used to start IOU (read only)") diff --git a/pyproject.toml b/pyproject.toml index 4c502006b..86353ab97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -377,7 +377,6 @@ module = [ "gns3server.schemas.compute.atm_switch_nodes", # 5 "gns3server.schemas.compute.dynamips_nodes", # 1 "gns3server.schemas.compute.nat_nodes", # 1 - "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 "gns3server.schemas.compute.vmware_nodes", # 3 "gns3server.schemas.compute.vpcs_nodes", # 1 From d027146fb95e37ada84130e47f1b569cbf6b67e1 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:46:34 +0000 Subject: [PATCH 082/390] fix(typing): resolve mypy errors in schemas.compute.vpcs_nodes --- gns3server/schemas/compute/vpcs_nodes.py | 7 ++++--- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gns3server/schemas/compute/vpcs_nodes.py b/gns3server/schemas/compute/vpcs_nodes.py index 30cd40960..fda0634c4 100644 --- a/gns3server/schemas/compute/vpcs_nodes.py +++ b/gns3server/schemas/compute/vpcs_nodes.py @@ -37,7 +37,7 @@ class VPCSBase(BaseModel): Common VPCS node properties. """ - name: str + name: Optional[str] = None node_id: Optional[UUID] = None usage: Optional[str] = Field(None, description="How to use the node") console: Optional[int] = Field(None, gt=0, le=65535, description="Console TCP port") @@ -50,7 +50,7 @@ class VPCSCreate(VPCSBase): Properties to create a VPCS node. """ - pass + name: str class VPCSUpdate(VPCSBase): @@ -58,10 +58,11 @@ class VPCSUpdate(VPCSBase): Properties to update a VPCS node. """ - name: Optional[str] = None + pass class VPCS(VPCSBase): + name: str project_id: UUID = Field(..., description="Project ID") node_directory: str = Field(..., description="Path to the node working directory (read only)") status: NodeStatus = Field(..., description="Container status (read only)") diff --git a/pyproject.toml b/pyproject.toml index bbcbfa968..7ed8113e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -383,7 +383,6 @@ module = [ "gns3server.schemas.compute.nat_nodes", # 1 "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 - "gns3server.schemas.compute.vpcs_nodes", # 1 "gns3server.schemas.controller.appliances", # 1 "gns3server.schemas.controller.computes", # 6 "gns3server.schemas.controller.nodes", # 3 From 515ae8dcfbf5f7800015ba321d2abce760116c77 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:54:42 +0000 Subject: [PATCH 083/390] fix(typing): resolve mypy errors in schemas.compute.virtualbox_nodes --- gns3server/schemas/compute/virtualbox_nodes.py | 12 +++++++----- pyproject.toml | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gns3server/schemas/compute/virtualbox_nodes.py b/gns3server/schemas/compute/virtualbox_nodes.py index 06ad9f831..d05692ebc 100644 --- a/gns3server/schemas/compute/virtualbox_nodes.py +++ b/gns3server/schemas/compute/virtualbox_nodes.py @@ -56,8 +56,8 @@ class VirtualBoxBase(BaseModel): Common VirtualBox node properties. """ - name: str - vmname: str = Field(..., description="VirtualBox VM name (in VirtualBox itself)") + name: Optional[str] = None + vmname: Optional[str] = None node_id: Optional[UUID] = None linked_clone: Optional[bool] = Field(None, description="Whether the VM is a linked clone or not") usage: Optional[str] = Field(None, description="How to use the node") @@ -78,7 +78,8 @@ class VirtualBoxCreate(VirtualBoxBase): Properties to create a VirtualBox node. """ - pass + name: str + vmname: str = Field(..., description="VirtualBox VM name (in VirtualBox itself)") class VirtualBoxUpdate(VirtualBoxBase): @@ -86,11 +87,12 @@ class VirtualBoxUpdate(VirtualBoxBase): Properties to update a VirtualBox node. """ - name: Optional[str] = None - vmname: Optional[str] = None + pass class VirtualBox(VirtualBoxBase): + name: str + vmname: str = Field(..., description="VirtualBox VM name (in VirtualBox itself)") project_id: UUID = Field(..., description="Project ID") node_directory: Optional[str] = Field(None, description="Path to the node working directory (read only)") status: NodeStatus = Field(..., description="Container status (read only)") diff --git a/pyproject.toml b/pyproject.toml index 86353ab97..7e068d69e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -377,7 +377,6 @@ module = [ "gns3server.schemas.compute.atm_switch_nodes", # 5 "gns3server.schemas.compute.dynamips_nodes", # 1 "gns3server.schemas.compute.nat_nodes", # 1 - "gns3server.schemas.compute.virtualbox_nodes", # 2 "gns3server.schemas.compute.vmware_nodes", # 3 "gns3server.schemas.compute.vpcs_nodes", # 1 "gns3server.schemas.controller.appliances", # 1 From 7439e91f5ac9cb8f1940385260fbae77603d5fcf Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:53:44 +0000 Subject: [PATCH 084/390] fix(typing): resolve mypy errors in schemas.controller.appliances --- gns3server/schemas/controller/appliances.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/schemas/controller/appliances.py b/gns3server/schemas/controller/appliances.py index a4aecaa94..3660067b8 100644 --- a/gns3server/schemas/controller/appliances.py +++ b/gns3server/schemas/controller/appliances.py @@ -782,7 +782,7 @@ Appliance = ApplianceUnion # Create a validator wrapper for convenience from pydantic import TypeAdapter -_appliance_validator = TypeAdapter(ApplianceUnion) +_appliance_validator: TypeAdapter[Union[ApplianceV1_6, ApplianceV8]] = TypeAdapter(ApplianceUnion) class ApplianceModel: diff --git a/pyproject.toml b/pyproject.toml index 7ed8113e2..c4806fbe4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -383,7 +383,6 @@ module = [ "gns3server.schemas.compute.nat_nodes", # 1 "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 - "gns3server.schemas.controller.appliances", # 1 "gns3server.schemas.controller.computes", # 6 "gns3server.schemas.controller.nodes", # 3 "gns3server.schemas.controller.projects", # 2 From a68e57dd2e4a4e70472daac4800cc850305b6677 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:08:39 +0000 Subject: [PATCH 085/390] fix(typing): resolve mypy errors in schemas.controller.nodes --- gns3server/schemas/controller/nodes.py | 16 ++++++++++------ pyproject.toml | 1 - 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gns3server/schemas/controller/nodes.py b/gns3server/schemas/controller/nodes.py index 43d8ca5b4..9faf260d3 100644 --- a/gns3server/schemas/controller/nodes.py +++ b/gns3server/schemas/controller/nodes.py @@ -114,9 +114,9 @@ class NodeBase(BaseModel): Node data. """ - compute_id: Union[UUID, str] - name: str - node_type: NodeType + compute_id: Optional[Union[UUID, str]] = None + name: Optional[str] = None + node_type: Optional[NodeType] = None node_id: Optional[UUID] = None @@ -162,6 +162,9 @@ class NodeBase(BaseModel): class NodeCreate(NodeBase): + compute_id: Union[UUID, str] + name: str + node_type: NodeType node_id: UUID = Field(default_factory=uuid4) @@ -170,12 +173,13 @@ class NodeUpdate(NodeBase): Data to update a node. """ - compute_id: Optional[Union[UUID, str]] = None - name: Optional[str] = None - node_type: Optional[NodeType] = None + pass class Node(NodeBase): + compute_id: Union[UUID, str] + name: str + node_type: NodeType template_id: Optional[UUID] = Field( None, description="Template UUID from which the node has been created. Read only" ) diff --git a/pyproject.toml b/pyproject.toml index c4806fbe4..16afd963b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -384,7 +384,6 @@ module = [ "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 "gns3server.schemas.controller.computes", # 6 - "gns3server.schemas.controller.nodes", # 3 "gns3server.schemas.controller.projects", # 2 "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 From 01dd09495c80b562bd7fc6c5a601a081a7f90aba Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:54:19 +0000 Subject: [PATCH 086/390] fix(typing): resolve mypy errors in schemas.controller.projects --- gns3server/schemas/controller/projects.py | 8 ++++---- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gns3server/schemas/controller/projects.py b/gns3server/schemas/controller/projects.py index ddfbde02e..e1210f99f 100644 --- a/gns3server/schemas/controller/projects.py +++ b/gns3server/schemas/controller/projects.py @@ -45,7 +45,7 @@ class ProjectBase(BaseModel): Common properties for projects. """ - name: str + name: Optional[str] = None project_id: Optional[UUID] = None path: Optional[str] = Field(None, description="Project directory") auto_close: Optional[bool] = Field(None, description="Close project when last client leaves") @@ -69,7 +69,7 @@ class ProjectCreate(ProjectBase): Properties for project creation. """ - pass + name: str class ProjectDuplicate(ProjectBase): @@ -77,6 +77,7 @@ class ProjectDuplicate(ProjectBase): Properties for project duplication. """ + name: str reset_mac_addresses: Optional[bool] = Field(False, description="Reset MAC addresses for this project") @@ -85,12 +86,11 @@ class ProjectUpdate(ProjectBase): Properties for project update. """ - name: Optional[str] = None + pass class Project(ProjectBase): project_id: UUID - name: Optional[str] = None status: Optional[ProjectStatus] = None filename: Optional[str] = None created_by: Optional[str] = Field(None, description="Username of the user who created the project") diff --git a/pyproject.toml b/pyproject.toml index 16afd963b..c79072b7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -384,7 +384,6 @@ module = [ "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 "gns3server.schemas.controller.computes", # 6 - "gns3server.schemas.controller.projects", # 2 "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 "gns3server.schemas.controller.templates.iou_templates", # 1 From 07dc9b4d7d0103c9ee5e0c5f001ae3c5136e09e9 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:09:17 +0000 Subject: [PATCH 087/390] fix(typing): resolve mypy errors in schemas.controller.settings --- gns3server/schemas/controller/settings.py | 9 ++++++--- pyproject.toml | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gns3server/schemas/controller/settings.py b/gns3server/schemas/controller/settings.py index d64d029e1..9925c403c 100644 --- a/gns3server/schemas/controller/settings.py +++ b/gns3server/schemas/controller/settings.py @@ -25,6 +25,7 @@ says, so exposing or writing it via the API would be useless at best and a secret leak at worst. """ +from pathlib import Path from typing import List, Optional from pydantic import ConfigDict, BaseModel, Field @@ -49,9 +50,11 @@ SECRET_MASK = "**********" class ServerSettingsResponse(ServerSettings): # plain strings instead of FilePath/DirectoryPath: paths are validated when # the settings are loaded or updated, not when echoed back to the client - secrets_dir: Optional[str] = Field(None, description="Directory where secrets are stored (e.g. the JWT secret key)") - certfile: Optional[str] = Field(None, description="SSL certificate file, requires enable_ssl") - certkey: Optional[str] = Field(None, description="SSL key file, requires enable_ssl") + secrets_dir: Optional[Path] = Field( + None, description="Directory where secrets are stored (e.g. the JWT secret key)" + ) + certfile: Optional[Path] = Field(None, description="SSL certificate file, requires enable_ssl") + certkey: Optional[Path] = Field(None, description="SSL key file, requires enable_ssl") # Optional overrides: typed as plain "str = None" in the config schema, # which fails re-validation when the value actually is None resources_path: Optional[str] = Field( diff --git a/pyproject.toml b/pyproject.toml index c79072b7c..2506a25e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -384,7 +384,6 @@ module = [ "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 "gns3server.schemas.controller.computes", # 6 - "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 "gns3server.schemas.controller.templates.iou_templates", # 1 "gns3server.schemas.controller.templates.virtualbox_templates", # 1 From 94a0f462bf64891bb446819f60c19405a4180352 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:49:52 +0000 Subject: [PATCH 088/390] fix(typing): resolve mypy errors in schemas.controller.templates.iou_templates --- .../schemas/controller/templates/iou_templates.py | 12 ++++++++---- pyproject.toml | 1 - 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gns3server/schemas/controller/templates/iou_templates.py b/gns3server/schemas/controller/templates/iou_templates.py index 02ab06696..36468d8aa 100644 --- a/gns3server/schemas/controller/templates/iou_templates.py +++ b/gns3server/schemas/controller/templates/iou_templates.py @@ -22,11 +22,11 @@ from pydantic import Field from typing import Optional -class IOUTemplate(TemplateBase): +class IOUTemplateBase(TemplateBase): category: Optional[Category] = Category.router default_name_format: Optional[str] = "IOU{0}" symbol: Optional[str] = "multilayer_switch" - path: str = Field(..., description="Path of IOU executable") + path: Optional[str] = Field(None, description="Path of IOU executable") ethernet_adapters: Optional[int] = Field(2, ge=0, description="Number of ethernet adapters") serial_adapters: Optional[int] = Field(2, ge=0, description="Number of serial adapters") ram: Optional[int] = Field(1024, gt=0, description="Amount of RAM in MB") @@ -44,5 +44,9 @@ class IOUTemplate(TemplateBase): ) -class IOUTemplateUpdate(IOUTemplate): - path: Optional[str] = Field(None, description="Path of IOU executable") +class IOUTemplate(IOUTemplateBase): + path: str = Field(..., description="Path of IOU executable") + + +class IOUTemplateUpdate(IOUTemplateBase): + pass diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..23a3afc29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -391,7 +391,6 @@ module = [ "gns3server.schemas.controller.projects", # 2 "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 - "gns3server.schemas.controller.templates.iou_templates", # 1 "gns3server.schemas.controller.templates.virtualbox_templates", # 1 "gns3server.schemas.controller.templates.vmware_templates", # 1 "gns3server.schemas.qemu_disk_image", # 2 From edaf9a437721f083eabd9daf8865503f530efae2 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:49:54 +0000 Subject: [PATCH 089/390] fix(typing): resolve mypy errors in schemas.controller.templates.virtualbox_templates --- .../controller/templates/virtualbox_templates.py | 12 ++++++++---- pyproject.toml | 1 - 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gns3server/schemas/controller/templates/virtualbox_templates.py b/gns3server/schemas/controller/templates/virtualbox_templates.py index 3cce1cd6e..b9d966ec1 100644 --- a/gns3server/schemas/controller/templates/virtualbox_templates.py +++ b/gns3server/schemas/controller/templates/virtualbox_templates.py @@ -26,11 +26,11 @@ from pydantic import Field from typing import Optional, List -class VirtualBoxTemplate(TemplateBase): +class VirtualBoxTemplateBase(TemplateBase): category: Optional[Category] = Category.guest default_name_format: Optional[str] = "{name}-{0}" symbol: Optional[str] = "vbox_guest" - vmname: str = Field(..., description="VirtualBox VM name (in VirtualBox itself)") + vmname: Optional[str] = Field(None, description="VirtualBox VM name (in VirtualBox itself)") ram: Optional[int] = Field(256, gt=0, description="Amount of RAM in MB") linked_clone: Optional[bool] = Field(False, description="Whether the VM is a linked clone or not") adapters: Optional[int] = Field( @@ -59,5 +59,9 @@ class VirtualBoxTemplate(TemplateBase): custom_adapters: Optional[List[CustomAdapter]] = Field(default_factory=list, description="Custom adapters") -class VirtualBoxTemplateUpdate(VirtualBoxTemplate): - vmname: Optional[str] = Field(None, description="VirtualBox VM name (in VirtualBox itself)") +class VirtualBoxTemplate(VirtualBoxTemplateBase): + vmname: str = Field(..., description="VirtualBox VM name (in VirtualBox itself)") + + +class VirtualBoxTemplateUpdate(VirtualBoxTemplateBase): + pass diff --git a/pyproject.toml b/pyproject.toml index 23a3afc29..f5189aab4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -391,7 +391,6 @@ module = [ "gns3server.schemas.controller.projects", # 2 "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 - "gns3server.schemas.controller.templates.virtualbox_templates", # 1 "gns3server.schemas.controller.templates.vmware_templates", # 1 "gns3server.schemas.qemu_disk_image", # 2 "gns3server.services.computes", # 4 From 3abed4070735711a5927f8efc0a7d4a3f2eaff7e Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:49:50 +0000 Subject: [PATCH 090/390] fix(typing): resolve mypy errors in schemas.controller.templates.docker_templates --- .../schemas/controller/templates/docker_templates.py | 12 ++++++++---- pyproject.toml | 1 - 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gns3server/schemas/controller/templates/docker_templates.py b/gns3server/schemas/controller/templates/docker_templates.py index 1c7a320e3..4123630e8 100644 --- a/gns3server/schemas/controller/templates/docker_templates.py +++ b/gns3server/schemas/controller/templates/docker_templates.py @@ -22,11 +22,11 @@ from pydantic import Field from typing import Optional, List -class DockerTemplate(TemplateBase): +class DockerTemplateBase(TemplateBase): category: Optional[Category] = Category.guest default_name_format: Optional[str] = "{name}-{0}" symbol: Optional[str] = "docker_guest" - image: str = Field(..., description="Docker image name") + image: Optional[str] = Field(None, description="Docker image name") adapters: Optional[int] = Field(1, ge=0, le=100, description="Number of adapters") mac_address: Optional[str] = Field( "", description="Base MAC address", pattern="^([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})$|^$" @@ -58,5 +58,9 @@ class DockerTemplate(TemplateBase): custom_adapters: Optional[List[CustomAdapter]] = Field(default_factory=list, description="Custom adapters") -class DockerTemplateUpdate(DockerTemplate): - image: Optional[str] = Field(None, description="Docker image name") +class DockerTemplate(DockerTemplateBase): + image: str = Field(..., description="Docker image name") + + +class DockerTemplateUpdate(DockerTemplateBase): + pass diff --git a/pyproject.toml b/pyproject.toml index 2506a25e7..c02000879 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -384,7 +384,6 @@ module = [ "gns3server.schemas.compute.qemu_nodes", # 1 "gns3server.schemas.compute.virtualbox_nodes", # 2 "gns3server.schemas.controller.computes", # 6 - "gns3server.schemas.controller.templates.docker_templates", # 1 "gns3server.schemas.controller.templates.iou_templates", # 1 "gns3server.schemas.controller.templates.virtualbox_templates", # 1 "gns3server.schemas.controller.templates.vmware_templates", # 1 From 79862d900a5c536757bbd54f58be25c3a8dc1721 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:49:56 +0000 Subject: [PATCH 091/390] fix(typing): resolve mypy errors in schemas.controller.templates.vmware_templates --- .../schemas/controller/templates/vmware_templates.py | 12 ++++++++---- pyproject.toml | 1 - 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gns3server/schemas/controller/templates/vmware_templates.py b/gns3server/schemas/controller/templates/vmware_templates.py index 4aed1ee90..85d9dce96 100644 --- a/gns3server/schemas/controller/templates/vmware_templates.py +++ b/gns3server/schemas/controller/templates/vmware_templates.py @@ -27,11 +27,11 @@ from pydantic import Field from typing import Optional, List -class VMwareTemplate(TemplateBase): +class VMwareTemplateBase(TemplateBase): category: Optional[Category] = Category.guest default_name_format: Optional[str] = "{name}-{0}" symbol: Optional[str] = "vmware_guest" - vmx_path: str = Field(..., description="Path to the vmx file") + vmx_path: Optional[str] = Field(None, description="Path to the vmx file") linked_clone: Optional[bool] = Field(False, description="Whether the VM is a linked clone or not") first_port_name: Optional[str] = Field("", description="Optional name of the first networking port example: eth0") port_name_format: Optional[str] = Field( @@ -57,5 +57,9 @@ class VMwareTemplate(TemplateBase): custom_adapters: Optional[List[CustomAdapter]] = Field(default_factory=list, description="Custom adapters") -class VMwareTemplateUpdate(VMwareTemplate): - vmx_path: Optional[str] = Field(None, description="Path to the vmx file") +class VMwareTemplate(VMwareTemplateBase): + vmx_path: str = Field(..., description="Path to the vmx file") + + +class VMwareTemplateUpdate(VMwareTemplateBase): + pass diff --git a/pyproject.toml b/pyproject.toml index f5189aab4..984fe66fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -391,7 +391,6 @@ module = [ "gns3server.schemas.controller.projects", # 2 "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 - "gns3server.schemas.controller.templates.vmware_templates", # 1 "gns3server.schemas.qemu_disk_image", # 2 "gns3server.services.computes", # 4 "gns3server.services.templates", # 18 From 9bad1d92f8a829ffed284953bd857cfba595d422 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:54:50 +0000 Subject: [PATCH 092/390] fix(typing): resolve mypy errors in schemas.qemu_disk_image --- gns3server/schemas/qemu_disk_image.py | 9 ++++----- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/gns3server/schemas/qemu_disk_image.py b/gns3server/schemas/qemu_disk_image.py index a3ebccba6..1c0f596ad 100644 --- a/gns3server/schemas/qemu_disk_image.py +++ b/gns3server/schemas/qemu_disk_image.py @@ -78,8 +78,8 @@ class QemuDiskImageAdapterType(str, Enum): class QemuDiskImageBase(BaseModel): - format: QemuDiskImageFormat = Field(..., description="Image format type") - size: int = Field(..., description="Image size in Megabytes") + format: Optional[QemuDiskImageFormat] = Field(None, description="Image format type") + size: Optional[int] = Field(None, description="Image size in Megabytes") preallocation: Optional[QemuDiskImagePreallocation] = None cluster_size: Optional[int] = None refcount_bits: Optional[int] = None @@ -91,10 +91,9 @@ class QemuDiskImageBase(BaseModel): class QemuDiskImageCreate(QemuDiskImageBase): - pass + format: QemuDiskImageFormat = Field(..., description="Image format type") + size: int = Field(..., description="Image size in Megabytes") class QemuDiskImageUpdate(QemuDiskImageBase): - format: Optional[QemuDiskImageFormat] = Field(None, description="Image format type") - size: Optional[int] = Field(None, description="Image size in Megabytes") extend: Optional[int] = Field(None, description="Number of Megabytes to extend the image") diff --git a/pyproject.toml b/pyproject.toml index 984fe66fe..a9780d39c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -391,7 +391,6 @@ module = [ "gns3server.schemas.controller.projects", # 2 "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 - "gns3server.schemas.qemu_disk_image", # 2 "gns3server.services.computes", # 4 "gns3server.services.templates", # 18 "gns3server.utils.asyncio.aiozipstream", # 8 From e6053dd0a8b4c9c377bab0081b4091761c2c8823 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:10:23 +0000 Subject: [PATCH 093/390] fix(typing): resolve mypy errors in services.computes --- gns3server/db/repositories/computes.py | 10 ++++++---- pyproject.toml | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gns3server/db/repositories/computes.py b/gns3server/db/repositories/computes.py index 4f3aac7f4..5747fbf03 100644 --- a/gns3server/db/repositories/computes.py +++ b/gns3server/db/repositories/computes.py @@ -16,7 +16,7 @@ # along with this program. If not, see . from uuid import UUID -from typing import Optional, List +from typing import Optional, List, Union from sqlalchemy import select, update, delete from sqlalchemy.ext.asyncio import AsyncSession @@ -31,7 +31,7 @@ class ComputesRepository(BaseRepository): super().__init__(db_session) - async def get_compute(self, compute_id: UUID) -> Optional[models.Compute]: + async def get_compute(self, compute_id: Union[str, UUID]) -> Optional[models.Compute]: query = select(models.Compute).where(models.Compute.compute_id == compute_id) result = await self._db_session.execute(query) @@ -65,7 +65,9 @@ class ComputesRepository(BaseRepository): await self._db_session.refresh(db_compute) return db_compute - async def update_compute(self, compute_id: UUID, compute_update: schemas.ComputeUpdate) -> Optional[models.Compute]: + async def update_compute( + self, compute_id: Union[str, UUID], compute_update: schemas.ComputeUpdate + ) -> Optional[models.Compute]: update_values = compute_update.model_dump(exclude_unset=True) if compute_update.password is not None: @@ -80,7 +82,7 @@ class ComputesRepository(BaseRepository): await self._db_session.refresh(compute_db) # force refresh of updated_at value return compute_db - async def delete_compute(self, compute_id: UUID) -> bool: + async def delete_compute(self, compute_id: Union[str, UUID]) -> bool: query = delete(models.Compute).where(models.Compute.compute_id == compute_id) result = await self._db_session.execute(query) diff --git a/pyproject.toml b/pyproject.toml index a9780d39c..1179d2526 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -391,7 +391,6 @@ module = [ "gns3server.schemas.controller.projects", # 2 "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 - "gns3server.services.computes", # 4 "gns3server.services.templates", # 18 "gns3server.utils.asyncio.aiozipstream", # 8 "gns3server.utils.encryption", # 2 From 5bf3c8d20303b10544bd51e03345ae65cc5071a0 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:09:43 +0000 Subject: [PATCH 094/390] fix(typing): resolve mypy errors in utils.http_client --- gns3server/utils/http_client.py | 17 ++++++++++++----- pyproject.toml | 1 - 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gns3server/utils/http_client.py b/gns3server/utils/http_client.py index 505073cf5..a6b032a82 100644 --- a/gns3server/utils/http_client.py +++ b/gns3server/utils/http_client.py @@ -16,6 +16,7 @@ # along with this program. If not, see . import aiohttp +from pydantic import SecretStr import socket import logging @@ -28,7 +29,7 @@ class HTTPClient: HTTP client for request to computes and external services. """ - _aiohttp_client: aiohttp.ClientSession = None + _aiohttp_client: aiohttp.ClientSession | None = None @classmethod def get_client(cls, ssl_context=None) -> aiohttp.ClientSession: @@ -44,15 +45,21 @@ class HTTPClient: cls._aiohttp_client = None @classmethod - def request(cls, method: str, url: str, user: str = None, password: str = None, ssl_context=None, **kwargs): + def request( + cls, + method: str, + url: str, + user: str | None = None, + password: SecretStr | None = None, + ssl_context=None, + **kwargs, + ): client = cls.get_client(ssl_context=ssl_context) basic_auth = None if user: - if not password: - password = "" try: - basic_auth = aiohttp.BasicAuth(user, password.get_secret_value(), "utf-8") + basic_auth = aiohttp.BasicAuth(user, password.get_secret_value() if password else "", "utf-8") except ValueError as e: log.error(f"Basic authentication set-up error: {e}") diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..53da2cea5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -399,7 +399,6 @@ module = [ "gns3server.services.templates", # 18 "gns3server.utils.asyncio.aiozipstream", # 8 "gns3server.utils.encryption", # 2 - "gns3server.utils.http_client", # 4 "gns3server.utils.images", # 4 "gns3server.utils.packet_filter_validation", # 16 "gns3server.utils.websocket_to_websocket", # 12 From 1772c7380e6c884de22ffaf79c33363ac65bb6c4 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:16:28 +0000 Subject: [PATCH 095/390] fix(typing): resolve mypy errors in utils.websocket_to_websocket --- gns3server/utils/websocket_to_websocket.py | 47 +++++++++------------- pyproject.toml | 1 - 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/gns3server/utils/websocket_to_websocket.py b/gns3server/utils/websocket_to_websocket.py index 88efdbfd2..12e410ce2 100644 --- a/gns3server/utils/websocket_to_websocket.py +++ b/gns3server/utils/websocket_to_websocket.py @@ -25,7 +25,6 @@ Similar pattern to VNC console implementation in base_node.py: import asyncio import logging -import sys from typing import Optional import aiohttp @@ -39,7 +38,7 @@ log = logging.getLogger(__name__) async def websocket_proxy( client_ws: WebSocket, target_url: str, - requested_protocols: list = None, + requested_protocols: Optional[list] = None, buffer_size: int = 65536, timeout: Optional[float] = None, ) -> None: @@ -59,7 +58,7 @@ async def websocket_proxy( Raises: aiohttp.ClientError: If connection to target fails """ - client_info = f"{client_ws.client.host}:{client_ws.client.port}" + client_info = f"{client_ws.client.host}:{client_ws.client.port}" if client_ws.client else "unknown" async def forward_client_to_target(target_ws): """Client → Target: Forward binary WebSocket data.""" @@ -101,25 +100,20 @@ async def websocket_proxy( subprotocols = requested_protocols or ["binary"] log.info(f"Client requested subprotocols: {subprotocols}") - timeout_config = {} - if timeout: - timeout_config = {"timeout": aiohttp.ClientTimeout(total=timeout)} + session_timeout = aiohttp.ClientTimeout(total=timeout) if timeout else None - async with aiohttp.ClientSession() as session: - async with session.ws_connect(target_url, protocols=subprotocols, **timeout_config) as target_ws: + async with aiohttp.ClientSession(timeout=session_timeout) as session: + async with session.ws_connect(target_url, protocols=subprotocols) as target_ws: negotiated_protocol = target_ws.protocol log.info(f"Target WebSocket negotiated protocol: {negotiated_protocol}") log.info(f"WebSocket proxy established: {client_info} → {target_url}") # Run both forwarding tasks in parallel # Similar pattern to base_node.py VNC implementation - if sys.version_info >= (3, 11, 0): - aws = [ - asyncio.create_task(forward_client_to_target(target_ws)), - asyncio.create_task(forward_target_to_client(target_ws)), - ] - else: - aws = [forward_client_to_target(target_ws), forward_target_to_client(target_ws)] + aws = [ + asyncio.create_task(forward_client_to_target(target_ws)), + asyncio.create_task(forward_target_to_client(target_ws)), + ] try: done, pending = await asyncio.wait(aws, return_when=asyncio.FIRST_COMPLETED) @@ -146,7 +140,7 @@ async def websocket_proxy( async def websocket_proxy_with_manual_accept( client_ws: StarletteWebSocket, target_url: str, - requested_protocols: list = None, + requested_protocols: Optional[list] = None, buffer_size: int = 65536, timeout: Optional[float] = None, ) -> None: @@ -167,7 +161,7 @@ async def websocket_proxy_with_manual_accept( Raises: aiohttp.ClientError: If connection to target fails """ - client_info = f"{client_ws.client.host}:{client_ws.client.port}" if hasattr(client_ws, "client") else "unknown" + client_info = f"{client_ws.client.host}:{client_ws.client.port}" if client_ws.client else "unknown" async def forward_client_to_target(target_ws): """Client → Target: Forward binary WebSocket data.""" @@ -213,13 +207,11 @@ async def websocket_proxy_with_manual_accept( subprotocols = requested_protocols or ["binary"] log.info(f"Client requested subprotocols: {subprotocols}") - timeout_config = {} - if timeout: - timeout_config = {"timeout": aiohttp.ClientTimeout(total=timeout)} + session_timeout = aiohttp.ClientTimeout(total=timeout) if timeout else None - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(timeout=session_timeout) as session: log.info(f"About to ws_connect to {target_url}") - ws_conn = session.ws_connect(target_url, protocols=subprotocols, **timeout_config) + ws_conn = session.ws_connect(target_url, protocols=subprotocols) log.info("ws_connect coroutine created, about to enter") async with ws_conn as target_ws: negotiated_protocol = target_ws.protocol @@ -235,13 +227,10 @@ async def websocket_proxy_with_manual_accept( log.info(f"WebSocket proxy established: {client_info} → {target_url}") # Run both forwarding tasks in parallel - if sys.version_info >= (3, 11, 0): - aws = [ - asyncio.create_task(forward_client_to_target(target_ws)), - asyncio.create_task(forward_target_to_client(target_ws)), - ] - else: - aws = [forward_client_to_target(target_ws), forward_target_to_client(target_ws)] + aws = [ + asyncio.create_task(forward_client_to_target(target_ws)), + asyncio.create_task(forward_target_to_client(target_ws)), + ] log.info(f"About to call asyncio.wait with {len(aws)} tasks") try: diff --git a/pyproject.toml b/pyproject.toml index 53da2cea5..d40ba58b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -401,7 +401,6 @@ module = [ "gns3server.utils.encryption", # 2 "gns3server.utils.images", # 4 "gns3server.utils.packet_filter_validation", # 16 - "gns3server.utils.websocket_to_websocket", # 12 "gns3server.utils.zipfile_zstd._patcher", # 1 ] ignore_errors = true From df8b3c2903a6553506cd3dcc0c1afb11507d71da Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:14:38 +0000 Subject: [PATCH 096/390] fix(typing): resolve mypy errors in utils.asyncio.aiozipstream --- gns3server/utils/asyncio/aiozipstream.py | 18 ++++++++---------- pyproject.toml | 1 - 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/gns3server/utils/asyncio/aiozipstream.py b/gns3server/utils/asyncio/aiozipstream.py index a6e1fc49b..1efafc37e 100644 --- a/gns3server/utils/asyncio/aiozipstream.py +++ b/gns3server/utils/asyncio/aiozipstream.py @@ -32,16 +32,14 @@ import asyncio import aiofiles from concurrent import futures -from zipfile import ( - structCentralDir, - structEndArchive64, - structEndArchive, - structEndArchive64Locator, - stringCentralDir, - stringEndArchive64, - stringEndArchive, - stringEndArchive64Locator, -) +structCentralDir = "<4s4B4HL2L5H2L" +structEndArchive64 = "<4sQ2H2L4Q" +structEndArchive = b"<4s4H2LH" +structEndArchive64Locator = "<4sLQL" +stringCentralDir = b"PK\x01\x02" +stringEndArchive64 = b"PK\x06\x06" +stringEndArchive = b"PK\x05\x06" +stringEndArchive64Locator = b"PK\x06\x07" ZIP_ZSTANDARD = 93 # zstandard is supported by WinZIP v24 and later, PowerArchiver 2021 and 7-Zip-zstd diff --git a/pyproject.toml b/pyproject.toml index 1179d2526..63bfde2eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -392,7 +392,6 @@ module = [ "gns3server.schemas.controller.settings", # 3 "gns3server.schemas.controller.templates.docker_templates", # 1 "gns3server.services.templates", # 18 - "gns3server.utils.asyncio.aiozipstream", # 8 "gns3server.utils.encryption", # 2 "gns3server.utils.http_client", # 4 "gns3server.utils.images", # 4 From 128470125346696f3e056ecabe3a3cbeb8b0111a Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:58:21 +0000 Subject: [PATCH 097/390] fix(typing): resolve mypy errors in utils.zipfile_zstd._patcher --- gns3server/utils/zipfile_zstd/_patcher.py | 3 ++- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/utils/zipfile_zstd/_patcher.py b/gns3server/utils/zipfile_zstd/_patcher.py index ee2d19812..fc97d3645 100644 --- a/gns3server/utils/zipfile_zstd/_patcher.py +++ b/gns3server/utils/zipfile_zstd/_patcher.py @@ -1,8 +1,9 @@ import functools +from typing import Any class patch: - originals = {} + originals: dict[str, Any] = {} def __init__(self, host, name): self.host = host diff --git a/pyproject.toml b/pyproject.toml index d40ba58b3..01aaf9959 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -401,6 +401,5 @@ module = [ "gns3server.utils.encryption", # 2 "gns3server.utils.images", # 4 "gns3server.utils.packet_filter_validation", # 16 - "gns3server.utils.zipfile_zstd._patcher", # 1 ] ignore_errors = true From 68368220f21f01c717ef94b061a43d2aad7ee95c Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:00:02 +0000 Subject: [PATCH 098/390] fix(typing): resolve mypy errors in api.server --- gns3server/api/server.py | 6 ++++-- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gns3server/api/server.py b/gns3server/api/server.py index 3eaade6e8..7827aec7c 100644 --- a/gns3server/api/server.py +++ b/gns3server/api/server.py @@ -19,6 +19,8 @@ FastAPI app """ +from typing import cast + from fastapi import FastAPI, Request, HTTPException, status from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse @@ -118,7 +120,7 @@ def handle_exit(*args, **kwargs): unicorn_exit_handler(*args, **kwargs) -UvicornServer.handle_exit = handle_exit +UvicornServer.handle_exit = handle_exit # type: ignore[method-assign] # Configure self-hosting JavaScript and CSS for docs @@ -134,7 +136,7 @@ async def custom_swagger_ui_html(): ) -@app.get(app.swagger_ui_oauth2_redirect_url, include_in_schema=False) +@app.get(cast(str, app.swagger_ui_oauth2_redirect_url), include_in_schema=False) async def swagger_ui_redirect(): return get_swagger_ui_oauth2_redirect_html() diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..67ff5fe32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -355,7 +355,6 @@ module = [ "gns3server.api.routes.controller.snapshots", # 1 "gns3server.api.routes.controller.templates", # 10 "gns3server.api.routes.controller.users", # 14 - "gns3server.api.server", # 2 "gns3server.compute.dynamips.nodes.router", # 2 "gns3server.compute.iou.utils.iou_export", # 2 "gns3server.compute.iou.utils.iou_import", # 2 From 1babf7bccee1e69cf8ada0f9aa5668d8e6dfb4f4 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:45:28 +0000 Subject: [PATCH 099/390] fix(typing): resolve mypy errors in compute.dynamips.nodes.router --- gns3server/compute/dynamips/nodes/router.py | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/compute/dynamips/nodes/router.py b/gns3server/compute/dynamips/nodes/router.py index 4bc1f77b5..2eedfc2c4 100644 --- a/gns3server/compute/dynamips/nodes/router.py +++ b/gns3server/compute/dynamips/nodes/router.py @@ -1645,7 +1645,7 @@ class Router(BaseNode): await nio.start_packet_capture(output_file, data_link_type) log.debug( 'Router "{name}" [{id}]: starting packet capture on port {slot_number}/{port_number}'.format( - name=self._name, id=self._id, nio_name=nio.name, slot_number=slot_number, port_number=port_number + name=self._name, id=self._id, slot_number=slot_number, port_number=port_number ) ) @@ -1685,7 +1685,7 @@ class Router(BaseNode): log.debug( 'Router "{name}" [{id}]: stopping packet capture on port {slot_number}/{port_number}'.format( - name=self._name, id=self._id, nio_name=nio.name, slot_number=slot_number, port_number=port_number + name=self._name, id=self._id, slot_number=slot_number, port_number=port_number ) ) diff --git a/pyproject.toml b/pyproject.toml index 67ff5fe32..b6cf0462f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -355,7 +355,6 @@ module = [ "gns3server.api.routes.controller.snapshots", # 1 "gns3server.api.routes.controller.templates", # 10 "gns3server.api.routes.controller.users", # 14 - "gns3server.compute.dynamips.nodes.router", # 2 "gns3server.compute.iou.utils.iou_export", # 2 "gns3server.compute.iou.utils.iou_import", # 2 "gns3server.compute.virtualbox.virtualbox_vm", # 1 From a7350ae0c879ef1ccc39e443a15aa80b6064e442 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:59:25 +0000 Subject: [PATCH 100/390] fix(typing): resolve mypy errors in compute.iou.utils --- gns3server/compute/iou/utils/iou_export.py | 15 +++++------- gns3server/compute/iou/utils/iou_import.py | 28 +++++++++------------- pyproject.toml | 2 -- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/gns3server/compute/iou/utils/iou_export.py b/gns3server/compute/iou/utils/iou_export.py index f3b67d039..3ee1d2f5c 100644 --- a/gns3server/compute/iou/utils/iou_export.py +++ b/gns3server/compute/iou/utils/iou_export.py @@ -204,9 +204,8 @@ if __name__ == "__main__": args = parser.parse_args() try: - fd = open(args.nvram, "rb") - nvram = fd.read() - fd.close() + with open(args.nvram, "rb") as fd: + nvram = fd.read() except OSError as err: sys.stderr.write(f"Error reading file: {err}\n") sys.exit(1) @@ -218,16 +217,14 @@ if __name__ == "__main__": sys.exit(3) try: - fd = open(args.startup, "wb") - fd.write(startup) - fd.close() + with open(args.startup, "wb") as out: + out.write(startup) if args.private is not None: if private is None: sys.stderr.write("Warning: No private config\n") else: - fd = open(args.private, "wb") - fd.write(private) - fd.close() + with open(args.private, "wb") as out: + out.write(private) except OSError as err: sys.stderr.write(f"Error writing file: {err}\n") sys.exit(1) diff --git a/gns3server/compute/iou/utils/iou_import.py b/gns3server/compute/iou/utils/iou_import.py index 361ed0c54..1dbcbfba4 100644 --- a/gns3server/compute/iou/utils/iou_import.py +++ b/gns3server/compute/iou/utils/iou_import.py @@ -197,22 +197,17 @@ if __name__ == "__main__": parser.add_argument("private", metavar="private-config", nargs="?", help="private configuration") args = parser.parse_args() + nvram: bytes | None = None + private: bytes | None = None try: if args.create is None: - fd = open(args.nvram, "rb") - nvram = fd.read() - fd.close() - else: - nvram = None - fd = open(args.startup, "rb") - startup = fd.read() - fd.close() - if args.private is None: - private = None - else: - fd = open(args.private, "rb") - private = fd.read() - fd.close() + with open(args.nvram, "rb") as fd: + nvram = fd.read() + with open(args.startup, "rb") as fd: + startup = fd.read() + if args.private is not None: + with open(args.private, "rb") as fd: + private = fd.read() except OSError as err: sys.stderr.write(f"Error reading file: {err}\n") sys.exit(1) @@ -224,9 +219,8 @@ if __name__ == "__main__": sys.exit(3) try: - fd = open(args.nvram, "wb") - fd.write(nvram) - fd.close() + with open(args.nvram, "wb") as out: + out.write(nvram) except OSError as err: sys.stderr.write(f"Error writing file: {err}\n") sys.exit(1) diff --git a/pyproject.toml b/pyproject.toml index b6cf0462f..63d910a26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -355,8 +355,6 @@ module = [ "gns3server.api.routes.controller.snapshots", # 1 "gns3server.api.routes.controller.templates", # 10 "gns3server.api.routes.controller.users", # 14 - "gns3server.compute.iou.utils.iou_export", # 2 - "gns3server.compute.iou.utils.iou_import", # 2 "gns3server.compute.virtualbox.virtualbox_vm", # 1 "gns3server.compute.vpcs.vpcs_vm", # 2 "gns3server.controller.appliance", # 2 From 2542ad4647bf0742924a01daefba5ee8fb689a47 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:44:03 +0000 Subject: [PATCH 101/390] fix(typing): resolve mypy errors in compute.vpcs.vpcs_vm --- gns3server/compute/vpcs/vpcs_vm.py | 12 ++++++++++-- pyproject.toml | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gns3server/compute/vpcs/vpcs_vm.py b/gns3server/compute/vpcs/vpcs_vm.py index b42c4095a..c72405543 100644 --- a/gns3server/compute/vpcs/vpcs_vm.py +++ b/gns3server/compute/vpcs/vpcs_vm.py @@ -148,7 +148,11 @@ class VPCSVM(BaseNode): vpcs_path = shutil.which(vpcs_path) return vpcs_path - @BaseNode.name.setter + @property + def name(self): + return self._name + + @name.setter def name(self, new_name): """ Sets the name of this VPCS VM. @@ -358,7 +362,11 @@ class VPCSVM(BaseNode): if self.is_running(): await self.reset_wrap_console() - @BaseNode.console_type.setter + @property + def console_type(self): + return self._console_type + + @console_type.setter def console_type(self, new_console_type): """ Sets the console type for this VPCS VM. diff --git a/pyproject.toml b/pyproject.toml index 63d910a26..263226226 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -356,7 +356,6 @@ module = [ "gns3server.api.routes.controller.templates", # 10 "gns3server.api.routes.controller.users", # 14 "gns3server.compute.virtualbox.virtualbox_vm", # 1 - "gns3server.compute.vpcs.vpcs_vm", # 2 "gns3server.controller.appliance", # 2 "gns3server.controller.appliance_manager", # 5 "gns3server.controller.project", # 2 From a7b32ca6dfe1a3571d39e0469bd56ce43bf06b6a Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:56:53 +0000 Subject: [PATCH 102/390] fix(typing): resolve mypy errors in controller.appliance --- gns3server/controller/appliance.py | 8 ++++---- pyproject.toml | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gns3server/controller/appliance.py b/gns3server/controller/appliance.py index 10d958983..d62cb3a52 100644 --- a/gns3server/controller/appliance.py +++ b/gns3server/controller/appliance.py @@ -51,6 +51,10 @@ class Appliance: def symbol(self): return self._data.get("symbol") + @symbol.setter + def symbol(self, new_symbol): + self._data["symbol"] = new_symbol + @property def name(self): return self._data.get("name") @@ -63,10 +67,6 @@ class Appliance: def versions(self): return self._data.get("versions") - @symbol.setter - def symbol(self, new_symbol): - self._data["symbol"] = new_symbol - @property def type(self): diff --git a/pyproject.toml b/pyproject.toml index 263226226..2d81451cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -356,7 +356,6 @@ module = [ "gns3server.api.routes.controller.templates", # 10 "gns3server.api.routes.controller.users", # 14 "gns3server.compute.virtualbox.virtualbox_vm", # 1 - "gns3server.controller.appliance", # 2 "gns3server.controller.appliance_manager", # 5 "gns3server.controller.project", # 2 "gns3server.controller.topology", # 1 From d783ccfc0d8ee99ac4941eb8e9503e0402740a79 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 04:48:54 +0000 Subject: [PATCH 103/390] fix(typing): resolve mypy errors in controller.topology --- gns3server/controller/topology.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 5048be4ce..f2390930a 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -53,7 +53,7 @@ GNS3_FILE_FORMAT_REVISION = 10 class DynamipsNodeValidation(DynamipsCreate): - name: Optional[str] = None + name: Optional[str] = None # type: ignore[assignment] def _check_topology_schema(topo, path): diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..d2f066c64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -364,7 +364,6 @@ module = [ "gns3server.controller.appliance", # 2 "gns3server.controller.appliance_manager", # 5 "gns3server.controller.project", # 2 - "gns3server.controller.topology", # 1 "gns3server.db.repositories.api_keys", # 8 "gns3server.db.repositories.computes", # 10 "gns3server.db.repositories.images", # 14 From 07560b0026cb55dfed639180d86cd44bf53ac09f Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:06:09 +0000 Subject: [PATCH 104/390] fix(typing): resolve mypy errors in agent --- gns3server/agent/__init__.py | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gns3server/agent/__init__.py b/gns3server/agent/__init__.py index dee2aaed1..082c6dd4a 100644 --- a/gns3server/agent/__init__.py +++ b/gns3server/agent/__init__.py @@ -57,7 +57,7 @@ except ImportError as e: AI_COPILOT_AVAILABLE = False # Provide stub functions that raise helpful errors - async def get_project_agent_manager(): + async def get_project_agent_manager() -> "ProjectAgentManager": """ Get the global ProjectAgentManager singleton instance. @@ -68,7 +68,7 @@ except ImportError as e: "AI Copilot is not available. Install AI dependencies with: pip install gns3-server[ai-features]" ) - class ProjectAgentManager: + class ProjectAgentManager: # type: ignore[no-redef] """ Stub class for ProjectAgentManager when AI dependencies are not installed. """ diff --git a/pyproject.toml b/pyproject.toml index 258447eb6..87f19d76b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -294,7 +294,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] # Baseline: modules with existing type errors (error count at baseline time). # Remove modules from this list one small PR at a time. Never add new ones. module = [ - "gns3server.agent", # 2 "gns3server.agent.gns3_copilot.agent.context_manager", # 5 "gns3server.agent.gns3_copilot.agent.model_factory", # 4 "gns3server.agent.gns3_copilot.chat_sessions_repository", # 8 From 9882eba08812447e35e430174e5716a9c510d205 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:11:44 +0000 Subject: [PATCH 105/390] fix(typing): resolve mypy errors in agent.gns3_copilot.chat_sessions_repository --- gns3server/agent/gns3_copilot/chat_sessions_repository.py | 8 +++++--- pyproject.toml | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gns3server/agent/gns3_copilot/chat_sessions_repository.py b/gns3server/agent/gns3_copilot/chat_sessions_repository.py index 4d18d8852..41006f299 100644 --- a/gns3server/agent/gns3_copilot/chat_sessions_repository.py +++ b/gns3server/agent/gns3_copilot/chat_sessions_repository.py @@ -125,7 +125,7 @@ class ChatSessionsRepository: project_id: str, title: str = "New Conversation", copilot_mode: Optional[str] = None, - ) -> ChatSession: + ) -> Optional[ChatSession]: """ Create a new chat session. @@ -158,6 +158,8 @@ class ChatSessionsRepository: session_id = cursor.lastrowid log.info("Created chat session: id=%s, thread_id=%s, copilot_mode=%s", session_id, thread_id, copilot_mode) + if session_id is None: + return None return await self.get_session_by_id(session_id) async def get_session_by_id(self, session_id: int) -> Optional[ChatSession]: @@ -214,7 +216,7 @@ class ChatSessionsRepository: List of ChatSession """ query = "SELECT * FROM chat_sessions" - params = [] + params: List[Any] = [] conditions = [] if user_id: @@ -268,7 +270,7 @@ class ChatSessionsRepository: Updated ChatSession or None """ updates = [] - params = [] + params: List[Any] = [] now = datetime.utcnow().isoformat() diff --git a/pyproject.toml b/pyproject.toml index 87f19d76b..a2e9c2872 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -296,7 +296,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] module = [ "gns3server.agent.gns3_copilot.agent.context_manager", # 5 "gns3server.agent.gns3_copilot.agent.model_factory", # 4 - "gns3server.agent.gns3_copilot.chat_sessions_repository", # 8 "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 "gns3server.agent.gns3_copilot.gns3_client.connector_factory", # 1 "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 From bc27c4814fe8cebbc3040ae3732bbebe7370e49e Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 06:37:23 +0000 Subject: [PATCH 106/390] fix(typing): resolve mypy errors in agent.gns3_copilot.gns3_client.api_handlers --- .../agent/gns3_copilot/gns3_client/api_handlers.py | 14 +++++++------- .../gns3_copilot/tools_v2/gns3_create_link.py | 2 ++ .../gns3_copilot/tools_v2/gns3_create_node.py | 2 ++ pyproject.toml | 1 - 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gns3server/agent/gns3_copilot/gns3_client/api_handlers.py b/gns3server/agent/gns3_copilot/gns3_client/api_handlers.py index b0934c201..4f7105881 100644 --- a/gns3server/agent/gns3_copilot/gns3_client/api_handlers.py +++ b/gns3server/agent/gns3_copilot/gns3_client/api_handlers.py @@ -162,14 +162,14 @@ def build_gns3_ctx(jwt_token: str | None = None, url: str | None = None) -> dict } -def _filter_node_response(node: dict, fields: list[str] = None) -> dict: +def _filter_node_response(node: dict, fields: list[str] | None = None) -> dict: """Filter node response to only include requested fields.""" if not fields: fields = ["node_id", "name", "node_type", "status", "console"] return {k: node[k] for k in fields if k in node} -def _filter_link_response(link: dict, fields: list[str] = None) -> dict: +def _filter_link_response(link: dict, fields: list[str] | None = None) -> dict: """Filter link response to only include requested fields.""" if not fields: fields = LINK_DEFAULT_FIELDS @@ -332,7 +332,7 @@ def suspend_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> di return {"message": f"Node {node_id} suspended", "node_id": node_id} -def create_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any]: +def create_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any] | list[dict[str, Any]]: project_id = params.get("project_id") if not project_id: @@ -401,7 +401,7 @@ def create_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dic return _filter_node_response(resp, fields) -def delete_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any]: +def delete_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any] | list[dict[str, Any]]: project_id = params.get("project_id") if not project_id: return {"error": "project_id is required"} @@ -706,7 +706,7 @@ def available_filters_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) return conn.http_call("get", url).json() -def create_link_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any]: +def create_link_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any] | list[dict[str, Any]]: project_id = params.get("project_id") if not project_id: return {"error": "project_id is required"} @@ -762,7 +762,7 @@ def create_link_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dic return _filter_link_response(resp, fields) -def delete_link_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any]: +def delete_link_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any] | list[dict[str, Any]]: project_id = params.get("project_id") if not project_id: return {"error": "project_id is required"} @@ -809,7 +809,7 @@ def update_link_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dic # ── Link capture / reset handlers ────────────────────────────────────── -def reset_link_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any]: +def reset_link_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any] | list[dict[str, Any]]: project_id = params.get("project_id") if not project_id: return {"error": "project_id is required"} diff --git a/gns3server/agent/gns3_copilot/tools_v2/gns3_create_link.py b/gns3server/agent/gns3_copilot/tools_v2/gns3_create_link.py index 8f926586b..ff11c6a44 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/gns3_create_link.py +++ b/gns3server/agent/gns3_copilot/tools_v2/gns3_create_link.py @@ -222,6 +222,8 @@ class GNS3LinkTool(BaseTool): }, gns3_ctx, ) + if isinstance(link_resp, list): + raise RuntimeError("Unexpected batch response when creating a single link") if "error" in link_resp: raise RuntimeError(link_resp["error"]) diff --git a/gns3server/agent/gns3_copilot/tools_v2/gns3_create_node.py b/gns3server/agent/gns3_copilot/tools_v2/gns3_create_node.py index a511de21f..bdbc0bf42 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/gns3_create_node.py +++ b/gns3server/agent/gns3_copilot/tools_v2/gns3_create_node.py @@ -230,6 +230,8 @@ class GNS3CreateNodeTool(BaseTool): }, gns3_ctx, ) + if isinstance(created, list): + raise RuntimeError("Unexpected batch response when creating a single node") if "error" in created: raise RuntimeError(created["error"]) node_info = { diff --git a/pyproject.toml b/pyproject.toml index a2e9c2872..ee860c022 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -296,7 +296,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] module = [ "gns3server.agent.gns3_copilot.agent.context_manager", # 5 "gns3server.agent.gns3_copilot.agent.model_factory", # 4 - "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 "gns3server.agent.gns3_copilot.gns3_client.connector_factory", # 1 "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 "gns3server.agent.gns3_copilot.skills.loader", # 1 From 780b7f2ab6b6375067eef65ad37362240aebe351 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Mon, 28 Sep 2026 05:04:32 +0000 Subject: [PATCH 107/390] fix(typing): resolve mypy errors in agent node lifecycle tools --- gns3server/agent/gns3_copilot/gns3_client/api_handlers.py | 6 +++--- gns3server/agent/gns3_copilot/tools_v2/gns3_start_node.py | 6 +++++- gns3server/agent/gns3_copilot/tools_v2/gns3_stop_node.py | 6 +++++- gns3server/agent/gns3_copilot/tools_v2/gns3_suspend_node.py | 6 +++++- pyproject.toml | 3 --- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gns3server/agent/gns3_copilot/gns3_client/api_handlers.py b/gns3server/agent/gns3_copilot/gns3_client/api_handlers.py index 4f7105881..7f6ca8c95 100644 --- a/gns3server/agent/gns3_copilot/gns3_client/api_handlers.py +++ b/gns3server/agent/gns3_copilot/gns3_client/api_handlers.py @@ -278,7 +278,7 @@ def _batch_lifecycle(project_id, node_ids, action, conn, action_label): return list(pool.map(_act, node_ids)) -def start_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any]: +def start_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any] | list[dict[str, Any]]: project_id = params.get("project_id") if not project_id: return {"error": "project_id is required"} @@ -296,7 +296,7 @@ def start_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict return {"message": f"Node {node_id} started", "node_id": node_id} -def stop_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any]: +def stop_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any] | list[dict[str, Any]]: project_id = params.get("project_id") if not project_id: return {"error": "project_id is required"} @@ -314,7 +314,7 @@ def stop_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[ return {"message": f"Node {node_id} stopped", "node_id": node_id} -def suspend_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any]: +def suspend_node_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any] | list[dict[str, Any]]: project_id = params.get("project_id") if not project_id: return {"error": "project_id is required"} diff --git a/gns3server/agent/gns3_copilot/tools_v2/gns3_start_node.py b/gns3server/agent/gns3_copilot/tools_v2/gns3_start_node.py index 8e98c7480..4086cde1b 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/gns3_start_node.py +++ b/gns3server/agent/gns3_copilot/tools_v2/gns3_start_node.py @@ -136,7 +136,11 @@ class GNS3StartNodeTool(BaseTool): results = [] known_ids = [nid for nid in node_ids if nid in nodes_by_id] start_results = start_node_handler({"project_id": project_id, "node_ids": known_ids}, gns3_ctx) - start_errors = {r["node_id"]: r.get("error") for r in start_results if r.get("status") == "error"} + start_errors = ( + {r["node_id"]: r.get("error") for r in start_results if r.get("status") == "error"} + if isinstance(start_results, list) + else {} + ) # Get immediate status (likely 'starting' or 'stopped') — one call listing = get_nodes_handler({"project_id": project_id}, gns3_ctx) diff --git a/gns3server/agent/gns3_copilot/tools_v2/gns3_stop_node.py b/gns3server/agent/gns3_copilot/tools_v2/gns3_stop_node.py index 3c0d8ef2c..d6965f19b 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/gns3_stop_node.py +++ b/gns3server/agent/gns3_copilot/tools_v2/gns3_stop_node.py @@ -124,7 +124,11 @@ class GNS3StopNodeTool(BaseTool): results = [] known_ids = [nid for nid in node_ids if nid in nodes_by_id] stop_results = stop_node_handler({"project_id": project_id, "node_ids": known_ids}, gns3_ctx) - stop_errors = {r["node_id"]: r.get("error") for r in stop_results if r.get("status") == "error"} + stop_errors = ( + {r["node_id"]: r.get("error") for r in stop_results if r.get("status") == "error"} + if isinstance(stop_results, list) + else {} + ) # Get updated status — one call listing = get_nodes_handler({"project_id": project_id}, gns3_ctx) diff --git a/gns3server/agent/gns3_copilot/tools_v2/gns3_suspend_node.py b/gns3server/agent/gns3_copilot/tools_v2/gns3_suspend_node.py index 74f9ba883..47a0cc4b1 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/gns3_suspend_node.py +++ b/gns3server/agent/gns3_copilot/tools_v2/gns3_suspend_node.py @@ -130,7 +130,11 @@ class GNS3SuspendNodeTool(BaseTool): results = [] known_ids = [nid for nid in node_ids if nid in nodes_by_id] suspend_results = suspend_node_handler({"project_id": project_id, "node_ids": known_ids}, gns3_ctx) - suspend_errors = {r["node_id"]: r.get("error") for r in suspend_results if r.get("status") == "error"} + suspend_errors = ( + {r["node_id"]: r.get("error") for r in suspend_results if r.get("status") == "error"} + if isinstance(suspend_results, list) + else {} + ) # Get updated status — one call listing = get_nodes_handler({"project_id": project_id}, gns3_ctx) diff --git a/pyproject.toml b/pyproject.toml index ee860c022..9ccaef978 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -303,9 +303,6 @@ module = [ "gns3server.agent.gns3_copilot.tools_v2.config_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.display_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.gns3_packet_filter", # 1 - "gns3server.agent.gns3_copilot.tools_v2.gns3_start_node", # 3 - "gns3server.agent.gns3_copilot.tools_v2.gns3_stop_node", # 3 - "gns3server.agent.gns3_copilot.tools_v2.gns3_suspend_node", # 3 "gns3server.agent.gns3_copilot.tools_v2.packet_analysis_tool", # 1 "gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko", # 9 "gns3server.agent.gns3_copilot.utils.custom_netmiko.scripts.list_netmiko_telnet_devices", # 1 From a51af4a32eedecd8a803ab423f4a97581595db53 Mon Sep 17 00:00:00 2001 From: Jeremy Grossmann Date: Tue, 29 Sep 2026 12:35:33 +0200 Subject: [PATCH 108/390] Fix module list after merging Removed unused modules from the project configuration. --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6677635c2..1bb396c59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -297,10 +297,6 @@ module = [ "gns3server.agent", # 2 "gns3server.agent.gns3_copilot.chat_sessions_repository", # 8 "gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10 - "gns3server.agent.gns3_copilot.gns3_client.connector_factory", # 1 - "gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2 - "gns3server.agent.gns3_copilot.skills.loader", # 1 - "gns3server.agent.gns3_copilot.skills.manager", # 4 "gns3server.agent.gns3_copilot.tools_v2.config_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.display_tools_nornir", # 6 "gns3server.agent.gns3_copilot.tools_v2.gns3_packet_filter", # 1 From 2e127759113ed16fbbac455a93857fd214d43529 Mon Sep 17 00:00:00 2001 From: Cristi Date: Tue, 29 Sep 2026 15:42:49 +0300 Subject: [PATCH 109/390] fix(images): Fix symlink support in image inventory --- gns3server/utils/image_inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/utils/image_inventory.py b/gns3server/utils/image_inventory.py index e222d5a69..78943ba11 100644 --- a/gns3server/utils/image_inventory.py +++ b/gns3server/utils/image_inventory.py @@ -20,7 +20,7 @@ def contained_path(path, root): def fingerprint(path): - info = os.stat(path, follow_symlinks=False) + info = os.stat(path, follow_symlinks=True) if not stat.S_ISREG(info.st_mode): raise OSError(f"Not a regular image file: {path}") return stat_fingerprint(info) From 87df09c00ca4b3425fa32128599a636a3fe5cfcc Mon Sep 17 00:00:00 2001 From: Cristi Date: Tue, 29 Sep 2026 20:16:22 +0300 Subject: [PATCH 110/390] fix(images): Fix symlinked image imports and add regression tests --- gns3server/utils/images.py | 2 +- tests/services/test_image_reconciliation.py | 34 ++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/gns3server/utils/images.py b/gns3server/utils/images.py index a1b208c5c..58acc8b1e 100644 --- a/gns3server/utils/images.py +++ b/gns3server/utils/images.py @@ -132,7 +132,7 @@ def get_builtin_disks() -> List[str]: def inspect_image_file(path, expected_image_type=None, allow_raw_image=False, stopped_event=None): """Read a stable regular file once, never trusting checksum sidecars.""" before = fingerprint(path) - flags = os.O_RDONLY | getattr(os, "O_BINARY", 0) | getattr(os, "O_NOFOLLOW", 0) + flags = os.O_RDONLY | getattr(os, "O_BINARY", 0) with os.fdopen(os.open(path, flags), "rb") as f: info = os.fstat(f.fileno()) if not stat.S_ISREG(info.st_mode) or stat_fingerprint(info) != before: diff --git a/tests/services/test_image_reconciliation.py b/tests/services/test_image_reconciliation.py index cf0c41d6a..fa8e9beba 100644 --- a/tests/services/test_image_reconciliation.py +++ b/tests/services/test_image_reconciliation.py @@ -176,7 +176,39 @@ async def test_rename_retains_old_reference(inventory, config): assert next(row for row in await rows(inventory) if row["image_id"] == old["image_id"])["availability"] == "missing" -async def test_symlinks_hidden_files_and_libraries_are_not_imported(inventory, config, tmp_path): +async def test_symlink_images_are_imported_and_target_changes_detected(inventory, config): + target = image_file(config, ".storage/target.qcow2") + path = image_file(config) + path.unlink() + path.symlink_to(target) + assert fingerprint(path) == fingerprint(target) + result = await scan(inventory) + assert result["status"] == "completed", result + assert result["counts"]["added"] == 1 + original = (await rows(inventory))[0] + assert original["path"] == str(path) + assert original["checksum"] == hashlib.md5(QCOW).hexdigest() + target.write_bytes(QCOW + b"changed") + result = await scan(inventory) + assert result["counts"]["updated"] == 1 + updated = (await rows(inventory))[0] + assert updated["image_id"] == original["image_id"] + assert updated["checksum"] == hashlib.md5(target.read_bytes()).hexdigest() + assert path.is_symlink() + + +@pytest.mark.parametrize("target_kind", ["directory", "missing"]) +async def test_fingerprint_rejects_symlinks_without_regular_file_targets(tmp_path, target_kind): + target = tmp_path / "target" + if target_kind == "directory": + target.mkdir() + link = tmp_path / "image.qcow2" + link.symlink_to(target, target_is_directory=target_kind == "directory") + with pytest.raises(OSError): + fingerprint(link) + + +async def test_external_symlinks_hidden_files_and_libraries_are_not_imported(inventory, config, tmp_path): outside = tmp_path / "outside.qcow2" outside.write_bytes(QCOW) path = image_file(config) From dfea615248f29f1479bca739f24f5e9c6eaf8a9d Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 21:48:32 +0300 Subject: [PATCH 111/390] fix(typing): resolve mypy errors in services.templates --- gns3server/db/models/templates.py | 41 +++++++++++++++---------- gns3server/db/repositories/templates.py | 18 ++++++----- gns3server/services/templates.py | 19 ++++++------ 3 files changed, 44 insertions(+), 34 deletions(-) diff --git a/gns3server/db/models/templates.py b/gns3server/db/models/templates.py index 62ea74a9e..0450be881 100644 --- a/gns3server/db/models/templates.py +++ b/gns3server/db/models/templates.py @@ -16,19 +16,26 @@ # along with this program. If not, see . +import uuid +from typing import Optional + from sqlalchemy import Boolean, Column, String, Integer, Float, ForeignKey, JSON -from sqlalchemy.orm import relationship +from sqlalchemy.orm import Mapped, mapped_column, relationship from .base import BaseTable, generate_uuid, GUID from .images import image_template_map +def template_id_column() -> Mapped[uuid.UUID]: + return mapped_column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) + + class Template(BaseTable): __tablename__ = "templates" - template_id = Column(GUID, primary_key=True, default=generate_uuid) + template_id: Mapped[uuid.UUID] = mapped_column(GUID, primary_key=True, default=generate_uuid) name = Column(String, index=True) - version = Column(String) + version: Mapped[Optional[str]] = mapped_column(String) category = Column(String) default_name_format = Column(String) symbol = Column(String) @@ -36,7 +43,7 @@ class Template(BaseTable): usage = Column(String) netmiko_device_type = Column(String) appliance_metadata = Column(JSON) - template_type = Column(String) + template_type: Mapped[str] = mapped_column(String, nullable=True) tags = Column(JSON) compute_id = Column(String) images = relationship("Image", secondary=image_template_map, back_populates="templates") @@ -50,7 +57,7 @@ class Template(BaseTable): class CloudTemplate(Template): __tablename__ = "cloud_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) + template_id: Mapped[uuid.UUID] = template_id_column() ports_mapping = Column(JSON) remote_console_host = Column(String) remote_console_port = Column(Integer) @@ -63,7 +70,7 @@ class CloudTemplate(Template): class DockerTemplate(Template): __tablename__ = "docker_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) + template_id: Mapped[uuid.UUID] = template_id_column() image = Column(String) adapters = Column(Integer) mac_address = Column(String) @@ -88,10 +95,10 @@ class DockerTemplate(Template): class DynamipsTemplate(Template): __tablename__ = "dynamips_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) - platform = Column(String) + template_id: Mapped[uuid.UUID] = template_id_column() + platform: Mapped[str] = mapped_column(String, nullable=True) chassis = Column(String) - image = Column(String) + image: Mapped[str] = mapped_column(String, nullable=True) exec_area = Column(Integer) mmap = Column(Boolean) mac_addr = Column(String) @@ -130,7 +137,7 @@ class DynamipsTemplate(Template): class EthernetHubTemplate(Template): __tablename__ = "ethernet_hub_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) + template_id: Mapped[uuid.UUID] = template_id_column() ports_mapping = Column(JSON) __mapper_args__ = {"polymorphic_identity": "ethernet_hub", "polymorphic_load": "selectin"} @@ -139,7 +146,7 @@ class EthernetHubTemplate(Template): class EthernetSwitchTemplate(Template): __tablename__ = "ethernet_switch_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) + template_id: Mapped[uuid.UUID] = template_id_column() ports_mapping = Column(JSON) console_type = Column(String) @@ -149,8 +156,8 @@ class EthernetSwitchTemplate(Template): class IOUTemplate(Template): __tablename__ = "iou_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) - path = Column(String) + template_id: Mapped[uuid.UUID] = template_id_column() + path: Mapped[str] = mapped_column(String, nullable=True) ethernet_adapters = Column(Integer) serial_adapters = Column(Integer) ram = Column(Integer) @@ -168,7 +175,7 @@ class IOUTemplate(Template): class QemuTemplate(Template): __tablename__ = "qemu_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) + template_id: Mapped[uuid.UUID] = template_id_column() qemu_path = Column(String) platform = Column(String) linked_clone = Column(Boolean) @@ -214,7 +221,7 @@ class QemuTemplate(Template): class VirtualBoxTemplate(Template): __tablename__ = "virtualbox_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) + template_id: Mapped[uuid.UUID] = template_id_column() vmname = Column(String) ram = Column(Integer) linked_clone = Column(Boolean) @@ -236,7 +243,7 @@ class VirtualBoxTemplate(Template): class VMwareTemplate(Template): __tablename__ = "vmware_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) + template_id: Mapped[uuid.UUID] = template_id_column() vmx_path = Column(String) linked_clone = Column(Boolean) first_port_name = Column(String) @@ -257,7 +264,7 @@ class VMwareTemplate(Template): class VPCSTemplate(Template): __tablename__ = "vpcs_templates" - template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) + template_id: Mapped[uuid.UUID] = template_id_column() base_script_file = Column(String) console_type = Column(String) console_auto_start = Column(Boolean, default=False) diff --git a/gns3server/db/repositories/templates.py b/gns3server/db/repositories/templates.py index 582404301..9d5c1a9af 100644 --- a/gns3server/db/repositories/templates.py +++ b/gns3server/db/repositories/templates.py @@ -16,11 +16,13 @@ # along with this program. If not, see . import os +import uuid import logging from uuid import UUID -from typing import List, Union, Optional +from typing import List, Union, Optional, cast from sqlalchemy import select, delete +from sqlalchemy.engine import CursorResult from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import selectinload from sqlalchemy.orm.session import make_transient @@ -64,7 +66,7 @@ class TemplatesRepository(BaseRepository): result = await self._db_session.execute(query) return result.scalars().first() - async def get_template_by_name_and_version(self, name: str, version: str) -> Union[None, models.Template]: + async def get_template_by_name_and_version(self, name: str, version: Optional[str]) -> Union[None, models.Template]: query = ( select(models.Template) @@ -89,7 +91,7 @@ class TemplatesRepository(BaseRepository): query = select(models.Template).options(selectinload(models.Template.images)) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def create_template(self, template_type: str, template_settings: dict) -> models.Template: @@ -100,7 +102,7 @@ class TemplatesRepository(BaseRepository): await self._db_session.refresh(db_template) return db_template - async def update_template(self, db_template: models.Template, template_settings: dict) -> schemas.Template: + async def update_template(self, db_template: models.Template, template_settings: dict) -> models.Template: # update the fields directly because update() query couldn't work for key, value in template_settings.items(): @@ -114,9 +116,9 @@ class TemplatesRepository(BaseRepository): query = delete(models.Template).where(models.Template.template_id == template_id) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 - async def duplicate_template(self, template_id: UUID) -> Optional[schemas.Template]: + async def duplicate_template(self, template_id: UUID) -> Optional[models.Template]: query = ( select(models.Template) @@ -128,7 +130,7 @@ class TemplatesRepository(BaseRepository): # duplicate db object with new primary key (template_id) self._db_session.expunge(db_template) make_transient(db_template) - db_template.template_id = None + db_template.template_id = uuid.uuid4() self._db_session.add(db_template) await self._db_session.commit() await self._db_session.refresh(db_template) @@ -205,4 +207,4 @@ class TemplatesRepository(BaseRepository): query = select(models.Image).join(models.Image.templates).filter(models.Template.template_id == template_id) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) diff --git a/gns3server/services/templates.py b/gns3server/services/templates.py index 10a167c89..00f02b4b0 100644 --- a/gns3server/services/templates.py +++ b/gns3server/services/templates.py @@ -20,7 +20,7 @@ import pydantic from uuid import UUID from fastapi.encoders import jsonable_encoder -from typing import List +from typing import List, Optional from gns3server import schemas from gns3server.config import Config @@ -34,7 +34,7 @@ from gns3server.controller.controller_error import ( ) -TEMPLATE_TYPE_TO_SCHEMA = { +TEMPLATE_TYPE_TO_SCHEMA: dict[str, type[pydantic.BaseModel]] = { "cloud": schemas.CloudTemplate, "ethernet_hub": schemas.EthernetHubTemplate, "ethernet_switch": schemas.EthernetSwitchTemplate, @@ -47,7 +47,7 @@ TEMPLATE_TYPE_TO_SCHEMA = { "qemu": schemas.QemuTemplate, } -TEMPLATE_TYPE_TO_UPDATE_SCHEMA = { +TEMPLATE_TYPE_TO_UPDATE_SCHEMA: dict[str, type[pydantic.BaseModel]] = { "cloud": schemas.CloudTemplateUpdate, "ethernet_hub": schemas.EthernetHubTemplateUpdate, "ethernet_switch": schemas.EthernetSwitchTemplateUpdate, @@ -59,7 +59,7 @@ TEMPLATE_TYPE_TO_UPDATE_SCHEMA = { "qemu": schemas.QemuTemplateUpdate, } -DYNAMIPS_PLATFORM_TO_SCHEMA = { +DYNAMIPS_PLATFORM_TO_SCHEMA: dict[str, type[pydantic.BaseModel]] = { "c7200": schemas.C7200DynamipsTemplate, "c3745": schemas.C3745DynamipsTemplate, "c3725": schemas.C3725DynamipsTemplate, @@ -69,7 +69,7 @@ DYNAMIPS_PLATFORM_TO_SCHEMA = { "c1700": schemas.C1700DynamipsTemplate, } -DYNAMIPS_PLATFORM_TO_UPDATE_SCHEMA = { +DYNAMIPS_PLATFORM_TO_UPDATE_SCHEMA: dict[str, type[pydantic.BaseModel]] = { "c7200": schemas.C7200DynamipsTemplateUpdate, "c3745": schemas.C3745DynamipsTemplateUpdate, "c3725": schemas.C3725DynamipsTemplateUpdate, @@ -169,11 +169,12 @@ class TemplatesService: for builtin_template in BUILTIN_TEMPLATES: builtin_template["symbol"] = self._controller.symbols.resolve_symbol(builtin_template["symbol"]) - def get_builtin_template(self, template_id: UUID) -> dict: + def get_builtin_template(self, template_id: UUID) -> Optional[dict]: for builtin_template in BUILTIN_TEMPLATES: if builtin_template["template_id"] == template_id: return jsonable_encoder(builtin_template) + return None def _base_path(self): return self._templates_repo.configs_path() @@ -303,7 +304,7 @@ class TemplatesService: try: # validate the update settings update_settings = jsonable_encoder(template_update, exclude_unset=True) - if db_template.template_type == "dynamips": + if isinstance(db_template, models.DynamipsTemplate): template_schema = DYNAMIPS_PLATFORM_TO_UPDATE_SCHEMA[db_template.platform] else: template_schema = TEMPLATE_TYPE_TO_UPDATE_SCHEMA[db_template.template_type] @@ -312,9 +313,9 @@ class TemplatesService: raise ControllerBadRequestError(f"JSON schema error received while updating template: {e}") images_to_add_to_template = await self._find_images(db_template.template_type, template_settings) - if db_template.template_type == "dynamips" and "image" in template_settings: + if isinstance(db_template, models.DynamipsTemplate) and "image" in template_settings: await self._remove_image(db_template.template_id, db_template.image) - elif db_template.template_type == "iou" and "path" in template_settings: + elif isinstance(db_template, models.IOUTemplate) and "path" in template_settings: await self._remove_image(db_template.template_id, db_template.path) elif db_template.template_type == "qemu": for key in template_update.model_dump().keys(): From a3cb73da3df0c3aa2d1be22b45cc0d4b3dae76b8 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 21:48:33 +0300 Subject: [PATCH 112/390] fix(typing): resolve mypy errors in api.routes.controller.dependencies.authentication --- .../api/routes/controller/dependencies/authentication.py | 7 ++++--- gns3server/db/models/api_keys.py | 9 +++++++-- gns3server/schemas/controller/tokens.py | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gns3server/api/routes/controller/dependencies/authentication.py b/gns3server/api/routes/controller/dependencies/authentication.py index 1043db717..1517e0572 100644 --- a/gns3server/api/routes/controller/dependencies/authentication.py +++ b/gns3server/api/routes/controller/dependencies/authentication.py @@ -55,7 +55,7 @@ async def get_user_from_token( user_repo: UsersRepository = Depends(get_repository(UsersRepository)), api_keys_repo: ApiKeysRepository = Depends(get_repository(ApiKeysRepository)), token: Optional[str] = Query(None, include_in_schema=False), -) -> schemas.User: +) -> models.User: if bearer_token: # bearer token is used first, then any token passed as a URL parameter @@ -169,7 +169,7 @@ async def get_current_active_user_from_websocket( websocket: WebSocket, token: str = Query(...), user_repo: UsersRepository = Depends(get_repository(UsersRepository)), -) -> Optional[schemas.User]: +) -> Optional[models.User]: # Extract requested subprotocols from headers for proper WebSocket negotiation # This is critical for protocols like xpra that require specific subprotocols @@ -238,4 +238,5 @@ async def get_current_active_user_from_websocket( websocket_error = {"action": "log.error", "event": {"message": err_msg}} await websocket.send_json(websocket_error) log.error(err_msg) - return await websocket.close(code=1008) + await websocket.close(code=1008) + return None diff --git a/gns3server/db/models/api_keys.py b/gns3server/db/models/api_keys.py index 5cc40eb0b..ec320f9dd 100644 --- a/gns3server/db/models/api_keys.py +++ b/gns3server/db/models/api_keys.py @@ -14,7 +14,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import uuid + from sqlalchemy import Column, String, Boolean, DateTime, ForeignKey, func +from sqlalchemy.orm import Mapped, mapped_column from .base import BaseTable, GUID @@ -22,8 +25,10 @@ from .base import BaseTable, GUID class ApiKey(BaseTable): __tablename__ = "api_keys" - api_key_id = Column(GUID, primary_key=True) - user_id = Column(GUID, ForeignKey("users.user_id", ondelete="CASCADE"), nullable=False, index=True) + api_key_id: Mapped[uuid.UUID] = mapped_column(GUID, primary_key=True) + user_id: Mapped[uuid.UUID] = mapped_column( + GUID, ForeignKey("users.user_id", ondelete="CASCADE"), nullable=False, index=True + ) name = Column(String(128), nullable=False) key_hash = Column(String(128), nullable=False) key_prefix = Column(String(8), nullable=False) diff --git a/gns3server/schemas/controller/tokens.py b/gns3server/schemas/controller/tokens.py index 29197acfa..2ac14dda6 100644 --- a/gns3server/schemas/controller/tokens.py +++ b/gns3server/schemas/controller/tokens.py @@ -25,7 +25,7 @@ class Token(BaseModel): class TokenData(BaseModel): - username: Optional[str] = None + username: str token_version: int = 0 token_use: str = "access" From 1aaf36fc802f7fcb077f818fcb02719c496c7007 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:18 +0300 Subject: [PATCH 113/390] fix(typing): resolve mypy errors in db.tasks --- gns3server/db/models/llm_model_configs.py | 6 ++++-- gns3server/db/tasks.py | 18 +++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/gns3server/db/models/llm_model_configs.py b/gns3server/db/models/llm_model_configs.py index 778d16bbc..d582bf754 100644 --- a/gns3server/db/models/llm_model_configs.py +++ b/gns3server/db/models/llm_model_configs.py @@ -16,7 +16,7 @@ # along with this program. If not, see . from sqlalchemy import Column, Boolean, ForeignKey, CheckConstraint, Index, Integer, String, text, JSON -from sqlalchemy.orm import relationship +from sqlalchemy.orm import Mapped, mapped_column, relationship from .base import BaseTable, generate_uuid, GUID @@ -36,7 +36,9 @@ class LLMModelConfig(BaseTable): config_id = Column(GUID, primary_key=True, default=generate_uuid) name = Column(String(100), nullable=False) # Configuration name (table-level for indexing) model_type = Column(String(50), nullable=False) # Model type: text, vision, stt, tts, multimodal, etc. - config = Column(JSON, nullable=False) # Config fields: provider, base_url, model, temperature, api_key, etc. + config: Mapped[dict] = mapped_column( + JSON, nullable=False + ) # Config fields: provider, base_url, model, temperature, api_key, etc. user_id = Column(GUID, ForeignKey("users.user_id", ondelete="CASCADE"), nullable=True) group_id = Column(GUID, ForeignKey("user_groups.user_group_id", ondelete="CASCADE"), nullable=True) is_default = Column(Boolean, default=False, nullable=False) diff --git a/gns3server/db/tasks.py b/gns3server/db/tasks.py index 8b3395156..a9554c9cc 100644 --- a/gns3server/db/tasks.py +++ b/gns3server/db/tasks.py @@ -171,7 +171,7 @@ async def disconnect_from_db(app: FastAPI) -> None: log.info(f"Disconnected from database") -async def get_computes(app: FastAPI) -> List[dict]: +async def get_computes(app: FastAPI) -> List[schemas.Compute]: computes = [] async with AsyncSession(app.state._db_engine) as db_session: @@ -201,12 +201,12 @@ async def discover_images_on_filesystem(app: FastAPI) -> None: continue for image_type in ("qemu", "ios", "iou"): discovered_images = await discover_images(image_type, existing_image_paths) - for image in discovered_images: - log.info(f"Adding discovered image '{image['path']}' to the database") + for image_info in discovered_images: + log.info(f"Adding discovered image '{image_info['path']}' to the database") try: - await images_repository.add_image(**image) + await images_repository.add_image(**image_info) except SQLAlchemyError as e: - log.warning(f"Error while adding image '{image['path']}' to the database: {e}") + log.warning(f"Error while adding image '{image_info['path']}' to the database: {e}") # monitor if images have been manually added asyncio.create_task(monitor_images_on_filesystem(app)) @@ -237,7 +237,7 @@ class EventHandler(PatternMatchingEventHandler): Watchdog event handler. """ - def __init__(self, queue: asyncio.Queue, loop: asyncio.BaseEventLoop, **kwargs): + def __init__(self, queue: asyncio.Queue, loop: asyncio.AbstractEventLoop, **kwargs): self._loop = loop self._queue = queue @@ -274,7 +274,7 @@ class EventIterator(object): async def monitor_images_on_filesystem(app: FastAPI): def watchdog( - path: str, queue: asyncio.Queue, loop: asyncio.BaseEventLoop, app: FastAPI, recursive: bool = False + path: str, queue: asyncio.Queue, loop: asyncio.AbstractEventLoop, app: FastAPI, recursive: bool = False ) -> None: """ Thread to monitor a directory for new images. @@ -295,7 +295,7 @@ async def monitor_images_on_filesystem(app: FastAPI): loop.call_soon_threadsafe(queue.put_nowait, None) break - queue = asyncio.Queue() + queue: asyncio.Queue = asyncio.Queue() loop = asyncio.get_event_loop() server_config = Config.instance().settings.Server image_dir = os.path.expanduser(server_config.images_path) @@ -348,7 +348,7 @@ async def get_user_llm_config_full(user_id: str, app: FastAPI) -> Optional[dict] from gns3server.utils.encryption import decrypt, is_encrypted try: - user_uuid = UUID(user_id) if isinstance(user_id, str) else user_id + user_uuid = UUID(user_id) async with AsyncSession(app.state._db_engine, expire_on_commit=False) as session: repo = LLMModelConfigsRepository(session) From 8e96f18429a261dd45dd2375caf91b4d5b8ed503 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:18 +0300 Subject: [PATCH 114/390] fix(typing): resolve mypy errors in db.repositories.users --- gns3server/db/models/users.py | 7 +++++-- gns3server/db/repositories/users.py | 15 ++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gns3server/db/models/users.py b/gns3server/db/models/users.py index d9fc9aa29..08d50f8a1 100644 --- a/gns3server/db/models/users.py +++ b/gns3server/db/models/users.py @@ -15,8 +15,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from datetime import datetime +from typing import Optional + from sqlalchemy import Table, Boolean, Column, Integer, String, DateTime, ForeignKey, event -from sqlalchemy.orm import relationship +from sqlalchemy.orm import Mapped, mapped_column, relationship from .base import Base, BaseTable, generate_uuid, GUID @@ -43,7 +46,7 @@ class User(BaseTable): email = Column(String, unique=True, index=True) full_name = Column(String) hashed_password = Column(String) - last_login = Column(DateTime) + last_login: Mapped[Optional[datetime]] = mapped_column(DateTime) token_version = Column(Integer, default=0, nullable=False, server_default="0") is_active = Column(Boolean, default=True) is_superadmin = Column(Boolean, default=False) diff --git a/gns3server/db/repositories/users.py b/gns3server/db/repositories/users.py index f7e098dc4..2bd40e313 100644 --- a/gns3server/db/repositories/users.py +++ b/gns3server/db/repositories/users.py @@ -16,8 +16,9 @@ # along with this program. If not, see . from uuid import UUID -from typing import Optional, List, Union +from typing import Optional, List, Union, cast from sqlalchemy import select, update, delete, func +from sqlalchemy.engine import CursorResult from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import selectinload @@ -72,7 +73,7 @@ class UsersRepository(BaseRepository): query = select(models.User) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def create_user(self, user: schemas.UserCreate) -> models.User: """ @@ -129,7 +130,7 @@ class UsersRepository(BaseRepository): query = delete(models.User).where(models.User.user_id == user_id) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def authenticate_user(self, username: str, password: str) -> Optional[models.User]: """ @@ -168,7 +169,7 @@ class UsersRepository(BaseRepository): query = select(models.UserGroup).join(models.UserGroup.users).filter(models.User.user_id == user_id) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def get_user_group(self, user_group_id: UUID) -> Optional[models.UserGroup]: """ @@ -195,7 +196,7 @@ class UsersRepository(BaseRepository): query = select(models.UserGroup) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def create_user_group(self, user_group: schemas.UserGroupCreate) -> models.UserGroup: """ @@ -233,7 +234,7 @@ class UsersRepository(BaseRepository): query = delete(models.UserGroup).where(models.UserGroup.user_group_id == user_group_id) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def add_member_to_user_group(self, user_group_id: UUID, user: models.User) -> Union[None, models.UserGroup]: """ @@ -285,4 +286,4 @@ class UsersRepository(BaseRepository): query = select(models.User).join(models.User.groups).filter(models.UserGroup.user_group_id == user_group_id) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) From b1d13edd2d95eebfdae0038bc2a8fa408fbffea4 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:18 +0300 Subject: [PATCH 115/390] fix(typing): resolve mypy errors in api.routes.controller.users --- gns3server/api/routes/controller/users.py | 15 ++++++++------- gns3server/db/models/users.py | 2 +- gns3server/db/repositories/users.py | 4 +++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gns3server/api/routes/controller/users.py b/gns3server/api/routes/controller/users.py index 1f834d712..673886195 100644 --- a/gns3server/api/routes/controller/users.py +++ b/gns3server/api/routes/controller/users.py @@ -22,7 +22,7 @@ API routes for users. from fastapi import APIRouter, Depends, HTTPException, Response, status from fastapi.security import OAuth2PasswordRequestForm from uuid import UUID -from typing import List +from typing import List, Optional from gns3server import schemas from gns3server.controller.controller_error import ( @@ -32,6 +32,7 @@ from gns3server.controller.controller_error import ( ControllerForbiddenError, ) +import gns3server.db.models as models from gns3server.db.repositories.users import UsersRepository from gns3server.db.repositories.rbac import RbacRepository from gns3server.services import auth_service @@ -168,7 +169,7 @@ async def update_logged_in_user( user_update: schemas.LoggedInUserUpdate, current_user: schemas.User = Depends(get_current_active_user), users_repo: UsersRepository = Depends(get_repository(UsersRepository)), -) -> schemas.User: +) -> Optional[models.User]: """ Update the current active user. """ @@ -180,7 +181,7 @@ async def update_logged_in_user( @router.get("", response_model=List[schemas.User], dependencies=[Depends(has_privilege("User.Audit"))]) -async def get_users(users_repo: UsersRepository = Depends(get_repository(UsersRepository))) -> List[schemas.User]: +async def get_users(users_repo: UsersRepository = Depends(get_repository(UsersRepository))) -> List[models.User]: """ Get all users. @@ -198,7 +199,7 @@ async def get_users(users_repo: UsersRepository = Depends(get_repository(UsersRe ) async def create_user( user_create: schemas.UserCreate, users_repo: UsersRepository = Depends(get_repository(UsersRepository)) -) -> schemas.User: +) -> models.User: """ Create a new user. @@ -218,7 +219,7 @@ async def create_user( async def get_user( user_id: UUID, users_repo: UsersRepository = Depends(get_repository(UsersRepository)), -) -> schemas.User: +) -> models.User: """ Get a user. @@ -236,7 +237,7 @@ async def update_user( user_id: UUID, user_update: schemas.UserUpdate, users_repo: UsersRepository = Depends(get_repository(UsersRepository)), -) -> schemas.User: +) -> Optional[models.User]: """ Update a user. @@ -287,7 +288,7 @@ async def delete_user( ) async def get_user_memberships( user_id: UUID, users_repo: UsersRepository = Depends(get_repository(UsersRepository)) -) -> List[schemas.UserGroup]: +) -> List[models.UserGroup]: """ Get user memberships. diff --git a/gns3server/db/models/users.py b/gns3server/db/models/users.py index 08d50f8a1..32af1e72f 100644 --- a/gns3server/db/models/users.py +++ b/gns3server/db/models/users.py @@ -47,7 +47,7 @@ class User(BaseTable): full_name = Column(String) hashed_password = Column(String) last_login: Mapped[Optional[datetime]] = mapped_column(DateTime) - token_version = Column(Integer, default=0, nullable=False, server_default="0") + token_version: Mapped[int] = mapped_column(Integer, default=0, nullable=False, server_default="0") is_active = Column(Boolean, default=True) is_superadmin = Column(Boolean, default=False) groups = relationship("UserGroup", secondary=user_group_map, back_populates="users") diff --git a/gns3server/db/repositories/users.py b/gns3server/db/repositories/users.py index 2bd40e313..556185272 100644 --- a/gns3server/db/repositories/users.py +++ b/gns3server/db/repositories/users.py @@ -89,7 +89,9 @@ class UsersRepository(BaseRepository): await self._db_session.refresh(db_user) return db_user - async def update_user(self, user_id: UUID, user_update: schemas.UserUpdate) -> Optional[models.User]: + async def update_user( + self, user_id: UUID, user_update: Union[schemas.UserUpdate, schemas.LoggedInUserUpdate] + ) -> Optional[models.User]: """ Update a user. """ From c048124c2105a92ee17d25ebb1546e8f5a7d7f69 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:19 +0300 Subject: [PATCH 116/390] fix(typing): resolve mypy errors in db.repositories.llm_model_configs --- gns3server/db/models/base.py | 8 +++-- gns3server/db/models/llm_model_configs.py | 2 +- gns3server/db/models/users.py | 3 +- .../db/repositories/llm_model_configs.py | 35 ++++++++++--------- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/gns3server/db/models/base.py b/gns3server/db/models/base.py index 1802c1771..4984b8773 100644 --- a/gns3server/db/models/base.py +++ b/gns3server/db/models/base.py @@ -16,12 +16,14 @@ # along with this program. If not, see . import uuid +from datetime import datetime +from typing import Optional from fastapi.encoders import jsonable_encoder from sqlalchemy import Column, DateTime, func, inspect from sqlalchemy.types import TypeDecorator, CHAR, VARCHAR from sqlalchemy.dialects.postgresql import UUID -from sqlalchemy.orm import DeclarativeBase +from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column class Base(DeclarativeBase): @@ -105,7 +107,9 @@ class BaseTable(Base): __abstract__ = True created_at = Column(DateTime, server_default=func.current_timestamp()) - updated_at = Column(DateTime, server_default=func.current_timestamp(), onupdate=func.current_timestamp()) + updated_at: Mapped[Optional[datetime]] = mapped_column( + DateTime, server_default=func.current_timestamp(), onupdate=func.current_timestamp() + ) __mapper_args__ = {"eager_defaults": True} diff --git a/gns3server/db/models/llm_model_configs.py b/gns3server/db/models/llm_model_configs.py index d582bf754..4a95719f4 100644 --- a/gns3server/db/models/llm_model_configs.py +++ b/gns3server/db/models/llm_model_configs.py @@ -42,7 +42,7 @@ class LLMModelConfig(BaseTable): user_id = Column(GUID, ForeignKey("users.user_id", ondelete="CASCADE"), nullable=True) group_id = Column(GUID, ForeignKey("user_groups.user_group_id", ondelete="CASCADE"), nullable=True) is_default = Column(Boolean, default=False, nullable=False) - version = Column(Integer, default=0, nullable=False) # Optimistic locking version + version: Mapped[int] = mapped_column(Integer, default=0, nullable=False) # Optimistic locking version # Relationships user = relationship("User", backref="llm_model_configs") diff --git a/gns3server/db/models/users.py b/gns3server/db/models/users.py index 32af1e72f..a66d20025 100644 --- a/gns3server/db/models/users.py +++ b/gns3server/db/models/users.py @@ -27,6 +27,7 @@ from gns3server.config import Config from gns3server.services import auth_service import logging +import uuid log = logging.getLogger(__name__) @@ -75,7 +76,7 @@ def create_default_super_admin(target, connection, **kw): class UserGroup(BaseTable): __tablename__ = "user_groups" - user_group_id = Column(GUID, primary_key=True, default=generate_uuid) + user_group_id: Mapped[uuid.UUID] = mapped_column(GUID, primary_key=True, default=generate_uuid) name = Column(String, unique=True, index=True) is_builtin = Column(Boolean, default=False) users = relationship("User", secondary=user_group_map, back_populates="groups") diff --git a/gns3server/db/repositories/llm_model_configs.py b/gns3server/db/repositories/llm_model_configs.py index f65ca8cac..2fb9188f4 100644 --- a/gns3server/db/repositories/llm_model_configs.py +++ b/gns3server/db/repositories/llm_model_configs.py @@ -16,8 +16,9 @@ # along with this program. If not, see . from uuid import UUID -from typing import Optional, List, Dict, Any +from typing import Optional, List, Dict, Any, cast from sqlalchemy import select, update, delete, and_ +from sqlalchemy.engine import CursorResult from datetime import datetime import logging @@ -63,7 +64,7 @@ class LLMModelConfigsRepository(BaseRepository): .order_by(models.LLMModelConfig.created_at) ) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def get_user_default_config(self, user_id: UUID) -> Optional[models.LLMModelConfig]: """Get a user's default LLM model configuration.""" @@ -182,7 +183,7 @@ class LLMModelConfigsRepository(BaseRepository): ) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def set_user_default_config(self, user_id: UUID, config_id: UUID) -> bool: """Set a user's default LLM model configuration.""" @@ -202,7 +203,7 @@ class LLMModelConfigsRepository(BaseRepository): ) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 # Group configuration methods @@ -222,7 +223,7 @@ class LLMModelConfigsRepository(BaseRepository): .order_by(models.LLMModelConfig.created_at) ) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def get_group_default_config(self, group_id: UUID) -> Optional[models.LLMModelConfig]: """Get a group's default LLM model configuration.""" @@ -341,7 +342,7 @@ class LLMModelConfigsRepository(BaseRepository): ) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def set_group_default_config(self, group_id: UUID, config_id: UUID) -> bool: """Set a group's default LLM model configuration.""" @@ -361,7 +362,7 @@ class LLMModelConfigsRepository(BaseRepository): ) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 # Inheritance methods @@ -441,21 +442,21 @@ class LLMModelConfigsRepository(BaseRepository): ) # Select default_config with proper priority: - # 1. User's config marked with is_default: true - # 2. Group's config marked with is_default: true - # 3. First config in the list (user configs come first) - for config in configs_with_source: - if config["is_default"] and config["source"] == "user": - default_config = config + # 1. User's entry marked with is_default: true + # 2. Group's entry marked with is_default: true + # 3. First entry in the list (user configs come first) + for entry in configs_with_source: + if entry["is_default"] and entry["source"] == "user": + default_config = entry break if default_config is None: - for config in configs_with_source: - if config["is_default"] and config["source"] == "group": - default_config = config + for entry in configs_with_source: + if entry["is_default"] and entry["source"] == "group": + default_config = entry break - # Fallback to first config if no default is marked + # Fallback to first entry if no default is marked if default_config is None and configs_with_source: default_config = configs_with_source[0] From 4361598df0635e98b5e5365c166a11cc187668d5 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:19 +0300 Subject: [PATCH 117/390] fix(typing): resolve mypy errors in api.routes.controller.llm_model_configs --- .../routes/controller/llm_model_configs.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gns3server/api/routes/controller/llm_model_configs.py b/gns3server/api/routes/controller/llm_model_configs.py index 620f75c26..c36912a02 100644 --- a/gns3server/api/routes/controller/llm_model_configs.py +++ b/gns3server/api/routes/controller/llm_model_configs.py @@ -206,7 +206,11 @@ async def create_user_llm_model_config( # Extract config fields (excluding table-level fields) config_fields = config_create.model_dump(exclude={"name", "model_type", "is_default"}) new_config = await llm_repo.create_user_config( - user_id, config_create.name, config_create.model_type, config_fields, is_default=config_create.is_default + user_id, + config_create.name, + config_create.model_type, + config_fields, + is_default=bool(config_create.is_default), ) return schemas.LLMModelConfigResponse( @@ -346,6 +350,10 @@ async def set_user_default_llm_model_config( # Get the updated config config = await llm_repo.get_user_config(config_id) + if config is None: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, detail=f"LLM model configuration '{config_id}' not found" + ) return schemas.LLMModelConfigResponse( config_id=config.config_id, name=config.name, @@ -506,7 +514,11 @@ async def create_group_llm_model_config( # Extract config fields (excluding table-level fields) config_fields = config_create.model_dump(exclude={"name", "model_type", "is_default"}) new_config = await llm_repo.create_group_config( - group_id, config_create.name, config_create.model_type, config_fields, is_default=config_create.is_default + group_id, + config_create.name, + config_create.model_type, + config_fields, + is_default=bool(config_create.is_default), ) return schemas.LLMModelConfigResponse( @@ -646,6 +658,10 @@ async def set_group_default_llm_model_config( # Get the updated config config = await llm_repo.get_group_config(config_id) + if config is None: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, detail=f"LLM model configuration '{config_id}' not found" + ) return schemas.LLMModelConfigResponse( config_id=config.config_id, name=config.name, From 81474b4651855c07db3d6a047a7d0b954e129929 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:19 +0300 Subject: [PATCH 118/390] fix(typing): resolve mypy errors in db.repositories.images --- gns3server/db/models/images.py | 4 ++-- gns3server/db/repositories/images.py | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gns3server/db/models/images.py b/gns3server/db/models/images.py index 9755d8470..aff50a649 100644 --- a/gns3server/db/models/images.py +++ b/gns3server/db/models/images.py @@ -16,7 +16,7 @@ # along with this program. If not, see . from sqlalchemy import Table, Column, String, ForeignKey, BigInteger, Integer -from sqlalchemy.orm import relationship +from sqlalchemy.orm import Mapped, mapped_column, relationship from .base import Base, BaseTable, GUID @@ -34,7 +34,7 @@ class Image(BaseTable): image_id = Column(Integer, primary_key=True, autoincrement=True) filename = Column(String, index=True) - path = Column(String, unique=True) + path: Mapped[str] = mapped_column(String, unique=True, nullable=True) image_type = Column(String) image_size = Column(BigInteger) checksum = Column(String, index=True) diff --git a/gns3server/db/repositories/images.py b/gns3server/db/repositories/images.py index c709c9820..69c3aa4fc 100644 --- a/gns3server/db/repositories/images.py +++ b/gns3server/db/repositories/images.py @@ -17,8 +17,9 @@ import os -from typing import Optional, List +from typing import Optional, List, cast from sqlalchemy import select, delete, update +from sqlalchemy.engine import CursorResult from sqlalchemy.ext.asyncio import AsyncSession from .base import BaseRepository @@ -50,7 +51,7 @@ class ImagesRepository(BaseRepository): result = await self._db_session.execute(query) return result.scalars().one_or_none() - async def get_image_by_checksum(self, checksum: str, image_dir: str = None) -> Optional[models.Image]: + async def get_image_by_checksum(self, checksum: str, image_dir: Optional[str] = None) -> Optional[models.Image]: """ Get an image by its checksum. """ @@ -76,7 +77,7 @@ class ImagesRepository(BaseRepository): else: query = select(models.Image) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def get_image_templates(self, image_id: int) -> Optional[List[models.Template]]: """ @@ -86,7 +87,7 @@ class ImagesRepository(BaseRepository): query = select(models.Template).join(models.Template.images).filter(models.Image.image_id == image_id) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def add_image(self, image_name, image_type, image_size, path, checksum, checksum_algorithm) -> models.Image: """ @@ -108,7 +109,7 @@ class ImagesRepository(BaseRepository): await self._db_session.refresh(db_image) return db_image - async def update_image(self, image_path: str, checksum: str, checksum_algorithm: str) -> models.Image: + async def update_image(self, image_path: str, checksum: str, checksum_algorithm: str) -> Optional[models.Image]: """ Update an image. """ @@ -142,9 +143,9 @@ class ImagesRepository(BaseRepository): query = delete(models.Image).where(models.Image.filename == image_name) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 - async def prune_images(self, skip_images: list[str] = None) -> int: + async def prune_images(self, skip_images: Optional[list[str]] = None) -> int: """ Prune images not attached to any template. """ From bbf4e6aa2c5cf741dc224b8e8a6c73e19141cbd1 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:20 +0300 Subject: [PATCH 119/390] fix(typing): resolve mypy errors in api.routes.controller.images --- gns3server/api/routes/controller/images.py | 11 ++++++----- gns3server/db/models/images.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gns3server/api/routes/controller/images.py b/gns3server/api/routes/controller/images.py index a67c68351..65f534b8e 100644 --- a/gns3server/api/routes/controller/images.py +++ b/gns3server/api/routes/controller/images.py @@ -38,6 +38,7 @@ from gns3server.utils.images import ( default_images_directory, get_builtin_disks, ) +import gns3server.db.models as models from gns3server.db.repositories.images import ImagesRepository from gns3server.db.repositories.templates import TemplatesRepository from gns3server.db.repositories.rbac import RbacRepository @@ -68,7 +69,7 @@ async def create_qemu_image( image_path: str, image_data: schemas.QemuDiskImageCreate, images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)), -) -> schemas.Image: +) -> models.Image: """ Create a new blank Qemu image. @@ -115,7 +116,7 @@ async def create_qemu_image( async def get_images( images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)), image_type: Optional[schemas.ImageType] = None, -) -> List[schemas.Image]: +) -> List[models.Image]: """ Return all images. @@ -139,7 +140,7 @@ async def upload_image( current_user: schemas.User = Depends(get_current_active_user), rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)), install_appliances: Optional[bool] = False, -) -> schemas.Image: +) -> models.Image: """ Upload an image. @@ -256,7 +257,7 @@ async def install_images( async def get_image( image_path: str, images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)), -) -> schemas.Image: +) -> models.Image: """ Return an image. @@ -299,7 +300,7 @@ async def delete_image( templates = await images_repo.get_image_templates(image.image_id) if templates: - template_names = ", ".join([template.name for template in templates]) + template_names = ", ".join([str(template.name) for template in templates]) raise ControllerError(f"Image '{image_path}' is used by one or more templates: {template_names}") project_names = Controller.instance().find_projects_using_image(image.filename) diff --git a/gns3server/db/models/images.py b/gns3server/db/models/images.py index aff50a649..626773aad 100644 --- a/gns3server/db/models/images.py +++ b/gns3server/db/models/images.py @@ -32,7 +32,7 @@ image_template_map = Table( class Image(BaseTable): __tablename__ = "images" - image_id = Column(Integer, primary_key=True, autoincrement=True) + image_id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) filename = Column(String, index=True) path: Mapped[str] = mapped_column(String, unique=True, nullable=True) image_type = Column(String) From 323055c486c3c415a29cb686d173b983a3b0ea80 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:20 +0300 Subject: [PATCH 120/390] fix(typing): resolve mypy errors in api.routes.controller.templates --- gns3server/api/routes/controller/templates.py | 20 ++++++++++--------- gns3server/db/repositories/images.py | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gns3server/api/routes/controller/templates.py b/gns3server/api/routes/controller/templates.py index 84d55d693..3c35eea16 100644 --- a/gns3server/api/routes/controller/templates.py +++ b/gns3server/api/routes/controller/templates.py @@ -27,7 +27,7 @@ import logging log = logging.getLogger(__name__) from fastapi import APIRouter, Request, HTTPException, Depends, Response, status, Query -from typing import List, Optional +from typing import Any, List, Optional, Union from uuid import UUID from gns3server import schemas @@ -43,7 +43,9 @@ from .dependencies.authentication import get_current_active_user from .dependencies.rbac import has_privilege from .dependencies.database import get_repository -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find template"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find template"} +} router = APIRouter(responses=responses) @@ -57,7 +59,7 @@ router = APIRouter(responses=responses) async def create_template( template_create: schemas.TemplateCreate, templates_repo: TemplatesRepository = Depends(get_repository(TemplatesRepository)), -) -> schemas.Template: +) -> dict: """ Create a new template. @@ -80,7 +82,7 @@ async def get_template( request: Request, response: Response, templates_repo: TemplatesRepository = Depends(get_repository(TemplatesRepository)), -) -> schemas.Template: +) -> Union[dict, Response]: """ Return a template. @@ -108,7 +110,7 @@ async def update_template( template_id: UUID, template_update: schemas.TemplateUpdate, templates_repo: TemplatesRepository = Depends(get_repository(TemplatesRepository)), -) -> schemas.Template: +) -> dict: """ Update a template. @@ -125,7 +127,7 @@ async def delete_template( template_id: UUID, prune_images: Optional[bool] = False, templates_repo: TemplatesRepository = Depends(get_repository(TemplatesRepository)), - images_repo: RbacRepository = Depends(get_repository(ImagesRepository)), + images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)), rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)), ) -> None: """ @@ -155,7 +157,7 @@ async def delete_template( if str(template.template_id) != str(template_id) ] if other_templates: - template_names = ", ".join([template.name for template in other_templates]) + template_names = ", ".join([str(template.name) for template in other_templates]) raise ControllerError(f"Image '{image.path}' is used by one or more templates: {template_names}") if referenced_filenames is None: @@ -193,7 +195,7 @@ async def get_templates( templates_repo: TemplatesRepository = Depends(get_repository(TemplatesRepository)), current_user: schemas.User = Depends(get_current_active_user), tags: Optional[List[str]] = Query(None, description="Filter by tags (e.g. tags=vendor:cisco&tags=model:7200)"), -) -> List[schemas.Template]: +) -> List[dict]: """ Return all templates. @@ -244,7 +246,7 @@ async def get_templates( ) async def duplicate_template( template_id: UUID, templates_repo: TemplatesRepository = Depends(get_repository(TemplatesRepository)) -) -> schemas.Template: +) -> dict: """ Duplicate a template. diff --git a/gns3server/db/repositories/images.py b/gns3server/db/repositories/images.py index 69c3aa4fc..5f9b35520 100644 --- a/gns3server/db/repositories/images.py +++ b/gns3server/db/repositories/images.py @@ -79,7 +79,7 @@ class ImagesRepository(BaseRepository): result = await self._db_session.execute(query) return list(result.scalars().all()) - async def get_image_templates(self, image_id: int) -> Optional[List[models.Template]]: + async def get_image_templates(self, image_id: int) -> List[models.Template]: """ Get all templates that an image belongs to. """ From fa9d1cde80fbc872a97d825cbf66e054fe28c7e4 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:20 +0300 Subject: [PATCH 121/390] fix(typing): resolve mypy errors in db.repositories.rbac --- gns3server/db/models/roles.py | 6 ++++-- gns3server/db/repositories/rbac.py | 25 +++++++++++++------------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/gns3server/db/models/roles.py b/gns3server/db/models/roles.py index 73c29dacb..b56b6ef95 100644 --- a/gns3server/db/models/roles.py +++ b/gns3server/db/models/roles.py @@ -15,8 +15,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import uuid + from sqlalchemy import Column, String, Boolean, event -from sqlalchemy.orm import relationship +from sqlalchemy.orm import Mapped, mapped_column, relationship from .base import BaseTable, generate_uuid, GUID from .privileges import privilege_role_map @@ -29,7 +31,7 @@ log = logging.getLogger(__name__) class Role(BaseTable): __tablename__ = "roles" - role_id = Column(GUID, primary_key=True, default=generate_uuid) + role_id: Mapped[uuid.UUID] = mapped_column(GUID, primary_key=True, default=generate_uuid) name = Column(String, unique=True, index=True) description = Column(String) is_builtin = Column(Boolean, default=False) diff --git a/gns3server/db/repositories/rbac.py b/gns3server/db/repositories/rbac.py index 13bfd067c..72cb1f954 100644 --- a/gns3server/db/repositories/rbac.py +++ b/gns3server/db/repositories/rbac.py @@ -17,8 +17,9 @@ from uuid import UUID from urllib.parse import urlparse -from typing import Optional, List, Union +from typing import Optional, List, Union, cast from sqlalchemy import select, update, delete +from sqlalchemy.engine import CursorResult from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import selectinload @@ -62,9 +63,9 @@ class RbacRepository(BaseRepository): query = select(models.Role).options(selectinload(models.Role.privileges)) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) - async def create_role(self, role_create: schemas.RoleCreate) -> models.Role: + async def create_role(self, role_create: schemas.RoleCreate) -> Optional[models.Role]: """ Create a new role. """ @@ -100,7 +101,7 @@ class RbacRepository(BaseRepository): query = delete(models.Role).where(models.Role.role_id == role_id) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def add_privilege_to_role(self, role_id: UUID, privilege: models.Privilege) -> Union[None, models.Role]: """ @@ -149,7 +150,7 @@ class RbacRepository(BaseRepository): query = select(models.Privilege).join(models.Privilege.roles).filter(models.Role.role_id == role_id) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def get_privilege(self, privilege_id: UUID) -> Optional[models.Privilege]: """ @@ -176,7 +177,7 @@ class RbacRepository(BaseRepository): query = select(models.Privilege) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def get_ace(self, ace_id: UUID) -> Optional[models.ACE]: """ @@ -203,7 +204,7 @@ class RbacRepository(BaseRepository): query = select(models.ACE) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def get_aces_for_path(self, path: str) -> List[models.ACE]: """ @@ -218,7 +219,7 @@ class RbacRepository(BaseRepository): .options(selectinload(models.ACE.user), selectinload(models.ACE.group), selectinload(models.ACE.role)) ) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def check_ace_exists(self, path: str) -> bool: """ @@ -264,7 +265,7 @@ class RbacRepository(BaseRepository): query = delete(models.ACE).where(models.ACE.ace_id == ace_id) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def delete_all_ace_starting_with_path(self, path: str) -> None: """ @@ -273,7 +274,7 @@ class RbacRepository(BaseRepository): query = delete(models.ACE).where(models.ACE.path.startswith(path)).execution_options(synchronize_session=False) result = await self._db_session.execute(query) - log.debug(f"{result.rowcount} ACE(s) have been deleted") + log.debug(f"{cast(CursorResult, result).rowcount} ACE(s) have been deleted") @staticmethod def _check_path_with_aces(path: str, aces) -> bool: @@ -297,7 +298,7 @@ class RbacRepository(BaseRepository): return True # only allow if the path is the original path or the ACE is set to propagate return False - async def _get_resources_in_pools(self, aces, path: str = None) -> List[models.Resource]: + async def _get_resources_in_pools(self, aces, path: Optional[str] = None) -> List[models.Resource]: """ Get all resources in pools. """ @@ -392,7 +393,7 @@ class RbacRepository(BaseRepository): all_resources = result.scalars().all() # Precompute pool_id -> set of project_ids - pool_to_projects = {} + pool_to_projects: dict[str, set[str]] = {} for r in all_resources: if r.resource_type == "project": for pool in r.resource_pools: From 8f7b895cf446dd8284b6a7a9ec2df393734d8fb8 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:21 +0300 Subject: [PATCH 122/390] fix(typing): resolve mypy errors in db.repositories.pools --- gns3server/db/models/pools.py | 6 ++++-- gns3server/db/repositories/pools.py | 15 ++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gns3server/db/models/pools.py b/gns3server/db/models/pools.py index d8c011cbc..c22cab2f0 100644 --- a/gns3server/db/models/pools.py +++ b/gns3server/db/models/pools.py @@ -15,8 +15,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import uuid + from sqlalchemy import Table, Column, String, ForeignKey -from sqlalchemy.orm import relationship +from sqlalchemy.orm import Mapped, mapped_column, relationship from .base import Base, BaseTable, generate_uuid, GUID @@ -36,7 +38,7 @@ resource_pool_map = Table( class Resource(BaseTable): __tablename__ = "resources" - resource_id = Column(GUID, primary_key=True) + resource_id: Mapped[uuid.UUID] = mapped_column(GUID, primary_key=True) name = Column(String, unique=True, index=True) resource_type = Column(String) resource_pools = relationship("ResourcePool", secondary=resource_pool_map, back_populates="resources") diff --git a/gns3server/db/repositories/pools.py b/gns3server/db/repositories/pools.py index 90615ee68..a9144166e 100644 --- a/gns3server/db/repositories/pools.py +++ b/gns3server/db/repositories/pools.py @@ -16,8 +16,9 @@ # along with this program. If not, see . from uuid import UUID -from typing import Optional, List, Union +from typing import Optional, List, Union, cast from sqlalchemy import select, update, delete +from sqlalchemy.engine import CursorResult from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import selectinload @@ -52,7 +53,7 @@ class ResourcePoolsRepository(BaseRepository): query = select(models.Resource) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def create_resource(self, resource: schemas.ResourceCreate) -> models.Resource: """ @@ -75,7 +76,7 @@ class ResourcePoolsRepository(BaseRepository): query = delete(models.Resource).where(models.Resource.resource_id == resource_id) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def get_resource_memberships(self, resource_id: UUID) -> List[models.ResourcePool]: """ @@ -89,7 +90,7 @@ class ResourcePoolsRepository(BaseRepository): ) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def get_resource_pool(self, resource_pool_id: UUID) -> Optional[models.ResourcePool]: """ @@ -116,7 +117,7 @@ class ResourcePoolsRepository(BaseRepository): query = select(models.ResourcePool) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def create_resource_pool(self, resource_pool: schemas.ResourcePoolCreate) -> models.ResourcePool: """ @@ -166,7 +167,7 @@ class ResourcePoolsRepository(BaseRepository): query = delete(models.ResourcePool).where(models.ResourcePool.resource_pool_id == resource_pool_id) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def add_resource_to_pool( self, resource_pool_id: UUID, resource: models.Resource @@ -225,4 +226,4 @@ class ResourcePoolsRepository(BaseRepository): ) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) From adf9c15e21cb686f79ff9714d568a5950877a21a Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:21 +0300 Subject: [PATCH 123/390] fix(typing): resolve mypy errors in api.routes.controller.projects --- gns3server/api/routes/controller/projects.py | 22 +++++++++++--------- gns3server/db/models/pools.py | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/gns3server/api/routes/controller/projects.py b/gns3server/api/routes/controller/projects.py index 19c29eead..378a276b8 100644 --- a/gns3server/api/routes/controller/projects.py +++ b/gns3server/api/routes/controller/projects.py @@ -34,7 +34,7 @@ from fastapi import APIRouter, Depends, Request, Body, HTTPException, status, We from fastapi.encoders import jsonable_encoder from fastapi.responses import StreamingResponse, FileResponse from websockets.exceptions import ConnectionClosed, WebSocketException -from typing import List, Optional +from typing import Any, List, Optional from uuid import UUID from gns3server import schemas @@ -57,7 +57,9 @@ from .dependencies.rbac import has_privilege, has_privilege_on_websocket from .dependencies.authentication import get_current_active_user from .dependencies.database import get_repository -responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project"}} +responses: dict[int | str, dict[str, Any]] = { + 404: {"model": schemas.ErrorMessage, "description": "Could not find project"} +} router = APIRouter(responses=responses) @@ -636,8 +638,8 @@ async def export_project( include_images: bool = False, reset_mac_addresses: bool = False, keep_compute_ids: bool = False, - compression: schemas.ProjectCompression = "zstd", - compression_level: int = None, + compression: schemas.ProjectCompression = schemas.ProjectCompression.zstd, + compression_level: Optional[int] = None, ) -> StreamingResponse: """ Export a project as a portable archive. @@ -650,19 +652,19 @@ async def export_project( compression_query = compression.lower() if compression_query == "zip": - compression = zipfile.ZIP_DEFLATED + zip_compression = zipfile.ZIP_DEFLATED if compression_level is not None and (compression_level < 0 or compression_level > 9): raise ControllerBadRequestError("Compression level must be between 0 and 9 for ZIP compression") elif compression_query == "none": - compression = zipfile.ZIP_STORED + zip_compression = zipfile.ZIP_STORED elif compression_query == "bzip2": - compression = zipfile.ZIP_BZIP2 + zip_compression = zipfile.ZIP_BZIP2 if compression_level is not None and (compression_level < 1 or compression_level > 9): raise ControllerBadRequestError("Compression level must be between 1 and 9 for BZIP2 compression") elif compression_query == "lzma": - compression = zipfile.ZIP_LZMA + zip_compression = zipfile.ZIP_LZMA elif compression_query == "zstd": - compression = zipfile.ZIP_ZSTANDARD + zip_compression = zipfile.ZIP_ZSTANDARD if compression_level is not None and (compression_level < 1 or compression_level > 22): raise ControllerBadRequestError("Compression level must be between 1 and 22 for Zstandard compression") @@ -681,7 +683,7 @@ async def export_project( f"Exporting project '{project.name}' with '{compression_query}' compression (level {compression_level})" ) with tempfile.TemporaryDirectory(dir=working_dir) as tmpdir: - with aiozipstream.ZipFile(compression=compression, compresslevel=compression_level) as zstream: + with aiozipstream.ZipFile(compression=zip_compression, compresslevel=compression_level) as zstream: await export_controller_project( zstream, project, diff --git a/gns3server/db/models/pools.py b/gns3server/db/models/pools.py index c22cab2f0..cd6616429 100644 --- a/gns3server/db/models/pools.py +++ b/gns3server/db/models/pools.py @@ -47,6 +47,6 @@ class Resource(BaseTable): class ResourcePool(BaseTable): __tablename__ = "resource_pools" - resource_pool_id = Column(GUID, primary_key=True, default=generate_uuid) + resource_pool_id: Mapped[uuid.UUID] = mapped_column(GUID, primary_key=True, default=generate_uuid) name = Column(String, unique=True, index=True) resources = relationship("Resource", secondary=resource_pool_map, back_populates="resource_pools") From bacfab84651bdd767b516a1fa41a9179629b87d4 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:21 +0300 Subject: [PATCH 124/390] fix(typing): resolve mypy errors in api.routes.controller.pools --- gns3server/api/routes/controller/pools.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/gns3server/api/routes/controller/pools.py b/gns3server/api/routes/controller/pools.py index a5ef8e8b5..882c05264 100644 --- a/gns3server/api/routes/controller/pools.py +++ b/gns3server/api/routes/controller/pools.py @@ -21,12 +21,13 @@ API routes for resource pools. from fastapi import APIRouter, Depends, status from uuid import UUID -from typing import List +from typing import List, Optional from gns3server import schemas from gns3server.controller.controller_error import ControllerError, ControllerBadRequestError, ControllerNotFoundError from gns3server.controller import Controller +import gns3server.db.models as models from gns3server.db.repositories.rbac import RbacRepository from gns3server.db.repositories.pools import ResourcePoolsRepository @@ -43,7 +44,7 @@ router = APIRouter() @router.get("", response_model=List[schemas.ResourcePool], dependencies=[Depends(has_privilege("Pool.Audit"))]) async def get_resource_pools( pools_repo: ResourcePoolsRepository = Depends(get_repository(ResourcePoolsRepository)), -) -> List[schemas.ResourcePool]: +) -> List[models.ResourcePool]: """ Get all resource pools. @@ -62,7 +63,7 @@ async def get_resource_pools( async def create_resource_pool( resource_pool_create: schemas.ResourcePoolCreate, pools_repo: ResourcePoolsRepository = Depends(get_repository(ResourcePoolsRepository)), -) -> schemas.ResourcePool: +) -> models.ResourcePool: """ Create a new resource pool @@ -80,7 +81,7 @@ async def create_resource_pool( ) async def get_resource_pool( resource_pool_id: UUID, pools_repo: ResourcePoolsRepository = Depends(get_repository(ResourcePoolsRepository)) -) -> schemas.ResourcePool: +) -> models.ResourcePool: """ Get a resource pool. @@ -100,7 +101,7 @@ async def update_resource_pool( resource_pool_id: UUID, resource_pool_update: schemas.ResourcePoolUpdate, pools_repo: ResourcePoolsRepository = Depends(get_repository(ResourcePoolsRepository)), -) -> schemas.ResourcePool: +) -> Optional[models.ResourcePool]: """ Update a resource pool. @@ -176,7 +177,7 @@ async def delete_resource_pool( async def get_pool_resources( resource_pool_id: UUID, pools_repo: ResourcePoolsRepository = Depends(get_repository(ResourcePoolsRepository)), -) -> List[schemas.Resource]: +) -> List[models.Resource]: """ Get all resource in a pool. @@ -215,13 +216,13 @@ async def add_resource_to_pool( # we only support projects in resource pools for now project = Controller.instance().get_project(str(resource_id)) - resource = await pools_repo.get_resource(resource_id) - if not resource: + db_resource = await pools_repo.get_resource(resource_id) + if not db_resource: # the resource is not in the database yet, create it resource_create = schemas.ResourceCreate(resource_id=resource_id, resource_type="project", name=project.name) - resource = await pools_repo.create_resource(resource_create) + db_resource = await pools_repo.create_resource(resource_create) - await pools_repo.add_resource_to_pool(resource_pool_id, resource) + await pools_repo.add_resource_to_pool(resource_pool_id, db_resource) @router.delete( From 2fe4e39715c54c75018821f702d77274bfdd9852 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:22 +0300 Subject: [PATCH 125/390] fix(typing): resolve mypy errors in db.repositories.api_keys --- gns3server/db/repositories/api_keys.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gns3server/db/repositories/api_keys.py b/gns3server/db/repositories/api_keys.py index d43d44dd1..1cbfdf25b 100644 --- a/gns3server/db/repositories/api_keys.py +++ b/gns3server/db/repositories/api_keys.py @@ -15,9 +15,10 @@ # along with this program. If not, see . from uuid import UUID -from typing import Optional, List +from typing import Optional, List, cast from datetime import datetime, timezone from sqlalchemy import select, update, delete, func +from sqlalchemy.engine import CursorResult from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import selectinload @@ -67,13 +68,13 @@ class ApiKeysRepository(BaseRepository): query = update(models.ApiKey).where(models.ApiKey.api_key_id == api_key_id).values(revoked=True) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def restore_api_key(self, api_key_id: UUID) -> bool: query = update(models.ApiKey).where(models.ApiKey.api_key_id == api_key_id).values(revoked=False) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def update_last_used(self, api_key_id: UUID) -> None: query = update(models.ApiKey).where(models.ApiKey.api_key_id == api_key_id).values(last_used_at=func.now()) @@ -84,4 +85,4 @@ class ApiKeysRepository(BaseRepository): query = delete(models.ApiKey).where(models.ApiKey.api_key_id == api_key_id) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 From 36945daa8377f9c18d40ffd6fdc0ec3992f53dba Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:22 +0300 Subject: [PATCH 126/390] fix(typing): resolve mypy errors in db.repositories.computes --- gns3server/db/repositories/computes.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gns3server/db/repositories/computes.py b/gns3server/db/repositories/computes.py index 5747fbf03..df9e5932d 100644 --- a/gns3server/db/repositories/computes.py +++ b/gns3server/db/repositories/computes.py @@ -19,6 +19,8 @@ from uuid import UUID from typing import Optional, List, Union from sqlalchemy import select, update, delete from sqlalchemy.ext.asyncio import AsyncSession +from sqlalchemy.engine import CursorResult +from typing import cast from .base import BaseRepository @@ -47,7 +49,7 @@ class ComputesRepository(BaseRepository): query = select(models.Compute) result = await self._db_session.execute(query) - return result.scalars().all() + return list(result.scalars().all()) async def create_compute(self, compute_create: schemas.ComputeCreate) -> models.Compute: @@ -58,7 +60,7 @@ class ComputesRepository(BaseRepository): host=compute_create.host, port=compute_create.port, user=compute_create.user, - password=compute_create.password.get_secret_value(), + password=compute_create.password.get_secret_value() if compute_create.password else None, ) self._db_session.add(db_compute) await self._db_session.commit() @@ -87,4 +89,4 @@ class ComputesRepository(BaseRepository): query = delete(models.Compute).where(models.Compute.compute_id == compute_id) result = await self._db_session.execute(query) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 From 0954723ebd56432e153c638b55ac144fc31312ed Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:22 +0300 Subject: [PATCH 127/390] fix(typing): resolve mypy errors in schemas.controller.computes --- gns3server/schemas/controller/computes.py | 19 +++++++++++-------- gns3server/services/computes.py | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gns3server/schemas/controller/computes.py b/gns3server/schemas/controller/computes.py index 1c87d95a0..f8612f43d 100644 --- a/gns3server/schemas/controller/computes.py +++ b/gns3server/schemas/controller/computes.py @@ -38,10 +38,10 @@ class ComputeBase(BaseModel): Data to create a compute. """ - protocol: Protocol - host: str - port: int = Field(..., gt=0, le=65535) - user: str = None + protocol: Optional[Protocol] = None + host: Optional[str] = None + port: Optional[int] = Field(None, gt=0, le=65535) + user: Optional[str] = None password: Optional[SecretStr] = None name: Optional[str] = None model_config = ConfigDict(use_enum_values=True) @@ -52,7 +52,10 @@ class ComputeCreate(ComputeBase): Data to create a compute. """ - compute_id: Union[str, uuid.UUID] = None + protocol: Protocol + host: str + port: int = Field(..., gt=0, le=65535) + compute_id: Optional[Union[str, uuid.UUID]] = None model_config = ConfigDict( json_schema_extra={ "example": {"name": "My compute", "host": "127.0.0.1", "port": 3080, "user": "user", "password": "password"} @@ -77,9 +80,6 @@ class ComputeUpdate(ComputeBase): Data to update a compute. """ - protocol: Optional[Protocol] = None - host: Optional[str] = None - port: Optional[int] = Field(None, gt=0, le=65535) user: Optional[str] = None password: Optional[SecretStr] = None model_config = ConfigDict( @@ -110,6 +110,9 @@ class Compute(DateTimeModelMixin, ComputeBase): Data returned for a compute. """ + protocol: Protocol + host: str + port: int = Field(..., gt=0, le=65535) compute_id: Union[str, uuid.UUID] name: str connected: Optional[bool] = Field(None, description="Whether the controller is connected to the compute or not") diff --git a/gns3server/services/computes.py b/gns3server/services/computes.py index a97c8fcf4..c3e3dad80 100644 --- a/gns3server/services/computes.py +++ b/gns3server/services/computes.py @@ -43,7 +43,7 @@ class ComputesService: async def create_compute(self, compute_create: schemas.ComputeCreate, connect: bool = False) -> models.Compute: - if await self._computes_repo.get_compute(compute_create.compute_id): + if compute_create.compute_id and await self._computes_repo.get_compute(compute_create.compute_id): raise ControllerBadRequestError(f"Compute '{compute_create.compute_id}' is already registered") db_compute = await self._computes_repo.create_compute(compute_create) compute = await self._controller.add_compute( From 783f243230c368fd645960e9f062f42bc8a80157 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:23 +0300 Subject: [PATCH 128/390] fix(typing): resolve mypy errors in controller.appliance_manager --- gns3server/controller/appliance_manager.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gns3server/controller/appliance_manager.py b/gns3server/controller/appliance_manager.py index 3bf0a302c..53dacadcf 100644 --- a/gns3server/controller/appliance_manager.py +++ b/gns3server/controller/appliance_manager.py @@ -21,7 +21,7 @@ import asyncio import platformdirs -from typing import Tuple, List +from typing import List, Optional, Tuple from aiohttp.client_exceptions import ClientError from uuid import UUID @@ -210,7 +210,7 @@ class ApplianceManager: log.info(f"Template '{template.get('name')}' has been created") return template - async def _appliance_to_template(self, appliance: Appliance, version: str = None) -> dict: + async def _appliance_to_template(self, appliance: Appliance, version: Optional[dict] = None) -> dict: """ Get template data from appliance """ @@ -314,7 +314,7 @@ class ApplianceManager: templates_repo: TemplatesRepository, rbac_repo: RbacRepository, current_user: schemas.User, - ) -> None: + ) -> dict: """ Install a new appliance """ @@ -362,7 +362,7 @@ class ApplianceManager: template_data = await self._appliance_to_template(appliance) return await self._create_template(template_data, templates_repo, rbac_repo, current_user) - def load_appliances(self, symbol_theme: str = None) -> None: + def load_appliances(self, symbol_theme: Optional[str] = None) -> None: """ Loads appliance files from disk. """ @@ -403,7 +403,7 @@ class ApplianceManager: print(f"Cannot load appliance file '{path}': {e}") continue - def _get_default_symbol(self, appliance: dict, symbol_theme: str) -> str: + def _get_default_symbol(self, appliance: dict, symbol_theme: Optional[str]) -> str: """ Returns the default symbol for a given appliance. """ From 472c1b61fdd26316fa1ae5d1546feda10f9faa89 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:23 +0300 Subject: [PATCH 129/390] fix(typing): resolve mypy errors in controller.project --- gns3server/controller/project.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py index 00906bc42..ad42e9323 100644 --- a/gns3server/controller/project.py +++ b/gns3server/controller/project.py @@ -479,10 +479,6 @@ class Project: def path(self): return self._path - @property - def status(self): - return self._status - @path.setter def path(self, path): check_path_allowed(path) @@ -510,6 +506,10 @@ class Project: self._path = path + @property + def status(self): + return self._status + @property def captures_directory(self): """ From eae69bd5c5603776651ff9103470eb54cae96d87 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:23 +0300 Subject: [PATCH 130/390] fix(typing): resolve mypy errors in compute.virtualbox.virtualbox_vm --- gns3server/compute/virtualbox/virtualbox_vm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gns3server/compute/virtualbox/virtualbox_vm.py b/gns3server/compute/virtualbox/virtualbox_vm.py index 6c9fb6154..8cb9f8016 100644 --- a/gns3server/compute/virtualbox/virtualbox_vm.py +++ b/gns3server/compute/virtualbox/virtualbox_vm.py @@ -1050,7 +1050,11 @@ class VirtualBoxVM(BaseNode): await self._stop_remote_console() await self._start_console() - @BaseNode.console_type.setter + @property + def console_type(self): + return self._console_type + + @console_type.setter def console_type(self, new_console_type): """ Sets the console type for this VirtualBox VM. From 98097a7f8ff7e8a23794eeb40434011b5d7691bb Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Tue, 29 Sep 2026 22:02:24 +0300 Subject: [PATCH 131/390] chore: drop the mypy baseline ignore list (no modules left) --- pyproject.toml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b29dd6a4d..f979b5eb3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -290,28 +290,3 @@ warn_unused_ignores = true strict_equality = true enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] -[[tool.mypy.overrides]] -# Baseline: modules with existing type errors (error count at baseline time). -# Remove modules from this list one small PR at a time. Never add new ones. -module = [ - "gns3server.api.routes.controller.images", # 9 - "gns3server.api.routes.controller.llm_model_configs", # 32 - "gns3server.api.routes.controller.pools", # 8 - "gns3server.api.routes.controller.projects", # 16 - "gns3server.api.routes.controller.templates", # 10 - "gns3server.api.routes.controller.users", # 14 - "gns3server.compute.virtualbox.virtualbox_vm", # 1 - "gns3server.controller.appliance_manager", # 5 - "gns3server.controller.project", # 2 - "gns3server.db.repositories.api_keys", # 8 - "gns3server.db.repositories.computes", # 10 - "gns3server.db.repositories.images", # 14 - "gns3server.db.repositories.llm_model_configs", # 32 - "gns3server.db.repositories.pools", # 11 - "gns3server.db.repositories.rbac", # 14 - "gns3server.db.repositories.templates", # 6 - "gns3server.db.repositories.users", # 12 - "gns3server.db.tasks", # 12 - "gns3server.schemas.controller.computes", # 6 -] -ignore_errors = true From 285af128f2c8a2f6bce485c1a4648432cfedb92d Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 1 Oct 2026 14:53:54 +0200 Subject: [PATCH 132/390] fix: ignore S324 error in tests --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f979b5eb3..9c76a1d74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -277,6 +277,8 @@ extend-immutable-calls = [ "tests/test_utils.py" = ["F403", "F405"] "tests/utils/test_asyncio.py" = ["B017"] "tests/utils/test_packet_filter_validation.py" = ["W292"] +"tests/tests/services/test_image_reconciliation.py" = ["S324"] + [tool.mypy] From 1456d36bf06fce0eaab412db715f6ee3bd6497e8 Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 1 Oct 2026 15:22:17 +0200 Subject: [PATCH 133/390] chore(tests): fix mypy errors --- gns3server/api/routes/controller/images.py | 2 +- gns3server/db/repositories/images.py | 7 ++++--- gns3server/db/tasks.py | 2 +- gns3server/utils/images.py | 15 +++++++++------ pyproject.toml | 4 +--- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/gns3server/api/routes/controller/images.py b/gns3server/api/routes/controller/images.py index 6141e4152..0496e29ee 100644 --- a/gns3server/api/routes/controller/images.py +++ b/gns3server/api/routes/controller/images.py @@ -110,7 +110,7 @@ async def create_qemu_image( image_path: str, image_data: schemas.QemuDiskImageCreate, images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)), -) -> models.Image: +) -> Optional[models.Image]: """ Create a new blank Qemu image. diff --git a/gns3server/db/repositories/images.py b/gns3server/db/repositories/images.py index e2d0f2401..1d52295e7 100644 --- a/gns3server/db/repositories/images.py +++ b/gns3server/db/repositories/images.py @@ -154,7 +154,7 @@ class ImagesRepository(BaseRepository): await self._db_session.refresh(image_db) # force refresh of updated_at value return image_db - async def save_verified_image(self, info: dict) -> models.Image: + async def save_verified_image(self, info: dict) -> Optional[models.Image]: """Upsert an exact path, preserving template associations and the image ID. Callers coordinate publication/inspection with image_lock(). Each commit @@ -217,11 +217,12 @@ class ImagesRepository(BaseRepository): except Exception: await self._db_session.rollback() raise + return None async def delete_image_exact(self, image_id: int) -> bool: result = await self._db_session.execute(delete(models.Image).where(models.Image.image_id == image_id)) await self._db_session.commit() - return result.rowcount > 0 + return cast(CursorResult, result).rowcount > 0 async def delete_image(self, image_path: str) -> bool: """ @@ -246,7 +247,7 @@ class ImagesRepository(BaseRepository): await self._db_session.commit() return cast(CursorResult, result).rowcount > 0 - async def prune_images(self, skip_images: Optional[list[str]] = None, is_in_use: Optional[Callable] = None) -> int: + async def prune_images(self, skip_images: Optional[list[str]] = None, is_in_use: Optional[Callable] = None) -> int: """ Prune images not attached to any template. """ diff --git a/gns3server/db/tasks.py b/gns3server/db/tasks.py index b3f762021..64f3f2673 100644 --- a/gns3server/db/tasks.py +++ b/gns3server/db/tasks.py @@ -203,7 +203,7 @@ async def update_disk_checksums(updated_disks: List[str]) -> None: repository = ImagesRepository(db_session) image = await repository.get_image(path) if image: - info = await read_image_info(path, image.image_type, allow_raw_image=True) + info = await read_image_info(path, str(image.image_type), allow_raw_image=True) try: os.unlink(path + ".md5sum") except FileNotFoundError: diff --git a/gns3server/utils/images.py b/gns3server/utils/images.py index fa4be5cb7..e2c458e1b 100644 --- a/gns3server/utils/images.py +++ b/gns3server/utils/images.py @@ -164,7 +164,7 @@ def inspect_image_file(path, expected_image_type=None, allow_raw_image=False, st ) -async def read_image_info(path: str, expected_image_type: str = None, allow_raw_image=False) -> dict: +async def read_image_info(path: str, expected_image_type: str | None = None, allow_raw_image=False) -> dict: try: return await asyncio.to_thread(inspect_image_file, path, expected_image_type, allow_raw_image) except OSError as e: @@ -376,7 +376,7 @@ async def write_image( break if len(prefix) < 7: raise InvalidImageError("The image content is empty or too small to be valid") - image_type = check_valid_image_header(image_path, prefix, allow_raw_image or not check_image_header) + image_type = check_valid_image_header(image_path, bytes(prefix), allow_raw_image or not check_image_header) if not image_dir: image_path = os.path.abspath(os.path.join(default_images_directory(image_type), image_name)) root = os.path.realpath(os.path.expanduser(Config.instance().settings.Server.images_path)) @@ -399,8 +399,8 @@ async def write_image( raise InvalidImageError( f"File '{image_path}' already exists, please choose a different name or remove the existing image" ) - checksum = checksum.hexdigest() - duplicate_image = await images_repo.get_image_by_checksum(checksum, os.path.dirname(image_path)) + checksum_str: str = checksum.hexdigest() + duplicate_image = await images_repo.get_image_by_checksum(checksum_str, os.path.dirname(image_path)) if duplicate_image: raise InvalidImageError( f"Image '{duplicate_image.filename}' with the same checksum " @@ -410,17 +410,20 @@ async def write_image( publish_image(tmp_path, image_path) # Complete files survive a database failure so the next scan can # recover them. Never compensate by unlinking a published image. - return await images_repo.save_verified_image( + image = await images_repo.save_verified_image( dict( image_name=image_name, image_type=image_type, image_size=image_size, path=image_path, - checksum=checksum, + checksum=checksum_str, checksum_algorithm="md5", file_fingerprint=fingerprint(image_path), ) ) + if image is None: + raise InvalidImageError(f"Failed to save image '{image_name}' to database") + return image finally: try: if os.path.exists(tmp_path): diff --git a/pyproject.toml b/pyproject.toml index 9c76a1d74..07c46dc7a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -277,9 +277,7 @@ extend-immutable-calls = [ "tests/test_utils.py" = ["F403", "F405"] "tests/utils/test_asyncio.py" = ["B017"] "tests/utils/test_packet_filter_validation.py" = ["W292"] -"tests/tests/services/test_image_reconciliation.py" = ["S324"] - - +"tests/services/test_image_reconciliation.py" = ["S324"] [tool.mypy] files = ["gns3server"] From be3da6f3727625c535ca4c6c1dbad9899bb3b6da Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 1 Oct 2026 16:28:26 +0200 Subject: [PATCH 134/390] fix: require Python >= 3.10 in remote-install.sh when installing v3 --- scripts/remote-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/remote-install.sh b/scripts/remote-install.sh index bc16f4658..6786bdd39 100644 --- a/scripts/remote-install.sh +++ b/scripts/remote-install.sh @@ -117,8 +117,8 @@ done if [ "$REPOSITORY" == "ppa-v3" ] then - if ! python3 -c 'import sys; assert sys.version_info >= (3,9)' > /dev/null 2>&1; then - echo "GNS3 version >= 3.0 requires Python 3.9 or later" + if ! python3 -c 'import sys; assert sys.version_info >= (3,10)' > /dev/null 2>&1; then + echo "GNS3 version >= 3.1 requires Python 3.10 or later" exit 1 fi fi From 9e5ab021473c25fc39b4d92cab88616a4d12dac1 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Wed, 30 Sep 2026 20:45:42 +0300 Subject: [PATCH 135/390] style: remove unused noqa directives --- gns3server/agent/gns3_copilot/agent/context_manager.py | 4 ++-- .../agent/gns3_copilot/tools_v2/config_tools_nornir.py | 2 +- .../gns3_copilot/tools_v2/display_tools_nornir.py | 2 +- .../agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py | 2 +- .../gns3_copilot/utils/custom_netmiko/__init__.py | 6 +++--- .../utils/custom_netmiko/tests/test_huawei_ce.py | 2 +- .../utils/custom_netmiko/tests/test_ruijie_telnet.py | 4 ++-- .../utils/custom_netmiko/tests/test_vpcs_telnet.py | 10 +++++----- .../agent/gns3_copilot/utils/gns3_drawing_utils.py | 6 +++--- gns3server/api/routes/controller/netmiko.py | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gns3server/agent/gns3_copilot/agent/context_manager.py b/gns3server/agent/gns3_copilot/agent/context_manager.py index 5337c3d95..419e7785c 100644 --- a/gns3server/agent/gns3_copilot/agent/context_manager.py +++ b/gns3server/agent/gns3_copilot/agent/context_manager.py @@ -391,10 +391,10 @@ def create_pre_model_hook( max_tokens_for_trim = max_input_tokens - tool_tokens # Validate budget and provide actionable warnings - if system_tokens + tool_tokens > max_input_tokens: # noqa: E501 + if system_tokens + tool_tokens > max_input_tokens: logger.error( "System prompt (%d tokens) + tools (%d tokens) EXCEED input " - "budget (%d tokens). This will likely cause LLM call failures. " # noqa: E501 + "budget (%d tokens). This will likely cause LLM call failures. " "Recommendations: 1) Reduce system prompt length, 2) Reduce " "number of tools, 3) Use a model with larger context window, " "or 4) Switch to 'conservative' strategy.", diff --git a/gns3server/agent/gns3_copilot/tools_v2/config_tools_nornir.py b/gns3server/agent/gns3_copilot/tools_v2/config_tools_nornir.py index ed15f0589..6b96e6202 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/config_tools_nornir.py +++ b/gns3server/agent/gns3_copilot/tools_v2/config_tools_nornir.py @@ -57,7 +57,7 @@ from gns3server.agent.gns3_copilot.utils.command_filter import ( # Import custom Netmiko device types for GNS3 emulation # This registers gns3_huawei_telnet_ce and other custom device types # NOTE: Must be imported BEFORE any Nornir operations to ensure device types are registered -from gns3server.agent.gns3_copilot.utils import custom_netmiko # noqa: F401 +from gns3server.agent.gns3_copilot.utils import custom_netmiko # Explicitly register custom device types to ensure they are available # This is a safety measure in case the auto-registration on import doesn't work diff --git a/gns3server/agent/gns3_copilot/tools_v2/display_tools_nornir.py b/gns3server/agent/gns3_copilot/tools_v2/display_tools_nornir.py index a8eb41bc4..206ca10ea 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/display_tools_nornir.py +++ b/gns3server/agent/gns3_copilot/tools_v2/display_tools_nornir.py @@ -57,7 +57,7 @@ from gns3server.agent.gns3_copilot.utils.command_filter import ( # Import custom Netmiko device types for GNS3 emulation # This registers gns3_huawei_telnet_ce and other custom device types # NOTE: Must be imported BEFORE any Nornir operations to ensure device types are registered -from gns3server.agent.gns3_copilot.utils import custom_netmiko # noqa: F401 +from gns3server.agent.gns3_copilot.utils import custom_netmiko # Explicitly register custom device types to ensure they are available # This is a safety measure in case the auto-registration on import doesn't work diff --git a/gns3server/agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py b/gns3server/agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py index 1315730c7..d9186d2d4 100644 --- a/gns3server/agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py +++ b/gns3server/agent/gns3_copilot/tools_v2/vpcs_tools_netmiko.py @@ -54,7 +54,7 @@ from gns3server.agent.gns3_copilot.utils import get_device_ports_from_topology # Import custom Netmiko device types for GNS3 emulation # This registers gns3_vpcs_telnet and other custom device types # NOTE: Must be imported BEFORE any Nornir operations to ensure device types are registered -from gns3server.agent.gns3_copilot.utils import custom_netmiko # noqa: F401 +from gns3server.agent.gns3_copilot.utils import custom_netmiko # Explicitly register VPCS device type to ensure it is available try: diff --git a/gns3server/agent/gns3_copilot/utils/custom_netmiko/__init__.py b/gns3server/agent/gns3_copilot/utils/custom_netmiko/__init__.py index 1aea7adf8..9cad247ca 100644 --- a/gns3server/agent/gns3_copilot/utils/custom_netmiko/__init__.py +++ b/gns3server/agent/gns3_copilot/utils/custom_netmiko/__init__.py @@ -61,17 +61,17 @@ logger = logging.getLogger(__name__) # Import all custom drivers (auto-registers them with Netmiko) try: - from . import huawei_ce # noqa: F401 + from . import huawei_ce except Exception as e: logger.warning(f"Failed to import Huawei CE driver: {e}", exc_info=True) try: - from .ruijie_telnet import RuijieTelnetEnhanced # noqa: F401 + from .ruijie_telnet import RuijieTelnetEnhanced except Exception as e: logger.warning(f"Failed to import Ruijie driver: {e}", exc_info=True) try: - from . import vpcs_telnet # noqa: F401 + from . import vpcs_telnet except Exception as e: logger.warning(f"Failed to import VPCS driver: {e}", exc_info=True) diff --git a/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_huawei_ce.py b/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_huawei_ce.py index c6b6db344..62343c3ef 100644 --- a/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_huawei_ce.py +++ b/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_huawei_ce.py @@ -157,7 +157,7 @@ class TestHuaweiTelnetCEIntegration(unittest.TestCase): def test_mock_telnet_connection(self): """Test telnet_login logic with mocked connection.""" - from gns3server.agent.gns3_copilot.utils.custom_netmiko.huawei_ce import ( # noqa: E501 + from gns3server.agent.gns3_copilot.utils.custom_netmiko.huawei_ce import ( GNS3HuaweiTelnetCE, ) diff --git a/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_ruijie_telnet.py b/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_ruijie_telnet.py index dfef81823..adfbafea2 100644 --- a/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_ruijie_telnet.py +++ b/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_ruijie_telnet.py @@ -178,7 +178,7 @@ class TestRuijieTelnetEnhancedIntegration(unittest.TestCase): def test_send_config_set_calls_preprocess(self): """Test that send_config_set calls preprocessing.""" - from gns3server.agent.gns3_copilot.utils.custom_netmiko.ruijie_telnet import ( # noqa: E501 + from gns3server.agent.gns3_copilot.utils.custom_netmiko.ruijie_telnet import ( RuijieTelnetEnhanced, ) @@ -205,7 +205,7 @@ class TestRuijieTelnetEnhancedIntegration(unittest.TestCase): def test_multiple_interactive_patterns(self): """Test that multiple interactive commands are detected.""" - from gns3server.agent.gns3_copilot.utils.custom_netmiko.ruijie_telnet import ( # noqa: E501 + from gns3server.agent.gns3_copilot.utils.custom_netmiko.ruijie_telnet import ( RuijieTelnetEnhanced, ) diff --git a/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_vpcs_telnet.py b/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_vpcs_telnet.py index 4659465cd..f24565d85 100644 --- a/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_vpcs_telnet.py +++ b/gns3server/agent/gns3_copilot/utils/custom_netmiko/tests/test_vpcs_telnet.py @@ -116,7 +116,7 @@ class TestVPCSTelnetInit(unittest.TestCase): @classmethod def setUpClass(cls): """Set up test fixtures.""" - from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501 + from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( VPCSTelnet, ) @@ -165,7 +165,7 @@ class TestVPCSTelnetMethods(unittest.TestCase): @classmethod def setUpClass(cls): """Set up test fixtures.""" - from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501 + from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( VPCSTelnet, ) @@ -208,7 +208,7 @@ class TestVPCSTelnetSendCommand(unittest.TestCase): @classmethod def setUpClass(cls): """Set up test fixtures.""" - from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501 + from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( VPCSTelnet, ) @@ -273,7 +273,7 @@ class TestVPCSTelnetTelnetLogin(unittest.TestCase): @classmethod def setUpClass(cls): """Set up test fixtures.""" - from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501 + from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( VPCSTelnet, ) @@ -353,7 +353,7 @@ class TestVPCSTelnetAnsiStripping(unittest.TestCase): @classmethod def setUpClass(cls): """Set up test fixtures.""" - from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501 + from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( VPCSTelnet, ) diff --git a/gns3server/agent/gns3_copilot/utils/gns3_drawing_utils.py b/gns3server/agent/gns3_copilot/utils/gns3_drawing_utils.py index a28278744..4fa48ee7d 100644 --- a/gns3server/agent/gns3_copilot/utils/gns3_drawing_utils.py +++ b/gns3server/agent/gns3_copilot/utils/gns3_drawing_utils.py @@ -238,7 +238,7 @@ def generate_ellipse_svg( svg_height: int, ) -> str: """Generate SVG for ellipse.""" - return f"""""" # noqa: E501 + return f"""""" def generate_rectangle_svg( @@ -247,7 +247,7 @@ def generate_rectangle_svg( color_scheme: dict[str, Any], ) -> str: """Generate SVG for rectangle.""" - return f"""""" # noqa: E501 + return f"""""" def generate_text_svg(text: str, color_scheme: dict[str, Any]) -> str: @@ -255,7 +255,7 @@ def generate_text_svg(text: str, color_scheme: dict[str, Any]) -> str: text_width = len(text) * 8 + 20 text_height = DEFAULT_FONT_SIZE + 16 - return f"""{text}""" # noqa: E501 + return f"""{text}""" def _hsv_to_hex(h: int, s: int, v: int) -> str: diff --git a/gns3server/api/routes/controller/netmiko.py b/gns3server/api/routes/controller/netmiko.py index 827ac751c..44c9c9f42 100644 --- a/gns3server/api/routes/controller/netmiko.py +++ b/gns3server/api/routes/controller/netmiko.py @@ -64,7 +64,7 @@ def _load_netmiko_device_types() -> schemas.NetmikoDeviceTypeList: # imported them yet); failures are logged by the package itself, do not # fail the whole endpoint. try: - from gns3server.agent.gns3_copilot.utils import custom_netmiko # noqa: F401 + from gns3server.agent.gns3_copilot.utils import custom_netmiko except Exception as e: log.warning(f"Could not register GNS3-copilot custom Netmiko drivers: {e}") From 06e98f8b5561cca01451ae4669b71cb83086439e Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Wed, 30 Sep 2026 20:45:43 +0300 Subject: [PATCH 136/390] style: drop redundant utf-8 coding declarations --- gns3server/controller/appliance_to_template.py | 1 - scripts/welcome.py | 1 - tests/api/routes/compute/test_capabilities.py | 1 - tests/api/routes/compute/test_cloud_nodes.py | 1 - tests/api/routes/compute/test_compute.py | 1 - tests/api/routes/compute/test_docker_nodes.py | 1 - tests/api/routes/compute/test_dynamips_nodes.py | 1 - tests/api/routes/compute/test_ethernet_switch_nodes.py | 1 - tests/api/routes/compute/test_iou_nodes.py | 1 - tests/api/routes/compute/test_nat_nodes.py | 1 - tests/api/routes/compute/test_projects.py | 1 - tests/api/routes/compute/test_qemu_nodes.py | 1 - tests/api/routes/compute/test_virtualbox_nodes.py | 1 - tests/api/routes/compute/test_vmware_nodes.py | 1 - tests/api/routes/compute/test_vpcs_nodes.py | 1 - tests/api/routes/controller/test_drawings.py | 1 - tests/api/routes/controller/test_gns3vm.py | 1 - tests/api/routes/controller/test_links.py | 1 - tests/api/routes/controller/test_markers.py | 1 - tests/api/routes/controller/test_nodes.py | 1 - tests/api/routes/controller/test_projects.py | 1 - tests/api/routes/controller/test_settings.py | 1 - tests/api/routes/controller/test_symbols.py | 1 - tests/api/routes/controller/test_version.py | 1 - tests/api/routes/test_index.py | 1 - tests/api/routes/test_routes.py | 1 - tests/compute/docker/test_docker_vm.py | 1 - tests/compute/dynamips/test_dynamips_manager.py | 1 - tests/compute/dynamips/test_dynamips_router.py | 1 - tests/compute/iou/test_iou_vm.py | 1 - tests/compute/qemu/test_qemu_manager.py | 1 - tests/compute/qemu/test_qemu_vm.py | 1 - tests/compute/test_base_node.py | 1 - tests/compute/test_manager.py | 1 - tests/compute/test_port_manager.py | 1 - tests/compute/test_project.py | 1 - tests/compute/test_project_manager.py | 1 - tests/compute/virtualbox/test_virtualbox_manager.py | 1 - tests/compute/virtualbox/test_virtualbox_vm.py | 1 - tests/compute/vmware/test_vmware_manager.py | 1 - tests/compute/vmware/test_vmware_vm.py | 1 - tests/compute/vpcs/test_vpcs_manager.py | 1 - tests/compute/vpcs/test_vpcs_vm.py | 1 - tests/controller/test_project.py | 1 - tests/test_config.py | 1 - tests/test_server.py | 1 - tests/utils.py | 1 - tests/utils/test_asyncio.py | 1 - tests/utils/test_hostname.py | 1 - tests/utils/test_images.py | 1 - tests/utils/test_interfaces.py | 1 - 51 files changed, 51 deletions(-) diff --git a/gns3server/controller/appliance_to_template.py b/gns3server/controller/appliance_to_template.py index b848e56d8..e78eaf56f 100644 --- a/gns3server/controller/appliance_to_template.py +++ b/gns3server/controller/appliance_to_template.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # Copyright (C) 2021 GNS3 Technologies Inc. # diff --git a/scripts/welcome.py b/scripts/welcome.py index dc3d5907f..277a35138 100644 --- a/scripts/welcome.py +++ b/scripts/welcome.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # # Copyright (C) 2015 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_capabilities.py b/tests/api/routes/compute/test_capabilities.py index 09d4186eb..9a285c7bc 100644 --- a/tests/api/routes/compute/test_capabilities.py +++ b/tests/api/routes/compute/test_capabilities.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_cloud_nodes.py b/tests/api/routes/compute/test_cloud_nodes.py index 05949e5e6..01a32ec36 100644 --- a/tests/api/routes/compute/test_cloud_nodes.py +++ b/tests/api/routes/compute/test_cloud_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_compute.py b/tests/api/routes/compute/test_compute.py index 0edb27aa6..1a9579b77 100644 --- a/tests/api/routes/compute/test_compute.py +++ b/tests/api/routes/compute/test_compute.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_docker_nodes.py b/tests/api/routes/compute/test_docker_nodes.py index fecc0ef56..e16fb422c 100644 --- a/tests/api/routes/compute/test_docker_nodes.py +++ b/tests/api/routes/compute/test_docker_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_dynamips_nodes.py b/tests/api/routes/compute/test_dynamips_nodes.py index a586aa508..c5d014ea6 100644 --- a/tests/api/routes/compute/test_dynamips_nodes.py +++ b/tests/api/routes/compute/test_dynamips_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_ethernet_switch_nodes.py b/tests/api/routes/compute/test_ethernet_switch_nodes.py index f552b8c21..cc046e3ef 100644 --- a/tests/api/routes/compute/test_ethernet_switch_nodes.py +++ b/tests/api/routes/compute/test_ethernet_switch_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2022 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_iou_nodes.py b/tests/api/routes/compute/test_iou_nodes.py index 565ed3070..65c2e56db 100644 --- a/tests/api/routes/compute/test_iou_nodes.py +++ b/tests/api/routes/compute/test_iou_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_nat_nodes.py b/tests/api/routes/compute/test_nat_nodes.py index aafa427aa..0d40cd487 100644 --- a/tests/api/routes/compute/test_nat_nodes.py +++ b/tests/api/routes/compute/test_nat_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_projects.py b/tests/api/routes/compute/test_projects.py index 88c4b463a..2b8637d5b 100644 --- a/tests/api/routes/compute/test_projects.py +++ b/tests/api/routes/compute/test_projects.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_qemu_nodes.py b/tests/api/routes/compute/test_qemu_nodes.py index 3f53d3538..304f330a4 100644 --- a/tests/api/routes/compute/test_qemu_nodes.py +++ b/tests/api/routes/compute/test_qemu_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_virtualbox_nodes.py b/tests/api/routes/compute/test_virtualbox_nodes.py index e50420518..2de646193 100644 --- a/tests/api/routes/compute/test_virtualbox_nodes.py +++ b/tests/api/routes/compute/test_virtualbox_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_vmware_nodes.py b/tests/api/routes/compute/test_vmware_nodes.py index 6b42eb61a..df485774a 100644 --- a/tests/api/routes/compute/test_vmware_nodes.py +++ b/tests/api/routes/compute/test_vmware_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/compute/test_vpcs_nodes.py b/tests/api/routes/compute/test_vpcs_nodes.py index 5b9073332..fd558d9a9 100644 --- a/tests/api/routes/compute/test_vpcs_nodes.py +++ b/tests/api/routes/compute/test_vpcs_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/controller/test_drawings.py b/tests/api/routes/controller/test_drawings.py index 2d491f863..2096df27a 100644 --- a/tests/api/routes/controller/test_drawings.py +++ b/tests/api/routes/controller/test_drawings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/controller/test_gns3vm.py b/tests/api/routes/controller/test_gns3vm.py index 27a8b9184..bf5db4141 100644 --- a/tests/api/routes/controller/test_gns3vm.py +++ b/tests/api/routes/controller/test_gns3vm.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/controller/test_links.py b/tests/api/routes/controller/test_links.py index a81ca094b..d6af89d70 100644 --- a/tests/api/routes/controller/test_links.py +++ b/tests/api/routes/controller/test_links.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/controller/test_markers.py b/tests/api/routes/controller/test_markers.py index 2e088ed3c..54e4dc8f0 100644 --- a/tests/api/routes/controller/test_markers.py +++ b/tests/api/routes/controller/test_markers.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2025 GNS3 Technologies Inc. # diff --git a/tests/api/routes/controller/test_nodes.py b/tests/api/routes/controller/test_nodes.py index d86e13fe0..017e65783 100644 --- a/tests/api/routes/controller/test_nodes.py +++ b/tests/api/routes/controller/test_nodes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/controller/test_projects.py b/tests/api/routes/controller/test_projects.py index e94b7e273..0d840a41c 100644 --- a/tests/api/routes/controller/test_projects.py +++ b/tests/api/routes/controller/test_projects.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/controller/test_settings.py b/tests/api/routes/controller/test_settings.py index 200ca9c6d..e23d0606c 100644 --- a/tests/api/routes/controller/test_settings.py +++ b/tests/api/routes/controller/test_settings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2026 GNS3 Technologies Inc. # diff --git a/tests/api/routes/controller/test_symbols.py b/tests/api/routes/controller/test_symbols.py index 7c28bff26..97f80889e 100644 --- a/tests/api/routes/controller/test_symbols.py +++ b/tests/api/routes/controller/test_symbols.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/controller/test_version.py b/tests/api/routes/controller/test_version.py index f8c205744..c7220ed62 100644 --- a/tests/api/routes/controller/test_version.py +++ b/tests/api/routes/controller/test_version.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/test_index.py b/tests/api/routes/test_index.py index 9cdb09851..df3c242b1 100644 --- a/tests/api/routes/test_index.py +++ b/tests/api/routes/test_index.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/api/routes/test_routes.py b/tests/api/routes/test_routes.py index 8628e427d..e43a8c557 100644 --- a/tests/api/routes/test_routes.py +++ b/tests/api/routes/test_routes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/docker/test_docker_vm.py b/tests/compute/docker/test_docker_vm.py index 6e340b21d..eccf438c2 100644 --- a/tests/compute/docker/test_docker_vm.py +++ b/tests/compute/docker/test_docker_vm.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/dynamips/test_dynamips_manager.py b/tests/compute/dynamips/test_dynamips_manager.py index d08a10271..0d62c014b 100644 --- a/tests/compute/dynamips/test_dynamips_manager.py +++ b/tests/compute/dynamips/test_dynamips_manager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/dynamips/test_dynamips_router.py b/tests/compute/dynamips/test_dynamips_router.py index 5ececc901..068bb5e9e 100644 --- a/tests/compute/dynamips/test_dynamips_router.py +++ b/tests/compute/dynamips/test_dynamips_router.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/iou/test_iou_vm.py b/tests/compute/iou/test_iou_vm.py index 05ee7de4b..d80cc4356 100644 --- a/tests/compute/iou/test_iou_vm.py +++ b/tests/compute/iou/test_iou_vm.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/qemu/test_qemu_manager.py b/tests/compute/qemu/test_qemu_manager.py index a75bfceaf..9f3c2afac 100644 --- a/tests/compute/qemu/test_qemu_manager.py +++ b/tests/compute/qemu/test_qemu_manager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2015 GNS3 Technologies Inc. # diff --git a/tests/compute/qemu/test_qemu_vm.py b/tests/compute/qemu/test_qemu_vm.py index d5f0842d3..e20eddcd6 100644 --- a/tests/compute/qemu/test_qemu_vm.py +++ b/tests/compute/qemu/test_qemu_vm.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/test_base_node.py b/tests/compute/test_base_node.py index db2418d76..850db6325 100644 --- a/tests/compute/test_base_node.py +++ b/tests/compute/test_base_node.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/test_manager.py b/tests/compute/test_manager.py index 304fa972d..f0f5bbc46 100644 --- a/tests/compute/test_manager.py +++ b/tests/compute/test_manager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/test_port_manager.py b/tests/compute/test_port_manager.py index ede2cea7a..f28418563 100644 --- a/tests/compute/test_port_manager.py +++ b/tests/compute/test_port_manager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/test_project.py b/tests/compute/test_project.py index 7380df23f..d46abe4e9 100644 --- a/tests/compute/test_project.py +++ b/tests/compute/test_project.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/test_project_manager.py b/tests/compute/test_project_manager.py index fe52e8e22..d2a325fe4 100644 --- a/tests/compute/test_project_manager.py +++ b/tests/compute/test_project_manager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/virtualbox/test_virtualbox_manager.py b/tests/compute/virtualbox/test_virtualbox_manager.py index 48315245c..8a23b41df 100644 --- a/tests/compute/virtualbox/test_virtualbox_manager.py +++ b/tests/compute/virtualbox/test_virtualbox_manager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/virtualbox/test_virtualbox_vm.py b/tests/compute/virtualbox/test_virtualbox_vm.py index 8bf127be0..ead5c72fe 100644 --- a/tests/compute/virtualbox/test_virtualbox_vm.py +++ b/tests/compute/virtualbox/test_virtualbox_vm.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/vmware/test_vmware_manager.py b/tests/compute/vmware/test_vmware_manager.py index 7f2c2e0bc..46faff20c 100644 --- a/tests/compute/vmware/test_vmware_manager.py +++ b/tests/compute/vmware/test_vmware_manager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/vmware/test_vmware_vm.py b/tests/compute/vmware/test_vmware_vm.py index 61b53b843..f2badff9c 100644 --- a/tests/compute/vmware/test_vmware_vm.py +++ b/tests/compute/vmware/test_vmware_vm.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/vpcs/test_vpcs_manager.py b/tests/compute/vpcs/test_vpcs_manager.py index 9929a1224..d567b8674 100644 --- a/tests/compute/vpcs/test_vpcs_manager.py +++ b/tests/compute/vpcs/test_vpcs_manager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/compute/vpcs/test_vpcs_vm.py b/tests/compute/vpcs/test_vpcs_vm.py index 65761cbd7..1d74fdf95 100644 --- a/tests/compute/vpcs/test_vpcs_vm.py +++ b/tests/compute/vpcs/test_vpcs_vm.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/controller/test_project.py b/tests/controller/test_project.py index 6b8d2651e..8256dd450 100644 --- a/tests/controller/test_project.py +++ b/tests/controller/test_project.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/test_config.py b/tests/test_config.py index 64cf66d7a..fb2b08dc0 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/test_server.py b/tests/test_server.py index da4abd306..7cdb2cb12 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # Copyright (C) 2015 GNS3 Technologies Inc. # diff --git a/tests/utils.py b/tests/utils.py index 5e640e478..d7212a666 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2020 GNS3 Technologies Inc. # diff --git a/tests/utils/test_asyncio.py b/tests/utils/test_asyncio.py index f196d65c5..87def33c4 100644 --- a/tests/utils/test_asyncio.py +++ b/tests/utils/test_asyncio.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2015 GNS3 Technologies Inc. # diff --git a/tests/utils/test_hostname.py b/tests/utils/test_hostname.py index 66904e066..e802a40a5 100644 --- a/tests/utils/test_hostname.py +++ b/tests/utils/test_hostname.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2024 GNS3 Technologies Inc. # diff --git a/tests/utils/test_images.py b/tests/utils/test_images.py index 7fa9a86c1..e7d8248b0 100644 --- a/tests/utils/test_images.py +++ b/tests/utils/test_images.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2014 GNS3 Technologies Inc. # diff --git a/tests/utils/test_interfaces.py b/tests/utils/test_interfaces.py index 3d912a09c..84ac5f7c3 100644 --- a/tests/utils/test_interfaces.py +++ b/tests/utils/test_interfaces.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2014 GNS3 Technologies Inc. # From 0f66fd6c2b2039c08b5110c27a9f6d9d00ba6079 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Wed, 30 Sep 2026 20:45:43 +0300 Subject: [PATCH 137/390] style: remove trailing whitespace --- gns3server/api/routes/compute/notifications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/api/routes/compute/notifications.py b/gns3server/api/routes/compute/notifications.py index ee533037b..66de26675 100644 --- a/gns3server/api/routes/compute/notifications.py +++ b/gns3server/api/routes/compute/notifications.py @@ -67,7 +67,7 @@ if __name__ == "__main__":
- + @@ -115,5 +115,5 @@ } })(); - + diff --git a/gns3server/static/web-ui/main-2SCMRH5O.js b/gns3server/static/web-ui/main-2SCMRH5O.js new file mode 100644 index 000000000..666f12b3f --- /dev/null +++ b/gns3server/static/web-ui/main-2SCMRH5O.js @@ -0,0 +1,4594 @@ +import{a as mt,b as rt,c as m5,d as _t,e as We,f as Wt,g as Xe,h as tb,i as qe,j as bt,k as Qe,l as ke,m as T5,n as E5,o as sb,p as O5,q as hg}from"./chunk-2MJLPLTV.js";import{$ as hm,A as Ho,B as ct,C as b5,D as ot,E as ob,F as ml,G as _s,H as x5,I as y5,J as pl,K as ab,L as w5,M as M5,N as gg,O as re,P as Gt,Q as Rt,R as Uk,S as Ni,T as rb,U as Ir,V as Xo,W as Yo,X as S5,Y as k5,Z as P5,_ as bo,a as pt,aa as so,b as st,ba as ui,c as ut,ca as Xn,d as u5,da as _m,e as Ko,ea as ga,f as eo,fa as fs,g as it,ga as Ja,h as Ve,ha as er,i as Wn,ia as tr,j as Dr,k as Bi,l as oi,m as nb,n as ug,o as Pe,p as we,q as Td,r as ib,s as g5,t as h5,u as gm,v as _5,w as nt,x as f5,y as v5,z as C5}from"./chunk-YK4BK3GN.js";import{$ as Qn,$a as mA,$b as Et,$c as DA,$d as No,$e as um,A as nA,Aa as IC,Ab as gt,Ac as Pa,Ad as LA,Ae as t5,B as Ci,Ba as Bk,Bb as ht,Bc as og,Bd as VA,Be as dg,C as ma,Ca as lf,Cc as dm,Cd as WC,Ce as YC,D as La,Da as Ba,Db as Bn,Dc as bA,De as n5,E as DC,Ea as AC,Eb as jn,Ec as fe,Ed as BA,Ee as $k,F as ro,Fa as So,Fb as Te,Fc as nc,Fe as ZC,G as Yi,Ga as lm,Gb as Tt,Gc as xA,Ge as i5,H as sl,Ha as m,Hb as ne,Hc as yA,Hd as jA,He as Or,I as ei,Ia as Ya,Ib as Za,Ic as VC,Ie as Hk,J as Lk,Ja as pa,Jb as c,Jc as BC,Je as mf,K as iA,Ka as Fp,Kb as N,Kc as wA,Kd as GC,Ke as o5,L as rf,La as qi,Lb as X,Lc as MA,Ld as $A,Le as $a,M as tg,Ma as Mt,Mb as Un,Mc as ag,Md as Pd,Me as a5,N as Gr,Nb as pA,Nc as SA,Nd as At,Ne as Vp,O as sf,Oa as Wo,Ob as RC,Oc as kA,Od as HA,Oe as r5,P as oA,Pa as V,Pb as uA,Pc as us,Pd as Ue,Pe as s5,Q as ng,Qa as on,Qb as an,Qc as PA,Qd as UA,Qe as $t,R as aA,Ra as yt,Rb as Xt,Rc as rg,Rd as qC,Re as mg,S as ig,Sa as qr,Sb as rn,Sc as TA,Sd as Nt,Se as Ft,Tb as ka,Tc as Pr,Td as vt,Te as Co,Ua as mi,Ub as Md,Uc as Ta,Ud as QC,Ue as JC,V as wd,Va as se,Vb as un,Vc as jC,Vd as Qo,Ve as vn,Wa as NC,Wb as at,Wc as df,Wd as Ji,We as l5,X as Di,Xa as dA,Xb as tn,Xc as Rp,Xd as Ec,Xe as ce,Y as Dn,Yb as Go,Yc as EA,Yd as Ge,Ye as ie,Z as He,Za as Hs,Zb as zC,Zc as OA,Zd as WA,Ze as c5,_ as rA,_a as Ce,_b as LC,_c as mm,_d as Ct,_e as eb,a as q,aa as Ii,ab as T,ac as gn,ad as cl,ae as Tr,af as d5,b as ze,ba as Pc,bb as FC,bc as Io,bd as ja,be as GA,bf as Xr,c as EC,ca as J,cb as E,cc as gA,cd as Kr,ce as qA,cf as Be,d as al,da as nn,db as ni,dc as Qr,dd as zp,de as Yt,df as Oc,e as qn,ea as mn,eb as Oe,ec as hA,ed as sg,ee as Ut,ef as he,f as Jl,fa as _e,fb as Q,fc as cf,fd as IA,fe as QA,ff as Y,g as Oo,ga as f,gb as K,gc as Ne,gd as AA,ge as KA,gf as zi,h as Sr,ha as sA,hb as v,hc as cm,hd as NA,he as pm,hf as p5,i as Ye,ia as lA,ib as r,ic as _A,id as Vi,ie as Er,if as sn,j as cn,ja as Vk,jb as l,jc as $o,jd as jk,je as dl,jf as Yr,k as Ju,ka as y,kb as L,kc as ee,kd as $C,ke as XA,kf as pg,l as J4,la as w,lb as ii,lc as ln,ld as kd,le as cg,m as eA,ma as Mi,mb as Si,mc as fA,md as FA,me as Ai,n as rl,na as Xa,nb as kr,nd as Lp,ne as St,o as eg,oa as xa,ob as Fe,oc as $,od as RA,oe as It,p as tA,pa as Do,pb as Re,pc as oe,pd as ua,pe as hs,q as sm,qa as Va,qb as li,qc as Sd,qd as zA,r as Vt,ra as be,rb as R,rc as zt,re as KC,s as jo,sa as Gi,sb as pr,sc as qo,sd as lg,t as af,ta as cA,tb as _,te as XC,u as OC,ua as z,ub as Tc,uc as ki,ue as YA,v as Rk,va as Vn,vb as h,vc as Ao,ve as ZA,w as Pt,wa as Nn,wb as pi,wc as vA,wd as HC,we as JA,x as mr,xa as yi,xb as Zt,xc as CA,xd as UC,xe as e5,y as Np,ya as Kt,yb as Zi,yc as ll,yd as gs,z as zk,za as ec,zb as Kn,zc as tc}from"./chunk-JPY5KHMK.js";var Hz=al((jz,$z)=>{(function(n){if(typeof jz=="object")$z.exports=n();else if(typeof define=="function"&&define.amd)define(n);else{var o;try{o=window}catch{o=self}o.SparkMD5=n()}})(function(n){"use strict";var o=function(S,O){return S+O&4294967295},e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function t(S,O,A,D,F,I){return O=o(o(O,S),o(D,I)),o(O<>>32-F,A)}function i(S,O){var A=S[0],D=S[1],F=S[2],I=S[3];A+=(D&F|~D&I)+O[0]-680876936|0,A=(A<<7|A>>>25)+D|0,I+=(A&D|~A&F)+O[1]-389564586|0,I=(I<<12|I>>>20)+A|0,F+=(I&A|~I&D)+O[2]+606105819|0,F=(F<<17|F>>>15)+I|0,D+=(F&I|~F&A)+O[3]-1044525330|0,D=(D<<22|D>>>10)+F|0,A+=(D&F|~D&I)+O[4]-176418897|0,A=(A<<7|A>>>25)+D|0,I+=(A&D|~A&F)+O[5]+1200080426|0,I=(I<<12|I>>>20)+A|0,F+=(I&A|~I&D)+O[6]-1473231341|0,F=(F<<17|F>>>15)+I|0,D+=(F&I|~F&A)+O[7]-45705983|0,D=(D<<22|D>>>10)+F|0,A+=(D&F|~D&I)+O[8]+1770035416|0,A=(A<<7|A>>>25)+D|0,I+=(A&D|~A&F)+O[9]-1958414417|0,I=(I<<12|I>>>20)+A|0,F+=(I&A|~I&D)+O[10]-42063|0,F=(F<<17|F>>>15)+I|0,D+=(F&I|~F&A)+O[11]-1990404162|0,D=(D<<22|D>>>10)+F|0,A+=(D&F|~D&I)+O[12]+1804603682|0,A=(A<<7|A>>>25)+D|0,I+=(A&D|~A&F)+O[13]-40341101|0,I=(I<<12|I>>>20)+A|0,F+=(I&A|~I&D)+O[14]-1502002290|0,F=(F<<17|F>>>15)+I|0,D+=(F&I|~F&A)+O[15]+1236535329|0,D=(D<<22|D>>>10)+F|0,A+=(D&I|F&~I)+O[1]-165796510|0,A=(A<<5|A>>>27)+D|0,I+=(A&F|D&~F)+O[6]-1069501632|0,I=(I<<9|I>>>23)+A|0,F+=(I&D|A&~D)+O[11]+643717713|0,F=(F<<14|F>>>18)+I|0,D+=(F&A|I&~A)+O[0]-373897302|0,D=(D<<20|D>>>12)+F|0,A+=(D&I|F&~I)+O[5]-701558691|0,A=(A<<5|A>>>27)+D|0,I+=(A&F|D&~F)+O[10]+38016083|0,I=(I<<9|I>>>23)+A|0,F+=(I&D|A&~D)+O[15]-660478335|0,F=(F<<14|F>>>18)+I|0,D+=(F&A|I&~A)+O[4]-405537848|0,D=(D<<20|D>>>12)+F|0,A+=(D&I|F&~I)+O[9]+568446438|0,A=(A<<5|A>>>27)+D|0,I+=(A&F|D&~F)+O[14]-1019803690|0,I=(I<<9|I>>>23)+A|0,F+=(I&D|A&~D)+O[3]-187363961|0,F=(F<<14|F>>>18)+I|0,D+=(F&A|I&~A)+O[8]+1163531501|0,D=(D<<20|D>>>12)+F|0,A+=(D&I|F&~I)+O[13]-1444681467|0,A=(A<<5|A>>>27)+D|0,I+=(A&F|D&~F)+O[2]-51403784|0,I=(I<<9|I>>>23)+A|0,F+=(I&D|A&~D)+O[7]+1735328473|0,F=(F<<14|F>>>18)+I|0,D+=(F&A|I&~A)+O[12]-1926607734|0,D=(D<<20|D>>>12)+F|0,A+=(D^F^I)+O[5]-378558|0,A=(A<<4|A>>>28)+D|0,I+=(A^D^F)+O[8]-2022574463|0,I=(I<<11|I>>>21)+A|0,F+=(I^A^D)+O[11]+1839030562|0,F=(F<<16|F>>>16)+I|0,D+=(F^I^A)+O[14]-35309556|0,D=(D<<23|D>>>9)+F|0,A+=(D^F^I)+O[1]-1530992060|0,A=(A<<4|A>>>28)+D|0,I+=(A^D^F)+O[4]+1272893353|0,I=(I<<11|I>>>21)+A|0,F+=(I^A^D)+O[7]-155497632|0,F=(F<<16|F>>>16)+I|0,D+=(F^I^A)+O[10]-1094730640|0,D=(D<<23|D>>>9)+F|0,A+=(D^F^I)+O[13]+681279174|0,A=(A<<4|A>>>28)+D|0,I+=(A^D^F)+O[0]-358537222|0,I=(I<<11|I>>>21)+A|0,F+=(I^A^D)+O[3]-722521979|0,F=(F<<16|F>>>16)+I|0,D+=(F^I^A)+O[6]+76029189|0,D=(D<<23|D>>>9)+F|0,A+=(D^F^I)+O[9]-640364487|0,A=(A<<4|A>>>28)+D|0,I+=(A^D^F)+O[12]-421815835|0,I=(I<<11|I>>>21)+A|0,F+=(I^A^D)+O[15]+530742520|0,F=(F<<16|F>>>16)+I|0,D+=(F^I^A)+O[2]-995338651|0,D=(D<<23|D>>>9)+F|0,A+=(F^(D|~I))+O[0]-198630844|0,A=(A<<6|A>>>26)+D|0,I+=(D^(A|~F))+O[7]+1126891415|0,I=(I<<10|I>>>22)+A|0,F+=(A^(I|~D))+O[14]-1416354905|0,F=(F<<15|F>>>17)+I|0,D+=(I^(F|~A))+O[5]-57434055|0,D=(D<<21|D>>>11)+F|0,A+=(F^(D|~I))+O[12]+1700485571|0,A=(A<<6|A>>>26)+D|0,I+=(D^(A|~F))+O[3]-1894986606|0,I=(I<<10|I>>>22)+A|0,F+=(A^(I|~D))+O[10]-1051523|0,F=(F<<15|F>>>17)+I|0,D+=(I^(F|~A))+O[1]-2054922799|0,D=(D<<21|D>>>11)+F|0,A+=(F^(D|~I))+O[8]+1873313359|0,A=(A<<6|A>>>26)+D|0,I+=(D^(A|~F))+O[15]-30611744|0,I=(I<<10|I>>>22)+A|0,F+=(A^(I|~D))+O[6]-1560198380|0,F=(F<<15|F>>>17)+I|0,D+=(I^(F|~A))+O[13]+1309151649|0,D=(D<<21|D>>>11)+F|0,A+=(F^(D|~I))+O[4]-145523070|0,A=(A<<6|A>>>26)+D|0,I+=(D^(A|~F))+O[11]-1120210379|0,I=(I<<10|I>>>22)+A|0,F+=(A^(I|~D))+O[2]+718787259|0,F=(F<<15|F>>>17)+I|0,D+=(I^(F|~A))+O[9]-343485551|0,D=(D<<21|D>>>11)+F|0,S[0]=A+S[0]|0,S[1]=D+S[1]|0,S[2]=F+S[2]|0,S[3]=I+S[3]|0}function a(S){var O=[],A;for(A=0;A<64;A+=4)O[A>>2]=S.charCodeAt(A)+(S.charCodeAt(A+1)<<8)+(S.charCodeAt(A+2)<<16)+(S.charCodeAt(A+3)<<24);return O}function s(S){var O=[],A;for(A=0;A<64;A+=4)O[A>>2]=S[A]+(S[A+1]<<8)+(S[A+2]<<16)+(S[A+3]<<24);return O}function d(S){var O=S.length,A=[1732584193,-271733879,-1732584194,271733878],D,F,I,B,le,ae;for(D=64;D<=O;D+=64)i(A,a(S.substring(D-64,D)));for(S=S.substring(D-64),F=S.length,I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],D=0;D>2]|=S.charCodeAt(D)<<(D%4<<3);if(I[D>>2]|=128<<(D%4<<3),D>55)for(i(A,I),D=0;D<16;D+=1)I[D]=0;return B=O*8,B=B.toString(16).match(/(.*?)(.{0,8})$/),le=parseInt(B[2],16),ae=parseInt(B[1],16)||0,I[14]=le,I[15]=ae,i(A,I),A}function p(S){var O=S.length,A=[1732584193,-271733879,-1732584194,271733878],D,F,I,B,le,ae;for(D=64;D<=O;D+=64)i(A,s(S.subarray(D-64,D)));for(S=D-64>2]|=S[D]<<(D%4<<3);if(I[D>>2]|=128<<(D%4<<3),D>55)for(i(A,I),D=0;D<16;D+=1)I[D]=0;return B=O*8,B=B.toString(16).match(/(.*?)(.{0,8})$/),le=parseInt(B[2],16),ae=parseInt(B[1],16)||0,I[14]=le,I[15]=ae,i(A,I),A}function u(S){var O="",A;for(A=0;A<4;A+=1)O+=e[S>>A*8+4&15]+e[S>>A*8&15];return O}function g(S){var O;for(O=0;O>16)+(O>>16)+(A>>16);return D<<16|A&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function S(O,A){return O=O|0||0,O<0?Math.max(O+A,0):Math.min(O,A)}ArrayBuffer.prototype.slice=function(O,A){var D=this.byteLength,F=S(O,D),I=D,B,le,ae,W;return A!==n&&(I=S(A,D)),F>I?new ArrayBuffer(0):(B=I-F,le=new ArrayBuffer(B),ae=new Uint8Array(le),W=new Uint8Array(this,F,B),ae.set(W),le)}})();function C(S){return/[\u0080-\uFFFF]/.test(S)&&(S=unescape(encodeURIComponent(S))),S}function M(S,O){var A=S.length,D=new ArrayBuffer(A),F=new Uint8Array(D),I;for(I=0;I>2]|=O.charCodeAt(D)<<(D%4<<3);return this._finish(F,A),I=g(this._hash),S&&(I=P(I)),this.reset(),I},k.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},k.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},k.prototype.setState=function(S){return this._buff=S.buff,this._length=S.length,this._hash=S.hash,this},k.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},k.prototype._finish=function(S,O){var A=O,D,F,I;if(S[A>>2]|=128<<(A%4<<3),A>55)for(i(this._hash,S),A=0;A<16;A+=1)S[A]=0;D=this._length*8,D=D.toString(16).match(/(.*?)(.{0,8})$/),F=parseInt(D[2],16),I=parseInt(D[1],16)||0,S[14]=F,S[15]=I,i(this._hash,S)},k.hash=function(S,O){return k.hashBinary(C(S),O)},k.hashBinary=function(S,O){var A=d(S),D=g(A);return O?P(D):D},k.ArrayBuffer=function(){this.reset()},k.ArrayBuffer.prototype.append=function(S){var O=b(this._buff.buffer,S,!0),A=O.length,D;for(this._length+=S.byteLength,D=64;D<=A;D+=64)i(this._hash,s(O.subarray(D-64,D)));return this._buff=D-64>2]|=O[F]<<(F%4<<3);return this._finish(D,A),I=g(this._hash),S&&(I=P(I)),this.reset(),I},k.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},k.ArrayBuffer.prototype.getState=function(){var S=k.prototype.getState.call(this);return S.buff=x(S.buff),S},k.ArrayBuffer.prototype.setState=function(S){return S.buff=M(S.buff,!0),k.prototype.setState.call(this,S)},k.ArrayBuffer.prototype.destroy=k.prototype.destroy,k.ArrayBuffer.prototype._finish=k.prototype._finish,k.ArrayBuffer.hash=function(S,O){var A=p(new Uint8Array(S)),D=g(A);return O?P(D):D},k})});var Jz=al((Qut,by)=>{(function(n,o,e){if(!n)return;for(var t={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},i={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},s={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},d,p=1;p<20;++p)t[111+p]="f"+p;for(p=0;p<=9;++p)t[p+96]=p.toString();function u(I,B,le){if(I.addEventListener){I.addEventListener(B,le,!1);return}I.attachEvent("on"+B,le)}function g(I){if(I.type=="keypress"){var B=String.fromCharCode(I.which);return I.shiftKey||(B=B.toLowerCase()),B}return t[I.which]?t[I.which]:i[I.which]?i[I.which]:String.fromCharCode(I.which).toLowerCase()}function C(I,B){return I.sort().join(",")===B.sort().join(",")}function M(I){var B=[];return I.shiftKey&&B.push("shift"),I.altKey&&B.push("alt"),I.ctrlKey&&B.push("ctrl"),I.metaKey&&B.push("meta"),B}function x(I){if(I.preventDefault){I.preventDefault();return}I.returnValue=!1}function b(I){if(I.stopPropagation){I.stopPropagation();return}I.cancelBubble=!0}function P(I){return I=="shift"||I=="ctrl"||I=="alt"||I=="meta"}function k(){if(!d){d={};for(var I in t)I>95&&I<112||t.hasOwnProperty(I)&&(d[t[I]]=I)}return d}function S(I,B,le){return le||(le=k()[I]?"keydown":"keypress"),le=="keypress"&&B.length&&(le="keydown"),le}function O(I){return I==="+"?["+"]:(I=I.replace(/\+{2}/g,"+plus"),I.split("+"))}function A(I,B){var le,ae,W,G=[];for(le=O(I),W=0;W1){te(me,Me,Ie,$e);return}Z=A(me,$e),B._callbacks[Z.key]=B._callbacks[Z.key]||[],pe(Z.key,Z.modifiers,{type:Z.action},tt,me,et),B._callbacks[Z.key][tt?"unshift":"push"]({callback:Ie,modifiers:Z.modifiers,action:Z.action,seq:tt,level:et,combo:me})}B._bindMultiple=function(me,Ie,$e){for(var tt=0;tt-1||D(B,le.target))return!1;if("composedPath"in I&&typeof I.composedPath=="function"){var ae=I.composedPath()[0];ae!==I.target&&(B=ae)}return B.tagName=="INPUT"||B.tagName=="SELECT"||B.tagName=="TEXTAREA"||B.isContentEditable},F.prototype.handleKey=function(){var I=this;return I._handleKey.apply(I,arguments)},F.addKeycodes=function(I){for(var B in I)I.hasOwnProperty(B)&&(t[B]=I[B]);d=null},F.init=function(){var I=F(o);for(var B in I)B.charAt(0)!=="_"&&(F[B]=(function(le){return function(){return I[le].apply(I,arguments)}})(B))},F.init(),n.Mousetrap=F,typeof by<"u"&&by.exports&&(by.exports=F),typeof define=="function"&&define.amd&&define(function(){return F})})(typeof window<"u"?window:null,typeof window<"u"?document:null)});var s7=al(cO=>{var r7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");cO.encode=function(n){if(0<=n&&n{var l7=s7(),dO=5,c7=1<>1;return o?-e:e}mO.encode=function(o){var e="",t,i=Uhe(o);do t=i&d7,i>>>=dO,i>0&&(t|=m7),e+=l7.encode(t);while(i>0);return e};mO.decode=function(o,e,t){var i=o.length,a=0,s=0,d,p;do{if(e>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(p=l7.decode(o.charCodeAt(e++)),p===-1)throw new Error("Invalid base64 digit: "+o.charAt(e-1));d=!!(p&m7),p&=d7,a=a+(p<{function Ghe(n,o,e){if(o in n)return n[o];if(arguments.length===3)return e;throw new Error('"'+o+'" is a required argument.')}cr.getArg=Ghe;var u7=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,qhe=/^data:.+\,.+$/;function Ev(n){var o=n.match(u7);return o?{scheme:o[1],auth:o[2],host:o[3],port:o[4],path:o[5]}:null}cr.urlParse=Ev;function Rh(n){var o="";return n.scheme&&(o+=n.scheme+":"),o+="//",n.auth&&(o+=n.auth+"@"),n.host&&(o+=n.host),n.port&&(o+=":"+n.port),n.path&&(o+=n.path),o}cr.urlGenerate=Rh;var Qhe=32;function Khe(n){var o=[];return function(e){for(var t=0;tQhe&&o.pop(),a}}var pO=Khe(function(o){var e=o,t=Ev(o);if(t){if(!t.path)return o;e=t.path}for(var i=cr.isAbsolute(e),a=[],s=0,d=0;;)if(s=d,d=e.indexOf("/",s),d===-1){a.push(e.slice(s));break}else for(a.push(e.slice(s,d));d=0;d--)p=a[d],p==="."?a.splice(d,1):p===".."?u++:u>0&&(p===""?(a.splice(d+1,u),u=0):(a.splice(d,2),u--));return e=a.join("/"),e===""&&(e=i?"/":"."),t?(t.path=e,Rh(t)):e});cr.normalize=pO;function g7(n,o){n===""&&(n="."),o===""&&(o=".");var e=Ev(o),t=Ev(n);if(t&&(n=t.path||"/"),e&&!e.scheme)return t&&(e.scheme=t.scheme),Rh(e);if(e||o.match(qhe))return o;if(t&&!t.host&&!t.path)return t.host=o,Rh(t);var i=o.charAt(0)==="/"?o:pO(n.replace(/\/+$/,"")+"/"+o);return t?(t.path=i,Rh(t)):i}cr.join=g7;cr.isAbsolute=function(n){return n.charAt(0)==="/"||u7.test(n)};function Xhe(n,o){n===""&&(n="."),n=n.replace(/\/$/,"");for(var e=0;o.indexOf(n+"/")!==0;){var t=n.lastIndexOf("/");if(t<0||(n=n.slice(0,t),n.match(/^([^\/]+:\/)?\/*$/)))return o;++e}return Array(e+1).join("../")+o.substr(n.length+1)}cr.relative=Xhe;var h7=(function(){var n=Object.create(null);return!("__proto__"in n)})();function _7(n){return n}function Yhe(n){return f7(n)?"$"+n:n}cr.toSetString=h7?_7:Yhe;function Zhe(n){return f7(n)?n.slice(1):n}cr.fromSetString=h7?_7:Zhe;function f7(n){if(!n)return!1;var o=n.length;if(o<9||n.charCodeAt(o-1)!==95||n.charCodeAt(o-2)!==95||n.charCodeAt(o-3)!==111||n.charCodeAt(o-4)!==116||n.charCodeAt(o-5)!==111||n.charCodeAt(o-6)!==114||n.charCodeAt(o-7)!==112||n.charCodeAt(o-8)!==95||n.charCodeAt(o-9)!==95)return!1;for(var e=o-10;e>=0;e--)if(n.charCodeAt(e)!==36)return!1;return!0}function Jhe(n,o,e){var t=Xd(n.source,o.source);return t!==0||(t=n.originalLine-o.originalLine,t!==0)||(t=n.originalColumn-o.originalColumn,t!==0||e)||(t=n.generatedColumn-o.generatedColumn,t!==0)||(t=n.generatedLine-o.generatedLine,t!==0)?t:Xd(n.name,o.name)}cr.compareByOriginalPositions=Jhe;function e_e(n,o,e){var t;return t=n.originalLine-o.originalLine,t!==0||(t=n.originalColumn-o.originalColumn,t!==0||e)||(t=n.generatedColumn-o.generatedColumn,t!==0)||(t=n.generatedLine-o.generatedLine,t!==0)?t:Xd(n.name,o.name)}cr.compareByOriginalPositionsNoSource=e_e;function t_e(n,o,e){var t=n.generatedLine-o.generatedLine;return t!==0||(t=n.generatedColumn-o.generatedColumn,t!==0||e)||(t=Xd(n.source,o.source),t!==0)||(t=n.originalLine-o.originalLine,t!==0)||(t=n.originalColumn-o.originalColumn,t!==0)?t:Xd(n.name,o.name)}cr.compareByGeneratedPositionsDeflated=t_e;function n_e(n,o,e){var t=n.generatedColumn-o.generatedColumn;return t!==0||e||(t=Xd(n.source,o.source),t!==0)||(t=n.originalLine-o.originalLine,t!==0)||(t=n.originalColumn-o.originalColumn,t!==0)?t:Xd(n.name,o.name)}cr.compareByGeneratedPositionsDeflatedNoLine=n_e;function Xd(n,o){return n===o?0:n===null?1:o===null?-1:n>o?1:-1}function i_e(n,o){var e=n.generatedLine-o.generatedLine;return e!==0||(e=n.generatedColumn-o.generatedColumn,e!==0)||(e=Xd(n.source,o.source),e!==0)||(e=n.originalLine-o.originalLine,e!==0)||(e=n.originalColumn-o.originalColumn,e!==0)?e:Xd(n.name,o.name)}cr.compareByGeneratedPositionsInflated=i_e;function o_e(n){return JSON.parse(n.replace(/^\)]}'[^\n]*\n/,""))}cr.parseSourceMapInput=o_e;function a_e(n,o,e){if(o=o||"",n&&(n[n.length-1]!=="/"&&o[0]!=="/"&&(n+="/"),o=n+o),e){var t=Ev(e);if(!t)throw new Error("sourceMapURL could not be parsed");if(t.path){var i=t.path.lastIndexOf("/");i>=0&&(t.path=t.path.substring(0,i+1))}o=g7(Rh(t),o)}return pO(o)}cr.computeSourceURL=a_e});var C7=al(v7=>{var uO=By(),gO=Object.prototype.hasOwnProperty,Nu=typeof Map<"u";function Yd(){this._array=[],this._set=Nu?new Map:Object.create(null)}Yd.fromArray=function(o,e){for(var t=new Yd,i=0,a=o.length;i=0)return e}else{var t=uO.toSetString(o);if(gO.call(this._set,t))return this._set[t]}throw new Error('"'+o+'" is not in the set.')};Yd.prototype.at=function(o){if(o>=0&&o{var b7=By();function r_e(n,o){var e=n.generatedLine,t=o.generatedLine,i=n.generatedColumn,a=o.generatedColumn;return t>e||t==e&&a>=i||b7.compareByGeneratedPositionsInflated(n,o)<=0}function jy(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}jy.prototype.unsortedForEach=function(o,e){this._array.forEach(o,e)};jy.prototype.add=function(o){r_e(this._last,o)?(this._last=o,this._array.push(o)):(this._sorted=!1,this._array.push(o))};jy.prototype.toArray=function(){return this._sorted||(this._array.sort(b7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};x7.MappingList=jy});var M7=al(w7=>{var Ov=p7(),Sa=By(),$y=C7().ArraySet,s_e=y7().MappingList;function Bl(n){n||(n={}),this._file=Sa.getArg(n,"file",null),this._sourceRoot=Sa.getArg(n,"sourceRoot",null),this._skipValidation=Sa.getArg(n,"skipValidation",!1),this._ignoreInvalidMapping=Sa.getArg(n,"ignoreInvalidMapping",!1),this._sources=new $y,this._names=new $y,this._mappings=new s_e,this._sourcesContents=null}Bl.prototype._version=3;Bl.fromSourceMap=function(o,e){var t=o.sourceRoot,i=new Bl(Object.assign(e||{},{file:o.file,sourceRoot:t}));return o.eachMapping(function(a){var s={generated:{line:a.generatedLine,column:a.generatedColumn}};a.source!=null&&(s.source=a.source,t!=null&&(s.source=Sa.relative(t,s.source)),s.original={line:a.originalLine,column:a.originalColumn},a.name!=null&&(s.name=a.name)),i.addMapping(s)}),o.sources.forEach(function(a){var s=a;t!==null&&(s=Sa.relative(t,a)),i._sources.has(s)||i._sources.add(s);var d=o.sourceContentFor(a);d!=null&&i.setSourceContent(a,d)}),i};Bl.prototype.addMapping=function(o){var e=Sa.getArg(o,"generated"),t=Sa.getArg(o,"original",null),i=Sa.getArg(o,"source",null),a=Sa.getArg(o,"name",null);!this._skipValidation&&this._validateMapping(e,t,i,a)===!1||(i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),a!=null&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:e.line,generatedColumn:e.column,originalLine:t!=null&&t.line,originalColumn:t!=null&&t.column,source:i,name:a}))};Bl.prototype.setSourceContent=function(o,e){var t=o;this._sourceRoot!=null&&(t=Sa.relative(this._sourceRoot,t)),e!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[Sa.toSetString(t)]=e):this._sourcesContents&&(delete this._sourcesContents[Sa.toSetString(t)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};Bl.prototype.applySourceMap=function(o,e,t){var i=e;if(e==null){if(o.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=o.file}var a=this._sourceRoot;a!=null&&(i=Sa.relative(a,i));var s=new $y,d=new $y;this._mappings.unsortedForEach(function(p){if(p.source===i&&p.originalLine!=null){var u=o.originalPositionFor({line:p.originalLine,column:p.originalColumn});u.source!=null&&(p.source=u.source,t!=null&&(p.source=Sa.join(t,p.source)),a!=null&&(p.source=Sa.relative(a,p.source)),p.originalLine=u.line,p.originalColumn=u.column,u.name!=null&&(p.name=u.name))}var g=p.source;g!=null&&!s.has(g)&&s.add(g);var C=p.name;C!=null&&!d.has(C)&&d.add(C)},this),this._sources=s,this._names=d,o.sources.forEach(function(p){var u=o.sourceContentFor(p);u!=null&&(t!=null&&(p=Sa.join(t,p)),a!=null&&(p=Sa.relative(a,p)),this.setSourceContent(p,u))},this)};Bl.prototype._validateMapping=function(o,e,t,i){if(e&&typeof e.line!="number"&&typeof e.column!="number"){var a="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(a),!1;throw new Error(a)}if(!(o&&"line"in o&&"column"in o&&o.line>0&&o.column>=0&&!e&&!t&&!i)){if(o&&"line"in o&&"column"in o&&e&&"line"in e&&"column"in e&&o.line>0&&o.column>=0&&e.line>0&&e.column>=0&&t)return;var a="Invalid mapping: "+JSON.stringify({generated:o,source:t,original:e,name:i});if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(a),!1;throw new Error(a)}};Bl.prototype._serializeMappings=function(){for(var o=0,e=1,t=0,i=0,a=0,s=0,d="",p,u,g,C,M=this._mappings.toArray(),x=0,b=M.length;x0){if(!Sa.compareByGeneratedPositionsInflated(u,M[x-1]))continue;p+=","}p+=Ov.encode(u.generatedColumn-o),o=u.generatedColumn,u.source!=null&&(C=this._sources.indexOf(u.source),p+=Ov.encode(C-s),s=C,p+=Ov.encode(u.originalLine-1-i),i=u.originalLine-1,p+=Ov.encode(u.originalColumn-t),t=u.originalColumn,u.name!=null&&(g=this._names.indexOf(u.name),p+=Ov.encode(g-a),a=g)),d+=p}return d};Bl.prototype._generateSourcesContent=function(o,e){return o.map(function(t){if(!this._sourcesContents)return null;e!=null&&(t=Sa.relative(e,t));var i=Sa.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};Bl.prototype.toJSON=function(){var o={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(o.file=this._file),this._sourceRoot!=null&&(o.sourceRoot=this._sourceRoot),this._sourcesContents&&(o.sourcesContent=this._generateSourcesContent(o.sources,o.sourceRoot)),o};Bl.prototype.toString=function(){return JSON.stringify(this.toJSON())};w7.SourceMapGenerator=Bl});var HM=al((nj,$M)=>{(function(n){"use strict";let o="(0?\\d+|0x[a-f0-9]+)",e={fourOctet:new RegExp(`^${o}\\.${o}\\.${o}\\.${o}$`,"i"),threeOctet:new RegExp(`^${o}\\.${o}\\.${o}$`,"i"),twoOctet:new RegExp(`^${o}\\.${o}$`,"i"),longValue:new RegExp(`^${o}$`,"i")},t=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",d={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${o}\\.${o}\\.${o}\\.${o}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${o}\\.${o}\\.${o}\\.${o}(${a})?$`,"i")};function p(x,b){if(x.indexOf("::")!==x.lastIndexOf("::"))return null;let P=0,k=-1,S=(x.match(d.zoneIndex)||[])[0],O,A;for(S&&(S=S.substring(1),x=x.replace(/%.+$/,""));(k=x.indexOf(":",k+1))>=0;)P++;if(x.substr(0,2)==="::"&&P--,x.substr(-2,2)==="::"&&P--,P>b)return null;for(A=b-P,O=":";A--;)O+="0:";return x=x.replace("::",O),x[0]===":"&&(x=x.slice(1)),x[x.length-1]===":"&&(x=x.slice(0,-1)),b=(function(){let D=x.split(":"),F=[];for(let I=0;I0;){if(O=P-k,O<0&&(O=0),x[S]>>O!==b[S]>>O)return!1;k-=P,S+=1}return!0}function g(x){if(i.test(x))return parseInt(x,16);if(x[0]==="0"&&!isNaN(parseInt(x[1],10))){if(t.test(x))return parseInt(x,8);throw new Error(`ipaddr: cannot parse ${x} as octal`)}return parseInt(x,10)}function C(x,b){for(;x.length=0;S-=1)if(O=this.octets[S],O in k){if(A=k[O],P&&A!==0)return null;A!==8&&(P=!0),b+=A}else return null;return 32-b},x.prototype.range=function(){return M.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){return this.octets.slice(0)},x.prototype.toIPv4MappedAddress=function(){return M.IPv6.parse(`::ffff:${this.toString()}`)},x.prototype.toNormalizedString=function(){return this.toString()},x.prototype.toString=function(){return this.octets.join(".")},x})(),M.IPv4.broadcastAddressFromCIDR=function(x){try{let b=this.parseCIDR(x),P=b[0].toByteArray(),k=this.subnetMaskFromPrefixLength(b[1]).toByteArray(),S=[],O=0;for(;O<4;)S.push(parseInt(P[O],10)|parseInt(k[O],10)^255),O++;return new this(S)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},M.IPv4.isIPv4=function(x){return this.parser(x)!==null},M.IPv4.isValid=function(x){try{return new this(this.parser(x)),!0}catch{return!1}},M.IPv4.isValidCIDR=function(x){try{return this.parseCIDR(x),!0}catch{return!1}},M.IPv4.isValidFourPartDecimal=function(x){return!!(M.IPv4.isValid(x)&&x.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},M.IPv4.isValidCIDRFourPartDecimal=function(x){let b=x.match(/^(.+)\/(\d+)$/);return!M.IPv4.isValidCIDR(x)||!b?!1:M.IPv4.isValidFourPartDecimal(b[1])},M.IPv4.networkAddressFromCIDR=function(x){let b,P,k,S,O;try{for(b=this.parseCIDR(x),k=b[0].toByteArray(),O=this.subnetMaskFromPrefixLength(b[1]).toByteArray(),S=[],P=0;P<4;)S.push(parseInt(k[P],10)&parseInt(O[P],10)),P++;return new this(S)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},M.IPv4.parse=function(x){let b=this.parser(x);if(b===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(b)},M.IPv4.parseCIDR=function(x){let b;if(b=x.match(/^(.+)\/(\d+)$/)){let P=parseInt(b[2]);if(P>=0&&P<=32){let k=[this.parse(b[1]),P];return Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},M.IPv4.parser=function(x){let b,P,k;if(b=x.match(e.fourOctet))return(function(){let S=b.slice(1,6),O=[];for(let A=0;A4294967295||k<0)throw new Error("ipaddr: address outside defined range");return(function(){let S=[],O;for(O=0;O<=24;O+=8)S.push(k>>O&255);return S})().reverse()}else return(b=x.match(e.twoOctet))?(function(){let S=b.slice(1,4),O=[];if(k=g(S[1]),k>16777215||k<0)throw new Error("ipaddr: address outside defined range");return O.push(g(S[0])),O.push(k>>16&255),O.push(k>>8&255),O.push(k&255),O})():(b=x.match(e.threeOctet))?(function(){let S=b.slice(1,5),O=[];if(k=g(S[2]),k>65535||k<0)throw new Error("ipaddr: address outside defined range");return O.push(g(S[0])),O.push(g(S[1])),O.push(k>>8&255),O.push(k&255),O})():null},M.IPv4.subnetMaskFromPrefixLength=function(x){if(x=parseInt(x),x<0||x>32)throw new Error("ipaddr: invalid IPv4 prefix length");let b=[0,0,0,0],P=0,k=Math.floor(x/8);for(;P=0;A-=1)if(S=this.parts[A],S in k){if(O=k[S],P&&O!==0)return null;O!==16&&(P=!0),b+=O}else return null;return 128-b},x.prototype.range=function(){return M.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){let b,P=[],k=this.parts;for(let S=0;S>8),P.push(b&255);return P},x.prototype.toFixedLengthString=function(){let b=function(){let k=[];for(let S=0;S>8,P&255,k>>8,k&255])},x.prototype.toNormalizedString=function(){let b=function(){let k=[];for(let S=0;SS&&(k=O.index,S=O[0].length);return S<0?P:`${P.substring(0,k)}::${P.substring(k+S)}`},x.prototype.toString=function(){return this.toRFC5952String()},x})(),M.IPv6.broadcastAddressFromCIDR=function(x){try{let b=this.parseCIDR(x),P=b[0].toByteArray(),k=this.subnetMaskFromPrefixLength(b[1]).toByteArray(),S=[],O=0;for(;O<16;)S.push(parseInt(P[O],10)|parseInt(k[O],10)^255),O++;return new this(S)}catch(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},M.IPv6.isIPv6=function(x){return this.parser(x)!==null},M.IPv6.isValid=function(x){if(typeof x=="string"&&x.indexOf(":")===-1)return!1;try{let b=this.parser(x);return new this(b.parts,b.zoneId),!0}catch{return!1}},M.IPv6.isValidCIDR=function(x){if(typeof x=="string"&&x.indexOf(":")===-1)return!1;try{return this.parseCIDR(x),!0}catch{return!1}},M.IPv6.networkAddressFromCIDR=function(x){let b,P,k,S,O;try{for(b=this.parseCIDR(x),k=b[0].toByteArray(),O=this.subnetMaskFromPrefixLength(b[1]).toByteArray(),S=[],P=0;P<16;)S.push(parseInt(k[P],10)&parseInt(O[P],10)),P++;return new this(S)}catch(A){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${A})`)}},M.IPv6.parse=function(x){let b=this.parser(x);if(b.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(b.parts,b.zoneId)},M.IPv6.parseCIDR=function(x){let b,P,k;if((P=x.match(/^(.+)\/(\d+)$/))&&(b=parseInt(P[2]),b>=0&&b<=128))return k=[this.parse(P[1]),b],Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},M.IPv6.parser=function(x){let b,P,k,S,O,A;if(k=x.match(d.deprecatedTransitional))return this.parser(`::ffff:${k[1]}`);if(d.native.test(x))return p(x,8);if((k=x.match(d.transitional))&&(A=k[6]||"",b=k[1],k[1].endsWith("::")||(b=b.slice(0,-1)),b=p(b+A,6),b.parts)){for(O=[parseInt(k[2]),parseInt(k[3]),parseInt(k[4]),parseInt(k[5])],P=0;P128)throw new Error("ipaddr: invalid IPv6 prefix length");let b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],P=0,k=Math.floor(x/8);for(;P{"use strict";(function(){var n=typeof S4<"u"&&S4||typeof define<"u"&&{}||this||window;typeof define<"u"&&define("save-svg-as-png",[],function(){return n}),n.default=n;var o="http://www.w3.org/2000/xmlns/",e="http://www.w3.org/1999/xhtml",t="http://www.w3.org/2000/svg",i=']>',a=/url\(["']?(.+?)["']?\)/,s={woff2:"font/woff2",woff:"font/woff",otf:"application/x-font-opentype",ttf:"application/x-font-ttf",eot:"application/vnd.ms-fontobject",sfnt:"application/font-sfnt",svg:"image/svg+xml"},d=function(G){return G instanceof HTMLElement||G instanceof SVGElement},p=function(G){if(!d(G))throw new Error("an HTMLElement or SVGElement is required; got "+G)},u=function(G){return new Promise(function(ve,Se){d(G)?ve(G):Se(new Error("an HTMLElement or SVGElement is required; got "+G))})},g=function(G){return G&&G.lastIndexOf("http",0)===0&&G.lastIndexOf(window.location.host)===-1},C=function(G){var ve=Object.keys(s).filter(function(Se){return G.indexOf("."+Se)>0}).map(function(Se){return s[Se]});return ve?ve[0]:(console.error("Unknown font format for "+G+". Fonts may not be working correctly."),"application/octet-stream")},M=function(G){for(var ve="",Se=new Uint8Array(G),pe=0;pe"u"||pe===null||isNaN(parseFloat(pe))?0:pe},b=function(G,ve,Se,pe){if(G.tagName==="svg")return{width:Se||x(G,ve,"width"),height:pe||x(G,ve,"height")};if(G.getBBox){var Ae=G.getBBox(),ue=Ae.x,H=Ae.y,te=Ae.width,de=Ae.height;return{width:ue+te,height:H+de}}},P=function(G){return decodeURIComponent(encodeURIComponent(G).replace(/%([0-9A-F]{2})/g,function(ve,Se){var pe=String.fromCharCode("0x"+Se);return pe==="%"?"%25":pe}))},k=function(G){for(var ve=window.atob(G.split(",")[1]),Se=G.split(",")[0].split(":")[1].split(";")[0],pe=new ArrayBuffer(ve.length),Ae=new Uint8Array(pe),ue=0;ue"u",$e=H||[];return B().forEach(function(tt){var et=tt.rules,Me=tt.href;et&&Array.from(et).forEach(function(Z){if(typeof Z.style<"u")if(S(G,Z.selectorText))me.push(de(Z.selectorText,Z.style.cssText));else if(Ie&&Z.cssText.match(/^@font-face/)){var Le=O(Z,Me);Le&&$e.push(Le)}else te||me.push(Z.cssText)})}),F($e).then(function(tt){return me.join(` +`)+tt})},ae=function(){if(!navigator.msSaveOrOpenBlob&&!("download"in document.createElement("a")))return{popup:window.open()}};n.prepareSvg=function(W,G,ve){p(W);var Se=G||{},pe=Se.left,Ae=pe===void 0?0:pe,ue=Se.top,H=ue===void 0?0:ue,te=Se.width,de=Se.height,me=Se.scale,Ie=me===void 0?1:me,$e=Se.responsive,tt=$e===void 0?!1:$e,et=Se.excludeCss,Me=et===void 0?!1:et;return A(W).then(function(){var Z=W.cloneNode(!0);Z.style.backgroundColor=(G||{}).backgroundColor||W.style.backgroundColor;var Le=b(W,Z,te,de),Ze=Le.width,dt=Le.height;if(W.tagName!=="svg")if(W.getBBox){Z.getAttribute("transform")!=null&&Z.setAttribute("transform",Z.getAttribute("transform").replace(/translate\(.*?\)/,""));var Ot=document.createElementNS("http://www.w3.org/2000/svg","svg");Ot.appendChild(Z),Z=Ot}else{console.error("Attempted to render non-SVG element",W);return}if(Z.setAttribute("version","1.1"),Z.setAttribute("viewBox",[Ae,H,Ze,dt].join(" ")),Z.getAttribute("xmlns")||Z.setAttributeNS(o,"xmlns",t),Z.getAttribute("xmlns:xlink")||Z.setAttributeNS(o,"xmlns:xlink","http://www.w3.org/1999/xlink"),tt?(Z.removeAttribute("width"),Z.removeAttribute("height"),Z.setAttribute("preserveAspectRatio","xMinYMin meet")):(Z.setAttribute("width",Ze*Ie),Z.setAttribute("height",dt*Ie)),Array.from(Z.querySelectorAll("foreignObject > *")).forEach(function(Mo){Mo.setAttributeNS(o,"xmlns",Mo.tagName==="svg"?t:e)}),Me){var si=document.createElement("div");si.appendChild(Z);var Bo=si.innerHTML;if(typeof ve=="function")ve(Bo,Ze,dt);else return{src:Bo,width:Ze,height:dt}}else return le(W,G).then(function(Mo){var Ka=document.createElement("style");Ka.setAttribute("type","text/css"),Ka.innerHTML=``;var Gn=document.createElement("defs");Gn.appendChild(Ka),Z.insertBefore(Gn,Z.firstChild);var om=document.createElement("div");om.appendChild(Z);var Zu=om.innerHTML.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');if(typeof ve=="function")ve(Zu,Ze,dt);else return{src:Zu,width:Ze,height:dt}})})},n.svgAsDataUri=function(W,G,ve){return p(W),n.prepareSvg(W,G).then(function(Se){var pe=Se.src,Ae=Se.width,ue=Se.height,H="data:image/svg+xml;base64,"+window.btoa(P(i+pe));return typeof ve=="function"&&ve(H,Ae,ue),H})},n.svgAsPngUri=function(W,G,ve){p(W);var Se=G||{},pe=Se.encoderType,Ae=pe===void 0?"image/png":pe,ue=Se.encoderOptions,H=ue===void 0?.8:ue,te=Se.canvg,de=function(Ie){var $e=Ie.src,tt=Ie.width,et=Ie.height,Me=document.createElement("canvas"),Z=Me.getContext("2d"),Le=window.devicePixelRatio||1;Me.width=tt*Le,Me.height=et*Le,Me.style.width=Me.width+"px",Me.style.height=Me.height+"px",Z.setTransform(Le,0,0,Le,0,0),te?te(Me,$e):Z.drawImage($e,0,0);var Ze=void 0;try{Ze=Me.toDataURL(Ae,H)}catch(dt){if(typeof SecurityError<"u"&&dt instanceof SecurityError||dt.name==="SecurityError"){console.error("Rendered SVG images cannot be downloaded in this browser.");return}else throw dt}return typeof ve=="function"&&ve(Ze,Me.width,Me.height),Promise.resolve(Ze)};return te?n.prepareSvg(W,G).then(de):n.svgAsDataUri(W,G).then(function(me){return new Promise(function(Ie,$e){var tt=new Image;tt.onload=function(){return Ie(de({src:tt,width:tt.width,height:tt.height}))},tt.onerror=function(){$e(`There was an error loading the data URI as an image on the following SVG +`+window.atob(me.slice(26))+`Open the following link to see browser's diagnosis +`+me)},tt.src=me})})},n.download=function(W,G,ve){if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(k(G),W);else{var Se=document.createElement("a");if("download"in Se){Se.download=W,Se.style.display="none",document.body.appendChild(Se);try{var pe=k(G),Ae=URL.createObjectURL(pe);Se.href=Ae,Se.onclick=function(){return requestAnimationFrame(function(){return URL.revokeObjectURL(Ae)})}}catch(ue){console.error(ue),console.warn("Error while getting object URL. Falling back to string URL."),Se.href=G}Se.click(),document.body.removeChild(Se)}else ve&&ve.popup&&(ve.popup.document.title=W,ve.popup.location.replace(G))}},n.saveSvg=function(W,G,ve){var Se=ae();return u(W).then(function(pe){return n.svgAsDataUri(pe,ve||{})}).then(function(pe){return n.download(G,pe,Se)})},n.saveSvgAsPng=function(W,G,ve){var Se=ae();return u(W).then(function(pe){return n.svgAsPngUri(pe,ve||{})}).then(function(pe){return n.download(G,pe,Se)})}})()});var O4=al((d2,E4)=>{(function(n,o){if(typeof d2=="object"&&typeof E4=="object")E4.exports=o();else if(typeof define=="function"&&define.amd)define([],o);else{var e=o();for(var t in e)(typeof d2=="object"?d2:n)[t]=e[t]}})(globalThis,()=>(()=>{"use strict";var n={4567:function(i,a,s){var d=this&&this.__decorate||function(k,S,O,A){var D,F=arguments.length,I=F<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,O):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(k,S,O,A);else for(var B=k.length-1;B>=0;B--)(D=k[B])&&(I=(F<3?D(I):F>3?D(S,O,I):D(S,O))||I);return F>3&&I&&Object.defineProperty(S,O,I),I},p=this&&this.__param||function(k,S){return function(O,A){S(O,A,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;let u=s(9042),g=s(9924),C=s(844),M=s(4725),x=s(2585),b=s(3656),P=a.AccessibilityManager=class extends C.Disposable{constructor(k,S,O,A){super(),this._terminal=k,this._coreBrowserService=O,this._renderService=A,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let D=0;Dthis._handleBoundaryFocus(D,0),this._bottomBoundaryFocusListener=D=>this._handleBoundaryFocus(D,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(D=>this._handleResize(D.rows))),this.register(this._terminal.onRender(D=>this._refreshRows(D.start,D.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(D=>this._handleChar(D))),this.register(this._terminal.onLineFeed(()=>this._handleChar(` +`))),this.register(this._terminal.onA11yTab(D=>this._handleTab(D))),this.register(this._terminal.onKey(D=>this._handleKey(D.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,b.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,C.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(k){for(let S=0;S0?this._charsToConsume.shift()!==k&&(this._charsToAnnounce+=k):this._charsToAnnounce+=k,k===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=u.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(k){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(k)||this._charsToConsume.push(k)}_refreshRows(k,S){this._liveRegionDebouncer.refresh(k,S,this._terminal.rows)}_renderRows(k,S){let O=this._terminal.buffer,A=O.lines.length.toString();for(let D=k;D<=S;D++){let F=O.lines.get(O.ydisp+D),I=[],B=F?.translateToString(!0,void 0,void 0,I)||"",le=(O.ydisp+D+1).toString(),ae=this._rowElements[D];ae&&(B.length===0?(ae.innerText="\xA0",this._rowColumns.set(ae,[0,1])):(ae.textContent=B,this._rowColumns.set(ae,I)),ae.setAttribute("aria-posinset",le),ae.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(k,S){let O=k.target,A=this._rowElements[S===0?1:this._rowElements.length-2];if(O.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||k.relatedTarget!==A)return;let D,F;if(S===0?(D=O,F=this._rowElements.pop(),this._rowContainer.removeChild(F)):(D=this._rowElements.shift(),F=O,this._rowContainer.removeChild(D)),D.removeEventListener("focus",this._topBoundaryFocusListener),F.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){let I=this._createAccessibilityTreeNode();this._rowElements.unshift(I),this._rowContainer.insertAdjacentElement("afterbegin",I)}else{let I=this._createAccessibilityTreeNode();this._rowElements.push(I),this._rowContainer.appendChild(I)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),k.preventDefault(),k.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let k=document.getSelection();if(!k)return;if(k.isCollapsed)return void(this._rowContainer.contains(k.anchorNode)&&this._terminal.clearSelection());if(!k.anchorNode||!k.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:k.anchorNode,offset:k.anchorOffset},O={node:k.focusNode,offset:k.focusOffset};if((S.node.compareDocumentPosition(O.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===O.node&&S.offset>O.offset)&&([S,O]=[O,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;let A=this._rowElements.slice(-1)[0];if(O.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(O={node:A,offset:A.textContent?.length??0}),!this._rowContainer.contains(O.node))return;let D=({node:B,offset:le})=>{let ae=B instanceof Text?B.parentNode:B,W=parseInt(ae?.getAttribute("aria-posinset"),10)-1;if(isNaN(W))return console.warn("row is invalid. Race condition?"),null;let G=this._rowColumns.get(ae);if(!G)return console.warn("columns is null. Race condition?"),null;let ve=le=this._terminal.cols&&(++W,ve=0),{row:W,column:ve}},F=D(S),I=D(O);if(F&&I){if(F.row>I.row||F.row===I.row&&F.column>=I.column)throw new Error("invalid range");this._terminal.select(F.column,F.row,(I.row-F.row)*this._terminal.cols-F.column+I.column)}}_handleResize(k){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;Sk;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let k=this._coreBrowserService.mainDocument.createElement("div");return k.setAttribute("role","listitem"),k.tabIndex=-1,this._refreshRowDimensions(k),k}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let k=0;k{function s(g){return g.replace(/\r?\n/g,"\r")}function d(g,C){return C?"\x1B[200~"+g+"\x1B[201~":g}function p(g,C,M,x){g=d(g=s(g),M.decPrivateModes.bracketedPasteMode&&x.rawOptions.ignoreBracketedPasteMode!==!0),M.triggerDataEvent(g,!0),C.value=""}function u(g,C,M){let x=M.getBoundingClientRect(),b=g.clientX-x.left-10,P=g.clientY-x.top-10;C.style.width="20px",C.style.height="20px",C.style.left=`${b}px`,C.style.top=`${P}px`,C.style.zIndex="1000",C.focus()}Object.defineProperty(a,"__esModule",{value:!0}),a.rightClickHandler=a.moveTextAreaUnderMouseCursor=a.paste=a.handlePasteEvent=a.copyHandler=a.bracketTextForPaste=a.prepareTextForTerminal=void 0,a.prepareTextForTerminal=s,a.bracketTextForPaste=d,a.copyHandler=function(g,C){g.clipboardData&&g.clipboardData.setData("text/plain",C.selectionText),g.preventDefault()},a.handlePasteEvent=function(g,C,M,x){g.stopPropagation(),g.clipboardData&&p(g.clipboardData.getData("text/plain"),C,M,x)},a.paste=p,a.moveTextAreaUnderMouseCursor=u,a.rightClickHandler=function(g,C,M,x,b){u(g,C,M),b&&x.rightClickSelect(g),C.value=x.selectionText,C.select()}},7239:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorContrastCache=void 0;let d=s(1505);a.ColorContrastCache=class{constructor(){this._color=new d.TwoKeyMap,this._css=new d.TwoKeyMap}setCss(p,u,g){this._css.set(p,u,g)}getCss(p,u){return this._css.get(p,u)}setColor(p,u,g){this._color.set(p,u,g)}getColor(p,u){return this._color.get(p,u)}clear(){this._color.clear(),this._css.clear()}}},3656:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.addDisposableDomListener=void 0,a.addDisposableDomListener=function(s,d,p,u){s.addEventListener(d,p,u);let g=!1;return{dispose:()=>{g||(g=!0,s.removeEventListener(d,p,u))}}}},3551:function(i,a,s){var d=this&&this.__decorate||function(P,k,S,O){var A,D=arguments.length,F=D<3?k:O===null?O=Object.getOwnPropertyDescriptor(k,S):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(P,k,S,O);else for(var I=P.length-1;I>=0;I--)(A=P[I])&&(F=(D<3?A(F):D>3?A(k,S,F):A(k,S))||F);return D>3&&F&&Object.defineProperty(k,S,F),F},p=this&&this.__param||function(P,k){return function(S,O){k(S,O,P)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;let u=s(3656),g=s(8460),C=s(844),M=s(2585),x=s(4725),b=a.Linkifier=class extends C.Disposable{get currentLink(){return this._currentLink}constructor(P,k,S,O,A){super(),this._element=P,this._mouseService=k,this._renderService=S,this._bufferService=O,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new g.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new g.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,C.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,C.toDisposable)(()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,u.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,u.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(P){this._lastMouseEvent=P;let k=this._positionFromMouseEvent(P,this._element,this._mouseService);if(!k)return;this._isMouseOut=!1;let S=P.composedPath();for(let O=0;O{O?.forEach(A=>{A.link.dispose&&A.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=P.y);let S=!1;for(let[O,A]of this._linkProviderService.linkProviders.entries())k?this._activeProviderReplies?.get(O)&&(S=this._checkLinkProviderResult(O,P,S)):A.provideLinks(P.y,D=>{if(this._isMouseOut)return;let F=D?.map(I=>({link:I}));this._activeProviderReplies?.set(O,F),S=this._checkLinkProviderResult(O,P,S),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(P.y,this._activeProviderReplies)})}_removeIntersectingLinks(P,k){let S=new Set;for(let O=0;OP?this._bufferService.cols:F.link.range.end.x;for(let le=I;le<=B;le++){if(S.has(le)){A.splice(D--,1);break}S.add(le)}}}}_checkLinkProviderResult(P,k,S){if(!this._activeProviderReplies)return S;let O=this._activeProviderReplies.get(P),A=!1;for(let D=0;Dthis._linkAtPosition(F.link,k));D&&(S=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let D=0;Dthis._linkAtPosition(I.link,k));if(F){S=!0,this._handleNewLink(F);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(P){if(!this._currentLink)return;let k=this._positionFromMouseEvent(P,this._element,this._mouseService);k&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,k)&&this._currentLink.link.activate(P,this._currentLink.link.text)}_clearCurrentLink(P,k){this._currentLink&&this._lastMouseEvent&&(!P||!k||this._currentLink.link.range.start.y>=P&&this._currentLink.link.range.end.y<=k)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,C.disposeArray)(this._linkCacheDisposables))}_handleNewLink(P){if(!this._lastMouseEvent)return;let k=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);k&&this._linkAtPosition(P.link,k)&&(this._currentLink=P,this._currentLink.state={decorations:{underline:P.link.decorations===void 0||P.link.decorations.underline,pointerCursor:P.link.decorations===void 0||P.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,P.link,this._lastMouseEvent),P.link.decorations={},Object.defineProperties(P.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:S=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:S=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(P.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(S=>{if(!this._currentLink)return;let O=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=O&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(O,A),this._lastMouseEvent)){let D=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);D&&this._askForLink(D,!1)}})))}_linkHover(P,k,S){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(k,!0),this._currentLink.state.decorations.pointerCursor&&P.classList.add("xterm-cursor-pointer")),k.hover&&k.hover(S,k.text)}_fireUnderlineEvent(P,k){let S=P.range,O=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-O-1,S.end.x,S.end.y-O-1,void 0);(k?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(P,k,S){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(k,!1),this._currentLink.state.decorations.pointerCursor&&P.classList.remove("xterm-cursor-pointer")),k.leave&&k.leave(S,k.text)}_linkAtPosition(P,k){let S=P.range.start.y*this._bufferService.cols+P.range.start.x,O=P.range.end.y*this._bufferService.cols+P.range.end.x,A=k.y*this._bufferService.cols+k.x;return S<=A&&A<=O}_positionFromMouseEvent(P,k,S){let O=S.getCoords(P,k,this._bufferService.cols,this._bufferService.rows);if(O)return{x:O[0],y:O[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(P,k,S,O,A){return{x1:P,y1:k,x2:S,y2:O,cols:this._bufferService.cols,fg:A}}};a.Linkifier=b=d([p(1,x.IMouseService),p(2,x.IRenderService),p(3,M.IBufferService),p(4,x.ILinkProviderService)],b)},9042:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.tooMuchOutput=a.promptLabel=void 0,a.promptLabel="Terminal input",a.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(i,a,s){var d=this&&this.__decorate||function(x,b,P,k){var S,O=arguments.length,A=O<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,P):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,b,P,k);else for(var D=x.length-1;D>=0;D--)(S=x[D])&&(A=(O<3?S(A):O>3?S(b,P,A):S(b,P))||A);return O>3&&A&&Object.defineProperty(b,P,A),A},p=this&&this.__param||function(x,b){return function(P,k){b(P,k,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;let u=s(511),g=s(2585),C=a.OscLinkProvider=class{constructor(x,b,P){this._bufferService=x,this._optionsService=b,this._oscLinkService=P}provideLinks(x,b){let P=this._bufferService.buffer.lines.get(x-1);if(!P)return void b(void 0);let k=[],S=this._optionsService.rawOptions.linkHandler,O=new u.CellData,A=P.getTrimmedLength(),D=-1,F=-1,I=!1;for(let B=0;BS?S.activate(G,ve,ae):M(0,ve),hover:(G,ve)=>S?.hover?.(G,ve,ae),leave:(G,ve)=>S?.leave?.(G,ve,ae)})}I=!1,O.hasExtendedAttrs()&&O.extended.urlId?(F=B,D=O.extended.urlId):(F=-1,D=-1)}}b(k)}};function M(x,b){if(confirm(`Do you want to navigate to ${b}? + +WARNING: This link could potentially be dangerous`)){let P=window.open();if(P){try{P.opener=null}catch{}P.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=C=d([p(0,g.IBufferService),p(1,g.IOptionsService),p(2,g.IOscLinkService)],C)},6193:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(s,d){this._renderCallback=s,this._coreBrowserService=d,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(s){return this._refreshCallbacks.push(s),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(s,d,p){this._rowCount=p,s=s!==void 0?s:0,d=d!==void 0?d:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,d):d,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let s=Math.max(this._rowStart,0),d=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,d),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let s of this._refreshCallbacks)s(0);this._refreshCallbacks=[]}}},3236:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;let d=s(3614),p=s(3656),u=s(3551),g=s(9042),C=s(3730),M=s(1680),x=s(3107),b=s(5744),P=s(2950),k=s(1296),S=s(428),O=s(4269),A=s(5114),D=s(8934),F=s(3230),I=s(9312),B=s(4725),le=s(6731),ae=s(8055),W=s(8969),G=s(8460),ve=s(844),Se=s(6114),pe=s(8437),Ae=s(2584),ue=s(7399),H=s(5941),te=s(9074),de=s(2585),me=s(5435),Ie=s(4567),$e=s(779);class tt extends W.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(Me={}){super(Me),this.browser=Se,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new ve.MutableDisposable),this._onCursorMove=this.register(new G.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new G.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new G.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new G.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new G.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new G.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new G.EventEmitter),this._onBlur=this.register(new G.EventEmitter),this._onA11yCharEmitter=this.register(new G.EventEmitter),this._onA11yTabEmitter=this.register(new G.EventEmitter),this._onWillOpen=this.register(new G.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(te.DecorationService),this._instantiationService.setService(de.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($e.LinkProviderService),this._instantiationService.setService(B.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((Z,Le)=>this.refresh(Z,Le))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(Z=>this._reportWindowsOptions(Z))),this.register(this._inputHandler.onColor(Z=>this._handleColorEvent(Z))),this.register((0,G.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,G.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,G.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,G.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(Z=>this._afterResize(Z.cols,Z.rows))),this.register((0,ve.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(Me){if(this._themeService)for(let Z of Me){let Le,Ze="";switch(Z.index){case 256:Le="foreground",Ze="10";break;case 257:Le="background",Ze="11";break;case 258:Le="cursor",Ze="12";break;default:Le="ansi",Ze="4;"+Z.index}switch(Z.type){case 0:let dt=ae.color.toColorRGB(Le==="ansi"?this._themeService.colors.ansi[Z.index]:this._themeService.colors[Le]);this.coreService.triggerDataEvent(`${Ae.C0.ESC}]${Ze};${(0,H.toRgbString)(dt)}${Ae.C1_ESCAPED.ST}`);break;case 1:if(Le==="ansi")this._themeService.modifyColors(Ot=>Ot.ansi[Z.index]=ae.channels.toColor(...Z.color));else{let Ot=Le;this._themeService.modifyColors(si=>si[Ot]=ae.channels.toColor(...Z.color))}break;case 2:this._themeService.restoreColor(Z.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Me){Me?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ie.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Me){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ae.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ae.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let Me=this.buffer.ybase+this.buffer.y,Z=this.buffer.lines.get(Me);if(!Z)return;let Le=Math.min(this.buffer.x,this.cols-1),Ze=this._renderService.dimensions.css.cell.height,dt=Z.getWidth(Le),Ot=this._renderService.dimensions.css.cell.width*dt,si=this.buffer.y*this._renderService.dimensions.css.cell.height,Bo=Le*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Bo+"px",this.textarea.style.top=si+"px",this.textarea.style.width=Ot+"px",this.textarea.style.height=Ze+"px",this.textarea.style.lineHeight=Ze+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",Z=>{this.hasSelection()&&(0,d.copyHandler)(Z,this._selectionService)}));let Me=Z=>(0,d.handlePasteEvent)(Z,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",Me)),this.register((0,p.addDisposableDomListener)(this.element,"paste",Me)),Se.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",Z=>{Z.button===2&&(0,d.rightClickHandler)(Z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",Z=>{(0,d.rightClickHandler)(Z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Se.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",Z=>{Z.button===1&&(0,d.moveTextAreaUnderMouseCursor)(Z,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",Me=>this._keyUp(Me),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",Me=>this._keyDown(Me),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",Me=>this._keyPress(Me),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",Me=>this._compositionHelper.compositionupdate(Me))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,p.addDisposableDomListener)(this.textarea,"input",Me=>this._inputEvent(Me),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(Me){if(!Me)throw new Error("Terminal requires a parent element.");if(Me.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Me.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),Me.appendChild(this.element);let Z=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),Z.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",Le=>this.updateCursorStyle(Le))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),Z.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.promptLabel),Se.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(A.CoreBrowserService,this.textarea,Me.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(B.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",Le=>this._handleTextAreaFocus(Le))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(B.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(le.ThemeService),this._instantiationService.setService(B.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(O.CharacterJoinerService),this._instantiationService.setService(B.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(F.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(B.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(Le=>this._onRender.fire(Le))),this.onResize(Le=>this._renderService.resize(Le.cols,Le.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(P.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(D.MouseService),this._instantiationService.setService(B.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(u.Linkifier,this.screenElement)),this.element.appendChild(Z);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(M.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(Le=>this.scrollLines(Le.amount,Le.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(I.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(B.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(Le=>this.scrollLines(Le.amount,Le.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(Le=>this._renderService.handleSelectionChanged(Le.start,Le.end,Le.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(Le=>{this.textarea.value=Le,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(Le=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(x.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",Le=>this._selectionService.handleMouseDown(Le))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ie.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",Le=>this._handleScreenReaderModeOptionChange(Le))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",Le=>{!this._overviewRulerRenderer&&Le&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(k.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let Me=this,Z=this.element;function Le(Ot){let si=Me._mouseService.getMouseReportCoords(Ot,Me.screenElement);if(!si)return!1;let Bo,Mo;switch(Ot.overrideType||Ot.type){case"mousemove":Mo=32,Ot.buttons===void 0?(Bo=3,Ot.button!==void 0&&(Bo=Ot.button<3?Ot.button:3)):Bo=1&Ot.buttons?0:4&Ot.buttons?1:2&Ot.buttons?2:3;break;case"mouseup":Mo=0,Bo=Ot.button<3?Ot.button:3;break;case"mousedown":Mo=1,Bo=Ot.button<3?Ot.button:3;break;case"wheel":if(Me._customWheelEventHandler&&Me._customWheelEventHandler(Ot)===!1||Me.viewport.getLinesScrolled(Ot)===0)return!1;Mo=Ot.deltaY<0?0:1,Bo=4;break;default:return!1}return!(Mo===void 0||Bo===void 0||Bo>4)&&Me.coreMouseService.triggerMouseEvent({col:si.col,row:si.row,x:si.x,y:si.y,button:Bo,action:Mo,ctrl:Ot.ctrlKey,alt:Ot.altKey,shift:Ot.shiftKey})}let Ze={mouseup:null,wheel:null,mousedrag:null,mousemove:null},dt={mouseup:Ot=>(Le(Ot),Ot.buttons||(this._document.removeEventListener("mouseup",Ze.mouseup),Ze.mousedrag&&this._document.removeEventListener("mousemove",Ze.mousedrag)),this.cancel(Ot)),wheel:Ot=>(Le(Ot),this.cancel(Ot,!0)),mousedrag:Ot=>{Ot.buttons&&Le(Ot)},mousemove:Ot=>{Ot.buttons||Le(Ot)}};this.register(this.coreMouseService.onProtocolChange(Ot=>{Ot?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Ot)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&Ot?Ze.mousemove||(Z.addEventListener("mousemove",dt.mousemove),Ze.mousemove=dt.mousemove):(Z.removeEventListener("mousemove",Ze.mousemove),Ze.mousemove=null),16&Ot?Ze.wheel||(Z.addEventListener("wheel",dt.wheel,{passive:!1}),Ze.wheel=dt.wheel):(Z.removeEventListener("wheel",Ze.wheel),Ze.wheel=null),2&Ot?Ze.mouseup||(Ze.mouseup=dt.mouseup):(this._document.removeEventListener("mouseup",Ze.mouseup),Ze.mouseup=null),4&Ot?Ze.mousedrag||(Ze.mousedrag=dt.mousedrag):(this._document.removeEventListener("mousemove",Ze.mousedrag),Ze.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(Z,"mousedown",Ot=>{if(Ot.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Ot))return Le(Ot),Ze.mouseup&&this._document.addEventListener("mouseup",Ze.mouseup),Ze.mousedrag&&this._document.addEventListener("mousemove",Ze.mousedrag),this.cancel(Ot)})),this.register((0,p.addDisposableDomListener)(Z,"wheel",Ot=>{if(!Ze.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Ot)===!1)return!1;if(!this.buffer.hasScrollback){let si=this.viewport.getLinesScrolled(Ot);if(si===0)return;let Bo=Ae.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Ot.deltaY<0?"A":"B"),Mo="";for(let Ka=0;Ka{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Ot),this.cancel(Ot)},{passive:!0})),this.register((0,p.addDisposableDomListener)(Z,"touchmove",Ot=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Ot)?void 0:this.cancel(Ot)},{passive:!1}))}refresh(Me,Z){this._renderService?.refreshRows(Me,Z)}updateCursorStyle(Me){this._selectionService?.shouldColumnSelect(Me)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(Me,Z,Le=0){Le===1?(super.scrollLines(Me,Z,Le),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(Me)}paste(Me){(0,d.paste)(Me,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Me){this._customKeyEventHandler=Me}attachCustomWheelEventHandler(Me){this._customWheelEventHandler=Me}registerLinkProvider(Me){return this._linkProviderService.registerLinkProvider(Me)}registerCharacterJoiner(Me){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let Z=this._characterJoinerService.register(Me);return this.refresh(0,this.rows-1),Z}deregisterCharacterJoiner(Me){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Me)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Me){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Me)}registerDecoration(Me){return this._decorationService.registerDecoration(Me)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Me,Z,Le){this._selectionService.setSelection(Me,Z,Le)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(Me,Z){this._selectionService?.selectLines(Me,Z)}_keyDown(Me){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Me)===!1)return!1;let Z=this.browser.isMac&&this.options.macOptionIsMeta&&Me.altKey;if(!Z&&!this._compositionHelper.keydown(Me))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;Z||Me.key!=="Dead"&&Me.key!=="AltGraph"||(this._unprocessedDeadKey=!0);let Le=(0,ue.evaluateKeyboardEvent)(Me,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Me),Le.type===3||Le.type===2){let Ze=this.rows-1;return this.scrollLines(Le.type===2?-Ze:Ze),this.cancel(Me,!0)}return Le.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Me)||(Le.cancel&&this.cancel(Me,!0),!Le.key||!!(Me.key&&!Me.ctrlKey&&!Me.altKey&&!Me.metaKey&&Me.key.length===1&&Me.key.charCodeAt(0)>=65&&Me.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(Le.key!==Ae.C0.ETX&&Le.key!==Ae.C0.CR||(this.textarea.value=""),this._onKey.fire({key:Le.key,domEvent:Me}),this._showCursor(),this.coreService.triggerDataEvent(Le.key,!0),!this.optionsService.rawOptions.screenReaderMode||Me.altKey||Me.ctrlKey?this.cancel(Me,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Me,Z){let Le=Me.isMac&&!this.options.macOptionIsMeta&&Z.altKey&&!Z.ctrlKey&&!Z.metaKey||Me.isWindows&&Z.altKey&&Z.ctrlKey&&!Z.metaKey||Me.isWindows&&Z.getModifierState("AltGraph");return Z.type==="keypress"?Le:Le&&(!Z.keyCode||Z.keyCode>47)}_keyUp(Me){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Me)===!1||((function(Z){return Z.keyCode===16||Z.keyCode===17||Z.keyCode===18})(Me)||this.focus(),this.updateCursorStyle(Me),this._keyPressHandled=!1)}_keyPress(Me){let Z;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Me)===!1)return!1;if(this.cancel(Me),Me.charCode)Z=Me.charCode;else if(Me.which===null||Me.which===void 0)Z=Me.keyCode;else{if(Me.which===0||Me.charCode===0)return!1;Z=Me.which}return!(!Z||(Me.altKey||Me.ctrlKey||Me.metaKey)&&!this._isThirdLevelShift(this.browser,Me)||(Z=String.fromCharCode(Z),this._onKey.fire({key:Z,domEvent:Me}),this._showCursor(),this.coreService.triggerDataEvent(Z,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Me){if(Me.data&&Me.inputType==="insertText"&&(!Me.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let Z=Me.data;return this.coreService.triggerDataEvent(Z,!0),this.cancel(Me),!0}return!1}resize(Me,Z){Me!==this.cols||Z!==this.rows?super.resize(Me,Z):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Me,Z){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let Me=1;Me{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(s,d=1e3){this._renderCallback=s,this._debounceThresholdMS=d,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(s,d,p){this._rowCount=p,s=s!==void 0?s:0,d=d!==void 0?d:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,s):s,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,d):d;let u=Date.now();if(u-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=u,this._innerRefresh();else if(!this._additionalRefreshRequested){let g=u-this._lastRefreshMs,C=this._debounceThresholdMS-g;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let s=Math.max(this._rowStart,0),d=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(s,d)}}},1680:function(i,a,s){var d=this&&this.__decorate||function(P,k,S,O){var A,D=arguments.length,F=D<3?k:O===null?O=Object.getOwnPropertyDescriptor(k,S):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(P,k,S,O);else for(var I=P.length-1;I>=0;I--)(A=P[I])&&(F=(D<3?A(F):D>3?A(k,S,F):A(k,S))||F);return D>3&&F&&Object.defineProperty(k,S,F),F},p=this&&this.__param||function(P,k){return function(S,O){k(S,O,P)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;let u=s(3656),g=s(4725),C=s(8460),M=s(844),x=s(2585),b=a.Viewport=class extends M.Disposable{constructor(P,k,S,O,A,D,F,I){super(),this._viewportElement=P,this._scrollArea=k,this._bufferService=S,this._optionsService=O,this._charSizeService=A,this._renderService=D,this._coreBrowserService=F,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(B=>this._activeBuffer=B.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(B=>this._renderDimensions=B)),this._handleThemeChange(I.colors),this.register(I.onChangeColors(B=>this._handleThemeChange(B))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(P){this._viewportElement.style.backgroundColor=P.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(P){if(P)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let k=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==k&&(this._lastRecordedBufferHeight=k,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}let P=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==P&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=P),this._refreshAnimationFrame=null}syncScrollArea(P=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(P);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(P)}_handleScroll(P){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let k=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:k,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let P=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(P*(this._smoothScrollState.target-this._smoothScrollState.origin)),P<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(P,k){let S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(k<0&&this._viewportElement.scrollTop!==0||k>0&&S0&&(S=ae),O=""}}return{bufferElements:A,cursorElement:S}}getLinesScrolled(P){if(P.deltaY===0||P.shiftKey)return 0;let k=this._applyScrollModifier(P.deltaY,P);return P.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(k/=this._currentRowHeight+0,this._wheelPartialScroll+=k,k=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):P.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(k*=this._bufferService.rows),k}_applyScrollModifier(P,k){let S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&k.altKey||S==="ctrl"&&k.ctrlKey||S==="shift"&&k.shiftKey?P*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:P*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(P){this._lastTouchY=P.touches[0].pageY}handleTouchMove(P){let k=this._lastTouchY-P.touches[0].pageY;return this._lastTouchY=P.touches[0].pageY,k!==0&&(this._viewportElement.scrollTop+=k,this._bubbleScroll(P,k))}};a.Viewport=b=d([p(2,x.IBufferService),p(3,x.IOptionsService),p(4,g.ICharSizeService),p(5,g.IRenderService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],b)},3107:function(i,a,s){var d=this&&this.__decorate||function(x,b,P,k){var S,O=arguments.length,A=O<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,P):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,b,P,k);else for(var D=x.length-1;D>=0;D--)(S=x[D])&&(A=(O<3?S(A):O>3?S(b,P,A):S(b,P))||A);return O>3&&A&&Object.defineProperty(b,P,A),A},p=this&&this.__param||function(x,b){return function(P,k){b(P,k,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;let u=s(4725),g=s(844),C=s(2585),M=a.BufferDecorationRenderer=class extends g.Disposable{constructor(x,b,P,k,S){super(),this._screenElement=x,this._bufferService=b,this._coreBrowserService=P,this._decorationService=k,this._renderService=S,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(O=>this._removeDecoration(O))),this.register((0,g.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let x of this._decorationService.decorations)this._renderDecoration(x);this._dimensionsChanged=!1}_renderDecoration(x){this._refreshStyle(x),this._dimensionsChanged&&this._refreshXPosition(x)}_createElement(x){let b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",x?.options?.layer==="top"),b.style.width=`${Math.round((x.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(x.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(x.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let P=x.options.x??0;return P&&P>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(x,b),b}_refreshStyle(x){let b=x.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)x.element&&(x.element.style.display="none",x.onRenderEmitter.fire(x.element));else{let P=this._decorationElements.get(x);P||(P=this._createElement(x),x.element=P,this._decorationElements.set(x,P),this._container.appendChild(P),x.onDispose(()=>{this._decorationElements.delete(x),P.remove()})),P.style.top=b*this._renderService.dimensions.css.cell.height+"px",P.style.display=this._altBufferIsActive?"none":"block",x.onRenderEmitter.fire(P)}}_refreshXPosition(x,b=x.element){if(!b)return;let P=x.options.x??0;(x.options.anchor||"left")==="right"?b.style.right=P?P*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=P?P*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(x){this._decorationElements.get(x)?.remove(),this._decorationElements.delete(x),x.dispose()}};a.BufferDecorationRenderer=M=d([p(1,C.IBufferService),p(2,u.ICoreBrowserService),p(3,C.IDecorationService),p(4,u.IRenderService)],M)},5871:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorZoneStore=void 0,a.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(s){if(s.options.overviewRulerOptions){for(let d of this._zones)if(d.color===s.options.overviewRulerOptions.color&&d.position===s.options.overviewRulerOptions.position){if(this._lineIntersectsZone(d,s.marker.line))return;if(this._lineAdjacentToZone(d,s.marker.line,s.options.overviewRulerOptions.position))return void this._addLineToZone(d,s.marker.line)}if(this._zonePoolIndex=s.startBufferLine&&d<=s.endBufferLine}_lineAdjacentToZone(s,d,p){return d>=s.startBufferLine-this._linePadding[p||"full"]&&d<=s.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(s,d){s.startBufferLine=Math.min(s.startBufferLine,d),s.endBufferLine=Math.max(s.endBufferLine,d)}}},5744:function(i,a,s){var d=this&&this.__decorate||function(S,O,A,D){var F,I=arguments.length,B=I<3?O:D===null?D=Object.getOwnPropertyDescriptor(O,A):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,O,A,D);else for(var le=S.length-1;le>=0;le--)(F=S[le])&&(B=(I<3?F(B):I>3?F(O,A,B):F(O,A))||B);return I>3&&B&&Object.defineProperty(O,A,B),B},p=this&&this.__param||function(S,O){return function(A,D){O(A,D,S)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;let u=s(5871),g=s(4725),C=s(844),M=s(2585),x={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},P={full:0,left:0,center:0,right:0},k=a.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,O,A,D,F,I,B){super(),this._viewportElement=S,this._screenElement=O,this._bufferService=A,this._decorationService=D,this._renderService=F,this._optionsService=I,this._coreBrowserService=B,this._colorZoneStore=new u.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let le=this._canvas.getContext("2d");if(!le)throw new Error("Ctx cannot be null");this._ctx=le,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.toDisposable)(()=>{this._canvas?.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){let S=Math.floor(this._canvas.width/3),O=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=S,b.center=O,b.right=S,this._refreshDrawHeightConstants(),P.full=0,P.left=0,P.center=b.left,P.right=b.left+b.center}_refreshDrawHeightConstants(){x.full=Math.round(2*this._coreBrowserService.dpr);let S=this._canvas.height/this._bufferService.buffer.lines.length,O=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);x.left=O,x.center=O,x.right=O}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let O of this._decorationService.decorations)this._colorZoneStore.addDecoration(O);this._ctx.lineWidth=1;let S=this._colorZoneStore.zones;for(let O of S)O.position!=="full"&&this._renderColorZone(O);for(let O of S)O.position==="full"&&this._renderColorZone(O);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(P[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-x[S.position||"full"]/2),b[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+x[S.position||"full"]))}_queueRefresh(S,O){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=O||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};a.OverviewRulerRenderer=k=d([p(2,M.IBufferService),p(3,M.IDecorationService),p(4,g.IRenderService),p(5,M.IOptionsService),p(6,g.ICoreBrowserService)],k)},2950:function(i,a,s){var d=this&&this.__decorate||function(x,b,P,k){var S,O=arguments.length,A=O<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,P):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,b,P,k);else for(var D=x.length-1;D>=0;D--)(S=x[D])&&(A=(O<3?S(A):O>3?S(b,P,A):S(b,P))||A);return O>3&&A&&Object.defineProperty(b,P,A),A},p=this&&this.__param||function(x,b){return function(P,k){b(P,k,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;let u=s(4725),g=s(2585),C=s(2584),M=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(x,b,P,k,S,O){this._textarea=x,this._compositionView=b,this._bufferService=P,this._optionsService=k,this._coreService=S,this._renderService=O,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(x){this._compositionView.textContent=x.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(x){if(this._isComposing||this._isSendingComposition){if(x.keyCode===229||x.keyCode===16||x.keyCode===17||x.keyCode===18)return!1;this._finalizeComposition(!1)}return x.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(x){if(this._compositionView.classList.remove("active"),this._isComposing=!1,x){let b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let P;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,P=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),P.length>0&&this._coreService.triggerDataEvent(P,!0)}},0)}else{this._isSendingComposition=!1;let b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){let x=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let b=this._textarea.value,P=b.replace(x,"");this._dataAlreadySent=P,b.length>x.length?this._coreService.triggerDataEvent(P,!0):b.lengththis.updateCompositionElements(!0),0)}}};a.CompositionHelper=M=d([p(2,g.IBufferService),p(3,g.IOptionsService),p(4,g.ICoreService),p(5,u.IRenderService)],M)},9806:(i,a)=>{function s(d,p,u){let g=u.getBoundingClientRect(),C=d.getComputedStyle(u),M=parseInt(C.getPropertyValue("padding-left")),x=parseInt(C.getPropertyValue("padding-top"));return[p.clientX-g.left-M,p.clientY-g.top-x]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=s,a.getCoords=function(d,p,u,g,C,M,x,b,P){if(!M)return;let k=s(d,p,u);return k?(k[0]=Math.ceil((k[0]+(P?x/2:0))/x),k[1]=Math.ceil(k[1]/b),k[0]=Math.min(Math.max(k[0],1),g+(P?1:0)),k[1]=Math.min(Math.max(k[1],1),C),k):void 0}},9504:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;let d=s(2584);function p(b,P,k,S){let O=b-u(b,k),A=P-u(P,k),D=Math.abs(O-A)-(function(F,I,B){let le=0,ae=F-u(F,B),W=I-u(I,B);for(let G=0;G=0&&bP?"A":"B"}function C(b,P,k,S,O,A){let D=b,F=P,I="";for(;D!==k||F!==S;)D+=O?1:-1,O&&D>A.cols-1?(I+=A.buffer.translateBufferLineToString(F,!1,b,D),D=0,b=0,F++):!O&&D<0&&(I+=A.buffer.translateBufferLineToString(F,!1,0,b+1),D=A.cols-1,b=D,F--);return I+A.buffer.translateBufferLineToString(F,!1,b,D)}function M(b,P){let k=P?"O":"[";return d.C0.ESC+k+b}function x(b,P){b=Math.floor(b);let k="";for(let S=0;S0?ae-u(ae,W):B;let Se=ae,pe=(function(Ae,ue,H,te,de,me){let Ie;return Ie=p(H,te,de,me).length>0?te-u(te,de):ue,Ae=H&&Ieb?"D":"C",x(Math.abs(O-b),M(D,S));D=A>P?"D":"C";let F=Math.abs(A-P);return x((function(I,B){return B.cols-I})(A>P?b:O,k)+(F-1)*k.cols+1+((A>P?O:b)-1),M(D,S))}},1296:function(i,a,s){var d=this&&this.__decorate||function(G,ve,Se,pe){var Ae,ue=arguments.length,H=ue<3?ve:pe===null?pe=Object.getOwnPropertyDescriptor(ve,Se):pe;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(G,ve,Se,pe);else for(var te=G.length-1;te>=0;te--)(Ae=G[te])&&(H=(ue<3?Ae(H):ue>3?Ae(ve,Se,H):Ae(ve,Se))||H);return ue>3&&H&&Object.defineProperty(ve,Se,H),H},p=this&&this.__param||function(G,ve){return function(Se,pe){ve(Se,pe,G)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;let u=s(3787),g=s(2550),C=s(2223),M=s(6171),x=s(6052),b=s(4725),P=s(8055),k=s(8460),S=s(844),O=s(2585),A="xterm-dom-renderer-owner-",D="xterm-rows",F="xterm-fg-",I="xterm-bg-",B="xterm-focus",le="xterm-selection",ae=1,W=a.DomRenderer=class extends S.Disposable{constructor(G,ve,Se,pe,Ae,ue,H,te,de,me,Ie,$e,tt){super(),this._terminal=G,this._document=ve,this._element=Se,this._screenElement=pe,this._viewportElement=Ae,this._helperContainer=ue,this._linkifier2=H,this._charSizeService=de,this._optionsService=me,this._bufferService=Ie,this._coreBrowserService=$e,this._themeService=tt,this._terminalClass=ae++,this._rowElements=[],this._selectionRenderModel=(0,x.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new k.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(D),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(le),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,M.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(et=>this._injectCss(et))),this._injectCss(this._themeService.colors),this._rowFactory=te.createInstance(u.DomRendererRowFactory,document),this._element.classList.add(A+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(et=>this._handleLinkHover(et))),this.register(this._linkifier2.onHideLinkUnderline(et=>this._handleLinkLeave(et))),this.register((0,S.toDisposable)(()=>{this._element.classList.remove(A+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new g.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let G=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*G,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*G),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/G),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/G),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let Se of this._rowElements)Se.style.width=`${this.dimensions.css.canvas.width}px`,Se.style.height=`${this.dimensions.css.cell.height}px`,Se.style.lineHeight=`${this.dimensions.css.cell.height}px`,Se.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let ve=`${this._terminalSelector} .${D} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=ve,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(G){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let ve=`${this._terminalSelector} .${D} { color: ${G.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;ve+=`${this._terminalSelector} .${D} .xterm-dim { color: ${P.color.multiplyOpacity(G.foreground,.5).css};}`,ve+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let Se=`blink_underline_${this._terminalClass}`,pe=`blink_bar_${this._terminalClass}`,Ae=`blink_block_${this._terminalClass}`;ve+=`@keyframes ${Se} { 50% { border-bottom-style: hidden; }}`,ve+=`@keyframes ${pe} { 50% { box-shadow: none; }}`,ve+=`@keyframes ${Ae} { 0% { background-color: ${G.cursor.css}; color: ${G.cursorAccent.css}; } 50% { background-color: inherit; color: ${G.cursor.css}; }}`,ve+=`${this._terminalSelector} .${D}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${Se} 1s step-end infinite;}${this._terminalSelector} .${D}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${pe} 1s step-end infinite;}${this._terminalSelector} .${D}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Ae} 1s step-end infinite;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-block { background-color: ${G.cursor.css}; color: ${G.cursorAccent.css};}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${G.cursor.css} !important; color: ${G.cursorAccent.css} !important;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${G.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${G.cursor.css} inset;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${G.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,ve+=`${this._terminalSelector} .${le} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${le} div { position: absolute; background-color: ${G.selectionBackgroundOpaque.css};}${this._terminalSelector} .${le} div { position: absolute; background-color: ${G.selectionInactiveBackgroundOpaque.css};}`;for(let[ue,H]of G.ansi.entries())ve+=`${this._terminalSelector} .${F}${ue} { color: ${H.css}; }${this._terminalSelector} .${F}${ue}.xterm-dim { color: ${P.color.multiplyOpacity(H,.5).css}; }${this._terminalSelector} .${I}${ue} { background-color: ${H.css}; }`;ve+=`${this._terminalSelector} .${F}${C.INVERTED_DEFAULT_COLOR} { color: ${P.color.opaque(G.background).css}; }${this._terminalSelector} .${F}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${P.color.multiplyOpacity(P.color.opaque(G.background),.5).css}; }${this._terminalSelector} .${I}${C.INVERTED_DEFAULT_COLOR} { background-color: ${G.foreground.css}; }`,this._themeStyleElement.textContent=ve}_setDefaultSpacing(){let G=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${G}px`,this._rowFactory.defaultSpacing=G}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(G,ve){for(let Se=this._rowElements.length;Se<=ve;Se++){let pe=this._document.createElement("div");this._rowContainer.appendChild(pe),this._rowElements.push(pe)}for(;this._rowElements.length>ve;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(G,ve){this._refreshRowElements(G,ve),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(B),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(B),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(G,ve,Se){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(G,ve,Se),this.renderRows(0,this._bufferService.rows-1),!G||!ve)return;this._selectionRenderModel.update(this._terminal,G,ve,Se);let pe=this._selectionRenderModel.viewportStartRow,Ae=this._selectionRenderModel.viewportEndRow,ue=this._selectionRenderModel.viewportCappedStartRow,H=this._selectionRenderModel.viewportCappedEndRow;if(ue>=this._bufferService.rows||H<0)return;let te=this._document.createDocumentFragment();if(Se){let de=G[0]>ve[0];te.appendChild(this._createSelectionElement(ue,de?ve[0]:G[0],de?G[0]:ve[0],H-ue+1))}else{let de=pe===ue?G[0]:0,me=ue===Ae?ve[0]:this._bufferService.cols;te.appendChild(this._createSelectionElement(ue,de,me));let Ie=H-ue-1;if(te.appendChild(this._createSelectionElement(ue+1,0,this._bufferService.cols,Ie)),ue!==H){let $e=Ae===H?ve[0]:this._bufferService.cols;te.appendChild(this._createSelectionElement(H,0,$e))}}this._selectionContainer.appendChild(te)}_createSelectionElement(G,ve,Se,pe=1){let Ae=this._document.createElement("div"),ue=ve*this.dimensions.css.cell.width,H=this.dimensions.css.cell.width*(Se-ve);return ue+H>this.dimensions.css.canvas.width&&(H=this.dimensions.css.canvas.width-ue),Ae.style.height=pe*this.dimensions.css.cell.height+"px",Ae.style.top=G*this.dimensions.css.cell.height+"px",Ae.style.left=`${ue}px`,Ae.style.width=`${H}px`,Ae}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let G of this._rowElements)G.replaceChildren()}renderRows(G,ve){let Se=this._bufferService.buffer,pe=Se.ybase+Se.y,Ae=Math.min(Se.x,this._bufferService.cols-1),ue=this._optionsService.rawOptions.cursorBlink,H=this._optionsService.rawOptions.cursorStyle,te=this._optionsService.rawOptions.cursorInactiveStyle;for(let de=G;de<=ve;de++){let me=de+Se.ydisp,Ie=this._rowElements[de],$e=Se.lines.get(me);if(!Ie||!$e)break;Ie.replaceChildren(...this._rowFactory.createRow($e,me,me===pe,H,te,Ae,ue,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover(G){this._setCellUnderline(G.x1,G.x2,G.y1,G.y2,G.cols,!0)}_handleLinkLeave(G){this._setCellUnderline(G.x1,G.x2,G.y1,G.y2,G.cols,!1)}_setCellUnderline(G,ve,Se,pe,Ae,ue){Se<0&&(G=0),pe<0&&(ve=0);let H=this._bufferService.rows-1;Se=Math.max(Math.min(Se,H),0),pe=Math.max(Math.min(pe,H),0),Ae=Math.min(Ae,this._bufferService.cols);let te=this._bufferService.buffer,de=te.ybase+te.y,me=Math.min(te.x,Ae-1),Ie=this._optionsService.rawOptions.cursorBlink,$e=this._optionsService.rawOptions.cursorStyle,tt=this._optionsService.rawOptions.cursorInactiveStyle;for(let et=Se;et<=pe;++et){let Me=et+te.ydisp,Z=this._rowElements[et],Le=te.lines.get(Me);if(!Z||!Le)break;Z.replaceChildren(...this._rowFactory.createRow(Le,Me,Me===de,$e,tt,me,Ie,this.dimensions.css.cell.width,this._widthCache,ue?et===Se?G:0:-1,ue?(et===pe?ve:Ae)-1:-1))}}};a.DomRenderer=W=d([p(7,O.IInstantiationService),p(8,b.ICharSizeService),p(9,O.IOptionsService),p(10,O.IBufferService),p(11,b.ICoreBrowserService),p(12,b.IThemeService)],W)},3787:function(i,a,s){var d=this&&this.__decorate||function(D,F,I,B){var le,ae=arguments.length,W=ae<3?F:B===null?B=Object.getOwnPropertyDescriptor(F,I):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(D,F,I,B);else for(var G=D.length-1;G>=0;G--)(le=D[G])&&(W=(ae<3?le(W):ae>3?le(F,I,W):le(F,I))||W);return ae>3&&W&&Object.defineProperty(F,I,W),W},p=this&&this.__param||function(D,F){return function(I,B){F(I,B,D)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;let u=s(2223),g=s(643),C=s(511),M=s(2585),x=s(8055),b=s(4725),P=s(4269),k=s(6171),S=s(3734),O=a.DomRendererRowFactory=class{constructor(D,F,I,B,le,ae,W){this._document=D,this._characterJoinerService=F,this._optionsService=I,this._coreBrowserService=B,this._coreService=le,this._decorationService=ae,this._themeService=W,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(D,F,I){this._selectionStart=D,this._selectionEnd=F,this._columnSelectMode=I}createRow(D,F,I,B,le,ae,W,G,ve,Se,pe){let Ae=[],ue=this._characterJoinerService.getJoinedCharacters(F),H=this._themeService.colors,te,de=D.getNoBgTrimmedLength();I&&de0&&si===ue[0][0]){Mo=!0;let oa=ue.shift();Gn=new P.JoinedCellData(this._workCell,D.translateToString(!0,oa[0],oa[1]),oa[1]-oa[0]),Ka=oa[1]-1,Bo=Gn.getWidth()}let om=this._isCellInSelection(si,F),Zu=I&&si===ae,Ak=Ot&&si>=Se&&si<=pe,Nk=!1;this._decorationService.forEachDecorationAtCell(si,F,void 0,oa=>{Nk=!0});let PC=Gn.getChars()||g.WHITESPACE_CELL_CHAR;if(PC===" "&&(Gn.isUnderline()||Gn.isOverline())&&(PC="\xA0"),Ze=Bo*G-ve.get(PC,Gn.isBold(),Gn.isItalic()),te){if(me&&(om&&Le||!om&&!Le&&Gn.bg===$e)&&(om&&Le&&H.selectionForeground||Gn.fg===tt)&&Gn.extended.ext===et&&Ak===Me&&Ze===Z&&!Zu&&!Mo&&!Nk){Gn.isInvisible()?Ie+=g.WHITESPACE_CELL_CHAR:Ie+=PC,me++;continue}me&&(te.textContent=Ie),te=this._document.createElement("span"),me=0,Ie=""}else te=this._document.createElement("span");if($e=Gn.bg,tt=Gn.fg,et=Gn.extended.ext,Me=Ak,Z=Ze,Le=om,Mo&&ae>=si&&ae<=Ka&&(ae=si),!this._coreService.isCursorHidden&&Zu&&this._coreService.isCursorInitialized){if(dt.push("xterm-cursor"),this._coreBrowserService.isFocused)W&&dt.push("xterm-cursor-blink"),dt.push(B==="bar"?"xterm-cursor-bar":B==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(le)switch(le){case"outline":dt.push("xterm-cursor-outline");break;case"block":dt.push("xterm-cursor-block");break;case"bar":dt.push("xterm-cursor-bar");break;case"underline":dt.push("xterm-cursor-underline")}}if(Gn.isBold()&&dt.push("xterm-bold"),Gn.isItalic()&&dt.push("xterm-italic"),Gn.isDim()&&dt.push("xterm-dim"),Ie=Gn.isInvisible()?g.WHITESPACE_CELL_CHAR:Gn.getChars()||g.WHITESPACE_CELL_CHAR,Gn.isUnderline()&&(dt.push(`xterm-underline-${Gn.extended.underlineStyle}`),Ie===" "&&(Ie="\xA0"),!Gn.isUnderlineColorDefault()))if(Gn.isUnderlineColorRGB())te.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(Gn.getUnderlineColor()).join(",")})`;else{let oa=Gn.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Gn.isBold()&&oa<8&&(oa+=8),te.style.textDecorationColor=H.ansi[oa].css}Gn.isOverline()&&(dt.push("xterm-overline"),Ie===" "&&(Ie="\xA0")),Gn.isStrikethrough()&&dt.push("xterm-strikethrough"),Ak&&(te.style.textDecoration="underline");let ol=Gn.getFgColor(),tf=Gn.getFgColorMode(),kc=Gn.getBgColor(),nf=Gn.getBgColorMode(),Fk=!!Gn.isInverse();if(Fk){let oa=ol;ol=kc,kc=oa;let jH=tf;tf=nf,nf=jH}let am,TC,rm,of=!1;switch(this._decorationService.forEachDecorationAtCell(si,F,void 0,oa=>{oa.options.layer!=="top"&&of||(oa.backgroundColorRGB&&(nf=50331648,kc=oa.backgroundColorRGB.rgba>>8&16777215,am=oa.backgroundColorRGB),oa.foregroundColorRGB&&(tf=50331648,ol=oa.foregroundColorRGB.rgba>>8&16777215,TC=oa.foregroundColorRGB),of=oa.options.layer==="top")}),!of&&om&&(am=this._coreBrowserService.isFocused?H.selectionBackgroundOpaque:H.selectionInactiveBackgroundOpaque,kc=am.rgba>>8&16777215,nf=50331648,of=!0,H.selectionForeground&&(tf=50331648,ol=H.selectionForeground.rgba>>8&16777215,TC=H.selectionForeground)),of&&dt.push("xterm-decoration-top"),nf){case 16777216:case 33554432:rm=H.ansi[kc],dt.push(`xterm-bg-${kc}`);break;case 50331648:rm=x.channels.toColor(kc>>16,kc>>8&255,255&kc),this._addStyle(te,`background-color:#${A((kc>>>0).toString(16),"0",6)}`);break;default:Fk?(rm=H.foreground,dt.push(`xterm-bg-${u.INVERTED_DEFAULT_COLOR}`)):rm=H.background}switch(am||Gn.isDim()&&(am=x.color.multiplyOpacity(rm,.5)),tf){case 16777216:case 33554432:Gn.isBold()&&ol<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ol+=8),this._applyMinimumContrast(te,rm,H.ansi[ol],Gn,am,void 0)||dt.push(`xterm-fg-${ol}`);break;case 50331648:let oa=x.channels.toColor(ol>>16&255,ol>>8&255,255&ol);this._applyMinimumContrast(te,rm,oa,Gn,am,TC)||this._addStyle(te,`color:#${A(ol.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(te,rm,H.foreground,Gn,am,TC)||Fk&&dt.push(`xterm-fg-${u.INVERTED_DEFAULT_COLOR}`)}dt.length&&(te.className=dt.join(" "),dt.length=0),Zu||Mo||Nk?te.textContent=Ie:me++,Ze!==this.defaultSpacing&&(te.style.letterSpacing=`${Ze}px`),Ae.push(te),si=Ka}return te&&me&&(te.textContent=Ie),Ae}_applyMinimumContrast(D,F,I,B,le,ae){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,k.treatGlyphAsBackgroundColor)(B.getCode()))return!1;let W=this._getContrastCache(B),G;if(le||ae||(G=W.getColor(F.rgba,I.rgba)),G===void 0){let ve=this._optionsService.rawOptions.minimumContrastRatio/(B.isDim()?2:1);G=x.color.ensureContrastRatio(le||F,ae||I,ve),W.setColor((le||F).rgba,(ae||I).rgba,G??null)}return!!G&&(this._addStyle(D,`color:${G.css}`),!0)}_getContrastCache(D){return D.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(D,F){D.setAttribute("style",`${D.getAttribute("style")||""}${F};`)}_isCellInSelection(D,F){let I=this._selectionStart,B=this._selectionEnd;return!(!I||!B)&&(this._columnSelectMode?I[0]<=B[0]?D>=I[0]&&F>=I[1]&&D=I[1]&&D>=B[0]&&F<=B[1]:F>I[1]&&F=I[0]&&D=I[0])}};function A(D,F,I){for(;D.length{Object.defineProperty(a,"__esModule",{value:!0}),a.WidthCache=void 0,a.WidthCache=class{constructor(s,d){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=s.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let p=s.createElement("span");p.classList.add("xterm-char-measure-element");let u=s.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold";let g=s.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontStyle="italic";let C=s.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[p,u,g,C],this._container.appendChild(p),this._container.appendChild(u),this._container.appendChild(g),this._container.appendChild(C),d.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(s,d,p,u){s===this._font&&d===this._fontSize&&p===this._weight&&u===this._weightBold||(this._font=s,this._fontSize=d,this._weight=p,this._weightBold=u,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${u}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${u}`,this.clear())}get(s,d,p){let u=0;if(!d&&!p&&s.length===1&&(u=s.charCodeAt(0))<256){if(this._flat[u]!==-9999)return this._flat[u];let M=this._measure(s,0);return M>0&&(this._flat[u]=M),M}let g=s;d&&(g+="B"),p&&(g+="I");let C=this._holey.get(g);if(C===void 0){let M=0;d&&(M|=1),p&&(M|=2),C=this._measure(s,M),C>0&&this._holey.set(g,C)}return C}_measure(s,d){let p=this._measureElements[d];return p.textContent=s.repeat(32),p.offsetWidth/32}}},2223:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TEXT_BASELINE=a.DIM_OPACITY=a.INVERTED_DEFAULT_COLOR=void 0;let d=s(6114);a.INVERTED_DEFAULT_COLOR=257,a.DIM_OPACITY=.5,a.TEXT_BASELINE=d.isFirefox||d.isLegacyEdge?"bottom":"ideographic"},6171:(i,a)=>{function s(p){return 57508<=p&&p<=57558}function d(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(a,"__esModule",{value:!0}),a.computeNextVariantOffset=a.createRenderDimensions=a.treatGlyphAsBackgroundColor=a.allowRescaling=a.isEmoji=a.isRestrictedPowerlineGlyph=a.isPowerlineGlyph=a.throwIfFalsy=void 0,a.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},a.isPowerlineGlyph=s,a.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},a.isEmoji=d,a.allowRescaling=function(p,u,g,C){return u===1&&g>Math.ceil(1.5*C)&&p!==void 0&&p>255&&!d(p)&&!s(p)&&!(function(M){return 57344<=M&&M<=63743})(p)},a.treatGlyphAsBackgroundColor=function(p){return s(p)||(function(u){return 9472<=u&&u<=9631})(p)},a.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},a.computeNextVariantOffset=function(p,u,g=0){return(p-(2*Math.round(u)-g))%(2*Math.round(u))}},6052:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createSelectionRenderModel=void 0;class s{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(p,u,g,C=!1){if(this.selectionStart=u,this.selectionEnd=g,!u||!g||u[0]===g[0]&&u[1]===g[1])return void this.clear();let M=p.buffers.active.ydisp,x=u[1]-M,b=g[1]-M,P=Math.max(x,0),k=Math.min(b,p.rows-1);P>=p.rows||k<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=x,this.viewportEndRow=b,this.viewportCappedStartRow=P,this.viewportCappedEndRow=k,this.startCol=u[0],this.endCol=g[0])}isCellSelected(p,u,g){return!!this.hasSelection&&(g-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&g>=this.viewportCappedStartRow&&u=this.viewportCappedStartRow&&u>=this.endCol&&g<=this.viewportCappedEndRow:g>this.viewportStartRow&&g=this.startCol&&u=this.startCol)}}a.createSelectionRenderModel=function(){return new s}},456:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionModel=void 0,a.SelectionModel=class{constructor(s){this._bufferService=s,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?s%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)-1]:[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[s,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let s=this.selectionStart[0]+this.selectionStartLength;return s>this._bufferService.cols?[s%this._bufferService.cols,this.selectionStart[1]+Math.floor(s/this._bufferService.cols)]:[Math.max(s,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let s=this.selectionStart,d=this.selectionEnd;return!(!s||!d)&&(s[1]>d[1]||s[1]===d[1]&&s[0]>d[0])}handleTrim(s){return this.selectionStart&&(this.selectionStart[1]-=s),this.selectionEnd&&(this.selectionEnd[1]-=s),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(i,a,s){var d=this&&this.__decorate||function(k,S,O,A){var D,F=arguments.length,I=F<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,O):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(k,S,O,A);else for(var B=k.length-1;B>=0;B--)(D=k[B])&&(I=(F<3?D(I):F>3?D(S,O,I):D(S,O))||I);return F>3&&I&&Object.defineProperty(S,O,I),I},p=this&&this.__param||function(k,S){return function(O,A){S(O,A,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;let u=s(2585),g=s(8460),C=s(844),M=a.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(k,S,O){super(),this._optionsService=O,this.width=0,this.height=0,this._onCharSizeChange=this.register(new g.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new P(this._optionsService))}catch{this._measureStrategy=this.register(new b(k,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){let k=this._measureStrategy.measure();k.width===this.width&&k.height===this.height||(this.width=k.width,this.height=k.height,this._onCharSizeChange.fire())}};a.CharSizeService=M=d([p(2,u.IOptionsService)],M);class x extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,O){S!==void 0&&S>0&&O!==void 0&&O>0&&(this._result.width=S,this._result.height=O)}}class b extends x{constructor(S,O,A){super(),this._document=S,this._parentElement=O,this._optionsService=A,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class P extends x{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let O=this._ctx.measureText("W");if(!("width"in O&&"fontBoundingBoxAscent"in O&&"fontBoundingBoxDescent"in O))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(i,a,s){var d=this&&this.__decorate||function(P,k,S,O){var A,D=arguments.length,F=D<3?k:O===null?O=Object.getOwnPropertyDescriptor(k,S):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(P,k,S,O);else for(var I=P.length-1;I>=0;I--)(A=P[I])&&(F=(D<3?A(F):D>3?A(k,S,F):A(k,S))||F);return D>3&&F&&Object.defineProperty(k,S,F),F},p=this&&this.__param||function(P,k){return function(S,O){k(S,O,P)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;let u=s(3734),g=s(643),C=s(511),M=s(2585);class x extends u.AttributeData{constructor(k,S,O){super(),this.content=0,this.combinedData="",this.fg=k.fg,this.bg=k.bg,this.combinedData=S,this._width=O}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(k){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.JoinedCellData=x;let b=a.CharacterJoinerService=class Fj{constructor(k){this._bufferService=k,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(k){let S={id:this._nextCharacterJoinerId++,handler:k};return this._characterJoiners.push(S),S.id}deregister(k){for(let S=0;S1){let W=this._getJoinedRanges(A,I,F,S,D);for(let G=0;G1){let ae=this._getJoinedRanges(A,I,F,S,D);for(let W=0;W{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;let d=s(844),p=s(8460),u=s(3656);class g extends d.Disposable{constructor(x,b,P){super(),this._textarea=x,this._window=b,this.mainDocument=P,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(k=>this._screenDprMonitor.setWindow(k))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(x){this._window!==x&&(this._window=x,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}a.CoreBrowserService=g;class C extends d.Disposable{constructor(x){super(),this._parentWindow=x,this._windowResizeListener=this.register(new d.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,d.toDisposable)(()=>this.clearListener()))}setWindow(x){this._parentWindow=x,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,u.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.LinkProviderService=void 0;let d=s(844);class p extends d.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,d.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(g){return this.linkProviders.push(g),{dispose:()=>{let C=this.linkProviders.indexOf(g);C!==-1&&this.linkProviders.splice(C,1)}}}}a.LinkProviderService=p},8934:function(i,a,s){var d=this&&this.__decorate||function(M,x,b,P){var k,S=arguments.length,O=S<3?x:P===null?P=Object.getOwnPropertyDescriptor(x,b):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(M,x,b,P);else for(var A=M.length-1;A>=0;A--)(k=M[A])&&(O=(S<3?k(O):S>3?k(x,b,O):k(x,b))||O);return S>3&&O&&Object.defineProperty(x,b,O),O},p=this&&this.__param||function(M,x){return function(b,P){x(b,P,M)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;let u=s(4725),g=s(9806),C=a.MouseService=class{constructor(M,x){this._renderService=M,this._charSizeService=x}getCoords(M,x,b,P,k){return(0,g.getCoords)(window,M,x,b,P,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,k)}getMouseReportCoords(M,x){let b=(0,g.getCoordsRelativeToElement)(window,M,x);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};a.MouseService=C=d([p(0,u.IRenderService),p(1,u.ICharSizeService)],C)},3230:function(i,a,s){var d=this&&this.__decorate||function(k,S,O,A){var D,F=arguments.length,I=F<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,O):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(k,S,O,A);else for(var B=k.length-1;B>=0;B--)(D=k[B])&&(I=(F<3?D(I):F>3?D(S,O,I):D(S,O))||I);return F>3&&I&&Object.defineProperty(S,O,I),I},p=this&&this.__param||function(k,S){return function(O,A){S(O,A,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;let u=s(6193),g=s(4725),C=s(8460),M=s(844),x=s(7226),b=s(2585),P=a.RenderService=class extends M.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(k,S,O,A,D,F,I,B){super(),this._rowCount=k,this._charSizeService=A,this._renderer=this.register(new M.MutableDisposable),this._pausedResizeTask=new x.DebouncedIdleTask,this._observerDisposable=this.register(new M.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new C.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new C.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new C.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new u.RenderDebouncer((le,ae)=>this._renderRows(le,ae),I),this.register(this._renderDebouncer),this.register(I.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(F.onResize(()=>this._fullRefresh())),this.register(F.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this.register(O.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(D.onDecorationRegistered(()=>this._fullRefresh())),this.register(D.onDecorationRemoved(()=>this._fullRefresh())),this.register(O.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(F.cols,F.rows),this._fullRefresh()})),this.register(O.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(F.buffer.y,F.buffer.y,!0))),this.register(B.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(I.window,S),this.register(I.onWindowChange(le=>this._registerIntersectionObserver(le,S)))}_registerIntersectionObserver(k,S){if("IntersectionObserver"in k){let O=new k.IntersectionObserver(A=>this._handleIntersectionChange(A[A.length-1]),{threshold:0});O.observe(S),this._observerDisposable.value=(0,M.toDisposable)(()=>O.disconnect())}}_handleIntersectionChange(k){this._isPaused=k.isIntersecting===void 0?k.intersectionRatio===0:!k.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(k,S,O=!1){this._isPaused?this._needsFullRefresh=!0:(O||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(k,S,this._rowCount))}_renderRows(k,S){this._renderer.value&&(k=Math.min(k,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(k,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:k,end:S}),this._onRender.fire({start:k,end:S}),this._isNextRenderRedrawOnly=!0)}resize(k,S){this._rowCount=S,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(k){this._renderer.value=k,this._renderer.value&&(this._renderer.value.onRequestRedraw(S=>this.refreshRows(S.start,S.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(k){return this._renderDebouncer.addRefreshCallback(k)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(k,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(k,S)):this._renderer.value.handleResize(k,S),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(k,S,O){this._selectionState.start=k,this._selectionState.end=S,this._selectionState.columnSelectMode=O,this._renderer.value?.handleSelectionChanged(k,S,O)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};a.RenderService=P=d([p(2,b.IOptionsService),p(3,g.ICharSizeService),p(4,b.IDecorationService),p(5,b.IBufferService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],P)},9312:function(i,a,s){var d=this&&this.__decorate||function(I,B,le,ae){var W,G=arguments.length,ve=G<3?B:ae===null?ae=Object.getOwnPropertyDescriptor(B,le):ae;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ve=Reflect.decorate(I,B,le,ae);else for(var Se=I.length-1;Se>=0;Se--)(W=I[Se])&&(ve=(G<3?W(ve):G>3?W(B,le,ve):W(B,le))||ve);return G>3&&ve&&Object.defineProperty(B,le,ve),ve},p=this&&this.__param||function(I,B){return function(le,ae){B(le,ae,I)}};Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionService=void 0;let u=s(9806),g=s(9504),C=s(456),M=s(4725),x=s(8460),b=s(844),P=s(6114),k=s(4841),S=s(511),O=s(2585),A="\xA0",D=new RegExp(A,"g"),F=a.SelectionService=class extends b.Disposable{constructor(I,B,le,ae,W,G,ve,Se,pe){super(),this._element=I,this._screenElement=B,this._linkifier=le,this._bufferService=ae,this._coreService=W,this._mouseService=G,this._optionsService=ve,this._renderService=Se,this._coreBrowserService=pe,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new x.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new x.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new x.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new x.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Ae=>this._handleMouseMove(Ae),this._mouseUpListener=Ae=>this._handleMouseUp(Ae),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(Ae=>this._handleTrim(Ae)),this.register(this._bufferService.buffers.onBufferActivate(Ae=>this._handleBufferActivate(Ae))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let I=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!I||!B||I[0]===B[0]&&I[1]===B[1])}get selectionText(){let I=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;if(!I||!B)return"";let le=this._bufferService.buffer,ae=[];if(this._activeSelectionMode===3){if(I[0]===B[0])return"";let W=I[0]W.replace(D," ")).join(P.isWindows?`\r +`:` +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(I){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),P.isLinux&&I&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(I){let B=this._getMouseBufferCoords(I),le=this._model.finalSelectionStart,ae=this._model.finalSelectionEnd;return!!(le&&ae&&B)&&this._areCoordsInSelection(B,le,ae)}isCellInSelection(I,B){let le=this._model.finalSelectionStart,ae=this._model.finalSelectionEnd;return!(!le||!ae)&&this._areCoordsInSelection([I,B],le,ae)}_areCoordsInSelection(I,B,le){return I[1]>B[1]&&I[1]=B[0]&&I[0]=B[0]}_selectWordAtCursor(I,B){let le=this._linkifier.currentLink?.link?.range;if(le)return this._model.selectionStart=[le.start.x-1,le.start.y-1],this._model.selectionStartLength=(0,k.getRangeLength)(le,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let ae=this._getMouseBufferCoords(I);return!!ae&&(this._selectWordAt(ae,B),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(I,B){this._model.clearSelection(),I=Math.max(I,0),B=Math.min(B,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,I],this._model.selectionEnd=[this._bufferService.cols,B],this.refresh(),this._onSelectionChange.fire()}_handleTrim(I){this._model.handleTrim(I)&&this.refresh()}_getMouseBufferCoords(I){let B=this._mouseService.getCoords(I,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(B)return B[0]--,B[1]--,B[1]+=this._bufferService.buffer.ydisp,B}_getMouseEventScrollAmount(I){let B=(0,u.getCoordsRelativeToElement)(this._coreBrowserService.window,I,this._screenElement)[1],le=this._renderService.dimensions.css.canvas.height;return B>=0&&B<=le?0:(B>le&&(B-=le),B=Math.min(Math.max(B,-50),50),B/=50,B/Math.abs(B)+Math.round(14*B))}shouldForceSelection(I){return P.isMac?I.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:I.shiftKey}handleMouseDown(I){if(this._mouseDownTimeStamp=I.timeStamp,(I.button!==2||!this.hasSelection)&&I.button===0){if(!this._enabled){if(!this.shouldForceSelection(I))return;I.stopPropagation()}I.preventDefault(),this._dragScrollAmount=0,this._enabled&&I.shiftKey?this._handleIncrementalClick(I):I.detail===1?this._handleSingleClick(I):I.detail===2?this._handleDoubleClick(I):I.detail===3&&this._handleTripleClick(I),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(I){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(I))}_handleSingleClick(I){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(I)?3:0,this._model.selectionStart=this._getMouseBufferCoords(I),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let B=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);B&&B.length!==this._model.selectionStart[0]&&B.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(I){this._selectWordAtCursor(I,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(I){let B=this._getMouseBufferCoords(I);B&&(this._activeSelectionMode=2,this._selectLineAt(B[1]))}shouldColumnSelect(I){return I.altKey&&!(P.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(I){if(I.stopImmediatePropagation(),!this._model.selectionStart)return;let B=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(I),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let le=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(I.ydisp+this._bufferService.rows,I.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=I.ydisp),this.refresh()}}_handleMouseUp(I){let B=I.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&B<500&&I.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let le=this._mouseService.getCoords(I,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(le&&le[0]!==void 0&&le[1]!==void 0){let ae=(0,g.moveToCellSequence)(le[0]-1,le[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(ae,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let I=this._model.finalSelectionStart,B=this._model.finalSelectionEnd,le=!(!I||!B||I[0]===B[0]&&I[1]===B[1]);le?I&&B&&(this._oldSelectionStart&&this._oldSelectionEnd&&I[0]===this._oldSelectionStart[0]&&I[1]===this._oldSelectionStart[1]&&B[0]===this._oldSelectionEnd[0]&&B[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(I,B,le)):this._oldHasSelection&&this._fireOnSelectionChange(I,B,le)}_fireOnSelectionChange(I,B,le){this._oldSelectionStart=I,this._oldSelectionEnd=B,this._oldHasSelection=le,this._onSelectionChange.fire()}_handleBufferActivate(I){this.clearSelection(),this._trimListener.dispose(),this._trimListener=I.activeBuffer.lines.onTrim(B=>this._handleTrim(B))}_convertViewportColToCharacterIndex(I,B){let le=B;for(let ae=0;B>=ae;ae++){let W=I.loadCell(ae,this._workCell).getChars().length;this._workCell.getWidth()===0?le--:W>1&&B!==ae&&(le+=W-1)}return le}setSelection(I,B,le){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[I,B],this._model.selectionStartLength=le,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(I){this._isClickInSelection(I)||(this._selectWordAtCursor(I,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(I,B,le=!0,ae=!0){if(I[0]>=this._bufferService.cols)return;let W=this._bufferService.buffer,G=W.lines.get(I[1]);if(!G)return;let ve=W.translateBufferLineToString(I[1],!1),Se=this._convertViewportColToCharacterIndex(G,I[0]),pe=Se,Ae=I[0]-Se,ue=0,H=0,te=0,de=0;if(ve.charAt(Se)===" "){for(;Se>0&&ve.charAt(Se-1)===" ";)Se--;for(;pe1&&(de+=et-1,pe+=et-1);$e>0&&Se>0&&!this._isCharWordSeparator(G.loadCell($e-1,this._workCell));){G.loadCell($e-1,this._workCell);let Me=this._workCell.getChars().length;this._workCell.getWidth()===0?(ue++,$e--):Me>1&&(te+=Me-1,Se-=Me-1),Se--,$e--}for(;tt1&&(de+=Me-1,pe+=Me-1),pe++,tt++}}pe++;let me=Se+Ae-ue+te,Ie=Math.min(this._bufferService.cols,pe-Se+ue+H-te-de);if(B||ve.slice(Se,pe).trim()!==""){if(le&&me===0&&G.getCodePoint(0)!==32){let $e=W.lines.get(I[1]-1);if($e&&G.isWrapped&&$e.getCodePoint(this._bufferService.cols-1)!==32){let tt=this._getWordAt([this._bufferService.cols-1,I[1]-1],!1,!0,!1);if(tt){let et=this._bufferService.cols-tt.start;me-=et,Ie+=et}}}if(ae&&me+Ie===this._bufferService.cols&&G.getCodePoint(this._bufferService.cols-1)!==32){let $e=W.lines.get(I[1]+1);if($e?.isWrapped&&$e.getCodePoint(0)!==32){let tt=this._getWordAt([0,I[1]+1],!1,!1,!0);tt&&(Ie+=tt.length)}}return{start:me,length:Ie}}}_selectWordAt(I,B){let le=this._getWordAt(I,B);if(le){for(;le.start<0;)le.start+=this._bufferService.cols,I[1]--;this._model.selectionStart=[le.start,I[1]],this._model.selectionStartLength=le.length}}_selectToWordAt(I){let B=this._getWordAt(I,!0);if(B){let le=I[1];for(;B.start<0;)B.start+=this._bufferService.cols,le--;if(!this._model.areSelectionValuesReversed())for(;B.start+B.length>this._bufferService.cols;)B.length-=this._bufferService.cols,le++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?B.start:B.start+B.length,le]}}_isCharWordSeparator(I){return I.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(I.getChars())>=0}_selectLineAt(I){let B=this._bufferService.buffer.getWrappedRangeForLine(I),le={start:{x:0,y:B.first},end:{x:this._bufferService.cols-1,y:B.last}};this._model.selectionStart=[0,B.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,k.getRangeLength)(le,this._bufferService.cols)}};a.SelectionService=F=d([p(3,O.IBufferService),p(4,O.ICoreService),p(5,M.IMouseService),p(6,O.IOptionsService),p(7,M.IRenderService),p(8,M.ICoreBrowserService)],F)},4725:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ILinkProviderService=a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;let d=s(8343);a.ICharSizeService=(0,d.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,d.createDecorator)("CoreBrowserService"),a.IMouseService=(0,d.createDecorator)("MouseService"),a.IRenderService=(0,d.createDecorator)("RenderService"),a.ISelectionService=(0,d.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,d.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,d.createDecorator)("ThemeService"),a.ILinkProviderService=(0,d.createDecorator)("LinkProviderService")},6731:function(i,a,s){var d=this&&this.__decorate||function(F,I,B,le){var ae,W=arguments.length,G=W<3?I:le===null?le=Object.getOwnPropertyDescriptor(I,B):le;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(F,I,B,le);else for(var ve=F.length-1;ve>=0;ve--)(ae=F[ve])&&(G=(W<3?ae(G):W>3?ae(I,B,G):ae(I,B))||G);return W>3&&G&&Object.defineProperty(I,B,G),G},p=this&&this.__param||function(F,I){return function(B,le){I(B,le,F)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;let u=s(7239),g=s(8055),C=s(8460),M=s(844),x=s(2585),b=g.css.toColor("#ffffff"),P=g.css.toColor("#000000"),k=g.css.toColor("#ffffff"),S=g.css.toColor("#000000"),O={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let F=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],I=[0,95,135,175,215,255];for(let B=0;B<216;B++){let le=I[B/36%6|0],ae=I[B/6%6|0],W=I[B%6];F.push({css:g.channels.toCss(le,ae,W),rgba:g.channels.toRgba(le,ae,W)})}for(let B=0;B<24;B++){let le=8+10*B;F.push({css:g.channels.toCss(le,le,le),rgba:g.channels.toRgba(le,le,le)})}return F})());let A=a.ThemeService=class extends M.Disposable{get colors(){return this._colors}constructor(F){super(),this._optionsService=F,this._contrastCache=new u.ColorContrastCache,this._halfContrastCache=new u.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:P,cursor:k,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:O,selectionBackgroundOpaque:g.color.blend(P,O),selectionInactiveBackgroundTransparent:O,selectionInactiveBackgroundOpaque:g.color.blend(P,O),ansi:a.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(F={}){let I=this._colors;if(I.foreground=D(F.foreground,b),I.background=D(F.background,P),I.cursor=D(F.cursor,k),I.cursorAccent=D(F.cursorAccent,S),I.selectionBackgroundTransparent=D(F.selectionBackground,O),I.selectionBackgroundOpaque=g.color.blend(I.background,I.selectionBackgroundTransparent),I.selectionInactiveBackgroundTransparent=D(F.selectionInactiveBackground,I.selectionBackgroundTransparent),I.selectionInactiveBackgroundOpaque=g.color.blend(I.background,I.selectionInactiveBackgroundTransparent),I.selectionForeground=F.selectionForeground?D(F.selectionForeground,g.NULL_COLOR):void 0,I.selectionForeground===g.NULL_COLOR&&(I.selectionForeground=void 0),g.color.isOpaque(I.selectionBackgroundTransparent)&&(I.selectionBackgroundTransparent=g.color.opacity(I.selectionBackgroundTransparent,.3)),g.color.isOpaque(I.selectionInactiveBackgroundTransparent)&&(I.selectionInactiveBackgroundTransparent=g.color.opacity(I.selectionInactiveBackgroundTransparent,.3)),I.ansi=a.DEFAULT_ANSI_COLORS.slice(),I.ansi[0]=D(F.black,a.DEFAULT_ANSI_COLORS[0]),I.ansi[1]=D(F.red,a.DEFAULT_ANSI_COLORS[1]),I.ansi[2]=D(F.green,a.DEFAULT_ANSI_COLORS[2]),I.ansi[3]=D(F.yellow,a.DEFAULT_ANSI_COLORS[3]),I.ansi[4]=D(F.blue,a.DEFAULT_ANSI_COLORS[4]),I.ansi[5]=D(F.magenta,a.DEFAULT_ANSI_COLORS[5]),I.ansi[6]=D(F.cyan,a.DEFAULT_ANSI_COLORS[6]),I.ansi[7]=D(F.white,a.DEFAULT_ANSI_COLORS[7]),I.ansi[8]=D(F.brightBlack,a.DEFAULT_ANSI_COLORS[8]),I.ansi[9]=D(F.brightRed,a.DEFAULT_ANSI_COLORS[9]),I.ansi[10]=D(F.brightGreen,a.DEFAULT_ANSI_COLORS[10]),I.ansi[11]=D(F.brightYellow,a.DEFAULT_ANSI_COLORS[11]),I.ansi[12]=D(F.brightBlue,a.DEFAULT_ANSI_COLORS[12]),I.ansi[13]=D(F.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),I.ansi[14]=D(F.brightCyan,a.DEFAULT_ANSI_COLORS[14]),I.ansi[15]=D(F.brightWhite,a.DEFAULT_ANSI_COLORS[15]),F.extendedAnsi){let B=Math.min(I.ansi.length-16,F.extendedAnsi.length);for(let le=0;le{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;let d=s(8460),p=s(844);class u extends p.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new d.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new d.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new d.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(C){if(this._maxLength===C)return;let M=new Array(C);for(let x=0;xthis._length)for(let M=this._length;M=C;b--)this._array[this._getCyclicIndex(b+x.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;bthis._maxLength){let b=this._length+x.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=x.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,M,x){if(!(M<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+x<0)throw new Error("Cannot shift elements in list beyond index 0");if(x>0){for(let P=M-1;P>=0;P--)this.set(C+P+x,this.get(C+P));let b=C+M+x-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function s(d,p=5){if(typeof d!="object")return d;let u=Array.isArray(d)?[]:{};for(let g in d)u[g]=p<=1?d[g]:d[g]&&s(d[g],p-1);return u}},8055:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;let s=0,d=0,p=0,u=0;var g,C,M,x,b;function P(S){let O=S.toString(16);return O.length<2?"0"+O:O}function k(S,O){return S>>0},S.toColor=function(O,A,D,F){return{css:S.toCss(O,A,D,F),rgba:S.toRgba(O,A,D,F)}}})(g||(a.channels=g={})),(function(S){function O(A,D){return u=Math.round(255*D),[s,d,p]=b.toChannels(A.rgba),{css:g.toCss(s,d,p,u),rgba:g.toRgba(s,d,p,u)}}S.blend=function(A,D){if(u=(255&D.rgba)/255,u===1)return{css:D.css,rgba:D.rgba};let F=D.rgba>>24&255,I=D.rgba>>16&255,B=D.rgba>>8&255,le=A.rgba>>24&255,ae=A.rgba>>16&255,W=A.rgba>>8&255;return s=le+Math.round((F-le)*u),d=ae+Math.round((I-ae)*u),p=W+Math.round((B-W)*u),{css:g.toCss(s,d,p),rgba:g.toRgba(s,d,p)}},S.isOpaque=function(A){return(255&A.rgba)==255},S.ensureContrastRatio=function(A,D,F){let I=b.ensureContrastRatio(A.rgba,D.rgba,F);if(I)return g.toColor(I>>24&255,I>>16&255,I>>8&255)},S.opaque=function(A){let D=(255|A.rgba)>>>0;return[s,d,p]=b.toChannels(D),{css:g.toCss(s,d,p),rgba:D}},S.opacity=O,S.multiplyOpacity=function(A,D){return u=255&A.rgba,O(A,u*D/255)},S.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(C||(a.color=C={})),(function(S){let O,A;try{let D=document.createElement("canvas");D.width=1,D.height=1;let F=D.getContext("2d",{willReadFrequently:!0});F&&(O=F,O.globalCompositeOperation="copy",A=O.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(D){if(D.match(/#[\da-f]{3,8}/i))switch(D.length){case 4:return s=parseInt(D.slice(1,2).repeat(2),16),d=parseInt(D.slice(2,3).repeat(2),16),p=parseInt(D.slice(3,4).repeat(2),16),g.toColor(s,d,p);case 5:return s=parseInt(D.slice(1,2).repeat(2),16),d=parseInt(D.slice(2,3).repeat(2),16),p=parseInt(D.slice(3,4).repeat(2),16),u=parseInt(D.slice(4,5).repeat(2),16),g.toColor(s,d,p,u);case 7:return{css:D,rgba:(parseInt(D.slice(1),16)<<8|255)>>>0};case 9:return{css:D,rgba:parseInt(D.slice(1),16)>>>0}}let F=D.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(F)return s=parseInt(F[1]),d=parseInt(F[2]),p=parseInt(F[3]),u=Math.round(255*(F[5]===void 0?1:parseFloat(F[5]))),g.toColor(s,d,p,u);if(!O||!A)throw new Error("css.toColor: Unsupported css format");if(O.fillStyle=A,O.fillStyle=D,typeof O.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(O.fillRect(0,0,1,1),[s,d,p,u]=O.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(s,d,p,u),css:D}}})(M||(a.css=M={})),(function(S){function O(A,D,F){let I=A/255,B=D/255,le=F/255;return .2126*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.7152*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))+.0722*(le<=.03928?le/12.92:Math.pow((le+.055)/1.055,2.4))}S.relativeLuminance=function(A){return O(A>>16&255,A>>8&255,255&A)},S.relativeLuminance2=O})(x||(a.rgb=x={})),(function(S){function O(D,F,I){let B=D>>24&255,le=D>>16&255,ae=D>>8&255,W=F>>24&255,G=F>>16&255,ve=F>>8&255,Se=k(x.relativeLuminance2(W,G,ve),x.relativeLuminance2(B,le,ae));for(;Se0||G>0||ve>0);)W-=Math.max(0,Math.ceil(.1*W)),G-=Math.max(0,Math.ceil(.1*G)),ve-=Math.max(0,Math.ceil(.1*ve)),Se=k(x.relativeLuminance2(W,G,ve),x.relativeLuminance2(B,le,ae));return(W<<24|G<<16|ve<<8|255)>>>0}function A(D,F,I){let B=D>>24&255,le=D>>16&255,ae=D>>8&255,W=F>>24&255,G=F>>16&255,ve=F>>8&255,Se=k(x.relativeLuminance2(W,G,ve),x.relativeLuminance2(B,le,ae));for(;Se>>0}S.blend=function(D,F){if(u=(255&F)/255,u===1)return F;let I=F>>24&255,B=F>>16&255,le=F>>8&255,ae=D>>24&255,W=D>>16&255,G=D>>8&255;return s=ae+Math.round((I-ae)*u),d=W+Math.round((B-W)*u),p=G+Math.round((le-G)*u),g.toRgba(s,d,p)},S.ensureContrastRatio=function(D,F,I){let B=x.relativeLuminance(D>>8),le=x.relativeLuminance(F>>8);if(k(B,le)>8));if(vek(B,x.relativeLuminance(Se>>8))?G:Se}return G}let ae=A(D,F,I),W=k(B,x.relativeLuminance(ae>>8));if(Wk(B,x.relativeLuminance(G>>8))?ae:G}return ae}},S.reduceLuminance=O,S.increaseLuminance=A,S.toChannels=function(D){return[D>>24&255,D>>16&255,D>>8&255,255&D]}})(b||(a.rgba=b={})),a.toPaddedHex=P,a.contrastRatio=k},8969:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;let d=s(844),p=s(2585),u=s(4348),g=s(7866),C=s(744),M=s(7302),x=s(6975),b=s(8460),P=s(1753),k=s(1480),S=s(7994),O=s(9282),A=s(5435),D=s(5981),F=s(2660),I=!1;class B extends d.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event(ae=>{this._onScrollApi?.fire(ae.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(ae){for(let W in ae)this.optionsService.options[W]=ae[W]}constructor(ae){super(),this._windowsWrappingHeuristics=this.register(new d.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new u.InstantiationService,this.optionsService=this.register(new M.OptionsService(ae)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(x.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(P.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(k.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(F.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new A.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(W=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(W=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new D.WriteBuffer((W,G)=>this._inputHandler.parse(W,G))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(ae,W){this._writeBuffer.write(ae,W)}writeSync(ae,W){this._logService.logLevel<=p.LogLevelEnum.WARN&&!I&&(this._logService.warn("writeSync is unreliable and will be removed soon."),I=!0),this._writeBuffer.writeSync(ae,W)}input(ae,W=!0){this.coreService.triggerDataEvent(ae,W)}resize(ae,W){isNaN(ae)||isNaN(W)||(ae=Math.max(ae,C.MINIMUM_COLS),W=Math.max(W,C.MINIMUM_ROWS),this._bufferService.resize(ae,W))}scroll(ae,W=!1){this._bufferService.scroll(ae,W)}scrollLines(ae,W,G){this._bufferService.scrollLines(ae,W,G)}scrollPages(ae){this.scrollLines(ae*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(ae){let W=ae-this._bufferService.buffer.ydisp;W!==0&&this.scrollLines(W)}registerEscHandler(ae,W){return this._inputHandler.registerEscHandler(ae,W)}registerDcsHandler(ae,W){return this._inputHandler.registerDcsHandler(ae,W)}registerCsiHandler(ae,W){return this._inputHandler.registerCsiHandler(ae,W)}registerOscHandler(ae,W){return this._inputHandler.registerOscHandler(ae,W)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let ae=!1,W=this.optionsService.rawOptions.windowsPty;W&&W.buildNumber!==void 0&&W.buildNumber!==void 0?ae=W.backend==="conpty"&&W.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(ae=!0),ae?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let ae=[];ae.push(this.onLineFeed(O.updateWindowsModeWrappedState.bind(null,this._bufferService))),ae.push(this.registerCsiHandler({final:"H"},()=>((0,O.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,d.toDisposable)(()=>{for(let W of ae)W.dispose()})}}}a.CoreTerminal=B},8460:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=s=>(this._listeners.push(s),{dispose:()=>{if(!this._disposed){for(let d=0;dd.fire(p))},a.runAndSubscribe=function(s,d){return d(void 0),s(p=>d(p))}},5435:function(i,a,s){var d=this&&this.__decorate||function(ue,H,te,de){var me,Ie=arguments.length,$e=Ie<3?H:de===null?de=Object.getOwnPropertyDescriptor(H,te):de;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$e=Reflect.decorate(ue,H,te,de);else for(var tt=ue.length-1;tt>=0;tt--)(me=ue[tt])&&($e=(Ie<3?me($e):Ie>3?me(H,te,$e):me(H,te))||$e);return Ie>3&&$e&&Object.defineProperty(H,te,$e),$e},p=this&&this.__param||function(ue,H){return function(te,de){H(te,de,ue)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;let u=s(2584),g=s(7116),C=s(2015),M=s(844),x=s(482),b=s(8437),P=s(8460),k=s(643),S=s(511),O=s(3734),A=s(2585),D=s(1480),F=s(6242),I=s(6351),B=s(5941),le={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ae=131072;function W(ue,H){if(ue>24)return H.setWinLines||!1;switch(ue){case 1:return!!H.restoreWin;case 2:return!!H.minimizeWin;case 3:return!!H.setWinPosition;case 4:return!!H.setWinSizePixels;case 5:return!!H.raiseWin;case 6:return!!H.lowerWin;case 7:return!!H.refreshWin;case 8:return!!H.setWinSizeChars;case 9:return!!H.maximizeWin;case 10:return!!H.fullscreenWin;case 11:return!!H.getWinState;case 13:return!!H.getWinPosition;case 14:return!!H.getWinSizePixels;case 15:return!!H.getScreenSizePixels;case 16:return!!H.getCellSizePixels;case 18:return!!H.getWinSizeChars;case 19:return!!H.getScreenSizeChars;case 20:return!!H.getIconTitle;case 21:return!!H.getWinTitle;case 22:return!!H.pushTitle;case 23:return!!H.popTitle;case 24:return!!H.setWinLines}return!1}var G;(function(ue){ue[ue.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ue[ue.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(G||(a.WindowsOptionsReportType=G={}));let ve=0;class Se extends M.Disposable{getAttrData(){return this._curAttrData}constructor(H,te,de,me,Ie,$e,tt,et,Me=new C.EscapeSequenceParser){super(),this._bufferService=H,this._charsetService=te,this._coreService=de,this._logService=me,this._optionsService=Ie,this._oscLinkService=$e,this._coreMouseService=tt,this._unicodeService=et,this._parser=Me,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new x.StringToUtf32,this._utf8Decoder=new x.Utf8ToUtf32,this._workCell=new S.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new P.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new P.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new P.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new P.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new P.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new P.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new P.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new P.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new P.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new P.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new P.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new P.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new P.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new pe(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(Z=>this._activeBuffer=Z.activeBuffer)),this._parser.setCsiHandlerFallback((Z,Le)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(Z),params:Le.toArray()})}),this._parser.setEscHandlerFallback(Z=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(Z)})}),this._parser.setExecuteHandlerFallback(Z=>{this._logService.debug("Unknown EXECUTE code: ",{code:Z})}),this._parser.setOscHandlerFallback((Z,Le,Ze)=>{this._logService.debug("Unknown OSC code: ",{identifier:Z,action:Le,data:Ze})}),this._parser.setDcsHandlerFallback((Z,Le,Ze)=>{Le==="HOOK"&&(Ze=Ze.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(Z),action:Le,payload:Ze})}),this._parser.setPrintHandler((Z,Le,Ze)=>this.print(Z,Le,Ze)),this._parser.registerCsiHandler({final:"@"},Z=>this.insertChars(Z)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},Z=>this.scrollLeft(Z)),this._parser.registerCsiHandler({final:"A"},Z=>this.cursorUp(Z)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},Z=>this.scrollRight(Z)),this._parser.registerCsiHandler({final:"B"},Z=>this.cursorDown(Z)),this._parser.registerCsiHandler({final:"C"},Z=>this.cursorForward(Z)),this._parser.registerCsiHandler({final:"D"},Z=>this.cursorBackward(Z)),this._parser.registerCsiHandler({final:"E"},Z=>this.cursorNextLine(Z)),this._parser.registerCsiHandler({final:"F"},Z=>this.cursorPrecedingLine(Z)),this._parser.registerCsiHandler({final:"G"},Z=>this.cursorCharAbsolute(Z)),this._parser.registerCsiHandler({final:"H"},Z=>this.cursorPosition(Z)),this._parser.registerCsiHandler({final:"I"},Z=>this.cursorForwardTab(Z)),this._parser.registerCsiHandler({final:"J"},Z=>this.eraseInDisplay(Z,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},Z=>this.eraseInDisplay(Z,!0)),this._parser.registerCsiHandler({final:"K"},Z=>this.eraseInLine(Z,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},Z=>this.eraseInLine(Z,!0)),this._parser.registerCsiHandler({final:"L"},Z=>this.insertLines(Z)),this._parser.registerCsiHandler({final:"M"},Z=>this.deleteLines(Z)),this._parser.registerCsiHandler({final:"P"},Z=>this.deleteChars(Z)),this._parser.registerCsiHandler({final:"S"},Z=>this.scrollUp(Z)),this._parser.registerCsiHandler({final:"T"},Z=>this.scrollDown(Z)),this._parser.registerCsiHandler({final:"X"},Z=>this.eraseChars(Z)),this._parser.registerCsiHandler({final:"Z"},Z=>this.cursorBackwardTab(Z)),this._parser.registerCsiHandler({final:"`"},Z=>this.charPosAbsolute(Z)),this._parser.registerCsiHandler({final:"a"},Z=>this.hPositionRelative(Z)),this._parser.registerCsiHandler({final:"b"},Z=>this.repeatPrecedingCharacter(Z)),this._parser.registerCsiHandler({final:"c"},Z=>this.sendDeviceAttributesPrimary(Z)),this._parser.registerCsiHandler({prefix:">",final:"c"},Z=>this.sendDeviceAttributesSecondary(Z)),this._parser.registerCsiHandler({final:"d"},Z=>this.linePosAbsolute(Z)),this._parser.registerCsiHandler({final:"e"},Z=>this.vPositionRelative(Z)),this._parser.registerCsiHandler({final:"f"},Z=>this.hVPosition(Z)),this._parser.registerCsiHandler({final:"g"},Z=>this.tabClear(Z)),this._parser.registerCsiHandler({final:"h"},Z=>this.setMode(Z)),this._parser.registerCsiHandler({prefix:"?",final:"h"},Z=>this.setModePrivate(Z)),this._parser.registerCsiHandler({final:"l"},Z=>this.resetMode(Z)),this._parser.registerCsiHandler({prefix:"?",final:"l"},Z=>this.resetModePrivate(Z)),this._parser.registerCsiHandler({final:"m"},Z=>this.charAttributes(Z)),this._parser.registerCsiHandler({final:"n"},Z=>this.deviceStatus(Z)),this._parser.registerCsiHandler({prefix:"?",final:"n"},Z=>this.deviceStatusPrivate(Z)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},Z=>this.softReset(Z)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},Z=>this.setCursorStyle(Z)),this._parser.registerCsiHandler({final:"r"},Z=>this.setScrollRegion(Z)),this._parser.registerCsiHandler({final:"s"},Z=>this.saveCursor(Z)),this._parser.registerCsiHandler({final:"t"},Z=>this.windowOptions(Z)),this._parser.registerCsiHandler({final:"u"},Z=>this.restoreCursor(Z)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},Z=>this.insertColumns(Z)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},Z=>this.deleteColumns(Z)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},Z=>this.selectProtected(Z)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},Z=>this.requestMode(Z,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},Z=>this.requestMode(Z,!1)),this._parser.setExecuteHandler(u.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(u.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(u.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(u.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(u.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(u.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(u.C1.IND,()=>this.index()),this._parser.setExecuteHandler(u.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(u.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new F.OscHandler(Z=>(this.setTitle(Z),this.setIconName(Z),!0))),this._parser.registerOscHandler(1,new F.OscHandler(Z=>this.setIconName(Z))),this._parser.registerOscHandler(2,new F.OscHandler(Z=>this.setTitle(Z))),this._parser.registerOscHandler(4,new F.OscHandler(Z=>this.setOrReportIndexedColor(Z))),this._parser.registerOscHandler(8,new F.OscHandler(Z=>this.setHyperlink(Z))),this._parser.registerOscHandler(10,new F.OscHandler(Z=>this.setOrReportFgColor(Z))),this._parser.registerOscHandler(11,new F.OscHandler(Z=>this.setOrReportBgColor(Z))),this._parser.registerOscHandler(12,new F.OscHandler(Z=>this.setOrReportCursorColor(Z))),this._parser.registerOscHandler(104,new F.OscHandler(Z=>this.restoreIndexedColor(Z))),this._parser.registerOscHandler(110,new F.OscHandler(Z=>this.restoreFgColor(Z))),this._parser.registerOscHandler(111,new F.OscHandler(Z=>this.restoreBgColor(Z))),this._parser.registerOscHandler(112,new F.OscHandler(Z=>this.restoreCursorColor(Z))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let Z in g.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:Z},()=>this.selectCharset("("+Z)),this._parser.registerEscHandler({intermediates:")",final:Z},()=>this.selectCharset(")"+Z)),this._parser.registerEscHandler({intermediates:"*",final:Z},()=>this.selectCharset("*"+Z)),this._parser.registerEscHandler({intermediates:"+",final:Z},()=>this.selectCharset("+"+Z)),this._parser.registerEscHandler({intermediates:"-",final:Z},()=>this.selectCharset("-"+Z)),this._parser.registerEscHandler({intermediates:".",final:Z},()=>this.selectCharset("."+Z)),this._parser.registerEscHandler({intermediates:"/",final:Z},()=>this.selectCharset("/"+Z));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(Z=>(this._logService.error("Parsing error: ",Z),Z)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new I.DcsHandler((Z,Le)=>this.requestStatusString(Z,Le)))}_preserveStack(H,te,de,me){this._parseStack.paused=!0,this._parseStack.cursorStartX=H,this._parseStack.cursorStartY=te,this._parseStack.decodedLength=de,this._parseStack.position=me}_logSlowResolvingAsync(H){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([H,new Promise((te,de)=>setTimeout(()=>de("#SLOW_TIMEOUT"),5e3))]).catch(te=>{if(te!=="#SLOW_TIMEOUT")throw te;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(H,te){let de,me=this._activeBuffer.x,Ie=this._activeBuffer.y,$e=0,tt=this._parseStack.paused;if(tt){if(de=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,te))return this._logSlowResolvingAsync(de),de;me=this._parseStack.cursorStartX,Ie=this._parseStack.cursorStartY,this._parseStack.paused=!1,H.length>ae&&($e=this._parseStack.position+ae)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof H=="string"?` "${H}"`:` "${Array.prototype.map.call(H,Z=>String.fromCharCode(Z)).join("")}"`),typeof H=="string"?H.split("").map(Z=>Z.charCodeAt(0)):H),this._parseBuffer.lengthae)for(let Z=$e;Z0&&Ze.getWidth(this._activeBuffer.x-1)===2&&Ze.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Le);let dt=this._parser.precedingJoinState;for(let Ot=te;Otet){if(Me){let Ka=Ze,Gn=this._activeBuffer.x-Mo;for(this._activeBuffer.x=Mo,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),Ze=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Mo>0&&Ze instanceof b.BufferLine&&Ze.copyCellsFrom(Ka,Gn,0,Mo,!1);Gn=0;)Ze.setCellFromCodepoint(this._activeBuffer.x++,0,0,Le)}else if(Z&&(Ze.insertCells(this._activeBuffer.x,Ie-Mo,this._activeBuffer.getNullCell(Le)),Ze.getWidth(et-1)===2&&Ze.setCellFromCodepoint(et-1,k.NULL_CELL_CODE,k.NULL_CELL_WIDTH,Le)),Ze.setCellFromCodepoint(this._activeBuffer.x++,me,Ie,Le),Ie>0)for(;--Ie;)Ze.setCellFromCodepoint(this._activeBuffer.x++,0,0,Le)}this._parser.precedingJoinState=dt,this._activeBuffer.x0&&Ze.getWidth(this._activeBuffer.x)===0&&!Ze.hasContent(this._activeBuffer.x)&&Ze.setCellFromCodepoint(this._activeBuffer.x,0,1,Le),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(H,te){return H.final!=="t"||H.prefix||H.intermediates?this._parser.registerCsiHandler(H,te):this._parser.registerCsiHandler(H,de=>!W(de.params[0],this._optionsService.rawOptions.windowOptions)||te(de))}registerDcsHandler(H,te){return this._parser.registerDcsHandler(H,new I.DcsHandler(te))}registerEscHandler(H,te){return this._parser.registerEscHandler(H,te)}registerOscHandler(H,te){return this._parser.registerOscHandler(H,new F.OscHandler(te))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);H.hasWidth(this._activeBuffer.x)&&!H.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let H=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-H),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(H=this._bufferService.cols-1){this._activeBuffer.x=Math.min(H,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(H,te){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=H,this._activeBuffer.y=this._activeBuffer.scrollTop+te):(this._activeBuffer.x=H,this._activeBuffer.y=te),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(H,te){this._restrictCursor(),this._setCursor(this._activeBuffer.x+H,this._activeBuffer.y+te)}cursorUp(H){let te=this._activeBuffer.y-this._activeBuffer.scrollTop;return te>=0?this._moveCursor(0,-Math.min(te,H.params[0]||1)):this._moveCursor(0,-(H.params[0]||1)),!0}cursorDown(H){let te=this._activeBuffer.scrollBottom-this._activeBuffer.y;return te>=0?this._moveCursor(0,Math.min(te,H.params[0]||1)):this._moveCursor(0,H.params[0]||1),!0}cursorForward(H){return this._moveCursor(H.params[0]||1,0),!0}cursorBackward(H){return this._moveCursor(-(H.params[0]||1),0),!0}cursorNextLine(H){return this.cursorDown(H),this._activeBuffer.x=0,!0}cursorPrecedingLine(H){return this.cursorUp(H),this._activeBuffer.x=0,!0}cursorCharAbsolute(H){return this._setCursor((H.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(H){return this._setCursor(H.length>=2?(H.params[1]||1)-1:0,(H.params[0]||1)-1),!0}charPosAbsolute(H){return this._setCursor((H.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(H){return this._moveCursor(H.params[0]||1,0),!0}linePosAbsolute(H){return this._setCursor(this._activeBuffer.x,(H.params[0]||1)-1),!0}vPositionRelative(H){return this._moveCursor(0,H.params[0]||1),!0}hVPosition(H){return this.cursorPosition(H),!0}tabClear(H){let te=H.params[0];return te===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:te===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(H){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let te=H.params[0]||1;for(;te--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(H){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let te=H.params[0]||1;for(;te--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(H){let te=H.params[0];return te===1&&(this._curAttrData.bg|=536870912),te!==2&&te!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(H,te,de,me=!1,Ie=!1){let $e=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);$e.replaceCells(te,de,this._activeBuffer.getNullCell(this._eraseAttrData()),Ie),me&&($e.isWrapped=!1)}_resetBufferLine(H,te=!1){let de=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);de&&(de.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),te),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+H),de.isWrapped=!1)}eraseInDisplay(H,te=!1){let de;switch(this._restrictCursor(this._bufferService.cols),H.params[0]){case 0:for(de=this._activeBuffer.y,this._dirtyRowTracker.markDirty(de),this._eraseInBufferLine(de++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,te);de=this._bufferService.cols&&(this._activeBuffer.lines.get(de+1).isWrapped=!1);de--;)this._resetBufferLine(de,te);this._dirtyRowTracker.markDirty(0);break;case 2:for(de=this._bufferService.rows,this._dirtyRowTracker.markDirty(de-1);de--;)this._resetBufferLine(de,te);this._dirtyRowTracker.markDirty(0);break;case 3:let me=this._activeBuffer.lines.length-this._bufferService.rows;me>0&&(this._activeBuffer.lines.trimStart(me),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-me,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-me,0),this._onScroll.fire(0))}return!0}eraseInLine(H,te=!1){switch(this._restrictCursor(this._bufferService.cols),H.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,te);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,te);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,te)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(H){this._restrictCursor();let te=H.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let Me=et;for(let Z=1;Z0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(u.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(u.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(H){return H.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(u.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(u.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(H.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(u.C0.ESC+"[>83;40003;0c")),!0}_is(H){return(this._optionsService.rawOptions.termName+"").indexOf(H)===0}setMode(H){for(let te=0;teBo?1:2,dt=H.params[0];return Ot=dt,si=te?dt===2?4:dt===4?Ze($e.modes.insertMode):dt===12?3:dt===20?Ze(Le.convertEol):0:dt===1?Ze(de.applicationCursorKeys):dt===3?Le.windowOptions.setWinLines?et===80?2:et===132?1:0:0:dt===6?Ze(de.origin):dt===7?Ze(de.wraparound):dt===8?3:dt===9?Ze(me==="X10"):dt===12?Ze(Le.cursorBlink):dt===25?Ze(!$e.isCursorHidden):dt===45?Ze(de.reverseWraparound):dt===66?Ze(de.applicationKeypad):dt===67?4:dt===1e3?Ze(me==="VT200"):dt===1002?Ze(me==="DRAG"):dt===1003?Ze(me==="ANY"):dt===1004?Ze(de.sendFocus):dt===1005?4:dt===1006?Ze(Ie==="SGR"):dt===1015?4:dt===1016?Ze(Ie==="SGR_PIXELS"):dt===1048?1:dt===47||dt===1047||dt===1049?Ze(Me===Z):dt===2004?Ze(de.bracketedPasteMode):0,$e.triggerDataEvent(`${u.C0.ESC}[${te?"":"?"}${Ot};${si}$y`),!0;var Ot,si}_updateAttrColor(H,te,de,me,Ie){return te===2?(H|=50331648,H&=-16777216,H|=O.AttributeData.fromColorRGB([de,me,Ie])):te===5&&(H&=-50331904,H|=33554432|255&de),H}_extractColor(H,te,de){let me=[0,0,-1,0,0,0],Ie=0,$e=0;do{if(me[$e+Ie]=H.params[te+$e],H.hasSubParams(te+$e)){let tt=H.getSubParams(te+$e),et=0;do me[1]===5&&(Ie=1),me[$e+et+1+Ie]=tt[et];while(++et=2||me[1]===2&&$e+Ie>=5)break;me[1]&&(Ie=1)}while(++$e+te5)&&(H=1),te.extended.underlineStyle=H,te.fg|=268435456,H===0&&(te.fg&=-268435457),te.updateExtended()}_processSGR0(H){H.fg=b.DEFAULT_ATTR_DATA.fg,H.bg=b.DEFAULT_ATTR_DATA.bg,H.extended=H.extended.clone(),H.extended.underlineStyle=0,H.extended.underlineColor&=-67108864,H.updateExtended()}charAttributes(H){if(H.length===1&&H.params[0]===0)return this._processSGR0(this._curAttrData),!0;let te=H.length,de,me=this._curAttrData;for(let Ie=0;Ie=30&&de<=37?(me.fg&=-50331904,me.fg|=16777216|de-30):de>=40&&de<=47?(me.bg&=-50331904,me.bg|=16777216|de-40):de>=90&&de<=97?(me.fg&=-50331904,me.fg|=16777224|de-90):de>=100&&de<=107?(me.bg&=-50331904,me.bg|=16777224|de-100):de===0?this._processSGR0(me):de===1?me.fg|=134217728:de===3?me.bg|=67108864:de===4?(me.fg|=268435456,this._processUnderline(H.hasSubParams(Ie)?H.getSubParams(Ie)[0]:1,me)):de===5?me.fg|=536870912:de===7?me.fg|=67108864:de===8?me.fg|=1073741824:de===9?me.fg|=2147483648:de===2?me.bg|=134217728:de===21?this._processUnderline(2,me):de===22?(me.fg&=-134217729,me.bg&=-134217729):de===23?me.bg&=-67108865:de===24?(me.fg&=-268435457,this._processUnderline(0,me)):de===25?me.fg&=-536870913:de===27?me.fg&=-67108865:de===28?me.fg&=-1073741825:de===29?me.fg&=2147483647:de===39?(me.fg&=-67108864,me.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):de===49?(me.bg&=-67108864,me.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):de===38||de===48||de===58?Ie+=this._extractColor(H,Ie,me):de===53?me.bg|=1073741824:de===55?me.bg&=-1073741825:de===59?(me.extended=me.extended.clone(),me.extended.underlineColor=-1,me.updateExtended()):de===100?(me.fg&=-67108864,me.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,me.bg&=-67108864,me.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",de);return!0}deviceStatus(H){switch(H.params[0]){case 5:this._coreService.triggerDataEvent(`${u.C0.ESC}[0n`);break;case 6:let te=this._activeBuffer.y+1,de=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[${te};${de}R`)}return!0}deviceStatusPrivate(H){if(H.params[0]===6){let te=this._activeBuffer.y+1,de=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[?${te};${de}R`)}return!0}softReset(H){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(H){let te=H.params[0]||1;switch(te){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let de=te%2==1;return this._optionsService.options.cursorBlink=de,!0}setScrollRegion(H){let te=H.params[0]||1,de;return(H.length<2||(de=H.params[1])>this._bufferService.rows||de===0)&&(de=this._bufferService.rows),de>te&&(this._activeBuffer.scrollTop=te-1,this._activeBuffer.scrollBottom=de-1,this._setCursor(0,0)),!0}windowOptions(H){if(!W(H.params[0],this._optionsService.rawOptions.windowOptions))return!0;let te=H.length>1?H.params[1]:0;switch(H.params[0]){case 14:te!==2&&this._onRequestWindowsOptionsReport.fire(G.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(G.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${u.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:te!==0&&te!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),te!==0&&te!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:te!==0&&te!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),te!==0&&te!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(H){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(H){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(H){return this._windowTitle=H,this._onTitleChange.fire(H),!0}setIconName(H){return this._iconName=H,!0}setOrReportIndexedColor(H){let te=[],de=H.split(";");for(;de.length>1;){let me=de.shift(),Ie=de.shift();if(/^\d+$/.exec(me)){let $e=parseInt(me);if(Ae($e))if(Ie==="?")te.push({type:0,index:$e});else{let tt=(0,B.parseColor)(Ie);tt&&te.push({type:1,index:$e,color:tt})}}}return te.length&&this._onColor.fire(te),!0}setHyperlink(H){let te=H.split(";");return!(te.length<2)&&(te[1]?this._createHyperlink(te[0],te[1]):!te[0]&&this._finishHyperlink())}_createHyperlink(H,te){this._getCurrentLinkId()&&this._finishHyperlink();let de=H.split(":"),me,Ie=de.findIndex($e=>$e.startsWith("id="));return Ie!==-1&&(me=de[Ie].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:me,uri:te}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(H,te){let de=H.split(";");for(let me=0;me=this._specialColors.length);++me,++te)if(de[me]==="?")this._onColor.fire([{type:0,index:this._specialColors[te]}]);else{let Ie=(0,B.parseColor)(de[me]);Ie&&this._onColor.fire([{type:1,index:this._specialColors[te],color:Ie}])}return!0}setOrReportFgColor(H){return this._setOrReportSpecialColor(H,0)}setOrReportBgColor(H){return this._setOrReportSpecialColor(H,1)}setOrReportCursorColor(H){return this._setOrReportSpecialColor(H,2)}restoreIndexedColor(H){if(!H)return this._onColor.fire([{type:2}]),!0;let te=[],de=H.split(";");for(let me=0;me=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let H=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,H,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(H){return this._charsetService.setgLevel(H),!0}screenAlignmentPattern(){let H=new S.CellData;H.content=4194373,H.fg=this._curAttrData.fg,H.bg=this._curAttrData.bg,this._setCursor(0,0);for(let te=0;te(this._coreService.triggerDataEvent(`${u.C0.ESC}${Ie}${u.C0.ESC}\\`),!0))(H==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:H==='"p'?'P1$r61;1"p':H==="r"?`P1$r${de.scrollTop+1};${de.scrollBottom+1}r`:H==="m"?"P1$r0m":H===" q"?`P1$r${{block:2,underline:4,bar:6}[me.cursorStyle]-(me.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(H,te){this._dirtyRowTracker.markRangeDirty(H,te)}}a.InputHandler=Se;let pe=class{constructor(ue){this._bufferService=ue,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ue){uethis.end&&(this.end=ue)}markRangeDirty(ue,H){ue>H&&(ve=ue,ue=H,H=ve),uethis.end&&(this.end=H)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Ae(ue){return 0<=ue&&ue<256}pe=d([p(0,A.IBufferService)],pe)},844:(i,a)=>{function s(d){for(let p of d)p.dispose();d.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let d of this._disposables)d.dispose();this._disposables.length=0}register(d){return this._disposables.push(d),d}unregister(d){let p=this._disposables.indexOf(d);p!==-1&&this._disposables.splice(p,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(d){this._isDisposed||d===this._value||(this._value?.dispose(),this._value=d)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},a.toDisposable=function(d){return{dispose:d}},a.disposeArray=s,a.getDisposeArrayDisposable=function(d){return{dispose:()=>s(d)}}},1505:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class s{constructor(){this._data={}}set(p,u,g){this._data[p]||(this._data[p]={}),this._data[p][u]=g}get(p,u){return this._data[p]?this._data[p][u]:void 0}clear(){this._data={}}}a.TwoKeyMap=s,a.FourKeyMap=class{constructor(){this._data=new s}set(d,p,u,g,C){this._data.get(d,p)||this._data.set(d,p,new s),this._data.get(d,p).set(u,g,C)}get(d,p,u,g){return this._data.get(d,p)?.get(u,g)}clear(){this._data.clear()}}},6114:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof process<"u"&&"title"in process;let s=a.isNode?"node":navigator.userAgent,d=a.isNode?"node":navigator.platform;a.isFirefox=s.includes("Firefox"),a.isLegacyEdge=s.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(s),a.getSafariVersion=function(){if(!a.isSafari)return 0;let p=s.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(d),a.isIpad=d==="iPad",a.isIphone=d==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(d),a.isLinux=d.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(s)},6106:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let s=0;a.SortedList=class{constructor(d){this._getKey=d,this._array=[]}clear(){this._array.length=0}insert(d){this._array.length!==0?(s=this._search(this._getKey(d)),this._array.splice(s,0,d)):this._array.push(d)}delete(d){if(this._array.length===0)return!1;let p=this._getKey(d);if(p===void 0||(s=this._search(p),s===-1)||this._getKey(this._array[s])!==p)return!1;do if(this._array[s]===d)return this._array.splice(s,1),!0;while(++s=this._array.length)&&this._getKey(this._array[s])===d))do yield this._array[s];while(++s=this._array.length)&&this._getKey(this._array[s])===d))do p(this._array[s]);while(++s=p;){let g=p+u>>1,C=this._getKey(this._array[g]);if(C>d)u=g-1;else{if(!(C0&&this._getKey(this._array[g-1])===d;)g--;return g}p=g+1}}return p}}},7226:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;let d=s(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),this._start()}flush(){for(;this._iP)return b-M<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-M))}ms`),void this._start();b=P}this.clear()}}class u extends p{_requestCallback(C){return setTimeout(()=>C(this._createDeadline(16)))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){let M=Date.now()+C;return{timeRemaining:()=>Math.max(0,M-Date.now())}}}a.PriorityTaskQueue=u,a.IdleTaskQueue=!d.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:u,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}flush(){this._queue.flush()}}},9282:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;let d=s(643);a.updateWindowsModeWrappedState=function(p){let u=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),g=u?.get(p.cols-1),C=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);C&&g&&(C.isWrapped=g[d.CHAR_DATA_CODE_INDEX]!==d.NULL_CELL_CODE&&g[d.CHAR_DATA_CODE_INDEX]!==d.WHITESPACE_CELL_CODE)}},3734:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class s{constructor(){this.fg=0,this.bg=0,this.extended=new d}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){let u=new s;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}a.AttributeData=s;class d{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){let u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,g=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=g}clone(){return new d(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=d},9092:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;let d=s(6349),p=s(7226),u=s(3734),g=s(8437),C=s(4634),M=s(511),x=s(643),b=s(4863),P=s(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(k,S,O){this._hasScrollback=k,this._optionsService=S,this._bufferService=O,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=g.DEFAULT_ATTR_DATA.clone(),this.savedCharset=P.DEFAULT_CHARSET,this.markers=[],this._nullCell=M.CellData.fromCharData([0,x.NULL_CELL_CHAR,x.NULL_CELL_WIDTH,x.NULL_CELL_CODE]),this._whitespaceCell=M.CellData.fromCharData([0,x.WHITESPACE_CELL_CHAR,x.WHITESPACE_CELL_WIDTH,x.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new d.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(k){return k?(this._nullCell.fg=k.fg,this._nullCell.bg=k.bg,this._nullCell.extended=k.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell}getWhitespaceCell(k){return k?(this._whitespaceCell.fg=k.fg,this._whitespaceCell.bg=k.bg,this._whitespaceCell.extended=k.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell}getBlankLine(k,S){return new g.BufferLine(this._bufferService.cols,this.getNullCell(k),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let k=this.ybase+this.y-this.ydisp;return k>=0&&ka.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:S}fillViewportRows(k){if(this.lines.length===0){k===void 0&&(k=g.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(k))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new d.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(k,S){let O=this.getNullCell(g.DEFAULT_ATTR_DATA),A=0,D=this._getCorrectBufferLength(S);if(D>this.lines.maxLength&&(this.lines.maxLength=D),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+F+1?(this.ybase--,F++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(k,O)));else for(let I=this._rows;I>S;I--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(D0&&(this.lines.trimStart(I),this.ybase=Math.max(this.ybase-I,0),this.ydisp=Math.max(this.ydisp-I,0),this.savedY=Math.max(this.savedY-I,0)),this.lines.maxLength=D}this.x=Math.min(this.x,k-1),this.y=Math.min(this.y,S-1),F&&(this.y+=F),this.savedX=Math.min(this.savedX,k-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(k,S),this._cols>k))for(let F=0;F.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let k=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,k=!1);let S=0;for(;this._memoryCleanupPosition100)return!0;return k}get _isReflowEnabled(){let k=this._optionsService.rawOptions.windowsPty;return k&&k.buildNumber?this._hasScrollback&&k.backend==="conpty"&&k.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(k,S){this._cols!==k&&(k>this._cols?this._reflowLarger(k,S):this._reflowSmaller(k,S))}_reflowLarger(k,S){let O=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,k,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(O.length>0){let A=(0,C.reflowLargerCreateNewLayout)(this.lines,O);(0,C.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(k,S,A.countRemoved)}}_reflowLargerAdjustViewport(k,S,O){let A=this.getNullCell(g.DEFAULT_ATTR_DATA),D=O;for(;D-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;F--){let I=this.lines.get(F);if(!I||!I.isWrapped&&I.getTrimmedLength()<=k)continue;let B=[I];for(;I.isWrapped&&F>0;)I=this.lines.get(--F),B.unshift(I);let le=this.ybase+this.y;if(le>=F&&le0&&(A.push({start:F+B.length+D,newLines:Se}),D+=Se.length),B.push(...Se);let pe=W.length-1,Ae=W[pe];Ae===0&&(pe--,Ae=W[pe]);let ue=B.length-G-1,H=ae;for(;ue>=0;){let de=Math.min(H,Ae);if(B[pe]===void 0)break;if(B[pe].copyCellsFrom(B[ue],H-de,Ae-de,de,!0),Ae-=de,Ae===0&&(pe--,Ae=W[pe]),H-=de,H===0){ue--;let me=Math.max(ue,0);H=(0,C.getWrappedLineTrimmedLength)(B,me,this._cols)}}for(let de=0;de0;)this.ybase===0?this.y0){let F=[],I=[];for(let pe=0;pe=0;pe--)if(W&&W.start>le+G){for(let Ae=W.newLines.length-1;Ae>=0;Ae--)this.lines.set(pe--,W.newLines[Ae]);pe++,F.push({index:le+1,amount:W.newLines.length}),G+=W.newLines.length,W=A[++ae]}else this.lines.set(pe,I[le--]);let ve=0;for(let pe=F.length-1;pe>=0;pe--)F[pe].index+=ve,this.lines.onInsertEmitter.fire(F[pe]),ve+=F[pe].amount;let Se=Math.max(0,B+D-this.lines.maxLength);Se>0&&this.lines.onTrimEmitter.fire(Se)}}translateBufferLineToString(k,S,O=0,A){let D=this.lines.get(k);return D?D.translateToString(S,O,A):""}getWrappedRangeForLine(k){let S=k,O=k;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;O+10;);return k>=this._cols?this._cols-1:k<0?0:k}nextStop(k){for(k==null&&(k=this.x);!this.tabs[++k]&&k=this._cols?this._cols-1:k<0?0:k}clearMarkers(k){this._isClearing=!0;for(let S=0;S{S.line-=O,S.line<0&&S.dispose()})),S.register(this.lines.onInsert(O=>{S.line>=O.index&&(S.line+=O.amount)})),S.register(this.lines.onDelete(O=>{S.line>=O.index&&S.lineO.index&&(S.line-=O.amount)})),S.register(S.onDispose(()=>this._removeMarker(S))),S}_removeMarker(k){this._isClearing||this.markers.splice(this.markers.indexOf(k),1)}}},8437:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;let d=s(3734),p=s(511),u=s(643),g=s(482);a.DEFAULT_ATTR_DATA=Object.freeze(new d.AttributeData);let C=0;class M{constructor(b,P,k=!1){this.isWrapped=k,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);let S=P||p.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]);for(let O=0;O>22,2097152&P?this._combined[b].charCodeAt(this._combined[b].length-1):k]}set(b,P){this._data[3*b+1]=P[u.CHAR_DATA_ATTR_INDEX],P[u.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=P[1],this._data[3*b+0]=2097152|b|P[u.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=P[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|P[u.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){let P=this._data[3*b+0];return 2097152&P?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&P}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){let P=this._data[3*b+0];return 2097152&P?this._combined[b]:2097151&P?(0,g.stringFromCodePoint)(2097151&P):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,P){return C=3*b,P.content=this._data[C+0],P.fg=this._data[C+1],P.bg=this._data[C+2],2097152&P.content&&(P.combinedData=this._combined[b]),268435456&P.bg&&(P.extended=this._extendedAttrs[b]),P}setCell(b,P){2097152&P.content&&(this._combined[b]=P.combinedData),268435456&P.bg&&(this._extendedAttrs[b]=P.extended),this._data[3*b+0]=P.content,this._data[3*b+1]=P.fg,this._data[3*b+2]=P.bg}setCellFromCodepoint(b,P,k,S){268435456&S.bg&&(this._extendedAttrs[b]=S.extended),this._data[3*b+0]=P|k<<22,this._data[3*b+1]=S.fg,this._data[3*b+2]=S.bg}addCodepointToCell(b,P,k){let S=this._data[3*b+0];2097152&S?this._combined[b]+=(0,g.stringFromCodePoint)(P):2097151&S?(this._combined[b]=(0,g.stringFromCodePoint)(2097151&S)+(0,g.stringFromCodePoint)(P),S&=-2097152,S|=2097152):S=P|4194304,k&&(S&=-12582913,S|=k<<22),this._data[3*b+0]=S}insertCells(b,P,k){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,k),P=0;--O)this.setCell(b+P+O,this.loadCell(b+O,S));for(let O=0;Othis.length){if(this._data.buffer.byteLength>=4*k)this._data=new Uint32Array(this._data.buffer,0,k);else{let S=new Uint32Array(k);S.set(this._data),this._data=S}for(let S=this.length;S=b&&delete this._combined[D]}let O=Object.keys(this._extendedAttrs);for(let A=0;A=b&&delete this._extendedAttrs[D]}}return this.length=b,4*k*2=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,P,k,S,O){let A=b._data;if(O)for(let F=S-1;F>=0;F--){for(let I=0;I<3;I++)this._data[3*(k+F)+I]=A[3*(P+F)+I];268435456&A[3*(P+F)+2]&&(this._extendedAttrs[k+F]=b._extendedAttrs[P+F])}else for(let F=0;F=P&&(this._combined[I-P+k]=b._combined[I])}}translateToString(b,P,k,S){P=P??0,k=k??this.length,b&&(k=Math.min(k,this.getTrimmedLength())),S&&(S.length=0);let O="";for(;P>22||1}return S&&S.push(P),O}}a.BufferLine=M},4841:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(s,d){if(s.start.y>s.end.y)throw new Error(`Buffer range end (${s.end.x}, ${s.end.y}) cannot be before start (${s.start.x}, ${s.start.y})`);return d*(s.end.y-s.start.y)+(s.end.x-s.start.x+1)}},4634:(i,a)=>{function s(d,p,u){if(p===d.length-1)return d[p].getTrimmedLength();let g=!d[p].hasContent(u-1)&&d[p].getWidth(u-1)===1,C=d[p+1].getWidth(0)===2;return g&&C?u-1:u}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(d,p,u,g,C){let M=[];for(let x=0;x=x&&g0&&(I>S||k[I].getTrimmedLength()===0);I--)F++;F>0&&(M.push(x+k.length-F),M.push(F)),x+=k.length-1}return M},a.reflowLargerCreateNewLayout=function(d,p){let u=[],g=0,C=p[g],M=0;for(let x=0;xs(d,k,p)).reduce((P,k)=>P+k),M=0,x=0,b=0;for(;bP&&(M-=P,x++);let k=d[x].getWidth(M-1)===2;k&&M--;let S=k?u-1:u;g.push(S),b+=S}return g},a.getWrappedLineTrimmedLength=s},5295:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;let d=s(8460),p=s(844),u=s(9092);class g extends p.Disposable{constructor(M,x){super(),this._optionsService=M,this._bufferService=x,this._onBufferActivate=this.register(new d.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new u.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new u.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(M){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(M),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(M,x){this._normal.resize(M,x),this._alt.resize(M,x),this.setupTabStops(M)}setupTabStops(M){this._normal.setupTabStops(M),this._alt.setupTabStops(M)}}a.BufferSet=g},511:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;let d=s(482),p=s(643),u=s(3734);class g extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(M){let x=new g;return x.setFromCharData(M),x}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,d.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(M){this.fg=M[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let x=!1;if(M[p.CHAR_DATA_CHAR_INDEX].length>2)x=!0;else if(M[p.CHAR_DATA_CHAR_INDEX].length===2){let b=M[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){let P=M[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=P&&P<=57343?this.content=1024*(b-55296)+P-56320+65536|M[p.CHAR_DATA_WIDTH_INDEX]<<22:x=!0}else x=!0}else this.content=M[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|M[p.CHAR_DATA_WIDTH_INDEX]<<22;x&&(this.combinedData=M[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|M[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=g},643:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;let d=s(8460),p=s(844);class u{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=u._nextId++,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}a.Marker=u,u._nextId=1},7116:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},a.CHARSETS.A={"#":"\xA3"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},a.CHARSETS.C=a.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},a.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},a.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},a.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},a.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},a.CHARSETS.E=a.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},a.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},a.CHARSETS.H=a.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},a.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(i,a)=>{var s,d,p;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(u){u.NUL="\0",u.SOH="",u.STX="",u.ETX="",u.EOT="",u.ENQ="",u.ACK="",u.BEL="\x07",u.BS="\b",u.HT=" ",u.LF=` +`,u.VT="\v",u.FF="\f",u.CR="\r",u.SO="",u.SI="",u.DLE="",u.DC1="",u.DC2="",u.DC3="",u.DC4="",u.NAK="",u.SYN="",u.ETB="",u.CAN="",u.EM="",u.SUB="",u.ESC="\x1B",u.FS="",u.GS="",u.RS="",u.US="",u.SP=" ",u.DEL="\x7F"})(s||(a.C0=s={})),(function(u){u.PAD="\x80",u.HOP="\x81",u.BPH="\x82",u.NBH="\x83",u.IND="\x84",u.NEL="\x85",u.SSA="\x86",u.ESA="\x87",u.HTS="\x88",u.HTJ="\x89",u.VTS="\x8A",u.PLD="\x8B",u.PLU="\x8C",u.RI="\x8D",u.SS2="\x8E",u.SS3="\x8F",u.DCS="\x90",u.PU1="\x91",u.PU2="\x92",u.STS="\x93",u.CCH="\x94",u.MW="\x95",u.SPA="\x96",u.EPA="\x97",u.SOS="\x98",u.SGCI="\x99",u.SCI="\x9A",u.CSI="\x9B",u.ST="\x9C",u.OSC="\x9D",u.PM="\x9E",u.APC="\x9F"})(d||(a.C1=d={})),(function(u){u.ST=`${s.ESC}\\`})(p||(a.C1_ESCAPED=p={}))},7399:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;let d=s(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};a.evaluateKeyboardEvent=function(u,g,C,M){let x={type:0,cancel:!1,key:void 0},b=(u.shiftKey?1:0)|(u.altKey?2:0)|(u.ctrlKey?4:0)|(u.metaKey?8:0);switch(u.keyCode){case 0:u.key==="UIKeyInputUpArrow"?x.key=g?d.C0.ESC+"OA":d.C0.ESC+"[A":u.key==="UIKeyInputLeftArrow"?x.key=g?d.C0.ESC+"OD":d.C0.ESC+"[D":u.key==="UIKeyInputRightArrow"?x.key=g?d.C0.ESC+"OC":d.C0.ESC+"[C":u.key==="UIKeyInputDownArrow"&&(x.key=g?d.C0.ESC+"OB":d.C0.ESC+"[B");break;case 8:x.key=u.ctrlKey?"\b":d.C0.DEL,u.altKey&&(x.key=d.C0.ESC+x.key);break;case 9:if(u.shiftKey){x.key=d.C0.ESC+"[Z";break}x.key=d.C0.HT,x.cancel=!0;break;case 13:x.key=u.altKey?d.C0.ESC+d.C0.CR:d.C0.CR,x.cancel=!0;break;case 27:x.key=d.C0.ESC,u.altKey&&(x.key=d.C0.ESC+d.C0.ESC),x.cancel=!0;break;case 37:if(u.metaKey)break;b?(x.key=d.C0.ESC+"[1;"+(b+1)+"D",x.key===d.C0.ESC+"[1;3D"&&(x.key=d.C0.ESC+(C?"b":"[1;5D"))):x.key=g?d.C0.ESC+"OD":d.C0.ESC+"[D";break;case 39:if(u.metaKey)break;b?(x.key=d.C0.ESC+"[1;"+(b+1)+"C",x.key===d.C0.ESC+"[1;3C"&&(x.key=d.C0.ESC+(C?"f":"[1;5C"))):x.key=g?d.C0.ESC+"OC":d.C0.ESC+"[C";break;case 38:if(u.metaKey)break;b?(x.key=d.C0.ESC+"[1;"+(b+1)+"A",C||x.key!==d.C0.ESC+"[1;3A"||(x.key=d.C0.ESC+"[1;5A")):x.key=g?d.C0.ESC+"OA":d.C0.ESC+"[A";break;case 40:if(u.metaKey)break;b?(x.key=d.C0.ESC+"[1;"+(b+1)+"B",C||x.key!==d.C0.ESC+"[1;3B"||(x.key=d.C0.ESC+"[1;5B")):x.key=g?d.C0.ESC+"OB":d.C0.ESC+"[B";break;case 45:u.shiftKey||u.ctrlKey||(x.key=d.C0.ESC+"[2~");break;case 46:x.key=b?d.C0.ESC+"[3;"+(b+1)+"~":d.C0.ESC+"[3~";break;case 36:x.key=b?d.C0.ESC+"[1;"+(b+1)+"H":g?d.C0.ESC+"OH":d.C0.ESC+"[H";break;case 35:x.key=b?d.C0.ESC+"[1;"+(b+1)+"F":g?d.C0.ESC+"OF":d.C0.ESC+"[F";break;case 33:u.shiftKey?x.type=2:u.ctrlKey?x.key=d.C0.ESC+"[5;"+(b+1)+"~":x.key=d.C0.ESC+"[5~";break;case 34:u.shiftKey?x.type=3:u.ctrlKey?x.key=d.C0.ESC+"[6;"+(b+1)+"~":x.key=d.C0.ESC+"[6~";break;case 112:x.key=b?d.C0.ESC+"[1;"+(b+1)+"P":d.C0.ESC+"OP";break;case 113:x.key=b?d.C0.ESC+"[1;"+(b+1)+"Q":d.C0.ESC+"OQ";break;case 114:x.key=b?d.C0.ESC+"[1;"+(b+1)+"R":d.C0.ESC+"OR";break;case 115:x.key=b?d.C0.ESC+"[1;"+(b+1)+"S":d.C0.ESC+"OS";break;case 116:x.key=b?d.C0.ESC+"[15;"+(b+1)+"~":d.C0.ESC+"[15~";break;case 117:x.key=b?d.C0.ESC+"[17;"+(b+1)+"~":d.C0.ESC+"[17~";break;case 118:x.key=b?d.C0.ESC+"[18;"+(b+1)+"~":d.C0.ESC+"[18~";break;case 119:x.key=b?d.C0.ESC+"[19;"+(b+1)+"~":d.C0.ESC+"[19~";break;case 120:x.key=b?d.C0.ESC+"[20;"+(b+1)+"~":d.C0.ESC+"[20~";break;case 121:x.key=b?d.C0.ESC+"[21;"+(b+1)+"~":d.C0.ESC+"[21~";break;case 122:x.key=b?d.C0.ESC+"[23;"+(b+1)+"~":d.C0.ESC+"[23~";break;case 123:x.key=b?d.C0.ESC+"[24;"+(b+1)+"~":d.C0.ESC+"[24~";break;default:if(!u.ctrlKey||u.shiftKey||u.altKey||u.metaKey)if(C&&!M||!u.altKey||u.metaKey)!C||u.altKey||u.ctrlKey||u.shiftKey||!u.metaKey?u.key&&!u.ctrlKey&&!u.altKey&&!u.metaKey&&u.keyCode>=48&&u.key.length===1?x.key=u.key:u.key&&u.ctrlKey&&(u.key==="_"&&(x.key=d.C0.US),u.key==="@"&&(x.key=d.C0.NUL)):u.keyCode===65&&(x.type=1);else{let P=p[u.keyCode],k=P?.[u.shiftKey?1:0];if(k)x.key=d.C0.ESC+k;else if(u.keyCode>=65&&u.keyCode<=90){let S=u.ctrlKey?u.keyCode-64:u.keyCode+32,O=String.fromCharCode(S);u.shiftKey&&(O=O.toUpperCase()),x.key=d.C0.ESC+O}else if(u.keyCode===32)x.key=d.C0.ESC+(u.ctrlKey?d.C0.NUL:" ");else if(u.key==="Dead"&&u.code.startsWith("Key")){let S=u.code.slice(3,4);u.shiftKey||(S=S.toLowerCase()),x.key=d.C0.ESC+S,x.cancel=!0}}else u.keyCode>=65&&u.keyCode<=90?x.key=String.fromCharCode(u.keyCode-64):u.keyCode===32?x.key=d.C0.NUL:u.keyCode>=51&&u.keyCode<=55?x.key=String.fromCharCode(u.keyCode-51+27):u.keyCode===56?x.key=d.C0.DEL:u.keyCode===219?x.key=d.C0.ESC:u.keyCode===220?x.key=d.C0.FS:u.keyCode===221&&(x.key=d.C0.GS)}return x}},482:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Utf8ToUtf32=a.StringToUtf32=a.utf32ToString=a.stringFromCodePoint=void 0,a.stringFromCodePoint=function(s){return s>65535?(s-=65536,String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):String.fromCharCode(s)},a.utf32ToString=function(s,d=0,p=s.length){let u="";for(let g=d;g65535?(C-=65536,u+=String.fromCharCode(55296+(C>>10))+String.fromCharCode(C%1024+56320)):u+=String.fromCharCode(C)}return u},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(s,d){let p=s.length;if(!p)return 0;let u=0,g=0;if(this._interim){let C=s.charCodeAt(g++);56320<=C&&C<=57343?d[u++]=1024*(this._interim-55296)+C-56320+65536:(d[u++]=this._interim,d[u++]=C),this._interim=0}for(let C=g;C=p)return this._interim=M,u;let x=s.charCodeAt(C);56320<=x&&x<=57343?d[u++]=1024*(M-55296)+x-56320+65536:(d[u++]=M,d[u++]=x)}else M!==65279&&(d[u++]=M)}return u}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(s,d){let p=s.length;if(!p)return 0;let u,g,C,M,x=0,b=0,P=0;if(this.interim[0]){let O=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let D,F=0;for(;(D=63&this.interim[++F])&&F<4;)A<<=6,A|=D;let I=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,B=I-F;for(;P=p)return 0;if(D=s[P++],(192&D)!=128){P--,O=!0;break}this.interim[F++]=D,A<<=6,A|=63&D}O||(I===2?A<128?P--:d[x++]=A:I===3?A<2048||A>=55296&&A<=57343||A===65279||(d[x++]=A):A<65536||A>1114111||(d[x++]=A)),this.interim.fill(0)}let k=p-4,S=P;for(;S=p)return this.interim[0]=u,x;if(g=s[S++],(192&g)!=128){S--;continue}if(b=(31&u)<<6|63&g,b<128){S--;continue}d[x++]=b}else if((240&u)==224){if(S>=p)return this.interim[0]=u,x;if(g=s[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=u,this.interim[1]=g,x;if(C=s[S++],(192&C)!=128){S--;continue}if(b=(15&u)<<12|(63&g)<<6|63&C,b<2048||b>=55296&&b<=57343||b===65279)continue;d[x++]=b}else if((248&u)==240){if(S>=p)return this.interim[0]=u,x;if(g=s[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=u,this.interim[1]=g,x;if(C=s[S++],(192&C)!=128){S--;continue}if(S>=p)return this.interim[0]=u,this.interim[1]=g,this.interim[2]=C,x;if(M=s[S++],(192&M)!=128){S--;continue}if(b=(7&u)<<18|(63&g)<<12|(63&C)<<6|63&M,b<65536||b>1114111)continue;d[x++]=b}}return x}}},225:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;let d=s(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],u=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],g;a.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let C=0;Cx[k][1])return!1;for(;k>=P;)if(b=P+k>>1,M>x[b][1])P=b+1;else{if(!(M=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,M){let x=this.wcwidth(C),b=x===0&&M!==0;if(b){let P=d.UnicodeService.extractWidth(M);P===0?b=!1:P>x&&(x=P)}return d.UnicodeService.createPropertyValue(0,x,b)}}},5981:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;let d=s(8460),p=s(844);class u extends p.Disposable{constructor(C){super(),this._action=C,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new d.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(C,M){if(M!==void 0&&this._syncCalls>M)return void(this._syncCalls=0);if(this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let x;for(this._isSyncWriting=!0;x=this._writeBuffer.shift();){this._action(x);let b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(C,M){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(M),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(M)}_innerWrite(C=0,M=!0){let x=C||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let b=this._writeBuffer[this._bufferOffset],P=this._action(b,M);if(P){let S=O=>Date.now()-x>=12?setTimeout(()=>this._innerWrite(0,O)):this._innerWrite(x,O);return void P.catch(O=>(queueMicrotask(()=>{throw O}),Promise.resolve(!1))).then(S)}let k=this._callbacks[this._bufferOffset];if(k&&k(),this._bufferOffset++,this._pendingData-=b.length,Date.now()-x>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}a.WriteBuffer=u},5941:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.toRgbString=a.parseColor=void 0;let s=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,d=/^[\da-f]+$/;function p(u,g){let C=u.toString(16),M=C.length<2?"0"+C:C;switch(g){case 4:return C[0];case 8:return M;case 12:return(M+M).slice(0,3);default:return M+M}}a.parseColor=function(u){if(!u)return;let g=u.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);let C=s.exec(g);if(C){let M=C[1]?15:C[4]?255:C[7]?4095:65535;return[Math.round(parseInt(C[1]||C[4]||C[7]||C[10],16)/M*255),Math.round(parseInt(C[2]||C[5]||C[8]||C[11],16)/M*255),Math.round(parseInt(C[3]||C[6]||C[9]||C[12],16)/M*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),d.exec(g)&&[3,6,9,12].includes(g.length))){let C=g.length/3,M=[0,0,0];for(let x=0;x<3;++x){let b=parseInt(g.slice(C*x,C*x+C),16);M[x]=C===1?b<<4:C===2?b:C===3?b>>4:b>>8}return M}},a.toRgbString=function(u,g=16){let[C,M,x]=u;return`rgb:${p(C,g)}/${p(M,g)}/${p(x,g)}`}},5770:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PAYLOAD_LIMIT=void 0,a.PAYLOAD_LIMIT=1e7},6351:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DcsHandler=a.DcsParser=void 0;let d=s(482),p=s(8742),u=s(5770),g=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(M,x){this._handlers[M]===void 0&&(this._handlers[M]=[]);let b=this._handlers[M];return b.push(x),{dispose:()=>{let P=b.indexOf(x);P!==-1&&b.splice(P,1)}}}clearHandler(M){this._handlers[M]&&delete this._handlers[M]}setHandlerFallback(M){this._handlerFb=M}reset(){if(this._active.length)for(let M=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;M>=0;--M)this._active[M].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(M,x){if(this.reset(),this._ident=M,this._active=this._handlers[M]||g,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(x);else this._handlerFb(this._ident,"HOOK",x)}put(M,x,b){if(this._active.length)for(let P=this._active.length-1;P>=0;P--)this._active[P].put(M,x,b);else this._handlerFb(this._ident,"PUT",(0,d.utf32ToString)(M,x,b))}unhook(M,x=!0){if(this._active.length){let b=!1,P=this._active.length-1,k=!1;if(this._stack.paused&&(P=this._stack.loopPosition-1,b=x,k=this._stack.fallThrough,this._stack.paused=!1),!k&&b===!1){for(;P>=0&&(b=this._active[P].unhook(M),b!==!0);P--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=P,this._stack.fallThrough=!1,b;P--}for(;P>=0;P--)if(b=this._active[P].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=P,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",M);this._active=g,this._ident=0}};let C=new p.Params;C.addParam(0),a.DcsHandler=class{constructor(M){this._handler=M,this._data="",this._params=C,this._hitLimit=!1}hook(M){this._params=M.length>1||M.params[0]?M.clone():C,this._data="",this._hitLimit=!1}put(M,x,b){this._hitLimit||(this._data+=(0,d.utf32ToString)(M,x,b),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(M){let x=!1;if(this._hitLimit)x=!1;else if(M&&(x=this._handler(this._data,this._params),x instanceof Promise))return x.then(b=>(this._params=C,this._data="",this._hitLimit=!1,b));return this._params=C,this._data="",this._hitLimit=!1,x}}},2015:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.EscapeSequenceParser=a.VT500_TRANSITION_TABLE=a.TransitionTable=void 0;let d=s(844),p=s(8742),u=s(6242),g=s(6351);class C{constructor(P){this.table=new Uint8Array(P)}setDefault(P,k){this.table.fill(P<<4|k)}add(P,k,S,O){this.table[k<<8|P]=S<<4|O}addMany(P,k,S,O){for(let A=0;AI),k=(F,I)=>P.slice(F,I),S=k(32,127),O=k(0,24);O.push(25),O.push.apply(O,k(28,32));let A=k(0,14),D;for(D in b.setDefault(1,0),b.addMany(S,0,2,0),A)b.addMany([24,26,153,154],D,3,0),b.addMany(k(128,144),D,3,0),b.addMany(k(144,152),D,3,0),b.add(156,D,0,0),b.add(27,D,11,1),b.add(157,D,4,8),b.addMany([152,158,159],D,0,7),b.add(155,D,11,3),b.add(144,D,11,9);return b.addMany(O,0,3,0),b.addMany(O,1,3,1),b.add(127,1,0,1),b.addMany(O,8,0,8),b.addMany(O,3,3,3),b.add(127,3,0,3),b.addMany(O,4,3,4),b.add(127,4,0,4),b.addMany(O,6,3,6),b.addMany(O,5,3,5),b.add(127,5,0,5),b.addMany(O,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(S,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(k(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(S,7,0,7),b.addMany(O,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(k(64,127),3,7,0),b.addMany(k(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(k(48,60),4,8,4),b.addMany(k(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(k(32,64),6,0,6),b.add(127,6,0,6),b.addMany(k(64,127),6,0,0),b.addMany(k(32,48),3,9,5),b.addMany(k(32,48),5,9,5),b.addMany(k(48,64),5,0,6),b.addMany(k(64,127),5,7,0),b.addMany(k(32,48),4,9,5),b.addMany(k(32,48),1,9,2),b.addMany(k(32,48),2,9,2),b.addMany(k(48,127),2,10,0),b.addMany(k(48,80),1,10,0),b.addMany(k(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(k(96,127),1,10,0),b.add(80,1,11,9),b.addMany(O,9,0,9),b.add(127,9,0,9),b.addMany(k(28,32),9,0,9),b.addMany(k(32,48),9,9,12),b.addMany(k(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(O,11,0,11),b.addMany(k(32,128),11,0,11),b.addMany(k(28,32),11,0,11),b.addMany(O,10,0,10),b.add(127,10,0,10),b.addMany(k(28,32),10,0,10),b.addMany(k(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(k(32,48),10,9,12),b.addMany(O,12,0,12),b.add(127,12,0,12),b.addMany(k(28,32),12,0,12),b.addMany(k(32,48),12,9,12),b.addMany(k(48,64),12,0,11),b.addMany(k(64,127),12,12,13),b.addMany(k(64,127),10,12,13),b.addMany(k(64,127),9,12,13),b.addMany(O,13,13,13),b.addMany(S,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(M,0,2,0),b.add(M,8,5,8),b.add(M,6,0,6),b.add(M,11,0,11),b.add(M,13,13,13),b})();class x extends d.Disposable{constructor(P=a.VT500_TRANSITION_TABLE){super(),this._transitions=P,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(k,S,O)=>{},this._executeHandlerFb=k=>{},this._csiHandlerFb=(k,S)=>{},this._escHandlerFb=k=>{},this._errorHandlerFb=k=>k,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,d.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new u.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(P,k=[64,126]){let S=0;if(P.prefix){if(P.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=P.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(P.intermediates){if(P.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;AD||D>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=D}}if(P.final.length!==1)throw new Error("final must be a single byte");let O=P.final.charCodeAt(0);if(k[0]>O||O>k[1])throw new Error(`final must be in range ${k[0]} .. ${k[1]}`);return S<<=8,S|=O,S}identToString(P){let k=[];for(;P;)k.push(String.fromCharCode(255&P)),P>>=8;return k.reverse().join("")}setPrintHandler(P){this._printHandler=P}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(P,k){let S=this._identifier(P,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);let O=this._escHandlers[S];return O.push(k),{dispose:()=>{let A=O.indexOf(k);A!==-1&&O.splice(A,1)}}}clearEscHandler(P){this._escHandlers[this._identifier(P,[48,126])]&&delete this._escHandlers[this._identifier(P,[48,126])]}setEscHandlerFallback(P){this._escHandlerFb=P}setExecuteHandler(P,k){this._executeHandlers[P.charCodeAt(0)]=k}clearExecuteHandler(P){this._executeHandlers[P.charCodeAt(0)]&&delete this._executeHandlers[P.charCodeAt(0)]}setExecuteHandlerFallback(P){this._executeHandlerFb=P}registerCsiHandler(P,k){let S=this._identifier(P);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);let O=this._csiHandlers[S];return O.push(k),{dispose:()=>{let A=O.indexOf(k);A!==-1&&O.splice(A,1)}}}clearCsiHandler(P){this._csiHandlers[this._identifier(P)]&&delete this._csiHandlers[this._identifier(P)]}setCsiHandlerFallback(P){this._csiHandlerFb=P}registerDcsHandler(P,k){return this._dcsParser.registerHandler(this._identifier(P),k)}clearDcsHandler(P){this._dcsParser.clearHandler(this._identifier(P))}setDcsHandlerFallback(P){this._dcsParser.setHandlerFallback(P)}registerOscHandler(P,k){return this._oscParser.registerHandler(P,k)}clearOscHandler(P){this._oscParser.clearHandler(P)}setOscHandlerFallback(P){this._oscParser.setHandlerFallback(P)}setErrorHandler(P){this._errorHandler=P}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(P,k,S,O,A){this._parseStack.state=P,this._parseStack.handlers=k,this._parseStack.handlerPos=S,this._parseStack.transition=O,this._parseStack.chunkPos=A}parse(P,k,S){let O,A=0,D=0,F=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,F=this._parseStack.chunkPos+1;else{if(S===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let I=this._parseStack.handlers,B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&B>-1){for(;B>=0&&(O=I[B](this._params),O!==!0);B--)if(O instanceof Promise)return this._parseStack.handlerPos=B,O}this._parseStack.handlers=[];break;case 4:if(S===!1&&B>-1){for(;B>=0&&(O=I[B](),O!==!0);B--)if(O instanceof Promise)return this._parseStack.handlerPos=B,O}this._parseStack.handlers=[];break;case 6:if(A=P[this._parseStack.chunkPos],O=this._dcsParser.unhook(A!==24&&A!==26,S),O)return O;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=P[this._parseStack.chunkPos],O=this._oscParser.end(A!==24&&A!==26,S),O)return O;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,F=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let I=F;I>4){case 2:for(let G=I+1;;++G){if(G>=k||(A=P[G])<32||A>126&&A=k||(A=P[G])<32||A>126&&A=k||(A=P[G])<32||A>126&&A=k||(A=P[G])<32||A>126&&A=0&&(O=B[le](this._params),O!==!0);le--)if(O instanceof Promise)return this._preserveStack(3,B,le,D,I),O;le<0&&this._csiHandlerFb(this._collect<<8|A,this._params),this.precedingJoinState=0;break;case 8:do switch(A){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(A-48)}while(++I47&&A<60);I--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:let ae=this._escHandlers[this._collect<<8|A],W=ae?ae.length-1:-1;for(;W>=0&&(O=ae[W](),O!==!0);W--)if(O instanceof Promise)return this._preserveStack(4,ae,W,D,I),O;W<0&&this._escHandlerFb(this._collect<<8|A),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|A,this._params);break;case 13:for(let G=I+1;;++G)if(G>=k||(A=P[G])===24||A===26||A===27||A>127&&A=k||(A=P[G])<32||A>127&&A{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;let d=s(5770),p=s(482),u=[];a.OscParser=class{constructor(){this._state=0,this._active=u,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(g,C){this._handlers[g]===void 0&&(this._handlers[g]=[]);let M=this._handlers[g];return M.push(C),{dispose:()=>{let x=M.indexOf(C);x!==-1&&M.splice(x,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=u}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=u,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||u,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,C,M){if(this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].put(g,C,M);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(g,C,M))}start(){this.reset(),this._state=1}put(g,C,M){if(this._state!==3){if(this._state===1)for(;C0&&this._put(g,C,M)}}end(g,C=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let M=!1,x=this._active.length-1,b=!1;if(this._stack.paused&&(x=this._stack.loopPosition-1,M=C,b=this._stack.fallThrough,this._stack.paused=!1),!b&&M===!1){for(;x>=0&&(M=this._active[x].end(g),M!==!0);x--)if(M instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!1,M;x--}for(;x>=0;x--)if(M=this._active[x].end(!1),M instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!0,M}else this._handlerFb(this._id,"END",g);this._active=u,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,C,M){this._hitLimit||(this._data+=(0,p.utf32ToString)(g,C,M),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let C=!1;if(this._hitLimit)C=!1;else if(g&&(C=this._handler(this._data),C instanceof Promise))return C.then(M=>(this._data="",this._hitLimit=!1,M));return this._data="",this._hitLimit=!1,C}}},8742:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;let s=2147483647;class d{static fromArray(u){let g=new d;if(!u.length)return g;for(let C=Array.isArray(u[0])?1:0;C256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(u),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(u),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let u=new d(this.maxLength,this.maxSubParamsLength);return u.params.set(this.params),u.length=this.length,u._subParams.set(this._subParams),u._subParamsLength=this._subParamsLength,u._subParamsIdx.set(this._subParamsIdx),u._rejectDigits=this._rejectDigits,u._rejectSubDigits=this._rejectSubDigits,u._digitIsSub=this._digitIsSub,u}toArray(){let u=[];for(let g=0;g>8,M=255&this._subParamsIdx[g];M-C>0&&u.push(Array.prototype.slice.call(this._subParams,C,M))}return u}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(u){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=u>s?s:u}}addSubParam(u){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=u>s?s:u,this._subParamsIdx[this.length-1]++}}hasSubParams(u){return(255&this._subParamsIdx[u])-(this._subParamsIdx[u]>>8)>0}getSubParams(u){let g=this._subParamsIdx[u]>>8,C=255&this._subParamsIdx[u];return C-g>0?this._subParams.subarray(g,C):null}getSubParamsAll(){let u={};for(let g=0;g>8,M=255&this._subParamsIdx[g];M-C>0&&(u[g]=this._subParams.slice(C,M))}return u}addDigit(u){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let C=this._digitIsSub?this._subParams:this.params,M=C[g-1];C[g-1]=~M?Math.min(10*M+u,s):u}}a.Params=d},5741:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.AddonManager=void 0,a.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let s=this._addons.length-1;s>=0;s--)this._addons[s].instance.dispose()}loadAddon(s,d){let p={instance:d,dispose:d.dispose,isDisposed:!1};this._addons.push(p),d.dispose=()=>this._wrappedAddonDispose(p),d.activate(s)}_wrappedAddonDispose(s){if(s.isDisposed)return;let d=-1;for(let p=0;p{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferApiView=void 0;let d=s(3785),p=s(511);a.BufferApiView=class{constructor(u,g){this._buffer=u,this.type=g}init(u){return this._buffer=u,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(u){let g=this._buffer.lines.get(u);if(g)return new d.BufferLineApiView(g)}getNullCell(){return new p.CellData}}},3785:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;let d=s(511);a.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,u){if(!(p<0||p>=this._line.length))return u?(this._line.loadCell(p,u),u):this._line.loadCell(p,new d.CellData)}translateToString(p,u,g){return this._line.translateToString(p,u,g)}}},8285:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;let d=s(8771),p=s(8460),u=s(844);class g extends u.Disposable{constructor(M){super(),this._core=M,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new d.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new d.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}a.BufferNamespaceApi=g},7975:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ParserApi=void 0,a.ParserApi=class{constructor(s){this._core=s}registerCsiHandler(s,d){return this._core.registerCsiHandler(s,p=>d(p.toArray()))}addCsiHandler(s,d){return this.registerCsiHandler(s,d)}registerDcsHandler(s,d){return this._core.registerDcsHandler(s,(p,u)=>d(p,u.toArray()))}addDcsHandler(s,d){return this.registerDcsHandler(s,d)}registerEscHandler(s,d){return this._core.registerEscHandler(s,d)}addEscHandler(s,d){return this.registerEscHandler(s,d)}registerOscHandler(s,d){return this._core.registerOscHandler(s,d)}addOscHandler(s,d){return this.registerOscHandler(s,d)}}},7090:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeApi=void 0,a.UnicodeApi=class{constructor(s){this._core=s}register(s){this._core.unicodeService.register(s)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(s){this._core.unicodeService.activeVersion=s}}},744:function(i,a,s){var d=this&&this.__decorate||function(b,P,k,S){var O,A=arguments.length,D=A<3?P:S===null?S=Object.getOwnPropertyDescriptor(P,k):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,P,k,S);else for(var F=b.length-1;F>=0;F--)(O=b[F])&&(D=(A<3?O(D):A>3?O(P,k,D):O(P,k))||D);return A>3&&D&&Object.defineProperty(P,k,D),D},p=this&&this.__param||function(b,P){return function(k,S){P(k,S,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;let u=s(8460),g=s(844),C=s(5295),M=s(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let x=a.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(b){super(),this.isUserScrolling=!1,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(b.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new C.BufferSet(b,this))}resize(b,P){this.cols=b,this.rows=P,this.buffers.resize(b,P),this._onResize.fire({cols:b,rows:P})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,P=!1){let k=this.buffer,S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===b.fg&&S.getBg(0)===b.bg||(S=k.getBlankLine(b,P),this._cachedBlankLine=S),S.isWrapped=P;let O=k.ybase+k.scrollTop,A=k.ybase+k.scrollBottom;if(k.scrollTop===0){let D=k.lines.isFull;A===k.lines.length-1?D?k.lines.recycle().copyFrom(S):k.lines.push(S.clone()):k.lines.splice(A+1,0,S.clone()),D?this.isUserScrolling&&(k.ydisp=Math.max(k.ydisp-1,0)):(k.ybase++,this.isUserScrolling||k.ydisp++)}else{let D=A-O+1;k.lines.shiftElements(O+1,D-1,-1),k.lines.set(A,S.clone())}this.isUserScrolling||(k.ydisp=k.ybase),this._onScroll.fire(k.ydisp)}scrollLines(b,P,k){let S=this.buffer;if(b<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else b+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);let O=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+b,S.ybase),0),O!==S.ydisp&&(P||this._onScroll.fire(S.ydisp))}};a.BufferService=x=d([p(0,M.IOptionsService)],x)},7994:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CharsetService=void 0,a.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(s){this.glevel=s,this.charset=this._charsets[s]}setgCharset(s,d){this._charsets[s]=d,this.glevel===s&&(this.charset=d)}}},1753:function(i,a,s){var d=this&&this.__decorate||function(S,O,A,D){var F,I=arguments.length,B=I<3?O:D===null?D=Object.getOwnPropertyDescriptor(O,A):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,O,A,D);else for(var le=S.length-1;le>=0;le--)(F=S[le])&&(B=(I<3?F(B):I>3?F(O,A,B):F(O,A))||B);return I>3&&B&&Object.defineProperty(O,A,B),B},p=this&&this.__param||function(S,O){return function(A,D){O(A,D,S)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;let u=s(2585),g=s(8460),C=s(844),M={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function x(S,O){let A=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(A|=64,A|=S.action):(A|=3&S.button,4&S.button&&(A|=64),8&S.button&&(A|=128),S.action===32?A|=32:S.action!==0||O||(A|=3)),A}let b=String.fromCharCode,P={DEFAULT:S=>{let O=[x(S,!1)+32,S.col+32,S.row+32];return O[0]>255||O[1]>255||O[2]>255?"":`\x1B[M${b(O[0])}${b(O[1])}${b(O[2])}`},SGR:S=>{let O=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${x(S,!0)};${S.col};${S.row}${O}`},SGR_PIXELS:S=>{let O=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${x(S,!0)};${S.x};${S.y}${O}`}},k=a.CoreMouseService=class extends C.Disposable{constructor(S,O){super(),this._bufferService=S,this._coreService=O,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let A of Object.keys(M))this.addProtocol(A,M[A]);for(let A of Object.keys(P))this.addEncoding(A,P[A]);this.reset()}addProtocol(S,O){this._protocols[S]=O}addEncoding(S,O){this._encodings[S]=O}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(S){if(!this._protocols[S])throw new Error(`unknown protocol "${S}"`);this._activeProtocol=S,this._onProtocolChange.fire(this._protocols[S].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(S){if(!this._encodings[S])throw new Error(`unknown encoding "${S}"`);this._activeEncoding=S}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(S){if(S.col<0||S.col>=this._bufferService.cols||S.row<0||S.row>=this._bufferService.rows||S.button===4&&S.action===32||S.button===3&&S.action!==32||S.button!==4&&(S.action===2||S.action===3)||(S.col++,S.row++,S.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,S,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(S))return!1;let O=this._encodings[this._activeEncoding](S);return O&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(O):this._coreService.triggerDataEvent(O,!0)),this._lastEvent=S,!0}explainEvents(S){return{down:!!(1&S),up:!!(2&S),drag:!!(4&S),move:!!(8&S),wheel:!!(16&S)}}_equalEvents(S,O,A){if(A){if(S.x!==O.x||S.y!==O.y)return!1}else if(S.col!==O.col||S.row!==O.row)return!1;return S.button===O.button&&S.action===O.action&&S.ctrl===O.ctrl&&S.alt===O.alt&&S.shift===O.shift}};a.CoreMouseService=k=d([p(0,u.IBufferService),p(1,u.ICoreService)],k)},6975:function(i,a,s){var d=this&&this.__decorate||function(k,S,O,A){var D,F=arguments.length,I=F<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,O):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(k,S,O,A);else for(var B=k.length-1;B>=0;B--)(D=k[B])&&(I=(F<3?D(I):F>3?D(S,O,I):D(S,O))||I);return F>3&&I&&Object.defineProperty(S,O,I),I},p=this&&this.__param||function(k,S){return function(O,A){S(O,A,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;let u=s(1439),g=s(8460),C=s(844),M=s(2585),x=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),P=a.CoreService=class extends C.Disposable{constructor(k,S,O){super(),this._bufferService=k,this._logService=S,this._optionsService=O,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,u.clone)(x),this.decPrivateModes=(0,u.clone)(b)}reset(){this.modes=(0,u.clone)(x),this.decPrivateModes=(0,u.clone)(b)}triggerDataEvent(k,S=!1){if(this._optionsService.rawOptions.disableStdin)return;let O=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&O.ybase!==O.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${k}"`,()=>k.split("").map(A=>A.charCodeAt(0))),this._onData.fire(k)}triggerBinaryEvent(k){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${k}"`,()=>k.split("").map(S=>S.charCodeAt(0))),this._onBinary.fire(k))}};a.CoreService=P=d([p(0,M.IBufferService),p(1,M.ILogService),p(2,M.IOptionsService)],P)},9074:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;let d=s(8055),p=s(8460),u=s(844),g=s(6106),C=0,M=0;class x extends u.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList(k=>k?.marker.line),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,u.toDisposable)(()=>this.reset()))}registerDecoration(k){if(k.marker.isDisposed)return;let S=new b(k);if(S){let O=S.marker.onDispose(()=>S.dispose());S.onDispose(()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),O.dispose())}),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(let k of this._decorations.values())k.dispose();this._decorations.clear()}*getDecorationsAtCell(k,S,O){let A=0,D=0;for(let F of this._decorations.getKeyIterator(S))A=F.options.x??0,D=A+(F.options.width??1),k>=A&&k{C=D.options.x??0,M=C+(D.options.width??1),k>=C&&k{Object.defineProperty(a,"__esModule",{value:!0}),a.InstantiationService=a.ServiceCollection=void 0;let d=s(2585),p=s(8343);class u{constructor(...C){this._entries=new Map;for(let[M,x]of C)this.set(M,x)}set(C,M){let x=this._entries.get(C);return this._entries.set(C,M),x}forEach(C){for(let[M,x]of this._entries.entries())C(M,x)}has(C){return this._entries.has(C)}get(C){return this._entries.get(C)}}a.ServiceCollection=u,a.InstantiationService=class{constructor(){this._services=new u,this._services.set(d.IInstantiationService,this)}setService(g,C){this._services.set(g,C)}getService(g){return this._services.get(g)}createInstance(g,...C){let M=(0,p.getServiceDependencies)(g).sort((P,k)=>P.index-k.index),x=[];for(let P of M){let k=this._services.get(P.id);if(!k)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${P.id}.`);x.push(k)}let b=M.length>0?M[0].index:C.length;if(C.length!==b)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${b+1} conflicts with ${C.length} static arguments`);return new g(...C,...x)}}},7866:function(i,a,s){var d=this&&this.__decorate||function(b,P,k,S){var O,A=arguments.length,D=A<3?P:S===null?S=Object.getOwnPropertyDescriptor(P,k):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,P,k,S);else for(var F=b.length-1;F>=0;F--)(O=b[F])&&(D=(A<3?O(D):A>3?O(P,k,D):O(P,k))||D);return A>3&&D&&Object.defineProperty(P,k,D),D},p=this&&this.__param||function(b,P){return function(k,S){P(k,S,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;let u=s(844),g=s(2585),C={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF},M,x=a.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),M=this}_updateLogLevel(){this._logLevel=C[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let P=0;PJSON.stringify(D)).join(", ")})`);let A=S.apply(this,O);return M.trace(`GlyphRenderer#${S.name} return`,A),A}}},7302:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;let d=s(8460),p=s(844),u=s(6114);a.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:u.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let g=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends p.Disposable{constructor(x){super(),this._onOptionChange=this.register(new d.EventEmitter),this.onOptionChange=this._onOptionChange.event;let b=q({},a.DEFAULT_OPTIONS);for(let P in x)if(P in b)try{let k=x[P];b[P]=this._sanitizeAndValidateOption(P,k)}catch(k){console.error(k)}this.rawOptions=b,this.options=q({},b),this._setupOptions(),this.register((0,p.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(x,b){return this.onOptionChange(P=>{P===x&&b(this.rawOptions[x])})}onMultipleOptionChange(x,b){return this.onOptionChange(P=>{x.indexOf(P)!==-1&&b()})}_setupOptions(){let x=P=>{if(!(P in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${P}"`);return this.rawOptions[P]},b=(P,k)=>{if(!(P in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${P}"`);k=this._sanitizeAndValidateOption(P,k),this.rawOptions[P]!==k&&(this.rawOptions[P]=k,this._onOptionChange.fire(P))};for(let P in this.rawOptions){let k={get:x.bind(this,P),set:b.bind(this,P)};Object.defineProperty(this.options,P,k)}}_sanitizeAndValidateOption(x,b){switch(x){case"cursorStyle":if(b||(b=a.DEFAULT_OPTIONS[x]),!(function(P){return P==="block"||P==="underline"||P==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${x}`);break;case"wordSeparator":b||(b=a.DEFAULT_OPTIONS[x]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=g.includes(b)?b:a.DEFAULT_OPTIONS[x];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${x} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${x} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${x} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${x} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}a.OptionsService=C},2660:function(i,a,s){var d=this&&this.__decorate||function(C,M,x,b){var P,k=arguments.length,S=k<3?M:b===null?b=Object.getOwnPropertyDescriptor(M,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(C,M,x,b);else for(var O=C.length-1;O>=0;O--)(P=C[O])&&(S=(k<3?P(S):k>3?P(M,x,S):P(M,x))||S);return k>3&&S&&Object.defineProperty(M,x,S),S},p=this&&this.__param||function(C,M){return function(x,b){M(x,b,C)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;let u=s(2585),g=a.OscLinkService=class{constructor(C){this._bufferService=C,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(C){let M=this._bufferService.buffer;if(C.id===void 0){let O=M.addMarker(M.ybase+M.y),A={data:C,id:this._nextId++,lines:[O]};return O.onDispose(()=>this._removeMarkerFromLink(A,O)),this._dataByLinkId.set(A.id,A),A.id}let x=C,b=this._getEntryIdKey(x),P=this._entriesWithId.get(b);if(P)return this.addLineToLink(P.id,M.ybase+M.y),P.id;let k=M.addMarker(M.ybase+M.y),S={id:this._nextId++,key:this._getEntryIdKey(x),data:x,lines:[k]};return k.onDispose(()=>this._removeMarkerFromLink(S,k)),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(C,M){let x=this._dataByLinkId.get(C);if(x&&x.lines.every(b=>b.line!==M)){let b=this._bufferService.buffer.addMarker(M);x.lines.push(b),b.onDispose(()=>this._removeMarkerFromLink(x,b))}}getLinkData(C){return this._dataByLinkId.get(C)?.data}_getEntryIdKey(C){return`${C.id};;${C.uri}`}_removeMarkerFromLink(C,M){let x=C.lines.indexOf(M);x!==-1&&(C.lines.splice(x,1),C.lines.length===0&&(C.data.id!==void 0&&this._entriesWithId.delete(C.key),this._dataByLinkId.delete(C.id)))}};a.OscLinkService=g=d([p(0,u.IBufferService)],g)},8343:(i,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createDecorator=a.getServiceDependencies=a.serviceRegistry=void 0;let s="di$target",d="di$dependencies";a.serviceRegistry=new Map,a.getServiceDependencies=function(p){return p[d]||[]},a.createDecorator=function(p){if(a.serviceRegistry.has(p))return a.serviceRegistry.get(p);let u=function(g,C,M){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(x,b,P){b[s]===b?b[d].push({id:x,index:P}):(b[d]=[{id:x,index:P}],b[s]=b)})(u,g,M)};return u.toString=()=>p,a.serviceRegistry.set(p,u),u}},2585:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IDecorationService=a.IUnicodeService=a.IOscLinkService=a.IOptionsService=a.ILogService=a.LogLevelEnum=a.IInstantiationService=a.ICharsetService=a.ICoreService=a.ICoreMouseService=a.IBufferService=void 0;let d=s(8343);var p;a.IBufferService=(0,d.createDecorator)("BufferService"),a.ICoreMouseService=(0,d.createDecorator)("CoreMouseService"),a.ICoreService=(0,d.createDecorator)("CoreService"),a.ICharsetService=(0,d.createDecorator)("CharsetService"),a.IInstantiationService=(0,d.createDecorator)("InstantiationService"),(function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"})(p||(a.LogLevelEnum=p={})),a.ILogService=(0,d.createDecorator)("LogService"),a.IOptionsService=(0,d.createDecorator)("OptionsService"),a.IOscLinkService=(0,d.createDecorator)("OscLinkService"),a.IUnicodeService=(0,d.createDecorator)("UnicodeService"),a.IDecorationService=(0,d.createDecorator)("DecorationService")},1480:(i,a,s)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;let d=s(8460),p=s(225);class u{static extractShouldJoin(C){return(1&C)!=0}static extractWidth(C){return C>>1&3}static extractCharKind(C){return C>>3}static createPropertyValue(C,M,x=!1){return(16777215&C)<<3|(3&M)<<1|(x?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new d.EventEmitter,this.onChange=this._onChange.event;let C=new p.UnicodeV6;this.register(C),this._active=C.version,this._activeProvider=C}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(C){if(!this._providers[C])throw new Error(`unknown Unicode version "${C}"`);this._active=C,this._activeProvider=this._providers[C],this._onChange.fire(C)}register(C){this._providers[C.version]=C}wcwidth(C){return this._activeProvider.wcwidth(C)}getStringCellWidth(C){let M=0,x=0,b=C.length;for(let P=0;P=b)return M+this.wcwidth(k);let A=C.charCodeAt(P);56320<=A&&A<=57343?k=1024*(k-55296)+A-56320+65536:M+=this.wcwidth(A)}let S=this.charProperties(k,x),O=u.extractWidth(S);u.extractShouldJoin(S)&&(O-=u.extractWidth(x)),M+=O,x=S}return M}charProperties(C,M){return this._activeProvider.charProperties(C,M)}}a.UnicodeService=u}},o={};function e(i){var a=o[i];if(a!==void 0)return a.exports;var s=o[i]={exports:{}};return n[i].call(s.exports,s,s.exports,e),s.exports}var t={};return(()=>{var i=t;Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;let a=e(9042),s=e(3236),d=e(844),p=e(5741),u=e(8285),g=e(7975),C=e(7090),M=["cols","rows"];class x extends d.Disposable{constructor(P){super(),this._core=this.register(new s.Terminal(P)),this._addonManager=this.register(new p.AddonManager),this._publicOptions=q({},this._core.options);let k=O=>this._core.options[O],S=(O,A)=>{this._checkReadonlyOptions(O),this._core.options[O]=A};for(let O in this._core.options){let A={get:k.bind(this,O),set:S.bind(this,O)};Object.defineProperty(this._publicOptions,O,A)}}_checkReadonlyOptions(P){if(M.includes(P))throw new Error(`Option "${P}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new C.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new u.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let P=this._core.coreService.decPrivateModes,k="none";switch(this._core.coreMouseService.activeProtocol){case"X10":k="x10";break;case"VT200":k="vt200";break;case"DRAG":k="drag";break;case"ANY":k="any"}return{applicationCursorKeysMode:P.applicationCursorKeys,applicationKeypadMode:P.applicationKeypad,bracketedPasteMode:P.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:k,originMode:P.origin,reverseWraparoundMode:P.reverseWraparound,sendFocusMode:P.sendFocus,wraparoundMode:P.wraparound}}get options(){return this._publicOptions}set options(P){for(let k in P)this._publicOptions[k]=P[k]}blur(){this._core.blur()}focus(){this._core.focus()}input(P,k=!0){this._core.input(P,k)}resize(P,k){this._verifyIntegers(P,k),this._core.resize(P,k)}open(P){this._core.open(P)}attachCustomKeyEventHandler(P){this._core.attachCustomKeyEventHandler(P)}attachCustomWheelEventHandler(P){this._core.attachCustomWheelEventHandler(P)}registerLinkProvider(P){return this._core.registerLinkProvider(P)}registerCharacterJoiner(P){return this._checkProposedApi(),this._core.registerCharacterJoiner(P)}deregisterCharacterJoiner(P){this._checkProposedApi(),this._core.deregisterCharacterJoiner(P)}registerMarker(P=0){return this._verifyIntegers(P),this._core.registerMarker(P)}registerDecoration(P){return this._checkProposedApi(),this._verifyPositiveIntegers(P.x??0,P.width??0,P.height??0),this._core.registerDecoration(P)}hasSelection(){return this._core.hasSelection()}select(P,k,S){this._verifyIntegers(P,k,S),this._core.select(P,k,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(P,k){this._verifyIntegers(P,k),this._core.selectLines(P,k)}dispose(){super.dispose()}scrollLines(P){this._verifyIntegers(P),this._core.scrollLines(P)}scrollPages(P){this._verifyIntegers(P),this._core.scrollPages(P)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(P){this._verifyIntegers(P),this._core.scrollToLine(P)}clear(){this._core.clear()}write(P,k){this._core.write(P,k)}writeln(P,k){this._core.write(P),this._core.write(`\r +`,k)}paste(P){this._core.paste(P)}refresh(P,k){this._verifyIntegers(P,k),this._core.refresh(P,k)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(P){this._addonManager.loadAddon(this,P)}static get strings(){return a}_verifyIntegers(...P){for(let k of P)if(k===1/0||isNaN(k)||k%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...P){for(let k of P)if(k&&(k===1/0||isNaN(k)||k%1!=0||k<0))throw new Error("This API only accepts positive integers")}}i.Terminal=x})(),t})())});var A4=al((p2,I4)=>{(function(n,o){typeof p2=="object"&&typeof I4=="object"?I4.exports=o():typeof define=="function"&&define.amd?define([],o):typeof p2=="object"?p2.FitAddon=o():n.FitAddon=o()})(self,()=>(()=>{"use strict";var n={};return(()=>{var o=n;Object.defineProperty(o,"__esModule",{value:!0}),o.FitAddon=void 0,o.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let i=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,a=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(a.getPropertyValue("height")),d=Math.max(0,parseInt(a.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),u=s-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),g=d-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-i;return{cols:Math.max(2,Math.floor(g/t.css.cell.width)),rows:Math.max(1,Math.floor(u/t.css.cell.height))}}}})(),n})())});var D5=new RegExp(`(\\:not\\()|(([\\.\\#]?)[-\\w]+)|(?:\\[([-.\\w*\\\\$]+)(?:=(["']?)([^\\]"']*)\\5)?\\])|(\\))|(\\s*,\\s*)`,"g"),Ag=class n{element=null;classNames=[];attrs=[];notSelectors=[];static parse(o){let e=[],t=(p,u)=>{u.notSelectors.length>0&&!u.element&&u.classNames.length==0&&u.attrs.length==0&&(u.element="*"),p.push(u)},i=new n,a,s=i,d=!1;for(D5.lastIndex=0;a=D5.exec(o);){if(a[1]){if(d)throw new Error("Nesting :not in a selector is not allowed");d=!0,s=new n,i.notSelectors.push(s)}let p=a[2];if(p){let g=a[3];g==="#"?s.addAttribute("id",p.slice(1)):g==="."?s.addClassName(p.slice(1)):s.setElement(p)}let u=a[4];if(u&&s.addAttribute(s.unescapeAttribute(u),a[6]),a[7]&&(d=!1,s=i),a[8]){if(d)throw new Error("Multiple selectors in :not are not supported");t(e,i),i=s=new n}}return t(e,i),e}unescapeAttribute(o){let e="",t=!1;for(let i=0;i0&&o.push("class",this.classNames.join(" ")),o.concat(this.attrs)}addAttribute(o,e=""){this.attrs.push(o,e&&e.toLowerCase()||"")}addClassName(o){this.classNames.push(o.toLowerCase())}toString(){let o=this.element||"";if(this.classNames&&this.classNames.forEach(e=>o+=`.${e}`),this.attrs)for(let e=0;eo+=`:not(${e})`),o}},kb=class n{static createNotMatcher(o){let e=new n;return e.addSelectables(o,null),e}_elementMap=new Map;_elementPartialMap=new Map;_classMap=new Map;_classPartialMap=new Map;_attrValueMap=new Map;_attrValuePartialMap=new Map;_listContexts=[];addSelectables(o,e){let t=null;o.length>1&&(t=new pP(o),this._listContexts.push(t));for(let i=0;i0&&(!this.listContext||!this.listContext.alreadyMatched)&&(t=!kb.createNotMatcher(this.notSelectors).match(o,null)),t&&e&&(!this.listContext||!this.listContext.alreadyMatched)&&(this.listContext&&(this.listContext.alreadyMatched=!0),e(this.selector,this.cbContext)),t}},Pb=class{registry;constructor(o){this.registry=o}match(o){return this.registry.has(o)?this.registry.get(o):[]}},gi=(function(n){return n[n.NONE=0]="NONE",n[n.HTML=1]="HTML",n[n.STYLE=2]="STYLE",n[n.SCRIPT=3]="SCRIPT",n[n.URL=4]="URL",n[n.RESOURCE_URL=5]="RESOURCE_URL",n[n.ATTRIBUTE_NO_BINDING=6]="ATTRIBUTE_NO_BINDING",n})(gi||{}),bb,I5="svg",$H="math";function HH(){return bb||(bb={},fm(gi.HTML,void 0,[["iframe",["srcdoc"]],["*",["innerHTML","outerHTML"]]]),fm(gi.STYLE,void 0,[["*",["style"]]]),fm(gi.URL,void 0,[["*",["formAction"]],["area",["href"]],["a",["href","xlink:href"]],["form",["action"]],["img",["src"]],["video",["src"]]]),fm(gi.URL,$H,[["*",["href","xlink:href"]],["annotation",["href","xlink:href"]],["annotation-xml",["href","xlink:href"]],["maction",["href","xlink:href"]],["malignmark",["href","xlink:href"]],["math",["href","xlink:href"]],["mroot",["href","xlink:href"]],["msqrt",["href","xlink:href"]],["merror",["href","xlink:href"]],["mfrac",["href","xlink:href"]],["mglyph",["href","xlink:href"]],["msub",["href","xlink:href"]],["msup",["href","xlink:href"]],["msubsup",["href","xlink:href"]],["mmultiscripts",["href","xlink:href"]],["mprescripts",["href","xlink:href"]],["mi",["href","xlink:href"]],["mn",["href","xlink:href"]],["mo",["href","xlink:href"]],["mpadded",["href","xlink:href"]],["mphantom",["href","xlink:href"]],["mrow",["href","xlink:href"]],["ms",["href","xlink:href"]],["mspace",["href","xlink:href"]],["mstyle",["href","xlink:href"]],["mtable",["href","xlink:href"]],["mtd",["href","xlink:href"]],["mtr",["href","xlink:href"]],["mtext",["href","xlink:href"]],["mover",["href","xlink:href"]],["munder",["href","xlink:href"]],["munderover",["href","xlink:href"]],["semantics",["href","xlink:href"]],["none",["href","xlink:href"]]]),fm(gi.RESOURCE_URL,void 0,[["base",["href"]],["embed",["src"]],["frame",["src"]],["iframe",["src"]],["link",["href"]],["object",["codebase","data"]]]),fm(gi.URL,I5,[["a",["href","xlink:href"]]]),fm(gi.ATTRIBUTE_NO_BINDING,I5,[["animate",["attributeName","values","to","from"]],["set",["to","attributeName"]],["animateMotion",["attributeName"]],["animateTransform",["attributeName"]]]),fm(gi.ATTRIBUTE_NO_BINDING,void 0,[["unknown",["attributeName","values","to","from","sandbox","allow","allowFullscreen","referrerPolicy","csp","fetchPriority"]],["iframe",["sandbox","allow","allowFullscreen","referrerPolicy","csp","fetchPriority"]]])),bb}function fm(n,o,e){for(let[t,i]of e){let a=o&&t!=="unknown"?`:${o}:${t}`:t;a=a.toLowerCase();for(let s of i)bb[`${a}|${s.toLowerCase()}`]=n}}var $p=(function(n){return n[n.Emulated=0]="Emulated",n[n.None=2]="None",n[n.ShadowDom=3]="ShadowDom",n[n.ExperimentalIsolatedShadowDom=4]="ExperimentalIsolatedShadowDom",n})($p||{}),$3=(function(n){return n[n.OnPush=0]="OnPush",n[n.Default=1]="Default",n[n.Eager=1]="Eager",n})($3||{}),yf=(function(n){return n[n.None=0]="None",n[n.SignalBased=1]="SignalBased",n[n.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",n})(yf||{}),A5={name:"custom-elements"},N5={name:"no-errors-schema"};function UH(n){let o=n.classNames&&n.classNames.length?[8,...n.classNames]:[];return[n.element&&n.element!=="*"?n.element:"",...n.attrs,...o]}function WH(n){let o=n.classNames&&n.classNames.length?[8,...n.classNames]:[];return n.element?[5,n.element,...n.attrs,...o]:n.attrs.length?[3,...n.attrs,...o]:n.classNames&&n.classNames.length?[9,...n.classNames]:[]}function GH(n){let o=UH(n),e=n.notSelectors&&n.notSelectors.length?n.notSelectors.map(t=>WH(t)):[];return o.concat(...e)}function H3(n){return n?Ag.parse(n).map(GH):[]}var Ed=(function(n){return n[n.Directive=0]="Directive",n[n.Component=1]="Component",n[n.Injectable=2]="Injectable",n[n.Pipe=3]="Pipe",n[n.NgModule=4]="NgModule",n})(Ed||{});var Tb;function qH(n){return YH(XH(n.nodes).join("")+`[${n.meaning}]`)}function QH(n){return n.id||PN(n)}function PN(n){let o=new gP,e=n.nodes.map(t=>t.visit(o,null));return TN(e.join(""),n.meaning)}var Eb=class{visitText(o,e){return o.value}visitContainer(o,e){return`[${o.children.map(t=>t.visit(this)).join(", ")}]`}visitIcu(o,e){let t=Object.keys(o.cases).map(i=>`${i} {${o.cases[i].visit(this)}}`);return`{${o.expression}, ${o.type}, ${t.join(", ")}}`}visitTagPlaceholder(o,e){return o.isVoid?``:`${o.children.map(t=>t.visit(this)).join(", ")}`}visitPlaceholder(o,e){return o.value?`${o.value}`:``}visitIcuPlaceholder(o,e){return`${o.value.visit(this)}`}visitBlockPlaceholder(o,e){return`${o.children.map(t=>t.visit(this)).join(", ")}`}},KH=new Eb;function XH(n){return n.map(o=>o.visit(KH,null))}var gP=class extends Eb{visitIcu(o){let e=Object.keys(o.cases).map(t=>`${t} {${o.cases[t].visit(this)}}`);return`{${o.type}, ${e.join(", ")}}`}};function YH(n){Tb??=new TextEncoder;let o=[...Tb.encode(n)],e=eU(o,U3.Big),t=o.length*8,i=new Uint32Array(80),a=1732584193,s=4023233417,d=2562383102,p=271733878,u=3285377520;e[t>>5]|=128<<24-t%32,e[(t+64>>9<<4)+15]=t;for(let g=0;g>>0).toString(16).padStart(8,"0")}function ZH(n,o,e,t){return n<20?[o&e|~o&t,1518500249]:n<40?[o^e^t,1859775393]:n<60?[o&e|o&t|e&t,2400959708]:[o^e^t,3395469782]}function F5(n){Tb??=new TextEncoder;let o=Tb.encode(n),e=new DataView(o.buffer,o.byteOffset,o.byteLength),t=R5(e,o.length,0),i=R5(e,o.length,102072);return t==0&&(i==0||i==1)&&(t=t^319790063,i=i^-1801410264),BigInt.asUintN(32,BigInt(t))<>BigInt(63)&BigInt(1),e+=F5(o)),BigInt.asUintN(63,e).toString()}function R5(n,o,e){let t=2654435769,i=2654435769,a=0,s=o-12;for(;a<=s;a+=12){t+=n.getUint32(a,!0),i+=n.getUint32(a+4,!0),e+=n.getUint32(a+8,!0);let p=z5(t,i,e);t=p[0],i=p[1],e=p[2]}let d=o-a;return e+=o,d>=4?(t+=n.getUint32(a,!0),a+=4,d>=8?(i+=n.getUint32(a,!0),a+=4,d>=9&&(e+=n.getUint8(a++)<<8),d>=10&&(e+=n.getUint8(a++)<<16),d===11&&(e+=n.getUint8(a++)<<24)):(d>=5&&(i+=n.getUint8(a++)),d>=6&&(i+=n.getUint8(a++)<<8),d===7&&(i+=n.getUint8(a++)<<16))):(d>=1&&(t+=n.getUint8(a++)),d>=2&&(t+=n.getUint8(a++)<<8),d===3&&(t+=n.getUint8(a++)<<16)),z5(t,i,e)[2]}function z5(n,o,e){return n-=o,n-=e,n^=e>>>13,o-=e,o-=n,o^=n<<8,e-=n,e-=o,e^=o>>>13,n-=o,n-=e,n^=e>>>12,o-=e,o-=n,o^=n<<16,e-=n,e-=o,e^=o>>>5,n-=o,n-=e,n^=e>>>3,o-=e,o-=n,o^=n<<10,e-=n,e-=o,e^=o>>>15,[n,o,e]}var U3=(function(n){return n[n.Little=0]="Little",n[n.Big=1]="Big",n})(U3||{});function _g(n,o){return JH(n,o)[1]}function JH(n,o){let e=(n&65535)+(o&65535),t=(n>>>16)+(o>>>16)+(e>>>16);return[t>>>16,t<<16|e&65535]}function Wk(n,o){return n<>>32-o}function eU(n,o){let e=n.length+3>>>2,t=[];for(let i=0;i=n.length?0:n[o]}function tU(n,o,e){let t=0;if(e===U3.Big)for(let i=0;i<4;i++)t+=L5(n,o+i)<<24-8*i;else for(let i=0;i<4;i++)t+=L5(n,o+i)<<8*i;return t}var EN=(function(n){return n[n.None=0]="None",n[n.Const=1]="Const",n})(EN||{}),Ob=class{modifiers;constructor(o=EN.None){this.modifiers=o}hasModifier(o){return(this.modifiers&o)!==0}},Ld=(function(n){return n[n.Dynamic=0]="Dynamic",n[n.Bool=1]="Bool",n[n.String=2]="String",n[n.Int=3]="Int",n[n.Number=4]="Number",n[n.Function=5]="Function",n[n.Inferred=6]="Inferred",n[n.None=7]="None",n})(Ld||{}),Vc=class extends Ob{name;constructor(o,e){super(e),this.name=o}visitType(o,e){return o.visitBuiltinType(this,e)}},xl=class extends Ob{value;typeParams;constructor(o,e,t=null){super(e),this.value=o,this.typeParams=t}visitType(o,e){return o.visitExpressionType(this,e)}};var ws=new Vc(Ld.Dynamic),ic=new Vc(Ld.Inferred),nU=new Vc(Ld.Bool),mHe=new Vc(Ld.Int),iu=new Vc(Ld.Number),W3=new Vc(Ld.String),pHe=new Vc(Ld.Function),Bc=new Vc(Ld.None),zf=(function(n){return n[n.Minus=0]="Minus",n[n.Plus=1]="Plus",n})(zf||{}),lt=(function(n){return n[n.Equals=0]="Equals",n[n.NotEquals=1]="NotEquals",n[n.Assign=2]="Assign",n[n.Identical=3]="Identical",n[n.NotIdentical=4]="NotIdentical",n[n.Minus=5]="Minus",n[n.Plus=6]="Plus",n[n.Divide=7]="Divide",n[n.Multiply=8]="Multiply",n[n.Modulo=9]="Modulo",n[n.And=10]="And",n[n.Or=11]="Or",n[n.BitwiseOr=12]="BitwiseOr",n[n.BitwiseAnd=13]="BitwiseAnd",n[n.Lower=14]="Lower",n[n.LowerEquals=15]="LowerEquals",n[n.Bigger=16]="Bigger",n[n.BiggerEquals=17]="BiggerEquals",n[n.NullishCoalesce=18]="NullishCoalesce",n[n.Exponentiation=19]="Exponentiation",n[n.In=20]="In",n[n.InstanceOf=21]="InstanceOf",n[n.AdditionAssignment=22]="AdditionAssignment",n[n.SubtractionAssignment=23]="SubtractionAssignment",n[n.MultiplicationAssignment=24]="MultiplicationAssignment",n[n.DivisionAssignment=25]="DivisionAssignment",n[n.RemainderAssignment=26]="RemainderAssignment",n[n.ExponentiationAssignment=27]="ExponentiationAssignment",n[n.AndAssignment=28]="AndAssignment",n[n.OrAssignment=29]="OrAssignment",n[n.NullishCoalesceAssignment=30]="NullishCoalesceAssignment",n})(lt||{});function iU(n,o){return n==null||o==null?n==o:n.isEquivalent(o)}function ON(n,o,e){let t=n.length;if(t!==o.length)return!1;for(let i=0;ie.isEquivalent(t))}var Qi=class{type;sourceSpan;constructor(o,e){this.type=o||null,this.sourceSpan=e||null}prop(o,e){return new Xs(this,o,null,e)}key(o,e,t){return new Fd(this,o,e,t)}callFn(o,e,t){return new Ms(this,o,null,e,t)}instantiate(o,e,t){return new Vf(this,o,e,t)}conditional(o,e=null,t){return new jc(this,o,e,null,t)}equals(o,e){return new Pi(lt.Equals,this,o,null,e)}notEquals(o,e){return new Pi(lt.NotEquals,this,o,null,e)}identical(o,e){return new Pi(lt.Identical,this,o,null,e)}notIdentical(o,e){return new Pi(lt.NotIdentical,this,o,null,e)}minus(o,e){return new Pi(lt.Minus,this,o,null,e)}plus(o,e){return new Pi(lt.Plus,this,o,null,e)}divide(o,e){return new Pi(lt.Divide,this,o,null,e)}multiply(o,e){return new Pi(lt.Multiply,this,o,null,e)}modulo(o,e){return new Pi(lt.Modulo,this,o,null,e)}power(o,e){return new Pi(lt.Exponentiation,this,o,null,e)}and(o,e){return new Pi(lt.And,this,o,null,e)}bitwiseOr(o,e){return new Pi(lt.BitwiseOr,this,o,null,e)}bitwiseAnd(o,e){return new Pi(lt.BitwiseAnd,this,o,null,e)}or(o,e){return new Pi(lt.Or,this,o,null,e)}lower(o,e){return new Pi(lt.Lower,this,o,null,e)}lowerEquals(o,e){return new Pi(lt.LowerEquals,this,o,null,e)}bigger(o,e){return new Pi(lt.Bigger,this,o,null,e)}biggerEquals(o,e){return new Pi(lt.BiggerEquals,this,o,null,e)}isBlank(o){return this.equals(lU,o)}nullishCoalesce(o,e){return new Pi(lt.NullishCoalesce,this,o,null,e)}toStmt(){return new fr(this,null)}},oc=class n extends Qi{name;constructor(o,e,t){super(e,t),this.name=o}isEquivalent(o){return o instanceof n&&this.name===o.name}isConstant(){return!1}visitExpression(o,e){return o.visitReadVarExpr(this,e)}clone(){return new n(this.name,this.type,this.sourceSpan)}set(o){return new Pi(lt.Assign,this,o,null,this.sourceSpan)}},Ng=class n extends Qi{expr;constructor(o,e,t){super(e,t),this.expr=o}visitExpression(o,e){return o.visitTypeofExpr(this,e)}isEquivalent(o){return o instanceof n&&o.expr.isEquivalent(this.expr)}isConstant(){return this.expr.isConstant()}clone(){return new n(this.expr.clone())}},Db=class n extends Qi{expr;constructor(o,e,t){super(e,t),this.expr=o}visitExpression(o,e){return o.visitVoidExpr(this,e)}isEquivalent(o){return o instanceof n&&o.expr.isEquivalent(this.expr)}isConstant(){return this.expr.isConstant()}clone(){return new n(this.expr.clone())}},_i=class n extends Qi{node;constructor(o,e,t){super(e,t),this.node=o}isEquivalent(o){return o instanceof n&&this.node===o.node}isConstant(){return!1}visitExpression(o,e){return o.visitWrappedNodeExpr(this,e)}clone(){return new n(this.node,this.type,this.sourceSpan)}},Ms=class n extends Qi{fn;args;pure;constructor(o,e,t,i,a=!1){super(t,i),this.fn=o,this.args=e,this.pure=a}get receiver(){return this.fn}isEquivalent(o){return o instanceof n&&this.fn.isEquivalent(o.fn)&&Ks(this.args,o.args)&&this.pure===o.pure}isConstant(){return!1}visitExpression(o,e){return o.visitInvokeFunctionExpr(this,e)}clone(){return new n(this.fn.clone(),this.args.map(o=>o.clone()),this.type,this.sourceSpan,this.pure)}},Lf=class n extends Qi{tag;template;constructor(o,e,t,i){super(t,i),this.tag=o,this.template=e}isEquivalent(o){return o instanceof n&&this.tag.isEquivalent(o.tag)&&this.template.isEquivalent(o.template)}isConstant(){return!1}visitExpression(o,e){return o.visitTaggedTemplateLiteralExpr(this,e)}clone(){return new n(this.tag.clone(),this.template.clone(),this.type,this.sourceSpan)}},Vf=class n extends Qi{classExpr;args;constructor(o,e,t,i){super(t,i),this.classExpr=o,this.args=e}isEquivalent(o){return o instanceof n&&this.classExpr.isEquivalent(o.classExpr)&&Ks(this.args,o.args)}isConstant(){return!1}visitExpression(o,e){return o.visitInstantiateExpr(this,e)}clone(){return new n(this.classExpr.clone(),this.args.map(o=>o.clone()),this.type,this.sourceSpan)}},Fg=class n extends Qi{body;flags;constructor(o,e,t){super(null,t),this.body=o,this.flags=e}isEquivalent(o){return o instanceof n&&this.body===o.body&&this.flags===o.flags}isConstant(){return!0}visitExpression(o,e){return o.visitRegularExpressionLiteral(this,e)}clone(){return new n(this.body,this.flags,this.sourceSpan)}},_r=class n extends Qi{value;constructor(o,e,t){super(e,t),this.value=o}isEquivalent(o){return o instanceof n&&this.value===o.value}isConstant(){return!0}visitExpression(o,e){return o.visitLiteralExpr(this,e)}clone(){return new n(this.value,this.type,this.sourceSpan)}},Bf=class n extends Qi{elements;expressions;constructor(o,e,t){super(null,t),this.elements=o,this.expressions=e}isEquivalent(o){return o instanceof n&&ON(this.elements,o.elements,(e,t)=>e.text===t.text)&&Ks(this.expressions,o.expressions)}isConstant(){return!1}visitExpression(o,e){return o.visitTemplateLiteralExpr(this,e)}clone(){return new n(this.elements.map(o=>o.clone()),this.expressions.map(o=>o.clone()))}},Ib=class n extends Qi{text;rawText;constructor(o,e,t){super(W3,e),this.text=o,this.rawText=t??hP(xb(o))}visitExpression(o,e){return o.visitTemplateLiteralElementExpr(this,e)}isEquivalent(o){return o instanceof n&&o.text===this.text&&o.rawText===this.rawText}isConstant(){return!0}clone(){return new n(this.text,this.sourceSpan,this.rawText)}},Xp=class{text;sourceSpan;constructor(o,e){this.text=o,this.sourceSpan=e}},Og=class{text;sourceSpan;associatedMessage;constructor(o,e,t){this.text=o,this.sourceSpan=e,this.associatedMessage=t}},oU="|",V5="@@",aU="\u241F",Ab=class n extends Qi{metaBlock;messageParts;placeHolderNames;expressions;constructor(o,e,t,i,a){super(W3,a),this.metaBlock=o,this.messageParts=e,this.placeHolderNames=t,this.expressions=i}isEquivalent(o){return!1}isConstant(){return!1}visitExpression(o,e){return o.visitLocalizedString(this,e)}clone(){return new n(this.metaBlock,this.messageParts,this.placeHolderNames,this.expressions.map(o=>o.clone()),this.sourceSpan)}serializeI18nHead(){let o=this.metaBlock.description||"";return this.metaBlock.meaning&&(o=`${this.metaBlock.meaning}${oU}${o}`),this.metaBlock.customId&&(o=`${o}${V5}${this.metaBlock.customId}`),this.metaBlock.legacyIds&&this.metaBlock.legacyIds.forEach(e=>{o=`${o}${aU}${e}`}),B5(o,this.messageParts[0].text,this.getMessagePartSourceSpan(0))}getMessagePartSourceSpan(o){return this.messageParts[o]?.sourceSpan??this.sourceSpan}getPlaceholderSourceSpan(o){return this.placeHolderNames[o]?.sourceSpan??this.expressions[o]?.sourceSpan??this.sourceSpan}serializeI18nTemplatePart(o){let e=this.placeHolderNames[o-1],t=this.messageParts[o],i=e.text;return e.associatedMessage?.legacyIds.length===0&&(i+=`${V5}${TN(e.associatedMessage.messageString,e.associatedMessage.meaning)}`),B5(i,t.text,this.getMessagePartSourceSpan(o))}},xb=n=>n.replace(/\\/g,"\\\\"),rU=n=>n.replace(/^:/,"\\:"),sU=n=>n.replace(/:/g,"\\:"),hP=n=>n.replace(/`/g,"\\`").replace(/\${/g,"$\\{");function B5(n,o,e){return n===""?{cooked:o,raw:hP(rU(xb(o))),range:e}:{cooked:`:${n}:${o}`,raw:hP(`:${sU(xb(n))}:${xb(o)}`),range:e}}var ou=class n extends Qi{value;typeParams;constructor(o,e,t=null,i){super(e,i),this.value=o,this.typeParams=t}isEquivalent(o){return o instanceof n&&this.value.name===o.value.name&&this.value.moduleName===o.value.moduleName}isConstant(){return!1}visitExpression(o,e){return o.visitExternalExpr(this,e)}clone(){return new n(this.value,this.type,this.typeParams,this.sourceSpan)}};var jc=class n extends Qi{condition;falseCase;trueCase;constructor(o,e,t=null,i,a){super(i||e.type,a),this.condition=o,this.falseCase=t,this.trueCase=e}isEquivalent(o){return o instanceof n&&this.condition.isEquivalent(o.condition)&&this.trueCase.isEquivalent(o.trueCase)&&iU(this.falseCase,o.falseCase)}isConstant(){return!1}visitExpression(o,e){return o.visitConditionalExpr(this,e)}clone(){return new n(this.condition.clone(),this.trueCase.clone(),this.falseCase?.clone(),this.type,this.sourceSpan)}};var jf=class n extends Qi{condition;constructor(o,e){super(nU,e),this.condition=o}isEquivalent(o){return o instanceof n&&this.condition.isEquivalent(o.condition)}isConstant(){return!1}visitExpression(o,e){return o.visitNotExpr(this,e)}clone(){return new n(this.condition.clone(),this.sourceSpan)}},Da=class n{name;type;constructor(o,e=null){this.name=o,this.type=e}isEquivalent(o){return this.name===o.name}clone(){return new n(this.name,this.type)}},Pm=class n extends Qi{params;statements;name;constructor(o,e,t,i,a){super(t,i),this.params=o,this.statements=e,this.name=a}isEquivalent(o){return(o instanceof n||o instanceof $f)&&Ks(this.params,o.params)&&Ks(this.statements,o.statements)}isConstant(){return!1}visitExpression(o,e){return o.visitFunctionExpr(this,e)}toDeclStmt(o,e){return new $f(o,this.params,this.statements,this.type,e,this.sourceSpan)}clone(){return new n(this.params.map(o=>o.clone()),this.statements,this.type,this.sourceSpan,this.name)}},vu=class _P extends Qi{params;body;constructor(o,e,t,i){super(t,i),this.params=o,this.body=e}isEquivalent(o){return!(o instanceof _P)||!Ks(this.params,o.params)?!1:this.body instanceof Qi&&o.body instanceof Qi?this.body.isEquivalent(o.body):Array.isArray(this.body)&&Array.isArray(o.body)?Ks(this.body,o.body):!1}isConstant(){return!1}visitExpression(o,e){return o.visitArrowFunctionExpr(this,e)}clone(){return new _P(this.params.map(o=>o.clone()),Array.isArray(this.body)?this.body:this.body.clone(),this.type,this.sourceSpan)}toDeclStmt(o,e){return new Ga(o,this,ic,e,this.sourceSpan)}},au=class n extends Qi{operator;expr;parens;constructor(o,e,t,i,a=!0){super(t||iu,i),this.operator=o,this.expr=e,this.parens=a}isEquivalent(o){return o instanceof n&&this.operator===o.operator&&this.expr.isEquivalent(o.expr)}isConstant(){return!1}visitExpression(o,e){return o.visitUnaryOperatorExpr(this,e)}clone(){return new n(this.operator,this.expr.clone(),this.type,this.sourceSpan,this.parens)}},ac=class n extends Qi{expr;constructor(o,e,t){super(e,t),this.expr=o}visitExpression(o,e){return o.visitParenthesizedExpr(this,e)}isEquivalent(o){return o instanceof n&&o.expr.isEquivalent(this.expr)}isConstant(){return this.expr.isConstant()}clone(){return new n(this.expr.clone())}},Pi=class n extends Qi{operator;rhs;lhs;constructor(o,e,t,i,a){super(i||e.type,a),this.operator=o,this.rhs=t,this.lhs=e}isEquivalent(o){return o instanceof n&&this.operator===o.operator&&this.lhs.isEquivalent(o.lhs)&&this.rhs.isEquivalent(o.rhs)}isConstant(){return!1}visitExpression(o,e){return o.visitBinaryOperatorExpr(this,e)}clone(){return new n(this.operator,this.lhs.clone(),this.rhs.clone(),this.type,this.sourceSpan)}isAssignment(){let o=this.operator;return o===lt.Assign||o===lt.AdditionAssignment||o===lt.SubtractionAssignment||o===lt.MultiplicationAssignment||o===lt.DivisionAssignment||o===lt.RemainderAssignment||o===lt.ExponentiationAssignment||o===lt.AndAssignment||o===lt.OrAssignment||o===lt.NullishCoalesceAssignment}},Xs=class n extends Qi{receiver;name;constructor(o,e,t,i){super(t,i),this.receiver=o,this.name=e}get index(){return this.name}isEquivalent(o){return o instanceof n&&this.receiver.isEquivalent(o.receiver)&&this.name===o.name}isConstant(){return!1}visitExpression(o,e){return o.visitReadPropExpr(this,e)}set(o){return new Pi(lt.Assign,this.receiver.prop(this.name),o,null,this.sourceSpan)}clone(){return new n(this.receiver.clone(),this.name,this.type,this.sourceSpan)}},Fd=class n extends Qi{receiver;index;constructor(o,e,t,i){super(t,i),this.receiver=o,this.index=e}isEquivalent(o){return o instanceof n&&this.receiver.isEquivalent(o.receiver)&&this.index.isEquivalent(o.index)}isConstant(){return!1}visitExpression(o,e){return o.visitReadKeyExpr(this,e)}set(o){return new Pi(lt.Assign,this.receiver.key(this.index),o,null,this.sourceSpan)}clone(){return new n(this.receiver.clone(),this.index.clone(),this.type,this.sourceSpan)}},$c=class n extends Qi{entries;constructor(o,e,t){super(e,t),this.entries=o}isConstant(){return this.entries.every(o=>o.isConstant())}isEquivalent(o){return o instanceof n&&Ks(this.entries,o.entries)}visitExpression(o,e){return o.visitLiteralArrayExpr(this,e)}clone(){return new n(this.entries.map(o=>o.clone()),this.type,this.sourceSpan)}},Rg=class n{key;value;quoted;constructor(o,e,t){this.key=o,this.value=e,this.quoted=t}isEquivalent(o){return this.key===o.key&&this.value.isEquivalent(o.value)}clone(){return new n(this.key,this.value.clone(),this.quoted)}isConstant(){return this.value.isConstant()}},Tm=class n{expression;constructor(o){this.expression=o}isEquivalent(o){return o instanceof n&&this.expression.isEquivalent(o.expression)}clone(){return new n(this.expression.clone())}isConstant(){return this.expression.isConstant()}},rc=class n extends Qi{entries;valueType=null;constructor(o,e,t){super(e,t),this.entries=o,e&&(this.valueType=e.valueType)}isEquivalent(o){return o instanceof n&&Ks(this.entries,o.entries)}isConstant(){return this.entries.every(o=>o.isConstant())}visitExpression(o,e){return o.visitLiteralMapExpr(this,e)}clone(){let o=this.entries.map(e=>e.clone());return new n(o,this.type,this.sourceSpan)}};var ru=class n extends Qi{expression;constructor(o,e){super(null,e),this.expression=o}isEquivalent(o){return o instanceof n&&this.expression.isEquivalent(o.expression)}isConstant(){return this.expression.isConstant()}visitExpression(o,e){return o.visitSpreadElementExpr(this,e)}clone(){return new n(this.expression.clone(),this.sourceSpan)}},zg=new _r(null,null,null),lU=new _r(null,ic,null),ur=(function(n){return n[n.None=0]="None",n[n.Final=1]="Final",n[n.Private=2]="Private",n[n.Exported=4]="Exported",n[n.Static=8]="Static",n})(ur||{}),fP=class{text;multiline;trailingNewline;constructor(o,e,t){this.text=o,this.multiline=e,this.trailingNewline=t}toString(){return this.multiline?` ${this.text} `:this.text}},Nb=class extends fP{tags;constructor(o){super("",!0,!0),this.tags=o}toString(){return uU(this.tags)}},su=class{modifiers;sourceSpan;leadingComments;constructor(o=ur.None,e=null,t){this.modifiers=o,this.sourceSpan=e,this.leadingComments=t}hasModifier(o){return(this.modifiers&o)!==0}addLeadingComment(o){this.leadingComments=this.leadingComments??[],this.leadingComments.push(o)}},Ga=class n extends su{name;value;type;constructor(o,e,t,i,a,s){super(i,a,s),this.name=o,this.value=e,this.type=t||e&&e.type||null}isEquivalent(o){return o instanceof n&&this.name===o.name&&(this.value?!!o.value&&this.value.isEquivalent(o.value):!o.value)}visitStatement(o,e){return o.visitDeclareVarStmt(this,e)}},$f=class n extends su{name;params;statements;type;constructor(o,e,t,i,a,s,d){super(a,s,d),this.name=o,this.params=e,this.statements=t,this.type=i||null}isEquivalent(o){return o instanceof n&&Ks(this.params,o.params)&&Ks(this.statements,o.statements)}visitStatement(o,e){return o.visitDeclareFunctionStmt(this,e)}},fr=class n extends su{expr;constructor(o,e,t){super(ur.None,e,t),this.expr=o}isEquivalent(o){return o instanceof n&&this.expr.isEquivalent(o.expr)}visitStatement(o,e){return o.visitExpressionStmt(this,e)}},Ia=class n extends su{value;constructor(o,e=null,t){super(ur.None,e,t),this.value=o}isEquivalent(o){return o instanceof n&&this.value.isEquivalent(o.value)}visitStatement(o,e){return o.visitReturnStmt(this,e)}},Fb=class n extends su{condition;trueCase;falseCase;constructor(o,e,t=[],i,a){super(ur.None,i,a),this.condition=o,this.trueCase=e,this.falseCase=t}isEquivalent(o){return o instanceof n&&this.condition.isEquivalent(o.condition)&&Ks(this.trueCase,o.trueCase)&&Ks(this.falseCase,o.falseCase)}visitStatement(o,e){return o.visitIfStmt(this,e)}};function cU(n=[]){return new Nb(n)}function di(n,o,e){return new oc(n,o,e)}function Ht(n,o=null,e){return new ou(n,null,o,e)}function gr(n,o,e){return new xl(n,o,e)}function N0(n){return new Ng(n)}function io(n,o,e){return new $c(n,o,e)}function yl(n,o=null){return new rc(n.map(e=>new Rg(e.key,e.value,e.quoted)),o,null)}function dU(n,o){return new jf(n,o)}function Em(n,o,e,t,i){return new Pm(n,o,e,t,i)}function Ys(n,o,e,t){return new vu(n,o,e,t)}function Nx(n,o,e,t,i){return new Fb(n,o,e,t,i)}function mU(n,o,e,t){return new Lf(n,o,e,t)}function De(n,o,e){return new _r(n,o,e)}function pU(n,o,e,t,i){return new Ab(n,o,e,t,i)}function j5(n){let o="";if(n.tagName&&(o+=` @${n.tagName}`),n.text){if(n.text.match(/\/\*|\*\//))throw new Error('JSDoc text cannot contain "/*" and "*/"');o+=" "+n.text.replace(/@/g,"\\@")}return o}function uU(n){if(n.length===0)return"";if(n.length===1&&n[0].tagName&&!n[0].text)return`*${j5(n[0])} `;let o=`* +`;for(let e of n)o+=" *",o+=j5(e).replace(/\n/g,` + * `),o+=` +`;return o+=" ",o}var gU="_c",hU={},_U=50,Rb=class n extends Qi{resolved;original;shared=!1;constructor(o){super(o.type),this.resolved=o,this.original=o}visitExpression(o,e){return e===hU?this.original.visitExpression(o,e):this.resolved.visitExpression(o,e)}isEquivalent(o){return o instanceof n&&this.resolved.isEquivalent(o.resolved)}isConstant(){return!0}clone(){throw new Error("Not supported.")}fixup(o){this.resolved=o,this.shared=!0}},zb=class{isClosureCompilerEnabled;statements=[];literals=new Map;literalFactories=new Map;sharedConstants=new Map;_claimedNames=new Map;nextNameIndex=0;constructor(o=!1){this.isClosureCompilerEnabled=o}getConstLiteral(o,e){if(o instanceof _r&&!$5(o)||o instanceof Rb)return o;let t=Hf.INSTANCE.keyOf(o),i=this.literals.get(t),a=!1;if(i||(i=new Rb(o),this.literals.set(t,i),a=!0),!a&&!i.shared||a&&e){let s=this.freshName(),d,p;this.isClosureCompilerEnabled&&$5(o)?(d=new Pm([],[new Ia(o)]),p=di(s).callFn([])):(d=o,p=di(s)),this.statements.push(new Ga(s,d,ic,ur.Final)),i.fixup(p)}return i}getSharedConstant(o,e){let t=o.keyOf(e);if(!this.sharedConstants.has(t)){let i=this.freshName();this.sharedConstants.set(t,di(i)),this.statements.push(o.toSharedConstantDeclaration(i,e))}return this.sharedConstants.get(t)}getSharedFunctionReference(o,e,t=!0){let i=o instanceof vu;for(let s of this.statements)if(i&&s instanceof Ga&&s.value?.isEquivalent(o)||!i&&s instanceof $f&&o instanceof Pm&&o.isEquivalent(s))return di(s.name);let a=t?this.uniqueName(e):e;return this.statements.push(o instanceof Pm?o.toDeclStmt(a,ur.Final):new Ga(a,o,ic,ur.Final,o.sourceSpan)),di(a)}uniqueName(o,e=!0){let t=this._claimedNames.get(o)??0,i=t===0&&!e?`${o}`:`${o}${t}`;return this._claimedNames.set(o,t+1),i}freshName(){return this.uniqueName(gU)}},Hf=class n{static INSTANCE=new n;keyOf(o){if(o instanceof _r&&typeof o.value=="string")return`"${o.value}"`;if(o instanceof _r)return String(o.value);if(o instanceof Fg)return`/${o.body}/${o.flags??""}`;if(o instanceof $c){let e=[];for(let t of o.entries)e.push(this.keyOf(t));return`[${e.join(",")}]`}else if(o instanceof rc){let e=[];for(let t of o.entries)if(t instanceof Tm)e.push("..."+this.keyOf(t.expression));else{let i=t.key;t.quoted&&(i=`"${i}"`),e.push(i+":"+this.keyOf(t.value))}return`{${e.join(",")}}`}else{if(o instanceof ou)return`import("${o.value.moduleName}", ${o.value.name})`;if(o instanceof oc)return`read(${o.name})`;if(o instanceof Ng)return`typeof(${this.keyOf(o.expr)})`;if(o instanceof ru)return`...${this.keyOf(o.expression)}`;throw new Error(`${this.constructor.name} does not handle expressions of type ${o.constructor.name}`)}}};function $5(n){return n instanceof _r&&typeof n.value=="string"&&n.value.length>=_U}var xe="@angular/core",ge=(()=>{class n{static core={name:null,moduleName:xe};static namespaceHTML={name:"\u0275\u0275namespaceHTML",moduleName:xe};static namespaceMathML={name:"\u0275\u0275namespaceMathML",moduleName:xe};static namespaceSVG={name:"\u0275\u0275namespaceSVG",moduleName:xe};static element={name:"\u0275\u0275element",moduleName:xe};static elementStart={name:"\u0275\u0275elementStart",moduleName:xe};static elementEnd={name:"\u0275\u0275elementEnd",moduleName:xe};static domElement={name:"\u0275\u0275domElement",moduleName:xe};static domElementStart={name:"\u0275\u0275domElementStart",moduleName:xe};static domElementEnd={name:"\u0275\u0275domElementEnd",moduleName:xe};static domElementContainer={name:"\u0275\u0275domElementContainer",moduleName:xe};static domElementContainerStart={name:"\u0275\u0275domElementContainerStart",moduleName:xe};static domElementContainerEnd={name:"\u0275\u0275domElementContainerEnd",moduleName:xe};static domTemplate={name:"\u0275\u0275domTemplate",moduleName:xe};static domListener={name:"\u0275\u0275domListener",moduleName:xe};static advance={name:"\u0275\u0275advance",moduleName:xe};static syntheticHostProperty={name:"\u0275\u0275syntheticHostProperty",moduleName:xe};static syntheticHostListener={name:"\u0275\u0275syntheticHostListener",moduleName:xe};static attribute={name:"\u0275\u0275attribute",moduleName:xe};static classProp={name:"\u0275\u0275classProp",moduleName:xe};static elementContainerStart={name:"\u0275\u0275elementContainerStart",moduleName:xe};static elementContainerEnd={name:"\u0275\u0275elementContainerEnd",moduleName:xe};static elementContainer={name:"\u0275\u0275elementContainer",moduleName:xe};static styleMap={name:"\u0275\u0275styleMap",moduleName:xe};static classMap={name:"\u0275\u0275classMap",moduleName:xe};static styleProp={name:"\u0275\u0275styleProp",moduleName:xe};static interpolate={name:"\u0275\u0275interpolate",moduleName:xe};static interpolate1={name:"\u0275\u0275interpolate1",moduleName:xe};static interpolate2={name:"\u0275\u0275interpolate2",moduleName:xe};static interpolate3={name:"\u0275\u0275interpolate3",moduleName:xe};static interpolate4={name:"\u0275\u0275interpolate4",moduleName:xe};static interpolate5={name:"\u0275\u0275interpolate5",moduleName:xe};static interpolate6={name:"\u0275\u0275interpolate6",moduleName:xe};static interpolate7={name:"\u0275\u0275interpolate7",moduleName:xe};static interpolate8={name:"\u0275\u0275interpolate8",moduleName:xe};static interpolateV={name:"\u0275\u0275interpolateV",moduleName:xe};static nextContext={name:"\u0275\u0275nextContext",moduleName:xe};static resetView={name:"\u0275\u0275resetView",moduleName:xe};static templateCreate={name:"\u0275\u0275template",moduleName:xe};static defer={name:"\u0275\u0275defer",moduleName:xe};static deferWhen={name:"\u0275\u0275deferWhen",moduleName:xe};static deferOnIdle={name:"\u0275\u0275deferOnIdle",moduleName:xe};static deferOnImmediate={name:"\u0275\u0275deferOnImmediate",moduleName:xe};static deferOnTimer={name:"\u0275\u0275deferOnTimer",moduleName:xe};static deferOnHover={name:"\u0275\u0275deferOnHover",moduleName:xe};static deferOnInteraction={name:"\u0275\u0275deferOnInteraction",moduleName:xe};static deferOnViewport={name:"\u0275\u0275deferOnViewport",moduleName:xe};static deferPrefetchWhen={name:"\u0275\u0275deferPrefetchWhen",moduleName:xe};static deferPrefetchOnIdle={name:"\u0275\u0275deferPrefetchOnIdle",moduleName:xe};static deferPrefetchOnImmediate={name:"\u0275\u0275deferPrefetchOnImmediate",moduleName:xe};static deferPrefetchOnTimer={name:"\u0275\u0275deferPrefetchOnTimer",moduleName:xe};static deferPrefetchOnHover={name:"\u0275\u0275deferPrefetchOnHover",moduleName:xe};static deferPrefetchOnInteraction={name:"\u0275\u0275deferPrefetchOnInteraction",moduleName:xe};static deferPrefetchOnViewport={name:"\u0275\u0275deferPrefetchOnViewport",moduleName:xe};static deferHydrateWhen={name:"\u0275\u0275deferHydrateWhen",moduleName:xe};static deferHydrateNever={name:"\u0275\u0275deferHydrateNever",moduleName:xe};static deferHydrateOnIdle={name:"\u0275\u0275deferHydrateOnIdle",moduleName:xe};static deferHydrateOnImmediate={name:"\u0275\u0275deferHydrateOnImmediate",moduleName:xe};static deferHydrateOnTimer={name:"\u0275\u0275deferHydrateOnTimer",moduleName:xe};static deferHydrateOnHover={name:"\u0275\u0275deferHydrateOnHover",moduleName:xe};static deferHydrateOnInteraction={name:"\u0275\u0275deferHydrateOnInteraction",moduleName:xe};static deferHydrateOnViewport={name:"\u0275\u0275deferHydrateOnViewport",moduleName:xe};static deferEnableTimerScheduling={name:"\u0275\u0275deferEnableTimerScheduling",moduleName:xe};static conditionalCreate={name:"\u0275\u0275conditionalCreate",moduleName:xe};static conditionalBranchCreate={name:"\u0275\u0275conditionalBranchCreate",moduleName:xe};static conditional={name:"\u0275\u0275conditional",moduleName:xe};static repeater={name:"\u0275\u0275repeater",moduleName:xe};static repeaterCreate={name:"\u0275\u0275repeaterCreate",moduleName:xe};static repeaterTrackByIndex={name:"\u0275\u0275repeaterTrackByIndex",moduleName:xe};static repeaterTrackByIdentity={name:"\u0275\u0275repeaterTrackByIdentity",moduleName:xe};static componentInstance={name:"\u0275\u0275componentInstance",moduleName:xe};static text={name:"\u0275\u0275text",moduleName:xe};static enableBindings={name:"\u0275\u0275enableBindings",moduleName:xe};static disableBindings={name:"\u0275\u0275disableBindings",moduleName:xe};static getCurrentView={name:"\u0275\u0275getCurrentView",moduleName:xe};static textInterpolate={name:"\u0275\u0275textInterpolate",moduleName:xe};static textInterpolate1={name:"\u0275\u0275textInterpolate1",moduleName:xe};static textInterpolate2={name:"\u0275\u0275textInterpolate2",moduleName:xe};static textInterpolate3={name:"\u0275\u0275textInterpolate3",moduleName:xe};static textInterpolate4={name:"\u0275\u0275textInterpolate4",moduleName:xe};static textInterpolate5={name:"\u0275\u0275textInterpolate5",moduleName:xe};static textInterpolate6={name:"\u0275\u0275textInterpolate6",moduleName:xe};static textInterpolate7={name:"\u0275\u0275textInterpolate7",moduleName:xe};static textInterpolate8={name:"\u0275\u0275textInterpolate8",moduleName:xe};static textInterpolateV={name:"\u0275\u0275textInterpolateV",moduleName:xe};static restoreView={name:"\u0275\u0275restoreView",moduleName:xe};static pureFunction0={name:"\u0275\u0275pureFunction0",moduleName:xe};static pureFunction1={name:"\u0275\u0275pureFunction1",moduleName:xe};static pureFunction2={name:"\u0275\u0275pureFunction2",moduleName:xe};static pureFunction3={name:"\u0275\u0275pureFunction3",moduleName:xe};static pureFunction4={name:"\u0275\u0275pureFunction4",moduleName:xe};static pureFunction5={name:"\u0275\u0275pureFunction5",moduleName:xe};static pureFunction6={name:"\u0275\u0275pureFunction6",moduleName:xe};static pureFunction7={name:"\u0275\u0275pureFunction7",moduleName:xe};static pureFunction8={name:"\u0275\u0275pureFunction8",moduleName:xe};static pureFunctionV={name:"\u0275\u0275pureFunctionV",moduleName:xe};static pipeBind1={name:"\u0275\u0275pipeBind1",moduleName:xe};static pipeBind2={name:"\u0275\u0275pipeBind2",moduleName:xe};static pipeBind3={name:"\u0275\u0275pipeBind3",moduleName:xe};static pipeBind4={name:"\u0275\u0275pipeBind4",moduleName:xe};static pipeBindV={name:"\u0275\u0275pipeBindV",moduleName:xe};static domProperty={name:"\u0275\u0275domProperty",moduleName:xe};static ariaProperty={name:"\u0275\u0275ariaProperty",moduleName:xe};static property={name:"\u0275\u0275property",moduleName:xe};static control={name:"\u0275\u0275control",moduleName:xe};static controlCreate={name:"\u0275\u0275controlCreate",moduleName:xe};static animationEnterListener={name:"\u0275\u0275animateEnterListener",moduleName:xe};static animationLeaveListener={name:"\u0275\u0275animateLeaveListener",moduleName:xe};static animationEnter={name:"\u0275\u0275animateEnter",moduleName:xe};static animationLeave={name:"\u0275\u0275animateLeave",moduleName:xe};static i18n={name:"\u0275\u0275i18n",moduleName:xe};static i18nAttributes={name:"\u0275\u0275i18nAttributes",moduleName:xe};static i18nExp={name:"\u0275\u0275i18nExp",moduleName:xe};static i18nStart={name:"\u0275\u0275i18nStart",moduleName:xe};static i18nEnd={name:"\u0275\u0275i18nEnd",moduleName:xe};static i18nApply={name:"\u0275\u0275i18nApply",moduleName:xe};static i18nPostprocess={name:"\u0275\u0275i18nPostprocess",moduleName:xe};static pipe={name:"\u0275\u0275pipe",moduleName:xe};static projection={name:"\u0275\u0275projection",moduleName:xe};static projectionDef={name:"\u0275\u0275projectionDef",moduleName:xe};static reference={name:"\u0275\u0275reference",moduleName:xe};static inject={name:"\u0275\u0275inject",moduleName:xe};static injectAttribute={name:"\u0275\u0275injectAttribute",moduleName:xe};static directiveInject={name:"\u0275\u0275directiveInject",moduleName:xe};static invalidFactory={name:"\u0275\u0275invalidFactory",moduleName:xe};static invalidFactoryDep={name:"\u0275\u0275invalidFactoryDep",moduleName:xe};static templateRefExtractor={name:"\u0275\u0275templateRefExtractor",moduleName:xe};static forwardRef={name:"forwardRef",moduleName:xe};static resolveForwardRef={name:"resolveForwardRef",moduleName:xe};static replaceMetadata={name:"\u0275\u0275replaceMetadata",moduleName:xe};static getReplaceMetadataURL={name:"\u0275\u0275getReplaceMetadataURL",moduleName:xe};static \u0275\u0275defineInjectable={name:"\u0275\u0275defineInjectable",moduleName:xe};static declareInjectable={name:"\u0275\u0275ngDeclareInjectable",moduleName:xe};static InjectableDeclaration={name:"\u0275\u0275InjectableDeclaration",moduleName:xe};static resolveWindow={name:"\u0275\u0275resolveWindow",moduleName:xe};static resolveDocument={name:"\u0275\u0275resolveDocument",moduleName:xe};static resolveBody={name:"\u0275\u0275resolveBody",moduleName:xe};static getComponentDepsFactory={name:"\u0275\u0275getComponentDepsFactory",moduleName:xe};static defineComponent={name:"\u0275\u0275defineComponent",moduleName:xe};static declareComponent={name:"\u0275\u0275ngDeclareComponent",moduleName:xe};static setComponentScope={name:"\u0275\u0275setComponentScope",moduleName:xe};static ChangeDetectionStrategy={name:"ChangeDetectionStrategy",moduleName:xe};static ViewEncapsulation={name:"ViewEncapsulation",moduleName:xe};static ComponentDeclaration={name:"\u0275\u0275ComponentDeclaration",moduleName:xe};static FactoryDeclaration={name:"\u0275\u0275FactoryDeclaration",moduleName:xe};static declareFactory={name:"\u0275\u0275ngDeclareFactory",moduleName:xe};static FactoryTarget={name:"\u0275\u0275FactoryTarget",moduleName:xe};static defineDirective={name:"\u0275\u0275defineDirective",moduleName:xe};static declareDirective={name:"\u0275\u0275ngDeclareDirective",moduleName:xe};static DirectiveDeclaration={name:"\u0275\u0275DirectiveDeclaration",moduleName:xe};static InjectorDef={name:"\u0275\u0275InjectorDef",moduleName:xe};static InjectorDeclaration={name:"\u0275\u0275InjectorDeclaration",moduleName:xe};static defineInjector={name:"\u0275\u0275defineInjector",moduleName:xe};static declareInjector={name:"\u0275\u0275ngDeclareInjector",moduleName:xe};static NgModuleDeclaration={name:"\u0275\u0275NgModuleDeclaration",moduleName:xe};static ModuleWithProviders={name:"ModuleWithProviders",moduleName:xe};static defineNgModule={name:"\u0275\u0275defineNgModule",moduleName:xe};static declareNgModule={name:"\u0275\u0275ngDeclareNgModule",moduleName:xe};static setNgModuleScope={name:"\u0275\u0275setNgModuleScope",moduleName:xe};static registerNgModuleType={name:"\u0275\u0275registerNgModuleType",moduleName:xe};static PipeDeclaration={name:"\u0275\u0275PipeDeclaration",moduleName:xe};static definePipe={name:"\u0275\u0275definePipe",moduleName:xe};static declarePipe={name:"\u0275\u0275ngDeclarePipe",moduleName:xe};static declareClassMetadata={name:"\u0275\u0275ngDeclareClassMetadata",moduleName:xe};static declareClassMetadataAsync={name:"\u0275\u0275ngDeclareClassMetadataAsync",moduleName:xe};static setClassMetadata={name:"\u0275setClassMetadata",moduleName:xe};static setClassMetadataAsync={name:"\u0275setClassMetadataAsync",moduleName:xe};static setClassDebugInfo={name:"\u0275setClassDebugInfo",moduleName:xe};static queryRefresh={name:"\u0275\u0275queryRefresh",moduleName:xe};static viewQuery={name:"\u0275\u0275viewQuery",moduleName:xe};static loadQuery={name:"\u0275\u0275loadQuery",moduleName:xe};static contentQuery={name:"\u0275\u0275contentQuery",moduleName:xe};static viewQuerySignal={name:"\u0275\u0275viewQuerySignal",moduleName:xe};static contentQuerySignal={name:"\u0275\u0275contentQuerySignal",moduleName:xe};static queryAdvance={name:"\u0275\u0275queryAdvance",moduleName:xe};static twoWayProperty={name:"\u0275\u0275twoWayProperty",moduleName:xe};static twoWayBindingSet={name:"\u0275\u0275twoWayBindingSet",moduleName:xe};static twoWayListener={name:"\u0275\u0275twoWayListener",moduleName:xe};static declareLet={name:"\u0275\u0275declareLet",moduleName:xe};static storeLet={name:"\u0275\u0275storeLet",moduleName:xe};static readContextLet={name:"\u0275\u0275readContextLet",moduleName:xe};static arrowFunction={name:"\u0275\u0275arrowFunction",moduleName:xe};static attachSourceLocations={name:"\u0275\u0275attachSourceLocations",moduleName:xe};static NgOnChangesFeature={name:"\u0275\u0275NgOnChangesFeature",moduleName:xe};static ControlFeature={name:"\u0275\u0275ControlFeature",moduleName:xe};static InheritDefinitionFeature={name:"\u0275\u0275InheritDefinitionFeature",moduleName:xe};static ProvidersFeature={name:"\u0275\u0275ProvidersFeature",moduleName:xe};static HostDirectivesFeature={name:"\u0275\u0275HostDirectivesFeature",moduleName:xe};static ExternalStylesFeature={name:"\u0275\u0275ExternalStylesFeature",moduleName:xe};static listener={name:"\u0275\u0275listener",moduleName:xe};static getInheritedFactory={name:"\u0275\u0275getInheritedFactory",moduleName:xe};static sanitizeHtml={name:"\u0275\u0275sanitizeHtml",moduleName:xe};static sanitizeStyle={name:"\u0275\u0275sanitizeStyle",moduleName:xe};static validateAttribute={name:"\u0275\u0275validateAttribute",moduleName:xe};static sanitizeResourceUrl={name:"\u0275\u0275sanitizeResourceUrl",moduleName:xe};static sanitizeScript={name:"\u0275\u0275sanitizeScript",moduleName:xe};static sanitizeUrl={name:"\u0275\u0275sanitizeUrl",moduleName:xe};static sanitizeUrlOrResourceUrl={name:"\u0275\u0275sanitizeUrlOrResourceUrl",moduleName:xe};static trustConstantHtml={name:"\u0275\u0275trustConstantHtml",moduleName:xe};static trustConstantResourceUrl={name:"\u0275\u0275trustConstantResourceUrl",moduleName:xe};static inputDecorator={name:"Input",moduleName:xe};static outputDecorator={name:"Output",moduleName:xe};static viewChildDecorator={name:"ViewChild",moduleName:xe};static viewChildrenDecorator={name:"ViewChildren",moduleName:xe};static contentChildDecorator={name:"ContentChild",moduleName:xe};static contentChildrenDecorator={name:"ContentChildren",moduleName:xe};static InputSignalBrandWriteType={name:"\u0275INPUT_SIGNAL_BRAND_WRITE_TYPE",moduleName:xe};static UnwrapDirectiveSignalInputs={name:"\u0275UnwrapDirectiveSignalInputs",moduleName:xe};static unwrapWritableSignal={name:"\u0275unwrapWritableSignal",moduleName:xe};static assertType={name:"\u0275assertType",moduleName:xe}}return n})(),fU=/-+([a-z0-9])/g;function vU(n){return n.replace(fU,(...o)=>o[1].toUpperCase())}function CU(n,o){return DN(n,":",o)}function bU(n,o){return DN(n,".",o)}function DN(n,o,e){let t=n.indexOf(o);return t==-1?e:[n.slice(0,t).trim(),n.slice(t+1).trim()]}function xU(n){let o=[];for(let e=0;e=55296&&t<=56319&&n.length>e+1){let i=n.charCodeAt(e+1);i>=56320&&i<=57343&&(e++,t=(t-55296<<10)+i-56320+65536)}t<=127?o.push(t):t<=2047?o.push(t>>6&31|192,t&63|128):t<=65535?o.push(t>>12|224,t>>6&63|128,t&63|128):t<=2097151&&o.push(t>>18&7|240,t>>12&63|128,t>>6&63|128,t&63|128)}return o}function IN(n){if(typeof n=="string")return n;if(Array.isArray(n))return`[${n.map(IN).join(", ")}]`;if(n==null)return""+n;let o=n.overriddenName||n.name;if(o)return`${o}`;if(!n.toString)return"object";let e=n.toString();if(e==null)return""+e;let t=e.indexOf(` +`);return t>=0?e.slice(0,t):e}var vP=class{full;major;minor;patch;constructor(o){this.full=o;let e=o.split(".");this.major=e[0],this.minor=e[1],this.patch=e.slice(2).join(".")}},Tf=globalThis,yU=/^([1-9]|1[0-8])\./;function AN(n){return n.startsWith("0.")?!0:!yU.test(n)}var wU=3,MU="# sourceMappingURL=data:application/json;base64,",CP=class{file;sourcesContent=new Map;lines=[];lastCol0=0;hasMappings=!1;constructor(o=null){this.file=o}addSource(o,e=null){return this.sourcesContent.has(o)||this.sourcesContent.set(o,e),this}addLine(){return this.lines.push([]),this.lastCol0=0,this}addMapping(o,e,t,i){if(!this.currentLine)throw new Error("A line must be added before mappings can be added");if(e!=null&&!this.sourcesContent.has(e))throw new Error(`Unknown source file "${e}"`);if(o==null)throw new Error("The column in the generated code must be provided");if(o{o.set(u,g),e.push(u),t.push(this.sourcesContent.get(u)||null)});let i="",a=0,s=0,d=0,p=0;return this.lines.forEach(u=>{a=0,i+=u.map(g=>{let C=lb(g.col0-a);return a=g.col0,g.sourceUrl!=null&&(C+=lb(o.get(g.sourceUrl)-s),s=o.get(g.sourceUrl),C+=lb(g.sourceLine0-d),d=g.sourceLine0,C+=lb(g.sourceCol0-p),p=g.sourceCol0),C}).join(","),i+=";"}),i=i.slice(0,-1),{file:this.file||"",version:wU,sourceRoot:"",sources:e,sourcesContent:t,mappings:i}}toJsComment(){return this.hasMappings?"//"+MU+SU(JSON.stringify(this,null,0)):""}};function SU(n){let o="",e=xU(n);for(let t=0;t>2),o+=wf((i&3)<<4|(a===null?0:a>>4)),o+=a===null?"=":wf((a&15)<<2|(s===null?0:s>>6)),o+=a===null||s===null?"=":wf(s&63)}return o}function lb(n){n=n<0?(-n<<1)+1:n<<1;let o="";do{let e=n&31;n=n>>5,n>0&&(e=e|32),o+=wf(e)}while(n>0);return o}var kU="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function wf(n){if(n<0||n>=64)throw new Error("Can only encode value in the range [0, 63]");return kU[n]}var PU=/'|\\|\n|\r|\$/g,TU=/^[$A-Z_][0-9A-Z_$]*$/i,bP=" ",Lb=class{indent;partsLength=0;parts=[];srcSpans=[];constructor(o){this.indent=o}},EU=new Map([[lt.And,"&&"],[lt.Bigger,">"],[lt.BiggerEquals,">="],[lt.BitwiseOr,"|"],[lt.BitwiseAnd,"&"],[lt.Divide,"/"],[lt.Assign,"="],[lt.Equals,"=="],[lt.Identical,"==="],[lt.Lower,"<"],[lt.LowerEquals,"<="],[lt.Minus,"-"],[lt.Modulo,"%"],[lt.Exponentiation,"**"],[lt.Multiply,"*"],[lt.NotEquals,"!="],[lt.NotIdentical,"!=="],[lt.NullishCoalesce,"??"],[lt.Or,"||"],[lt.Plus,"+"],[lt.In,"in"],[lt.InstanceOf,"instanceof"],[lt.AdditionAssignment,"+="],[lt.SubtractionAssignment,"-="],[lt.MultiplicationAssignment,"*="],[lt.DivisionAssignment,"/="],[lt.RemainderAssignment,"%="],[lt.ExponentiationAssignment,"**="],[lt.AndAssignment,"&&="],[lt.OrAssignment,"||="],[lt.NullishCoalesceAssignment,"??="]]),xP=class n{_indent;static createRoot(){return new n(0)}_lines;constructor(o){this._indent=o,this._lines=[new Lb(o)]}get _currentLine(){return this._lines[this._lines.length-1]}println(o,e=""){this.print(o||null,e,!0)}lineIsEmpty(){return this._currentLine.parts.length===0}lineLength(){return this._currentLine.indent*bP.length+this._currentLine.partsLength}print(o,e,t=!1){e.length>0&&(this._currentLine.parts.push(e),this._currentLine.partsLength+=e.length,this._currentLine.srcSpans.push(o&&o.sourceSpan||null)),t&&this._lines.push(new Lb(this._indent))}removeEmptyLastLine(){this.lineIsEmpty()&&this._lines.pop()}incIndent(){this._indent++,this.lineIsEmpty()&&(this._currentLine.indent=this._indent)}decIndent(){this._indent--,this.lineIsEmpty()&&(this._currentLine.indent=this._indent)}toSource(){return this.sourceLines.map(o=>o.parts.length>0?H5(o.indent)+o.parts.join(""):"").join(` +`)}toSourceMapGenerator(o,e=0){let t=new CP(o),i=!1,a=()=>{i||(t.addSource(o," ").addMapping(0,o,0,0),i=!0)};for(let s=0;s{t.addLine();let p=s.srcSpans,u=s.parts,g=s.indent*bP.length,C=0;for(;Ci)return t.srcSpans[a];i-=s.length}}return null}get sourceLines(){return this._lines.length&&this._lines[this._lines.length-1].parts.length===0?this._lines.slice(0,-1):this._lines}},yP=class{_escapeDollarInStrings;lastIfCondition=null;constructor(o){this._escapeDollarInStrings=o}printLeadingComments(o,e){if(o.leadingComments!==void 0)for(let t of o.leadingComments)t instanceof Nb?e.print(o,`/*${t.toString()}*/`,t.trailingNewline):t.multiline?e.print(o,`/* ${t.text} */`,t.trailingNewline):t.text.split(` +`).forEach(i=>{e.println(o,`// ${i}`)})}visitExpressionStmt(o,e){return this.printLeadingComments(o,e),o.expr.visitExpression(this,e),e.println(o,";"),null}visitReturnStmt(o,e){return this.printLeadingComments(o,e),e.print(o,"return "),o.value.visitExpression(this,e),e.println(o,";"),null}visitIfStmt(o,e){this.printLeadingComments(o,e),e.print(o,"if ("),this.lastIfCondition=o.condition,o.condition.visitExpression(this,e),this.lastIfCondition=null,e.print(o,") {");let t=o.falseCase!=null&&o.falseCase.length>0;return o.trueCase.length<=1&&!t?(e.print(o," "),this.visitAllStatements(o.trueCase,e),e.removeEmptyLastLine(),e.print(o," ")):(e.println(),e.incIndent(),this.visitAllStatements(o.trueCase,e),e.decIndent(),t&&(e.println(o,"} else {"),e.incIndent(),this.visitAllStatements(o.falseCase,e),e.decIndent())),e.println(o,"}"),null}visitInvokeFunctionExpr(o,e){let t=o.fn instanceof vu;return t&&e.print(o.fn,"("),o.fn.visitExpression(this,e),t&&e.print(o.fn,")"),e.print(o,"("),this.visitAllExpressions(o.args,e,","),e.print(o,")"),null}visitTaggedTemplateLiteralExpr(o,e){return o.tag.visitExpression(this,e),o.template.visitExpression(this,e),null}visitTemplateLiteralExpr(o,e){e.print(o,"`");for(let t=0;t{t instanceof Tm?(e.print(o,"..."),t.expression.visitExpression(this,e)):(e.print(o,`${Gp(t.key,this._escapeDollarInStrings,t.quoted)}:`),t.value.visitExpression(this,e))},o.entries,e,","),e.print(o,"}"),null}visitCommaExpr(o,e){return e.print(o,"("),this.visitAllExpressions(o.parts,e,","),e.print(o,")"),null}visitParenthesizedExpr(o,e){o.expr.visitExpression(this,e)}visitSpreadElementExpr(o,e){e.print(o,"..."),o.expression.visitExpression(this,e)}visitAllExpressions(o,e,t){this.visitAllObjects(i=>i.visitExpression(this,e),o,e,t)}visitAllObjects(o,e,t,i){let a=!1;for(let s=0;s0&&(t.lineLength()>80?(t.print(null,i,!0),a||(t.incIndent(),t.incIndent(),a=!0)):t.print(null,i,!1)),o(e[s]);a&&(t.decIndent(),t.decIndent())}visitAllStatements(o,e){o.forEach(t=>t.visitStatement(this,e))}};function Gp(n,o,e=!0){if(n==null)return null;let t=n.replace(PU,(...a)=>a[0]=="$"?o?"\\$":"$":a[0]==` +`?"\\n":a[0]=="\r"?"\\r":`\\${a[0]}`);return e||!TU.test(t)?`'${t}'`:t}function H5(n){let o="";for(let e=0;et.value));return o?Ys([],e):e}function G3(n,o){return{expression:n,forwardRef:o}}function AU({expression:n,forwardRef:o}){switch(o){case 0:case 1:return n;case 2:return NU(n)}}function NU(n){return Ht(ge.forwardRef).callFn([Ys([],n)])}var Vb=(function(n){return n[n.Class=0]="Class",n[n.Function=1]="Function",n})(Vb||{});function Hp(n){let o=di("__ngFactoryType__"),e=null,t=W5(n)?o:new Pi(lt.Or,o,n.type.value),i=null;n.deps!==null?n.deps!=="invalid"&&(i=new Vf(t,U5(n.deps,n.target))):(e=di(`\u0275${n.name}_BaseFactory`),i=e.callFn([t]));let a=[],s=null;function d(u){let g=di("__ngConditionalFactory__");a.push(new Ga(g.name,zg,ic));let C=i!==null?g.set(i).toStmt():Ht(ge.invalidFactory).callFn([]).toStmt();return a.push(Nx(o,[C],[g.set(u).toStmt()])),g}if(W5(n)){let u=U5(n.delegateDeps,n.target),g=new(n.delegateType===Vb.Class?Vf:Ms)(n.delegate,u);s=d(g)}else VU(n)?s=d(n.expression):s=i;if(s===null)a.push(Ht(ge.invalidFactory).callFn([]).toStmt());else if(e!==null){let u=Ht(ge.getInheritedFactory).callFn([n.type.value]),g=new Pi(lt.Or,e,e.set(u));a.push(new Ia(g.callFn([t])))}else a.push(new Ia(s));let p=Em([new Da(o.name,ws)],a,ic,void 0,`${n.name}_Factory`);return e!==null&&(p=Ys([],[new Ga(e.name),new Ia(p)]).callFn([],void 0,!0)),{expression:p,statements:[],type:FU(n)}}function FU(n){let o=n.deps!==null&&n.deps!=="invalid"?zU(n.deps):Bc;return gr(Ht(ge.FactoryDeclaration,[Fx(n.type.type,n.typeArgumentCount),o]))}function U5(n,o){return n.map((e,t)=>RU(e,o,t))}function RU(n,o,e){if(n.token===null)return Ht(ge.invalidFactoryDep).callFn([De(e)]);if(n.attributeNameType===null){let t=0|(n.self?2:0)|(n.skipSelf?4:0)|(n.host?1:0)|(n.optional?8:0)|(o===Ed.Pipe?16:0),i=t!==0||n.optional?De(t):null,a=[n.token];i&&a.push(i);let s=BU(o);return Ht(s).callFn(a)}else return Ht(ge.injectAttribute).callFn([n.token])}function zU(n){let o=!1,e=n.map(t=>{let i=LU(t);return i!==null?(o=!0,i):De(null)});return o?gr(io(e)):Bc}function LU(n){let o=[];return n.attributeNameType!==null&&o.push({key:"attribute",value:n.attributeNameType,quoted:!1}),n.optional&&o.push({key:"optional",value:De(!0),quoted:!1}),n.host&&o.push({key:"host",value:De(!0),quoted:!1}),n.self&&o.push({key:"self",value:De(!0),quoted:!1}),n.skipSelf&&o.push({key:"skipSelf",value:De(!0),quoted:!1}),o.length>0?yl(o):null}function W5(n){return n.delegateType!==void 0}function VU(n){return n.expression!==void 0}function BU(n){switch(n){case Ed.Component:case Ed.Directive:case Ed.Pipe:return ge.directiveInject;case Ed.NgModule:case Ed.Injectable:default:return ge.inject}}var lu=class{start;end;constructor(o,e){this.start=o,this.end=e}toAbsolute(o){return new qs(o+this.start,o+this.end)}},co=class{span;sourceSpan;constructor(o,e){this.span=o,this.sourceSpan=e}toString(){return"AST"}},Uf=class extends co{nameSpan;constructor(o,e,t){super(o,e),this.nameSpan=t}},Ar=class extends co{visit(o,e=null){return o.visitEmptyExpr?.(this,e)}},Hc=class extends co{visit(o,e=null){return o.visitImplicitReceiver(this,e)}},Wf=class extends co{visit(o,e=null){return o.visitThisReceiver?.(this,e)}},Lg=class extends co{expressions;constructor(o,e,t){super(o,e),this.expressions=t}visit(o,e=null){return o.visitChain(this,e)}},Bb=class extends co{condition;trueExp;falseExp;constructor(o,e,t,i,a){super(o,e),this.condition=t,this.trueExp=i,this.falseExp=a}visit(o,e=null){return o.visitConditional(this,e)}},zc=class extends Uf{receiver;name;constructor(o,e,t,i,a){super(o,e,t),this.receiver=i,this.name=a}visit(o,e=null){return o.visitPropertyRead(this,e)}},Gf=class extends Uf{receiver;name;constructor(o,e,t,i,a){super(o,e,t),this.receiver=i,this.name=a}visit(o,e=null){return o.visitSafePropertyRead(this,e)}},cu=class extends co{receiver;key;constructor(o,e,t,i){super(o,e),this.receiver=t,this.key=i}visit(o,e=null){return o.visitKeyedRead(this,e)}},qf=class extends co{receiver;key;constructor(o,e,t,i){super(o,e),this.receiver=t,this.key=i}visit(o,e=null){return o.visitSafeKeyedRead(this,e)}},yb=(function(n){return n[n.ReferencedByName=0]="ReferencedByName",n[n.ReferencedDirectly=1]="ReferencedDirectly",n})(yb||{}),jb=class extends Uf{exp;name;args;type;constructor(o,e,t,i,a,s,d){super(o,e,d),this.exp=t,this.name=i,this.args=a,this.type=s}visit(o,e=null){return o.visitPipe(this,e)}},Cs=class extends co{value;constructor(o,e,t){super(o,e),this.value=t}visit(o,e=null){return o.visitLiteralPrimitive(this,e)}},Qf=class extends co{expressions;constructor(o,e,t){super(o,e),this.expressions=t}visit(o,e=null){return o.visitLiteralArray(this,e)}},$b=class extends co{expression;constructor(o,e,t){super(o,e),this.expression=t}visit(o,e=null){return o.visitSpreadElement(this,e)}},du=class extends co{keys;values;constructor(o,e,t,i){super(o,e),this.keys=t,this.values=i}visit(o,e=null){return o.visitLiteralMap(this,e)}},F0=class extends co{strings;expressions;constructor(o,e,t,i){super(o,e),this.strings=t,this.expressions=i}visit(o,e=null){return o.visitInterpolation(this,e)}},Zr=class extends co{operation;left;right;constructor(o,e,t,i,a){super(o,e),this.operation=t,this.left=i,this.right=a}visit(o,e=null){return o.visitBinary(this,e)}static isAssignmentOperation(o){return o==="="||o==="+="||o==="-="||o==="*="||o==="/="||o==="%="||o==="**="||o==="&&="||o==="||="||o==="??="}},Dg=class n extends Zr{operator;expr;left=null;right=null;operation=null;static createMinus(o,e,t){return new n(o,e,"-",t,"-",new Cs(o,e,0),t)}static createPlus(o,e,t){return new n(o,e,"+",t,"-",t,new Cs(o,e,0))}constructor(o,e,t,i,a,s,d){super(o,e,a,s,d),this.operator=t,this.expr=i}visit(o,e=null){return o.visitUnary!==void 0?o.visitUnary(this,e):o.visitBinary(this,e)}},Kf=class extends co{expression;constructor(o,e,t){super(o,e),this.expression=t}visit(o,e=null){return o.visitPrefixNot(this,e)}},Xf=class extends co{expression;constructor(o,e,t){super(o,e),this.expression=t}visit(o,e=null){return o.visitTypeofExpression(this,e)}},Yf=class extends co{expression;constructor(o,e,t){super(o,e),this.expression=t}visit(o,e=null){return o.visitVoidExpression(this,e)}},Zf=class extends co{expression;constructor(o,e,t){super(o,e),this.expression=t}visit(o,e=null){return o.visitNonNullAssert(this,e)}},Vg=class extends co{receiver;args;argumentSpan;constructor(o,e,t,i,a){super(o,e),this.receiver=t,this.args=i,this.argumentSpan=a}visit(o,e=null){return o.visitCall(this,e)}},Hb=class extends co{receiver;args;argumentSpan;constructor(o,e,t,i,a){super(o,e),this.receiver=t,this.args=i,this.argumentSpan=a}visit(o,e=null){return o.visitSafeCall(this,e)}},Jf=class extends co{tag;template;constructor(o,e,t,i){super(o,e),this.tag=t,this.template=i}visit(o,e){return o.visitTaggedTemplateLiteral(this,e)}},e0=class extends co{elements;expressions;constructor(o,e,t,i){super(o,e),this.elements=t,this.expressions=i}visit(o,e){return o.visitTemplateLiteral(this,e)}},Ub=class extends co{text;constructor(o,e,t){super(o,e),this.text=t}visit(o,e){return o.visitTemplateLiteralElement(this,e)}},t0=class extends co{expression;constructor(o,e,t){super(o,e),this.expression=t}visit(o,e){return o.visitParenthesizedExpression(this,e)}},wP=class{name;span;sourceSpan;constructor(o,e,t){this.name=o,this.span=e,this.sourceSpan=t}},Wb=class extends co{parameters;body;constructor(o,e,t,i){super(o,e),this.parameters=t,this.body=i}visit(o,e){return o.visitArrowFunction(this,e)}},Gb=class extends co{body;flags;constructor(o,e,t,i){super(o,e),this.body=t,this.flags=i}visit(o,e){return o.visitRegularExpressionLiteral(this,e)}},qs=class{start;end;constructor(o,e){this.start=o,this.end=e}},xs=class extends co{ast;source;location;errors;constructor(o,e,t,i,a){super(new lu(0,e===null?0:e.length),new qs(i,e===null?i:i+e.length)),this.ast=o,this.source=e,this.location=t,this.errors=a}visit(o,e=null){return o.visitASTWithSource?o.visitASTWithSource(this,e):this.ast.visit(o,e)}toString(){return`${this.source} in ${this.location}`}},n0=class{sourceSpan;key;value;constructor(o,e,t){this.sourceSpan=o,this.key=e,this.value=t}},MP=class{sourceSpan;key;value;constructor(o,e,t){this.sourceSpan=o,this.key=e,this.value=t}},Bg=class{visit(o,e){o.visit(this,e)}visitUnary(o,e){this.visit(o.expr,e)}visitBinary(o,e){this.visit(o.left,e),this.visit(o.right,e)}visitChain(o,e){this.visitAll(o.expressions,e)}visitConditional(o,e){this.visit(o.condition,e),this.visit(o.trueExp,e),this.visit(o.falseExp,e)}visitPipe(o,e){this.visit(o.exp,e),this.visitAll(o.args,e)}visitImplicitReceiver(o,e){}visitThisReceiver(o,e){}visitInterpolation(o,e){this.visitAll(o.expressions,e)}visitKeyedRead(o,e){this.visit(o.receiver,e),this.visit(o.key,e)}visitLiteralArray(o,e){this.visitAll(o.expressions,e)}visitLiteralMap(o,e){this.visitAll(o.values,e)}visitLiteralPrimitive(o,e){}visitPrefixNot(o,e){this.visit(o.expression,e)}visitTypeofExpression(o,e){this.visit(o.expression,e)}visitVoidExpression(o,e){this.visit(o.expression,e)}visitNonNullAssert(o,e){this.visit(o.expression,e)}visitPropertyRead(o,e){this.visit(o.receiver,e)}visitSafePropertyRead(o,e){this.visit(o.receiver,e)}visitSafeKeyedRead(o,e){this.visit(o.receiver,e),this.visit(o.key,e)}visitCall(o,e){this.visit(o.receiver,e),this.visitAll(o.args,e)}visitSafeCall(o,e){this.visit(o.receiver,e),this.visitAll(o.args,e)}visitTemplateLiteral(o,e){for(let t=0;tt!==null);Gk(o,e)}visitTriggers(o,e,t){Gk(t,o.map(i=>e[i]))}},Zb=class extends Ss{expression;groups;unknownBlocks;exhaustiveCheck;constructor(o,e,t,i,a,s,d,p){super(p,a,s,d),this.expression=o,this.groups=e,this.unknownBlocks=t,this.exhaustiveCheck=i}visit(o){return o.visitSwitchBlock(this)}},NP=class extends Ss{expression;constructor(o,e,t,i,a){super(a,e,t,i),this.expression=o}visit(o){return o.visitSwitchBlockCase(this)}},s0=class extends Ss{cases;children;i18n;constructor(o,e,t,i,a,s,d){super(s,t,i,a),this.cases=o,this.children=e,this.i18n=d}visit(o){return o.visitSwitchBlockCaseGroup(this)}},FP=class extends Ss{constructor(o,e,t,i){super(i,o,e,t)}visit(o){return o.visitSwitchExhaustiveCheck(this)}},Hg=class extends Ss{item;expression;trackBy;trackKeywordSpan;contextVariables;children;empty;mainBlockSpan;i18n;constructor(o,e,t,i,a,s,d,p,u,g,C,M,x){super(M,p,g,C),this.item=o,this.expression=e,this.trackBy=t,this.trackKeywordSpan=i,this.contextVariables=a,this.children=s,this.empty=d,this.mainBlockSpan=u,this.i18n=x}visit(o){return o.visitForLoopBlock(this)}},l0=class extends Ss{children;i18n;constructor(o,e,t,i,a,s){super(a,e,t,i),this.children=o,this.i18n=s}visit(o){return o.visitForLoopBlockEmpty(this)}},Jb=class extends Ss{branches;constructor(o,e,t,i,a){super(a,e,t,i),this.branches=o}visit(o){return o.visitIfBlock(this)}},Yp=class extends Ss{expression;children;expressionAlias;i18n;constructor(o,e,t,i,a,s,d,p){super(d,i,a,s),this.expression=o,this.children=e,this.expressionAlias=t,this.i18n=p}visit(o){return o.visitIfBlockBranch(this)}},ex=class{name;sourceSpan;nameSpan;constructor(o,e,t){this.name=o,this.sourceSpan=e,this.nameSpan=t}visit(o){return o.visitUnknownBlock(this)}},q3=class{name;value;sourceSpan;nameSpan;valueSpan;constructor(o,e,t,i,a){this.name=o,this.value=e,this.sourceSpan=t,this.nameSpan=i,this.valueSpan=a}visit(o){return o.visitLetDeclaration(this)}},Ef=class{componentName;tagName;fullName;attributes;inputs;outputs;directives;children;references;isSelfClosing;sourceSpan;startSourceSpan;endSourceSpan;i18n;constructor(o,e,t,i,a,s,d,p,u,g,C,M,x,b){this.componentName=o,this.tagName=e,this.fullName=t,this.attributes=i,this.inputs=a,this.outputs=s,this.directives=d,this.children=p,this.references=u,this.isSelfClosing=g,this.sourceSpan=C,this.startSourceSpan=M,this.endSourceSpan=x,this.i18n=b}visit(o){return o.visitComponent(this)}},NN=class{name;attributes;inputs;outputs;references;sourceSpan;startSourceSpan;endSourceSpan;i18n;constructor(o,e,t,i,a,s,d,p,u){this.name=o,this.attributes=e,this.inputs=t,this.outputs=i,this.references=a,this.sourceSpan=s,this.startSourceSpan=d,this.endSourceSpan=p,this.i18n=u}visit(o){return o.visitDirective(this)}},Qs=class{tagName;attributes;inputs;outputs;directives;templateAttrs;children;references;variables;isSelfClosing;sourceSpan;startSourceSpan;endSourceSpan;i18n;constructor(o,e,t,i,a,s,d,p,u,g,C,M,x,b){this.tagName=o,this.attributes=e,this.inputs=t,this.outputs=i,this.directives=a,this.templateAttrs=s,this.children=d,this.references=p,this.variables=u,this.isSelfClosing=g,this.sourceSpan=C,this.startSourceSpan=M,this.endSourceSpan=x,this.i18n=b}visit(o){return o.visitTemplate(this)}},Ug=class{selector;attributes;children;isSelfClosing;sourceSpan;startSourceSpan;endSourceSpan;i18n;name="ng-content";constructor(o,e,t,i,a,s,d,p){this.selector=o,this.attributes=e,this.children=t,this.isSelfClosing=i,this.sourceSpan=a,this.startSourceSpan=s,this.endSourceSpan=d,this.i18n=p}visit(o){return o.visitContent(this)}},Om=class{name;value;sourceSpan;keySpan;valueSpan;constructor(o,e,t,i,a){this.name=o,this.value=e,this.sourceSpan=t,this.keySpan=i,this.valueSpan=a}visit(o){return o.visitVariable(this)}},c0=class{name;value;sourceSpan;keySpan;valueSpan;constructor(o,e,t,i,a){this.name=o,this.value=e,this.sourceSpan=t,this.keySpan=i,this.valueSpan=a}visit(o){return o.visitReference(this)}},FN=class{vars;placeholders;sourceSpan;i18n;constructor(o,e,t,i){this.vars=o,this.placeholders=e,this.sourceSpan=t,this.i18n=i}visit(o){return o.visitIcu(this)}},d0=class{tagNames;bindings;listeners;sourceSpan;constructor(o,e,t,i){if(this.tagNames=o,this.bindings=e,this.listeners=t,this.sourceSpan=i,o.length===0)throw new Error("HostElement must have at least one tag name.")}visit(){throw new Error("HostElement cannot be visited")}};function Gk(n,o){let e=[];if(n.visit)for(let t of o)n.visit(t);else for(let t of o){let i=t.visit(n);i&&e.push(i)}return e}var os=class{nodes;placeholders;placeholderToMessage;meaning;description;customId;sources;id;legacyIds=[];messageString;constructor(o,e,t,i,a,s){this.nodes=o,this.placeholders=e,this.placeholderToMessage=t,this.meaning=i,this.description=a,this.customId=s,this.id=this.customId,this.messageString=$U(this.nodes),o.length?this.sources=[{filePath:o[0].sourceSpan.start.file.url,startLine:o[0].sourceSpan.start.line+1,startCol:o[0].sourceSpan.start.col+1,endLine:o[o.length-1].sourceSpan.end.line+1,endCol:o[0].sourceSpan.start.col+1}]:this.sources=[]}},uf=class{value;sourceSpan;constructor(o,e){this.value=o,this.sourceSpan=e}visit(o,e){return o.visitText(this,e)}},Id=class{children;sourceSpan;constructor(o,e){this.children=o,this.sourceSpan=e}visit(o,e){return o.visitContainer(this,e)}},tx=class{expression;type;cases;sourceSpan;expressionPlaceholder;constructor(o,e,t,i,a){this.expression=o,this.type=e,this.cases=t,this.sourceSpan=i,this.expressionPlaceholder=a}visit(o,e){return o.visitIcu(this,e)}},Dm=class{tag;attrs;startName;closeName;children;isVoid;sourceSpan;startSourceSpan;endSourceSpan;constructor(o,e,t,i,a,s,d,p,u){this.tag=o,this.attrs=e,this.startName=t,this.closeName=i,this.children=a,this.isVoid=s,this.sourceSpan=d,this.startSourceSpan=p,this.endSourceSpan=u}visit(o,e){return o.visitTagPlaceholder(this,e)}},m0=class{value;name;sourceSpan;constructor(o,e,t){this.value=o,this.name=e,this.sourceSpan=t}visit(o,e){return o.visitPlaceholder(this,e)}},Wg=class{value;name;sourceSpan;previousMessage;constructor(o,e,t){this.value=o,this.name=e,this.sourceSpan=t}visit(o,e){return o.visitIcuPlaceholder(this,e)}},Im=class{name;parameters;startName;closeName;children;sourceSpan;startSourceSpan;endSourceSpan;constructor(o,e,t,i,a,s,d,p){this.name=o,this.parameters=e,this.startName=t,this.closeName=i,this.children=a,this.sourceSpan=s,this.startSourceSpan=d,this.endSourceSpan=p}visit(o,e){return o.visitBlockPlaceholder(this,e)}};function $U(n){let o=new RP;return n.map(t=>t.visit(o)).join("")}var RP=class{visitText(o){return o.value}visitContainer(o){return o.children.map(e=>e.visit(this)).join("")}visitIcu(o){let e=Object.keys(o.cases).map(t=>`${t} {${o.cases[t].visit(this)}}`);return`{${o.expressionPlaceholder}, ${o.type}, ${e.join(" ")}}`}visitTagPlaceholder(o){let e=o.children.map(t=>t.visit(this)).join("");return`{$${o.startName}}${e}{$${o.closeName}}`}visitPlaceholder(o){return`{$${o.name}}`}visitIcuPlaceholder(o){return`{$${o.name}}`}visitBlockPlaceholder(o){let e=o.children.map(t=>t.visit(this)).join("");return`{$${o.startName}}${e}{$${o.closeName}}`}};var HU=class{visitTag(o){let e=this._serializeAttributes(o.attrs);if(o.children.length==0)return`<${o.name}${e}/>`;let t=o.children.map(i=>i.visit(this));return`<${o.name}${e}>${t.join("")}`}visitText(o){return o.value}visitDeclaration(o){return``}_serializeAttributes(o){let e=Object.keys(o).map(t=>`${t}="${o[t]}"`).join(" ");return e.length>0?" "+e:""}visitDoctype(o){return``}},MHe=new HU;function UU(n){return n.toUpperCase().replace(/[^A-Z0-9_]/g,"_")}var RN="i18n",zP="i18n-",WU="VAR_";function zN(n){return n===RN||n.startsWith(zP)}function GU(n){return n.attrs.some(o=>zN(o.name))}function LN(n){return n.nodes[0]}function Q3(n={},o){let e={};return n&&Object.keys(n).length&&Object.keys(n).forEach(t=>e[R0(t,o)]=n[t]),e}function R0(n,o=!0){let e=UU(n);if(!o)return e;let t=e.split("_");if(t.length===1)return n.toLowerCase();let i;/^\d+$/.test(t[t.length-1])&&(i=t.pop());let a=t.shift().toLowerCase();return t.length&&(a+=t.map(s=>s.charAt(0).toUpperCase()+s.slice(1).toLowerCase()).join("")),i?`${a}_${i}`:a}var qU=/[-.]/,K3="_t",Zs="ctx",Jg="rf";function VN(n,o){let e=null;return()=>(e||(n(new Ga(K3,void 0,ws)),e=di(o)),e)}function kg(n){return Array.isArray(n)?io(n.map(kg)):De(n,ic)}function q5(n,o){let e=Object.getOwnPropertyNames(n);return e.length===0?null:yl(e.map(t=>{let i=n[t],a,s,d,p;if(typeof i=="string")a=t,d=t,s=i,p=kg(s);else{d=t,a=i.classPropertyName,s=i.bindingPropertyName;let u=s!==a,g=i.transformFunction!==null,C=yf.None;if(i.isSignal&&(C|=yf.SignalBased),g&&(C|=yf.HasDecoratorInputTransform),o&&(u||g||C!==yf.None)){let M=[De(C),kg(s)];(u||g)&&(M.push(kg(a)),g&&M.push(i.transformFunction)),p=io(M)}else p=kg(s)}return{key:d,quoted:qU.test(d),value:p}}))}var Am=class{values=[];set(o,e){if(e){let t=this.values.find(i=>i.key===o);t?t.value=e:this.values.push({key:o,value:e,quoted:!1})}}toLiteralMap(){return yl(this.values)}};function QU(n){let o=n instanceof Uc?n.name:"ng-template",e=KU(n),t=new Ag,i=hr(o)[1];return t.setElement(i),Object.getOwnPropertyNames(e).forEach(a=>{let s=hr(a)[1],d=e[a];t.addAttribute(s,d),a.toLowerCase()==="class"&&d.trim().split(/\s+/).forEach(u=>t.addClassName(u))}),t}function KU(n){let o={};return n instanceof Qs&&n.tagName!=="ng-template"?n.templateAttrs.forEach(e=>o[e.name]=""):(n.attributes.forEach(e=>{zN(e.name)||(o[e.name]=e.value)}),n.inputs.forEach(e=>{(e.type===Fi.Property||e.type===Fi.TwoWay)&&(o[e.name]="")}),n.outputs.forEach(e=>{o[e.name]=""})),o}function Q5(n,o){let e=null,t={name:n.name,type:n.type,typeArgumentCount:n.typeArgumentCount,deps:[],target:Ed.Injectable};if(n.useClass!==void 0){let d=n.useClass.expression.isEquivalent(n.type.value),p;n.deps!==void 0&&(p=n.deps),p!==void 0?e=Hp(ze(q({},t),{delegate:n.useClass.expression,delegateDeps:p,delegateType:Vb.Class})):d?e=Hp(t):e={statements:[],expression:K5(n.type.value,n.useClass.expression,o)}}else n.useFactory!==void 0?n.deps!==void 0?e=Hp(ze(q({},t),{delegate:n.useFactory,delegateDeps:n.deps||[],delegateType:Vb.Function})):e={statements:[],expression:Ys([],n.useFactory.callFn([]))}:n.useValue!==void 0?e=Hp(ze(q({},t),{expression:n.useValue.expression})):n.useExisting!==void 0?e=Hp(ze(q({},t),{expression:Ht(ge.inject).callFn([n.useExisting.expression])})):e={statements:[],expression:K5(n.type.value,n.type.value,o)};let i=n.type.value,a=new Am;return a.set("token",i),a.set("factory",e.expression),n.providedIn.expression.value!==null&&a.set("providedIn",AU(n.providedIn)),{expression:Ht(ge.\u0275\u0275defineInjectable).callFn([a.toLiteralMap()],void 0,!0),type:XU(n),statements:e.statements}}function XU(n){return new xl(Ht(ge.InjectableDeclaration,[Fx(n.type.type,n.typeArgumentCount)]))}function K5(n,o,e){if(n.node===o.node)return o.prop("\u0275fac");if(!e)return X5(o);let t=Ht(ge.resolveForwardRef).callFn([o]);return X5(t)}function X5(n){let o=new Da("__ngFactoryType__",ws);return Ys([o],n.prop("\u0275fac").callFn([di(o.name)]))}var or=0,YU=8,X3=9,Zp=10,BN=11,jN=12,Y3=13,$N=32,LP=33,p0=34,HN=35,zx=36,ZU=37,nx=38,u0=39,ns=40,Ea=41,Y5=42,UN=43,Nr=44,ix=45,jp=46,gl=47,Fc=58,bs=59,Ig=60,nr=61,Ws=62,Z5=63,Z3=48,JU=55,WN=57,Vm=65,eW=69,tW=70,nW=88,eh=90,Lc=91,Jp=92,Od=93,iW=94,Bm=95,pu=97,oW=98,aW=101,J3=102,GN=110,qN=114,QN=116,KN=117,XN=118,YN=120,z0=122,fl=123,J5=124,es=125,ZN=160,fg=64,VP=96;function g0(n){return n>=X3&&n<=$N||n==ZN}function hl(n){return Z3<=n&&n<=WN}function Nm(n){return n>=pu&&n<=z0||n>=Vm&&n<=eh}function rW(n){return n>=pu&&n<=J3||n>=Vm&&n<=tW||hl(n)}function ox(n){return n===Zp||n===Y3}function e6(n){return Z3<=n&&n<=JU}function Of(n){return n===u0||n===p0||n===VP}var h0=class n{file;offset;line;col;constructor(o,e,t,i){this.file=o,this.offset=e,this.line=t,this.col=i}toString(){return this.offset!=null?`${this.file.url}@${this.line}:${this.col}`:this.file.url}moveBy(o){let e=this.file.content,t=e.length,i=this.offset,a=this.line,s=this.col;for(;i>0&&o<0;)if(i--,o++,e.charCodeAt(i)==Zp){a--;let p=e.substring(0,i-1).lastIndexOf(String.fromCharCode(Zp));s=p>0?i-p:i}else s--;for(;i0;){let d=e.charCodeAt(i);i++,o--,d==Zp?(a++,s=0):s++}return new n(this.file,i,a,s)}getContext(o,e){let t=this.file.content,i=this.offset;if(i!=null){i>t.length-1&&(i=t.length-1);let a=i,s=0,d=0;for(;s0&&(i--,s++,!(t[i]==` +`&&++d==e)););for(s=0,d=0;s]${o.after}")`:this.msg}toString(){let o=this.span.details?`, ${this.span.details}`:"";return`${this.contextualMessage()}: ${this.span.start}${o}`}};function sW(n,o,e){let t=`in ${n} ${o} in ${e}`,i=new ax("",t);return new In(new h0(i,-1,-1,-1),new h0(i,-1,-1,-1))}var lW=0;function cW(n){if(!n||!n.reference)return null;let o=n.reference;if(o.__anonymousType)return o.__anonymousType;if(o.__forward_ref__)return"__forward_ref__";let e=IN(o);return e.indexOf("(")>=0?(e=`anonymous_${lW++}`,o.__anonymousType=e):e=Up(e),e}function Up(n){return n.replace(/\W/g,"_")}var t6='(this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e})',BP=class extends yP{constructor(){super(!1)}visitWrappedNodeExpr(o,e){throw new Error("Cannot emit a WrappedNodeExpr in Javascript.")}visitDeclareVarStmt(o,e){return e.print(o,`var ${o.name}`),o.value&&(e.print(o," = "),o.value.visitExpression(this,e)),e.println(o,";"),null}visitTaggedTemplateLiteralExpr(o,e){let t=o.template.elements;return o.tag.visitExpression(this,e),e.print(o,`(${t6}(`),e.print(o,`[${t.map(i=>Gp(i.text,!1)).join(", ")}], `),e.print(o,`[${t.map(i=>Gp(i.rawText,!1)).join(", ")}])`),o.template.expressions.forEach(i=>{e.print(o,", "),i.visitExpression(this,e)}),e.print(o,")"),null}visitTemplateLiteralExpr(o,e){e.print(o,"`");for(let t=0;t"),Array.isArray(o.body))e.println(o,"{"),e.incIndent(),this.visitAllStatements(o.body,e),e.decIndent(),e.print(o,"}");else{let t=o.body instanceof rc;t&&e.print(o,"("),o.body.visitExpression(this,e),t&&e.print(o,")")}return null}visitDeclareFunctionStmt(o,e){return e.print(o,`function ${o.name}(`),this._visitParams(o.params,e),e.println(o,") {"),e.incIndent(),this.visitAllStatements(o.statements,e),e.decIndent(),e.println(o,"}"),null}visitLocalizedString(o,e){e.print(o,`$localize(${t6}(`);let t=[o.serializeI18nHead()];for(let i=1;iGp(i.cooked,!1)).join(", ")}], `),e.print(o,`[${t.map(i=>Gp(i.raw,!1)).join(", ")}])`),o.expressions.forEach(i=>{e.print(o,", "),i.visitExpression(this,e)}),e.print(o,")"),null}_visitParams(o,e){this.visitAllObjects(t=>e.print(null,t.name),o,e,",")}},cb;function dW(){if(cb===void 0){let n=Tf.trustedTypes;if(cb=null,n)try{cb=n.createPolicy("angular#unsafe-jit",{createScript:o=>o})}catch{}}return cb}function mW(n){return dW()?.createScript(n)||n}function n6(...n){if(!Tf.trustedTypes)return new Function(...n);let o=n.slice(0,-1).join(","),e=n[n.length-1],t=`(function anonymous(${o} +) { ${e} +})`,i=Tf.eval(mW(t));return i.bind===void 0?new Function(...n):(i.toString=()=>t,i.bind(Tf))}var jP=class{evaluateStatements(o,e,t,i){let a=new $P(t),s=xP.createRoot();return e.length>0&&!pW(e[0])&&(e=[De("use strict").toStmt(),...e]),a.visitAllStatements(e,s),a.createReturnStmt(s),this.evaluateCode(o,s,a.getArgs(),i)}evaluateCode(o,e,t,i){let a=`"use strict";${e.toSource()} +//# sourceURL=${o}`,s=[],d=[];for(let u in t)d.push(t[u]),s.push(u);if(i){let u=n6(...s.concat("return null;")).toString(),g=u.slice(0,u.indexOf("return null;")).split(` +`).length-1;a+=` +${e.toSourceMapGenerator(o,g).toJsComment()}`}let p=n6(...s.concat(a));return this.executeFunction(p,d)}executeFunction(o,e){return o(...e)}},$P=class extends BP{refResolver;_evalArgNames=[];_evalArgValues=[];_evalExportedVars=[];constructor(o){super(),this.refResolver=o}createReturnStmt(o){new Ia(new rc(this._evalExportedVars.map(t=>new Rg(t,di(t),!1)))).visitStatement(this,o)}getArgs(){let o={};for(let e=0;e0&&o.set("imports",io(n.imports));let e=Ht(ge.defineInjector).callFn([o.toLiteralMap()],void 0,!0),t=uW(n);return{expression:e,type:t,statements:[]}}function uW(n){return new xl(Ht(ge.InjectorDeclaration,[new xl(n.type.type)]))}var HP=class{context;constructor(o){this.context=o}resolveExternalReference(o){if(o.moduleName!=="@angular/core")throw new Error(`Cannot resolve external reference to ${o.moduleName}, only references to @angular/core are supported.`);if(!this.context.hasOwnProperty(o.name))throw new Error(`No value provided for @angular/core symbol '${o.name}'.`);return this.context[o.name]}},rx=(function(n){return n[n.Inline=0]="Inline",n[n.SideEffect=1]="SideEffect",n[n.Omit=2]="Omit",n})(rx||{}),km=(function(n){return n[n.Global=0]="Global",n[n.Local=1]="Local",n})(km||{});function gW(n){let o=[],e=new Am;if(e.set("type",n.type.value),n.kind===km.Global&&n.bootstrap.length>0&&e.set("bootstrap",qp(n.bootstrap,n.containsForwardDecls)),n.selectorScopeMode===rx.Inline)n.declarations.length>0&&e.set("declarations",qp(n.declarations,n.containsForwardDecls)),n.imports.length>0&&e.set("imports",qp(n.imports,n.containsForwardDecls)),n.exports.length>0&&e.set("exports",qp(n.exports,n.containsForwardDecls));else if(n.selectorScopeMode===rx.SideEffect){let a=fW(n);a!==null&&o.push(a)}n.schemas!==null&&n.schemas.length>0&&e.set("schemas",io(n.schemas.map(a=>a.value))),n.id!==null&&(e.set("id",n.id),o.push(Ht(ge.registerNgModuleType).callFn([n.type.value,n.id]).toStmt()));let t=Ht(ge.defineNgModule).callFn([e.toLiteralMap()],void 0,!0),i=_W(n);return{expression:t,type:i,statements:o}}function hW(n){let o=new Am;return o.set("type",new _i(n.type)),n.bootstrap!==void 0&&o.set("bootstrap",new _i(n.bootstrap)),n.declarations!==void 0&&o.set("declarations",new _i(n.declarations)),n.imports!==void 0&&o.set("imports",new _i(n.imports)),n.exports!==void 0&&o.set("exports",new _i(n.exports)),n.schemas!==void 0&&o.set("schemas",new _i(n.schemas)),n.id!==void 0&&o.set("id",new _i(n.id)),Ht(ge.defineNgModule).callFn([o.toLiteralMap()])}function _W(n){if(n.kind===km.Local)return new xl(n.type.value);let{type:o,declarations:e,exports:t,imports:i,includeImportTypes:a,publicDeclarationTypes:s}=n;return new xl(Ht(ge.NgModuleDeclaration,[new xl(o.type),s===null?qk(e):vW(s),a?qk(i):Bc,qk(t)]))}function fW(n){let o=new Am;if(n.kind===km.Global?n.declarations.length>0&&o.set("declarations",qp(n.declarations,n.containsForwardDecls)):n.declarationsExpression&&o.set("declarations",n.declarationsExpression),n.kind===km.Global?n.imports.length>0&&o.set("imports",qp(n.imports,n.containsForwardDecls)):n.importsExpression&&o.set("imports",n.importsExpression),n.kind===km.Global?n.exports.length>0&&o.set("exports",qp(n.exports,n.containsForwardDecls)):n.exportsExpression&&o.set("exports",n.exportsExpression),n.kind===km.Local&&n.bootstrapExpression&&o.set("bootstrap",n.bootstrapExpression),Object.keys(o.values).length===0)return null;let e=new Ms(Ht(ge.setNgModuleScope),[n.type.value,o.toLiteralMap()]),t=DU(e),i=new Pm([],[t.toStmt()]);return new Ms(i,[]).toStmt()}function qk(n){let o=n.map(e=>N0(e.type));return n.length>0?gr(io(o)):Bc}function vW(n){let o=n.map(e=>N0(e));return n.length>0?gr(io(o)):Bc}function o6(n){let o=[];o.push({key:"name",value:De(n.pipeName??n.name),quoted:!1}),o.push({key:"type",value:n.type.value,quoted:!1}),o.push({key:"pure",value:De(n.pure),quoted:!1}),n.isStandalone===!1&&o.push({key:"standalone",value:De(!1),quoted:!1});let e=Ht(ge.definePipe).callFn([yl(o)],void 0,!0),t=CW(n);return{expression:e,type:t,statements:[]}}function CW(n){return new xl(Ht(ge.PipeDeclaration,[Fx(n.type.type,n.typeArgumentCount),new xl(new _r(n.pipeName)),new xl(new _r(n.isStandalone))]))}var Gg=(function(n){return n[n.Directive=0]="Directive",n[n.Pipe=1]="Pipe",n[n.NgModule=2]="NgModule",n})(Gg||{}),bW=new Set(["inherit","initial","revert","unset","alternate","alternate-reverse","normal","reverse","backwards","both","forwards","none","paused","running","ease","ease-in","ease-in-out","ease-out","linear","step-start","step-end","end","jump-both","jump-end","jump-none","jump-start","start"]),xW=["@media","@supports","@document","@layer","@container","@scope","@starting-style"],UP=class{shimCssText(o,e,t=""){let i=[];o=o.replace(zW,d=>{if(d.match(LW))i.push(d);else{let p=d.match(RW);i.push(p?.join("")??"")}return tT}),o=this._insertDirectives(o);let a=this._scopeCssText(o,e,t),s=0;return a.replace(VW,()=>i[s++])}_insertDirectives(o){return o=this._insertPolyfillDirectivesInCssText(o),this._insertPolyfillRulesInCssText(o)}_scopeKeyframesRelatedCss(o,e){let t=new Set,i=db(o,a=>this._scopeLocalKeyframeDeclarations(a,e,t));return db(i,a=>this._scopeAnimationRule(a,e,t))}_scopeLocalKeyframeDeclarations(o,e,t){return ze(q({},o),{selector:o.selector.replace(/(^@(?:-webkit-)?keyframes(?:\s+))(['"]?)(.+)\2(\s*)$/,(i,a,s,d,p)=>(t.add(s6(d,s)),`${a}${s}${e}_${d}${s}${p}`))})}_scopeAnimationKeyframe(o,e,t){return o.replace(/^(\s*)(['"]?)(.+?)\2(\s*)$/,(i,a,s,d,p)=>(d=`${t.has(s6(d,s))?e+"_":""}${d}`,`${a}${s}${d}${s}${p}`))}_animationDeclarationKeyframesRe=/(^|\s+|,)(?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))(?=[,\s]|$)/g;_scopeAnimationRule(o,e,t){let i=o.content.replace(/((?:^|\s+|;)(?:-webkit-)?animation\s*:\s*),*([^;]+)/g,(a,s,d)=>s+d.replace(this._animationDeclarationKeyframesRe,(p,u,g="",C,M)=>C?`${u}${this._scopeAnimationKeyframe(`${g}${C}${g}`,e,t)}`:bW.has(M)?p:`${u}${this._scopeAnimationKeyframe(M,e,t)}`));return i=i.replace(/((?:^|\s+|;)(?:-webkit-)?animation-name(?:\s*):(?:\s*))([^;]+)/g,(a,s,d)=>`${s}${d.split(",").map(p=>this._scopeAnimationKeyframe(p,e,t)).join(",")}`),ze(q({},o),{content:i})}_insertPolyfillDirectivesInCssText(o){return o.replace(wW,function(...e){return e[2]+"{"})}_insertPolyfillRulesInCssText(o){return o.replace(MW,(...e)=>{let t=e[0].replace(e[1],"").replace(e[2],"");return e[4]+t})}_scopeCssText(o,e,t){let i=this._extractUnscopedRulesFromCssText(o);return o=this._insertPolyfillHostInCssText(o),o=this._convertColonHost(o),o=this._convertColonHostContext(o),o=this._convertShadowDOMSelectors(o),e&&(o=this._scopeKeyframesRelatedCss(o,e),o=this._scopeSelectors(o,e,t)),o=o+` +`+i,o.trim()}_extractUnscopedRulesFromCssText(o){let e="",t;for(a6.lastIndex=0;(t=a6.exec(o))!==null;){let i=t[0].replace(t[2],"").replace(t[1],t[4]);e+=i+` + +`}return e}_convertColonHost(o){return o.replace(TW,(e,t,i)=>{if(t){let a=[];for(let s of this._splitOnTopLevelCommas(t,!0)){let d=s.trim();if(!d)break;let p=ym+d.replace(sx,"")+i;a.push(p)}return a.join(",")}else return ym+i})}*_splitOnTopLevelCommas(o,e){let t=o.length,i=0,a=0;for(let s=0;s{let i=[[]],a=e.indexOf(wg);for(;a!==-1;){let s=e.substring(a+wg.length);if(!s||s[0]!=="("){e=s,a=e.indexOf(wg);continue}let d=[],p=0;for(let g of this._splitOnTopLevelCommas(s.substring(1),!0)){p=p+g.length+1;let C=g.trim();C&&d.push(C)}let u=i.length;XW(i,d.length);for(let g=0;gKW(s,e,t)).join(", ")})}_convertShadowDOMSelectors(o){return IW.reduce((e,t)=>e.replace(t," "),o)}_scopeSelectors(o,e,t){return db(o,i=>{let a=i.selector,s=i.content;return i.selector[0]!=="@"?a=this._scopeSelector({selector:a,scopeSelector:e,hostSelector:t,isParentSelector:!0}):xW.some(d=>i.selector.startsWith(d))?s=this._scopeSelectors(i.content,e,t):(i.selector.startsWith("@font-face")||i.selector.startsWith("@page"))&&(s=this._stripScopingSelectors(i.content)),new _0(a,s)})}_stripScopingSelectors(o){return db(o,e=>{let t=e.selector.replace(r6," ").replace(Qk," ");return new _0(t,e.content)})}_safeSelector;_shouldScopeIndicator;_scopeSelector({selector:o,scopeSelector:e,hostSelector:t,isParentSelector:i=!1}){let a=/ ?,(?!(?:[^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\))) ?/;return o.split(a).map(s=>s.split(r6)).map(s=>{let[d,...p]=s;return[(g=>this._selectorNeedsScoping(g,e)?this._applySelectorScope({selector:g,scopeSelector:e,hostSelector:t,isParentSelector:i}):g)(d),...p].join(" ")}).join(", ")}_selectorNeedsScoping(o,e){return!this._makeScopeMatcher(e).test(o)}_makeScopeMatcher(o){let e=/\[/g,t=/\]/g;return o=o.replace(e,"\\[").replace(t,"\\]"),new RegExp("^("+o+")"+AW,"m")}_applySimpleSelectorScope(o,e,t){if(Pg.lastIndex=0,Pg.test(o)){let i=`[${t}]`,a=o;for(;a.match(Qk);)a=a.replace(Qk,(s,d)=>d.replace(/([^:\)]*)(:*)(.*)/,(p,u,g,C)=>u+i+g+C));return a.replace(Pg,i)}return e+" "+o}_applySelectorScope({selector:o,scopeSelector:e,hostSelector:t,isParentSelector:i}){let a=/\[is=([^\]]*)\]/g;e=e.replace(a,(P,...k)=>k[0]);let s=`[${e}]`,d=P=>{let k=P.trim();if(!k)return P;if(P.includes(ym)){if(k=this._applySimpleSelectorScope(P,e,t),!P.match(DW)){let[S,O,A,D]=k.match(/([^:]*)(:*)([\s\S]*)/);k=O+s+A+D}}else{let S=P.replace(Pg,"");if(S.length>0){let O=S.match(/([^:]*)(:*)([\s\S]*)/);O&&(k=O[1]+s+O[2]+O[3])}}return k},p=P=>{let k="",S=[],O;for(;(O=gf.exec(P))!==null;){let A=1,D=gf.lastIndex;for(;D{let[D]=A.match(gf)??[],F=A.slice(D?.length,-1);F.includes(ym)&&(this._shouldScopeIndicator=!0);let I=this._scopeSelector({selector:F,scopeSelector:e,hostSelector:t});return`${D}${I})`}).join(""):(this._shouldScopeIndicator=this._shouldScopeIndicator||P.includes(ym),k=this._shouldScopeIndicator?d(P):P),k};i&&(this._safeSelector=new WP(o),o=this._safeSelector.content());let u="",g=0,C,M=/( |>|\+|~(?!=))(?!([^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\)))\s*/g,x=o.includes(ym);for((i||this._shouldScopeIndicator)&&(this._shouldScopeIndicator=!x);(C=M.exec(o))!==null;){let P=C[1],k=o.slice(g,C.index);if(k.match(/__esc-ph-(\d+)__/)&&o[C.index+1]?.match(/[a-fA-F\d]/))continue;let S=p(k);u+=`${S} ${P} `,g=M.lastIndex}let b=o.substring(g);return u+=p(b),this._safeSelector.restore(u)}_insertPolyfillHostInCssText(o){return o.replace(FW,wg).replace(NW,sx)}},WP=class{placeholders=[];index=0;_content;constructor(o){o=this._escapeRegexMatches(o,/(\[[^\]]*\])/g),o=o.replace(/(\\.)/g,(e,t)=>{let i=`__esc-ph-${this.index}__`;return this.placeholders.push(t),this.index++,i}),this._content=o.replace(PW,(e,t,i)=>{let a=`__ph-${this.index}__`;return this.placeholders.push(`(${i})`),this.index++,t+a})}restore(o){return o.replace(/__(?:ph|esc-ph)-(\d+)__/g,(e,t)=>this.placeholders[+t])}content(){return this._content}_escapeRegexMatches(o,e){return o.replace(e,(t,i)=>{let a=`__ph-${this.index}__`;return this.placeholders.push(i),this.index++,a})}},yW="(:(where|is)\\()?",gf=/:(where|is)\(/gi,wW=/polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim,MW=/(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim,a6=/(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim,sx="-shadowcsshost",wg="-shadowcsscontext",GP="[^)(]*",SW=String.raw`(?:\(${GP}\)|${GP})+?`,kW=String.raw`(?:\(${SW}\)|${GP})+?`,eT=String.raw`(?:\((${kW})\))`,PW=new RegExp(String.raw`(:nth-[-\w]+)`+eT,"g"),TW=new RegExp(sx+eT+"?([^,{]*)","gim"),EW=wg+eT+"?([^{]*)",OW=new RegExp(`${yW}(${EW})`,"gim"),ym=sx+"-no-combinator",DW=new RegExp(`${ym}(?![^(]*\\))`,"g"),Qk=/-shadowcsshost-no-combinator([^\s,]*)/,IW=[/::shadow/g,/::content/g,/\/shadow-deep\//g,/\/shadow\//g],r6=/(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g,AW="([>\\s~+[.,{:][\\s\\S]*)?$",Pg=/-shadowcsshost/gim,NW=/:host/gim,FW=/:host-context/gim,RW=/\r?\n/g,zW=/\/\*[\s\S]*?\*\//g,LW=/\/\*\s*#\s*source(Mapping)?URL=/g,tT="%COMMENT%",VW=new RegExp(tT,"g"),Kk="%BLOCK%",BW=new RegExp(`(\\s*(?:${tT}\\s*)*)([^;\\{\\}]+?)(\\s*)((?:{%BLOCK%}?\\s*;?)|(?:\\s*;))`,"g"),jW=new Map([["{","}"]]),JN="%COMMA_IN_PLACEHOLDER%",eF="%SEMI_IN_PLACEHOLDER%",tF="%COLON_IN_PLACEHOLDER%",$W=new RegExp(JN,"g"),HW=new RegExp(eF,"g"),UW=new RegExp(tF,"g"),_0=class{selector;content;constructor(o,e){this.selector=o,this.content=e}};function db(n,o){let e=qW(n),t=WW(e,jW,Kk),i=0,a=t.escapedString.replace(BW,(...s)=>{let d=s[2],p="",u=s[4],g="";u&&u.startsWith("{"+Kk)&&(p=t.blocks[i++],u=u.substring(Kk.length+1),g="{");let C=o(new _0(d,p));return`${s[1]}${C.selector}${s[3]}${g}${C.content}${u}`});return QW(a)}var qP=class{escapedString;blocks;constructor(o,e){this.escapedString=o,this.blocks=e}};function WW(n,o,e){let t=[],i=[],a=0,s=0,d=-1,p,u;for(let g=0;g0;){let s=a.length,d=n.pop();for(let p=0;pi?`${e}${s}${o}`:`${e}${s}${t}${o}, ${e}${s} ${t}${o}`).join(",")}function XW(n,o){let e=n.length;for(let t=1;t{class n{static nextListId=0;debugListId=n.nextListId++;head={kind:j.ListEnd,next:null,prev:null,debugListId:this.debugListId};tail={kind:j.ListEnd,next:null,prev:null,debugListId:this.debugListId};constructor(){this.head.next=this.tail,this.tail.prev=this.head}push(e){if(Array.isArray(e)){for(let i of e)this.push(i);return}n.assertIsNotEnd(e),n.assertIsUnowned(e),e.debugListId=this.debugListId;let t=this.tail.prev;e.prev=t,t.next=e,e.next=this.tail,this.tail.prev=e}prepend(e){if(e.length===0)return;for(let a of e)n.assertIsNotEnd(a),n.assertIsUnowned(a),a.debugListId=this.debugListId;let t=this.head.next,i=this.head;for(let a of e)i.next=a,a.prev=i,i=a;i.next=t,t.prev=i}*[Symbol.iterator](){let e=this.head.next;for(;e!==this.tail;){n.assertIsOwned(e,this.debugListId);let t=e.next;yield e,e=t}}*reversed(){let e=this.tail.prev;for(;e!==this.head;){n.assertIsOwned(e,this.debugListId);let t=e.prev;yield e,e=t}}static replace(e,t){n.assertIsNotEnd(e),n.assertIsNotEnd(t),n.assertIsOwned(e),n.assertIsUnowned(t),t.debugListId=e.debugListId,e.prev!==null&&(e.prev.next=t,t.prev=e.prev),e.next!==null&&(e.next.prev=t,t.next=e.next),e.debugListId=null,e.prev=null,e.next=null}static replaceWithMany(e,t){if(t.length===0){n.remove(e);return}n.assertIsNotEnd(e),n.assertIsOwned(e);let i=e.debugListId;e.debugListId=null;for(let g of t)n.assertIsNotEnd(g),n.assertIsUnowned(g);let{prev:a,next:s}=e;e.prev=null,e.next=null;let d=a;for(let g of t)n.assertIsUnowned(g),g.debugListId=i,d.next=g,g.prev=d,g.next=null,d=g;let p=t[0],u=d;a!==null&&(a.next=p,p.prev=a),s!==null&&(s.prev=u,u.next=s)}static remove(e){n.assertIsNotEnd(e),n.assertIsOwned(e),e.prev.next=e.next,e.next.prev=e.prev,e.debugListId=null,e.prev=null,e.next=null}static insertBefore(e,t){if(Array.isArray(e)){for(let i of e)n.insertBefore(i,t);return}if(n.assertIsOwned(t),t.prev===null)throw new Error("AssertionError: illegal operation on list start");n.assertIsNotEnd(e),n.assertIsUnowned(e),e.debugListId=t.debugListId,e.prev=null,t.prev.next=e,e.prev=t.prev,e.next=t,t.prev=e}static insertAfter(e,t){if(n.assertIsOwned(t),t.next===null)throw new Error("AssertionError: illegal operation on list end");n.assertIsNotEnd(e),n.assertIsUnowned(e),e.debugListId=t.debugListId,t.next.prev=e,e.next=t.next,e.prev=t,t.next=e}static assertIsUnowned(e){if(e.debugListId!==null)throw new Error(`AssertionError: illegal operation on owned node: ${j[e.kind]}`)}static assertIsOwned(e,t){if(e.debugListId===null)throw new Error(`AssertionError: illegal operation on unowned node: ${j[e.kind]}`);if(t!==void 0&&e.debugListId!==t)throw new Error(`AssertionError: node belongs to the wrong list (expected ${t}, actual ${e.debugListId})`)}static assertIsNotEnd(e){if(e.kind===j.ListEnd)throw new Error("AssertionError: illegal operation on list head or tail")}}return n})();function Js(n){return q({kind:j.Statement,statement:n},An)}function Mm(n,o,e,t){return q({kind:j.Variable,xref:n,variable:o,initializer:e,flags:t},An)}var An={debugListId:null,prev:null,next:null},nF=Symbol("ConsumesSlot"),nT=Symbol("DependsOnSlotContext"),Cu=Symbol("ConsumesVars"),L0=Symbol("UsesVarOffset"),wl={[nF]:!0,numSlotsUsed:1},ks={[nT]:!0},Ps={[Cu]:!0};function nh(n){return n[nF]===!0}function v0(n){return n[nT]===!0}function Xk(n){return n[Cu]===!0}function l6(n){return n[L0]===!0}function YW(n,o,e){return q(q(q({kind:j.InterpolateText,target:n,interpolation:o,sourceSpan:e},ks),Ps),An)}var aa=class{strings;expressions;i18nPlaceholders;constructor(o,e,t){if(this.strings=o,this.expressions=e,this.i18nPlaceholders=t,t.length!==0&&t.length!==e.length)throw new Error(`Expected ${e.length} placeholders to match interpolation expression count, but got ${t.length}`)}};function uu(n,o,e,t,i,a,s,d,p,u,g){return q({kind:j.Binding,bindingKind:o,target:n,name:e,expression:t,unit:i,securityContext:a,isTextAttribute:s,isStructuralTemplateAttribute:d,templateKind:p,i18nContext:null,i18nMessage:u,sourceSpan:g},An)}function ZW(n,o,e,t,i,a,s,d,p,u){return q(q(q({kind:j.Property,target:n,name:o,expression:e,bindingKind:t,securityContext:i,sanitizer:null,isStructuralTemplateAttribute:a,templateKind:s,i18nContext:d,i18nMessage:p,sourceSpan:u},ks),Ps),An)}function JW(n,o,e,t,i,a,s,d,p){return q(q(q({kind:j.TwoWayProperty,target:n,name:o,expression:e,securityContext:t,sanitizer:null,isStructuralTemplateAttribute:i,templateKind:a,i18nContext:s,i18nMessage:d,sourceSpan:p},ks),Ps),An)}function eG(n,o,e,t,i){return q(q(q({kind:j.StyleProp,target:n,name:o,expression:e,unit:t,sourceSpan:i},ks),Ps),An)}function tG(n,o,e,t){return q(q(q({kind:j.ClassProp,target:n,name:o,expression:e,sourceSpan:t},ks),Ps),An)}function nG(n,o,e){return q(q(q({kind:j.StyleMap,target:n,expression:o,sourceSpan:e},ks),Ps),An)}function iG(n,o,e){return q(q(q({kind:j.ClassMap,target:n,expression:o,sourceSpan:e},ks),Ps),An)}function c6(n,o,e,t,i,a,s,d,p,u){return q(q(q({kind:j.Attribute,target:n,namespace:o,name:e,expression:t,securityContext:i,sanitizer:null,isTextAttribute:a,isStructuralTemplateAttribute:s,templateKind:d,i18nContext:null,i18nMessage:p,sourceSpan:u},ks),Ps),An)}function oG(n,o){return q({kind:j.Advance,delta:n,sourceSpan:o},An)}function iF(n,o,e,t){return q(q(q({kind:j.Conditional,target:n,test:o,conditions:e,processed:null,sourceSpan:t,contextValue:null},An),ks),Ps)}function aG(n,o,e,t){return q(q({kind:j.Repeater,target:n,targetSlot:o,collection:e,sourceSpan:t},An),ks)}function d6(n,o,e,t,i,a,s){return q({kind:j.AnimationBinding,name:n,target:o,animationKind:e,expression:t,i18nMessage:null,securityContext:i,sanitizer:null,sourceSpan:a,animationBindingKind:s},An)}function rG(n,o,e,t){return q(q(q({kind:j.DeferWhen,target:n,expr:o,modifier:e,sourceSpan:t},An),ks),Ps)}function oF(n,o,e,t,i,a,s,d,p,u,g){return q(q(q({kind:j.I18nExpression,context:n,target:o,i18nOwner:e,handle:t,expression:i,icuPlaceholder:a,i18nPlaceholder:s,resolutionTime:d,usage:p,name:u,sourceSpan:g},An),Ps),ks)}function sG(n,o,e){return q({kind:j.I18nApply,owner:n,handle:o,sourceSpan:e},An)}function lG(n,o,e,t){return q(q(q({kind:j.StoreLet,target:n,declaredName:o,value:e,sourceSpan:t},ks),Ps),An)}function cG(n,o){return q(q({kind:j.Control,sourceSpan:o,target:n},ks),An)}function Gc(n){return n instanceof oo}var oo=class extends Qi{constructor(o=null){super(null,o)}},ir=class n extends oo{name;kind=Jt.LexicalRead;constructor(o){super(),this.name=o}visitExpression(o,e){}isEquivalent(o){return this.name===o.name}isConstant(){return!1}transformInternalExpressions(){}clone(){return new n(this.name)}},lx=class n extends oo{target;targetSlot;offset;kind=Jt.Reference;constructor(o,e,t){super(),this.target=o,this.targetSlot=e,this.offset=t}visitExpression(){}isEquivalent(o){return o instanceof n&&o.target===this.target}isConstant(){return!1}transformInternalExpressions(){}clone(){return new n(this.target,this.targetSlot,this.offset)}},C0=class n extends oo{target;value;sourceSpan;kind=Jt.StoreLet;[Cu]=!0;[nT]=!0;constructor(o,e,t){super(),this.target=o,this.value=e,this.sourceSpan=t}visitExpression(){}isEquivalent(o){return o instanceof n&&o.target===this.target&&o.value.isEquivalent(this.value)}isConstant(){return!1}transformInternalExpressions(o,e){this.value=Bt(this.value,o,e)}clone(){return new n(this.target,this.value,this.sourceSpan)}},b0=class n extends oo{target;targetSlot;kind=Jt.ContextLetReference;constructor(o,e){super(),this.target=o,this.targetSlot=e}visitExpression(){}isEquivalent(o){return o instanceof n&&o.target===this.target}isConstant(){return!1}transformInternalExpressions(){}clone(){return new n(this.target,this.targetSlot)}},Fm=class n extends oo{view;kind=Jt.Context;constructor(o){super(),this.view=o}visitExpression(){}isEquivalent(o){return o instanceof n&&o.view===this.view}isConstant(){return!1}transformInternalExpressions(){}clone(){return new n(this.view)}},QP=class n extends oo{view;kind=Jt.TrackContext;constructor(o){super(),this.view=o}visitExpression(){}isEquivalent(o){return o instanceof n&&o.view===this.view}isConstant(){return!1}transformInternalExpressions(){}clone(){return new n(this.view)}},cx=class n extends oo{kind=Jt.NextContext;steps=1;visitExpression(){}isEquivalent(o){return o instanceof n&&o.steps===this.steps}isConstant(){return!1}transformInternalExpressions(){}clone(){let o=new n;return o.steps=this.steps,o}},KP=class n extends oo{kind=Jt.GetCurrentView;constructor(){super()}visitExpression(){}isEquivalent(o){return o instanceof n}isConstant(){return!1}transformInternalExpressions(){}clone(){return new n}},x0=class n extends oo{view;kind=Jt.RestoreView;constructor(o){super(),this.view=o}visitExpression(o,e){typeof this.view!="number"&&this.view.visitExpression(o,e)}isEquivalent(o){return!(o instanceof n)||typeof o.view!=typeof this.view?!1:typeof this.view=="number"?this.view===o.view:this.view.isEquivalent(o.view)}isConstant(){return!1}transformInternalExpressions(o,e){typeof this.view!="number"&&(this.view=Bt(this.view,o,e))}clone(){return new n(this.view instanceof Qi?this.view.clone():this.view)}},dx=class n extends oo{expr;kind=Jt.ResetView;constructor(o){super(),this.expr=o}visitExpression(o,e){this.expr.visitExpression(o,e)}isEquivalent(o){return o instanceof n&&this.expr.isEquivalent(o.expr)}isConstant(){return!1}transformInternalExpressions(o,e){this.expr=Bt(this.expr,o,e)}clone(){return new n(this.expr.clone())}},mx=class n extends oo{target;value;kind=Jt.TwoWayBindingSet;constructor(o,e){super(),this.target=o,this.value=e}visitExpression(o,e){this.target.visitExpression(o,e),this.value.visitExpression(o,e)}isEquivalent(o){return this.target.isEquivalent(o.target)&&this.value.isEquivalent(o.value)}isConstant(){return!1}transformInternalExpressions(o,e){this.target=Bt(this.target,o,e),this.value=Bt(this.value,o,e)}clone(){return new n(this.target,this.value)}},Ad=class n extends oo{xref;kind=Jt.ReadVariable;name=null;constructor(o){super(),this.xref=o}visitExpression(){}isEquivalent(o){return o instanceof n&&o.xref===this.xref}isConstant(){return!1}transformInternalExpressions(){}clone(){let o=new n(this.xref);return o.name=this.name,o}},gu=class n extends oo{kind=Jt.PureFunctionExpr;[Cu]=!0;[L0]=!0;varOffset=null;body;args;fn=null;constructor(o,e){super(),this.body=o,this.args=e}visitExpression(o,e){this.body?.visitExpression(o,e);for(let t of this.args)t.visitExpression(o,e)}isEquivalent(o){return!(o instanceof n)||o.args.length!==this.args.length?!1:o.body!==null&&this.body!==null&&o.body.isEquivalent(this.body)&&o.args.every((e,t)=>e.isEquivalent(this.args[t]))}isConstant(){return!1}transformInternalExpressions(o,e){this.body!==null?this.body=Bt(this.body,o,e|ai.InChildOperation):this.fn!==null&&(this.fn=Bt(this.fn,o,e));for(let t=0;te.clone()));return o.fn=this.fn?.clone()??null,o.varOffset=this.varOffset,o}},Rm=class n extends oo{index;kind=Jt.PureFunctionParameterExpr;constructor(o){super(),this.index=o}visitExpression(){}isEquivalent(o){return o instanceof n&&o.index===this.index}isConstant(){return!0}transformInternalExpressions(){}clone(){return new n(this.index)}},hu=class n extends oo{target;targetSlot;name;args;kind=Jt.PipeBinding;[Cu]=!0;[L0]=!0;varOffset=null;constructor(o,e,t,i){super(),this.target=o,this.targetSlot=e,this.name=t,this.args=i}visitExpression(o,e){for(let t of this.args)t.visitExpression(o,e)}isEquivalent(){return!1}isConstant(){return!1}transformInternalExpressions(o,e){for(let t=0;te.clone()));return o.varOffset=this.varOffset,o}},y0=class n extends oo{target;targetSlot;name;args;numArgs;kind=Jt.PipeBindingVariadic;[Cu]=!0;[L0]=!0;varOffset=null;constructor(o,e,t,i,a){super(),this.target=o,this.targetSlot=e,this.name=t,this.args=i,this.numArgs=a}visitExpression(o,e){this.args.visitExpression(o,e)}isEquivalent(){return!1}isConstant(){return!1}transformInternalExpressions(o,e){this.args=Bt(this.args,o,e)}clone(){let o=new n(this.target,this.targetSlot,this.name,this.args.clone(),this.numArgs);return o.varOffset=this.varOffset,o}},qg=class n extends oo{receiver;name;kind=Jt.SafePropertyRead;constructor(o,e){super(),this.receiver=o,this.name=e}get index(){return this.name}visitExpression(o,e){this.receiver.visitExpression(o,e)}isEquivalent(){return!1}isConstant(){return!1}transformInternalExpressions(o,e){this.receiver=Bt(this.receiver,o,e)}clone(){return new n(this.receiver.clone(),this.name)}},Qg=class n extends oo{receiver;index;kind=Jt.SafeKeyedRead;constructor(o,e,t){super(t),this.receiver=o,this.index=e}visitExpression(o,e){this.receiver.visitExpression(o,e),this.index.visitExpression(o,e)}isEquivalent(){return!1}isConstant(){return!1}transformInternalExpressions(o,e){this.receiver=Bt(this.receiver,o,e),this.index=Bt(this.index,o,e)}clone(){return new n(this.receiver.clone(),this.index.clone(),this.sourceSpan)}},_u=class n extends oo{receiver;args;kind=Jt.SafeInvokeFunction;constructor(o,e){super(),this.receiver=o,this.args=e}visitExpression(o,e){this.receiver.visitExpression(o,e);for(let t of this.args)t.visitExpression(o,e)}isEquivalent(){return!1}isConstant(){return!1}transformInternalExpressions(o,e){this.receiver=Bt(this.receiver,o,e);for(let t=0;to.clone()))}},Kg=class n extends oo{guard;expr;kind=Jt.SafeTernaryExpr;constructor(o,e){super(),this.guard=o,this.expr=e}visitExpression(o,e){this.guard.visitExpression(o,e),this.expr.visitExpression(o,e)}isEquivalent(){return!1}isConstant(){return!1}transformInternalExpressions(o,e){this.guard=Bt(this.guard,o,e),this.expr=Bt(this.expr,o,e)}clone(){return new n(this.guard.clone(),this.expr.clone())}},w0=class n extends oo{kind=Jt.EmptyExpr;visitExpression(o,e){}isEquivalent(o){return o instanceof n}isConstant(){return!0}clone(){return new n}transformInternalExpressions(){}},qc=class n extends oo{expr;xref;kind=Jt.AssignTemporaryExpr;name=null;constructor(o,e){super(),this.expr=o,this.xref=e}visitExpression(o,e){this.expr.visitExpression(o,e)}isEquivalent(){return!1}isConstant(){return!1}transformInternalExpressions(o,e){this.expr=Bt(this.expr,o,e)}clone(){let o=new n(this.expr.clone(),this.xref);return o.name=this.name,o}},zm=class n extends oo{xref;kind=Jt.ReadTemporaryExpr;name=null;constructor(o){super(),this.xref=o}visitExpression(o,e){}isEquivalent(){return this.xref===this.xref}isConstant(){return!1}transformInternalExpressions(o,e){}clone(){let o=new n(this.xref);return o.name=this.name,o}},px=class n extends oo{slot;kind=Jt.SlotLiteralExpr;constructor(o){super(),this.slot=o}visitExpression(o,e){}isEquivalent(o){return o instanceof n&&o.slot===this.slot}isConstant(){return!0}clone(){return new n(this.slot)}transformInternalExpressions(){}},ux=class n extends oo{expr;target;targetSlot;alias;kind=Jt.ConditionalCase;constructor(o,e,t,i=null){super(),this.expr=o,this.target=e,this.targetSlot=t,this.alias=i}visitExpression(o,e){this.expr!==null&&this.expr.visitExpression(o,e)}isEquivalent(o){return o instanceof n&&o.expr===this.expr}isConstant(){return!0}clone(){return new n(this.expr,this.target,this.targetSlot)}transformInternalExpressions(o,e){this.expr!==null&&(this.expr=Bt(this.expr,o,e))}},M0=class n extends oo{expr;kind=Jt.ConstCollected;constructor(o){super(),this.expr=o}transformInternalExpressions(o,e){this.expr=o(this.expr,e)}visitExpression(o,e){this.expr.visitExpression(o,e)}isEquivalent(o){return o instanceof n?this.expr.isEquivalent(o.expr):!1}isConstant(){return this.expr.isConstant()}clone(){return new n(this.expr)}},XP=class n extends oo{parameters;body;kind=Jt.ArrowFunction;[Cu]=!0;[L0]=!0;contextName=Zs;currentViewName="view";varOffset=null;ops;constructor(o,e){super(),this.parameters=o,this.body=e,this.ops=new Je,this.ops.push([Js(new Ia(e,e.sourceSpan))])}visitExpression(o,e){for(let t of this.ops)wa(t,i=>{i.visitExpression(o,e)})}isEquivalent(o){return o instanceof n&&o.parameters.length===this.parameters.length&&o.parameters.every((e,t)=>e.isEquivalent(this.parameters[t]))&&o.body.isEquivalent(this.body)}isConstant(){return!1}transformInternalExpressions(o,e){for(let t of this.ops)ra(t,o,e|(ai.InChildOperation|ai.InArrowFunctionOperation))}clone(){let o=new n(this.parameters,this.body);return o.varOffset=this.varOffset,o.ops=this.ops,o}};function wa(n,o){ra(n,(e,t)=>(o(e,t),e),ai.None)}var ai=(function(n){return n[n.None=0]="None",n[n.InChildOperation=1]="InChildOperation",n[n.InArrowFunctionOperation=2]="InArrowFunctionOperation",n})(ai||{});function Yk(n,o,e){for(let t=0;tBt(t,o,e));else if(n instanceof vu)if(Array.isArray(n.body))for(let t=0;t{!s&&v0(d)&&d.target!==a.xref&&(s=!0)}),s)break;e=e.next}}}}function RG(n){if(!(!n.enableDebugLocations||n.relativeTemplatePath===null))for(let o of n.units){let e=[];for(let t of o.create)if(t.kind===j.ElementStart||t.kind===j.Element){let i=t.startSourceSpan.start;e.push({targetSlot:t.handle,offset:i.offset,line:i.line,column:i.col})}e.length>0&&o.create.push(TG(n.relativeTemplatePath,e))}}function gF(n){let o=new Map;for(let e of n.create)nh(e)&&(o.set(e.xref,e),e.kind===j.RepeaterCreate&&e.emptyView!==null&&o.set(e.emptyView,e));return o}function zG(n){for(let o of n.units){let e=gF(o);for(let t of o.ops())switch(t.kind){case j.Attribute:LG(o,t,e);break;case j.Property:if(t.bindingKind!==Qt.LegacyAnimation&&t.bindingKind!==Qt.Animation){let i;t.i18nMessage!==null&&t.templateKind===null?i=Qt.I18n:t.isStructuralTemplateAttribute?i=Qt.Template:i=Qt.Property,Je.insertBefore(Cl(t.target,i,null,t.name,null,null,null,t.securityContext),Mg(e,t.target))}break;case j.TwoWayProperty:Je.insertBefore(Cl(t.target,Qt.TwoWayProperty,null,t.name,null,null,null,t.securityContext),Mg(e,t.target));break;case j.StyleProp:case j.ClassProp:t.expression instanceof w0&&Je.insertBefore(Cl(t.target,Qt.Property,null,t.name,null,null,null,gi.STYLE),Mg(e,t.target));break;case j.Listener:if(!t.isLegacyAnimationListener){let i=Cl(t.target,Qt.Property,null,t.name,null,null,null,gi.NONE);if(n.kind===Dt.Host)break;Je.insertBefore(i,Mg(e,t.target))}break;case j.TwoWayListener:if(n.kind!==Dt.Host){let i=Cl(t.target,Qt.Property,null,t.name,null,null,null,gi.NONE);Je.insertBefore(i,Mg(e,t.target))}break}}}function Mg(n,o){let e=n.get(o);if(e===void 0)throw new Error("All attributes should have an element-like target.");return e}function LG(n,o,e){if(!(o.expression instanceof aa)&&o.isTextAttribute){let t=Cl(o.target,o.isStructuralTemplateAttribute?Qt.Template:Qt.Attribute,o.namespace,o.name,o.expression,o.i18nContext,o.i18nMessage,o.securityContext);if(n.job.kind===Dt.Host)n.create.push(t);else{let i=Mg(e,o.target);Je.insertBefore(t,i)}Je.remove(o)}}var m6="aria-";function hF(n){return n.startsWith(m6)&&n.length>m6.length}function VG(n,o){let e=n.get(o);if(e===void 0)throw new Error("All attributes should have an element-like target.");return e}function BG(n){let o=new Map;for(let e of n.units)for(let t of e.create)Lm(t)&&o.set(t.xref,t);for(let e of n.units)for(let t of e.ops())if(t.kind===j.Binding)switch(t.bindingKind){case Qt.Attribute:if(t.name==="ngNonBindable"){Je.remove(t);let i=VG(o,t.target);i.nonBindable=!0}else if(t.name.startsWith("animate."))Je.replace(t,d6(t.name,t.target,t.name==="animate.enter"?"enter":"leave",t.expression,t.securityContext,t.sourceSpan,0));else{let[i,a]=hr(t.name);Je.replace(t,c6(t.target,i,a,t.expression,t.securityContext,t.isTextAttribute,t.isStructuralTemplateAttribute,t.templateKind,t.i18nMessage,t.sourceSpan))}break;case Qt.Animation:Je.replace(t,d6(t.name,t.target,t.name==="animate.enter"?"enter":"leave",t.expression,t.securityContext,t.sourceSpan,1));break;case Qt.Property:case Qt.LegacyAnimation:n.mode===vs.DomOnly&&hF(t.name)?Je.replace(t,c6(t.target,null,t.name,t.expression,t.securityContext,!1,t.isStructuralTemplateAttribute,t.templateKind,t.i18nMessage,t.sourceSpan)):n.kind===Dt.Host?Je.replace(t,OG(t.name,t.expression,t.bindingKind,t.i18nContext,t.securityContext,t.sourceSpan)):Je.replace(t,ZW(t.target,t.name,t.expression,t.bindingKind,t.securityContext,t.isStructuralTemplateAttribute,t.templateKind,t.i18nContext,t.i18nMessage,t.sourceSpan));break;case Qt.TwoWayProperty:if(!(t.expression instanceof Qi))throw new Error(`Expected value of two-way property binding "${t.name}" to be an expression`);Je.replace(t,JW(t.target,t.name,t.expression,t.securityContext,t.isStructuralTemplateAttribute,t.templateKind,t.i18nContext,t.i18nMessage,t.sourceSpan));break;case Qt.I18n:case Qt.ClassName:case Qt.StyleProperty:throw new Error(`Unhandled binding of kind ${Qt[t.bindingKind]}`)}}var p6=new Map([[ge.ariaProperty,ge.ariaProperty],[ge.attribute,ge.attribute],[ge.classProp,ge.classProp],[ge.element,ge.element],[ge.elementContainer,ge.elementContainer],[ge.elementContainerEnd,ge.elementContainerEnd],[ge.elementContainerStart,ge.elementContainerStart],[ge.elementEnd,ge.elementEnd],[ge.elementStart,ge.elementStart],[ge.domProperty,ge.domProperty],[ge.i18nExp,ge.i18nExp],[ge.listener,ge.listener],[ge.listener,ge.listener],[ge.property,ge.property],[ge.styleProp,ge.styleProp],[ge.syntheticHostListener,ge.syntheticHostListener],[ge.syntheticHostProperty,ge.syntheticHostProperty],[ge.templateCreate,ge.templateCreate],[ge.twoWayProperty,ge.twoWayProperty],[ge.twoWayListener,ge.twoWayListener],[ge.declareLet,ge.declareLet],[ge.conditionalCreate,ge.conditionalBranchCreate],[ge.conditionalBranchCreate,ge.conditionalBranchCreate],[ge.domElement,ge.domElement],[ge.domElementStart,ge.domElementStart],[ge.domElementEnd,ge.domElementEnd],[ge.domElementContainer,ge.domElementContainer],[ge.domElementContainerStart,ge.domElementContainerStart],[ge.domElementContainerEnd,ge.domElementContainerEnd],[ge.domListener,ge.domListener],[ge.domTemplate,ge.domTemplate],[ge.animationEnter,ge.animationEnter],[ge.animationLeave,ge.animationLeave],[ge.animationEnterListener,ge.animationEnterListener],[ge.animationLeaveListener,ge.animationLeaveListener]]),jG=256;function $G(n){for(let o of n.units)u6(o.create),u6(o.update)}function u6(n){let o=null;for(let e of n){if(e.kind!==j.Statement||!(e.statement instanceof fr)){o=null;continue}if(!(e.statement.expr instanceof Ms)||!(e.statement.expr.fn instanceof ou)){o=null;continue}let t=e.statement.expr.fn.value;if(!p6.has(t)){o=null;continue}if(o!==null&&p6.get(o.instruction)===t&&o.lengthi==="")&&(e.expression=e.expression.expressions[0])}function UG(n){for(let o of n.units)for(let e of o.ops()){if(e.kind!==j.Conditional)continue;let t,i=e.conditions.findIndex(d=>d.expr===null);if(i>=0){let d=e.conditions.splice(i,1)[0].targetSlot;t=new px(d)}else t=De(-1);let a=e.test==null?null:new qc(e.test,n.allocateXrefId()),s=null;for(let d=e.conditions.length-1;d>=0;d--){let p=e.conditions[d];if(p.expr!==null){if(a!==null){let u=d===0?a:new zm(a.xref);p.expr=new Pi(lt.Identical,u,p.expr)}else p.alias!==null&&(s??=n.allocateXrefId(),p.expr=new qc(p.expr,s),e.contextValue=new zm(s));t=new jc(p.expr,new px(p.targetSlot),t)}}e.processed=t,e.conditions=[]}}var WG=new Map([["&&",lt.And],[">",lt.Bigger],[">=",lt.BiggerEquals],["|",lt.BitwiseOr],["&",lt.BitwiseAnd],["/",lt.Divide],["=",lt.Assign],["==",lt.Equals],["===",lt.Identical],["<",lt.Lower],["<=",lt.LowerEquals],["-",lt.Minus],["%",lt.Modulo],["**",lt.Exponentiation],["*",lt.Multiply],["!=",lt.NotEquals],["!==",lt.NotIdentical],["??",lt.NullishCoalesce],["||",lt.Or],["+",lt.Plus],["in",lt.In],["instanceof",lt.InstanceOf],["+=",lt.AdditionAssignment],["-=",lt.SubtractionAssignment],["*=",lt.MultiplicationAssignment],["/=",lt.DivisionAssignment],["%=",lt.RemainderAssignment],["**=",lt.ExponentiationAssignment],["&&=",lt.AndAssignment],["||=",lt.OrAssignment],["??=",lt.NullishCoalesceAssignment]]);function _F(n){let o=new Map([["svg",Oa.SVG],["math",Oa.Math]]);return n===null?Oa.HTML:o.get(n)??Oa.HTML}function GG(n){let o=new Map([["svg",Oa.SVG],["math",Oa.Math]]);for(let[e,t]of o.entries())if(t===n)return e;return null}function qG(n,o){return o===Oa.HTML?n:`:${GG(o)}:${n}`}function Xg(n){return Array.isArray(n)?io(n.map(Xg)):De(n)}function QG(n){let o=new Map;for(let e of n.units)for(let t of e.create)if(t.kind===j.ExtractedAttribute){let i=o.get(t.target)||new ZP;o.set(t.target,i),i.add(t.bindingKind,t.name,t.expression,t.namespace,t.trustedValueFn),Je.remove(t)}if(n instanceof S0)for(let e of n.units)for(let t of e.create)if(t.kind==j.Projection){let i=o.get(t.xref);if(i!==void 0){let a=JP(i);a.entries.length>0&&(t.attributes=n.pool.getConstLiteral(a,!0))}}else Lm(t)&&(t.attributes=g6(n,o,t.xref),t.kind===j.RepeaterCreate&&t.emptyView!==null&&(t.emptyAttributes=g6(n,o,t.emptyView)));else if(n instanceof fx)for(let[e,t]of o.entries()){if(e!==n.root.xref)throw new Error("An attribute would be const collected into the host binding's template function, but is not associated with the root xref.");let i=JP(t);i.entries.length>0&&(n.root.attributes=i)}}function g6(n,o,e){let t=o.get(e);if(t!==void 0){let i=JP(t);if(i.entries.length>0)return n.addConst(i)}return null}var vg=Object.freeze([]),ZP=class{known=new Map;byKind=new Map;propertyBindings=null;projectAs=null;get attributes(){return this.byKind.get(Qt.Attribute)??vg}get classes(){return this.byKind.get(Qt.ClassName)??vg}get styles(){return this.byKind.get(Qt.StyleProperty)??vg}get bindings(){return this.propertyBindings??vg}get template(){return this.byKind.get(Qt.Template)??vg}get i18n(){return this.byKind.get(Qt.I18n)??vg}isKnown(o,e){let t=this.known.get(o)??new Set;return this.known.set(o,t),t.has(e)?!0:(t.add(e),!1)}add(o,e,t,i,a){if(!(o===Qt.Attribute||o===Qt.ClassName||o===Qt.StyleProperty)&&this.isKnown(o,e))return;if(e==="ngProjectAs"){if(t===null||!(t instanceof _r)||t.value==null||typeof t.value?.toString()!="string")throw Error("ngProjectAs must have a string literal value");this.projectAs=t.value.toString()}let d=this.arrayFor(o);if(d.push(...KG(i,e)),o===Qt.Attribute||o===Qt.StyleProperty){if(t===null)throw Error("Attribute, i18n attribute, & style element attributes must have a value");a!==null&&aF(t)?d.push(mU(a,new Bf([new Ib(t.value)],[]),void 0,t.sourceSpan)):d.push(t)}}arrayFor(o){return o===Qt.Property||o===Qt.TwoWayProperty?(this.propertyBindings??=[],this.propertyBindings):(this.byKind.has(o)||this.byKind.set(o,[]),this.byKind.get(o))}};function KG(n,o){let e=De(o);return n?[De(0),De(n),e]:[e]}function JP({attributes:n,bindings:o,classes:e,i18n:t,projectAs:i,styles:a,template:s}){let d=[...n];if(i!==null){let p=H3(i)[0];d.push(De(5),Xg(p))}return e.length>0&&d.push(De(1),...e),a.length>0&&d.push(De(2),...a),o.length>0&&d.push(De(3),...o),s.length>0&&d.push(De(4),...s),t.length>0&&d.push(De(6),...t),io(d)}function XG(n,o){let e=n.get(o);if(e===void 0)throw new Error("All attributes should have an element-like target.");return e}function YG(n){let o=new Map;for(let e of n.units)for(let t of e.create)Lm(t)&&o.set(t.xref,t);for(let e of n.units)for(let t of e.ops())if(t.kind===j.AnimationBinding){let i=ZG(t);n.kind===Dt.Host?e.create.push(i):Je.insertAfter(i,XG(o,t.target)),Je.remove(t)}}function ZG(n){if(n.animationBindingKind===0)return _G(n.name,n.target,n.name==="animate.enter"?"enter":"leave",n.expression,n.securityContext,n.sourceSpan);{let o=n.expression;return fG(n.name,n.target,n.name==="animate.enter"?"enter":"leave",[Js(new Ia(o,o.sourceSpan))],n.securityContext,n.sourceSpan)}}function JG(n){let o=new Map;for(let e of n.units){for(let t of e.create)t.kind===j.I18nAttributes&&o.set(t.target,t);for(let t of e.update)switch(t.kind){case j.Property:case j.Attribute:if(t.i18nContext===null||!(t.expression instanceof aa))continue;let i=o.get(t.target);if(i===void 0)throw new Error("AssertionError: An i18n attribute binding instruction requires the owning element to have an I18nAttributes create instruction");if(i.target!==t.target)throw new Error("AssertionError: Expected i18nAttributes target element to match binding target element");let a=[];for(let s=0;sgq(t,{job:n}),ai.None),ra(e,hq,ai.None)}function Us(n){return n instanceof au?Us(n.expr):n instanceof Pi?Us(n.lhs)||Us(n.rhs):n instanceof jc?n.falseCase&&Us(n.falseCase)?!0:Us(n.condition)||Us(n.trueCase):n instanceof jf?Us(n.condition):n instanceof qc?Us(n.expr):n instanceof Xs?Us(n.receiver):n instanceof Fd?Us(n.receiver)||Us(n.index):n instanceof ac?Us(n.expr):n instanceof Ms||n instanceof $c||n instanceof rc||n instanceof _u||n instanceof hu}function cq(n){let o=new Set;return Bt(n,e=>(e instanceof qc&&o.add(e.xref),e),ai.None),o}function dq(n,o,e){return Bt(n,t=>{if(t instanceof qc&&o.has(t.xref)){let i=new zm(t.xref);return new qc(i,i.xref)}return t},ai.None),n}function Cg(n,o,e){let t;if(Us(n)){let i=e.job.allocateXrefId();t=[new qc(n,i),new zm(i)]}else t=[n,n.clone()],dq(t[1],cq(t[0]));return new Kg(t[0],o(t[1]))}function mq(n){return n instanceof qg||n instanceof Qg||n instanceof _u}function pq(n){return n instanceof Xs||n instanceof Fd||n instanceof Ms}function fF(n){return mq(n)||pq(n)}function uq(n){if(fF(n)&&n.receiver instanceof Kg){let o=n.receiver;for(;o.expr instanceof Kg;)o=o.expr;return o}return null}function gq(n,o){if(!fF(n))return n;let e=uq(n);if(e){if(n instanceof Ms)return e.expr=e.expr.callFn(n.args),n.receiver;if(n instanceof Xs)return e.expr=e.expr.prop(n.name),n.receiver;if(n instanceof Fd)return e.expr=e.expr.key(n.index),n.receiver;if(n instanceof _u)return e.expr=Cg(e.expr,t=>t.callFn(n.args),o),n.receiver;if(n instanceof qg)return e.expr=Cg(e.expr,t=>t.prop(n.name),o),n.receiver;if(n instanceof Qg)return e.expr=Cg(e.expr,t=>t.key(n.index),o),n.receiver}else{if(n instanceof _u)return Cg(n.receiver,t=>t.callFn(n.args),o);if(n instanceof qg)return Cg(n.receiver,t=>t.prop(n.name),o);if(n instanceof Qg)return Cg(n.receiver,t=>t.key(n.index),o)}return n}function hq(n){return n instanceof Kg?new ac(new jc(new Pi(lt.Equals,n.guard,zg),zg,n.expr)):n}var h6="\uFFFD",_q="#",fq="*",vq="/",Cq=":",bq="[",xq="]",yq="|";function wq(n){let o=new Map,e=new Map,t=new Map;for(let a of n.units)for(let s of a.create)switch(s.kind){case j.I18nContext:let d=Mq(n,s);a.create.push(d),o.set(s.xref,d),t.set(s.xref,s);break;case j.I18nStart:e.set(s.xref,s);break}let i=null;for(let a of n.units)for(let s of a.create)switch(s.kind){case j.IcuStart:i=s,Je.remove(s);let d=t.get(s.context);if(d.contextKind!==Kp.Icu)continue;let p=e.get(d.i18nBlock);if(p.context===d.xref)continue;let u=e.get(p.root),g=o.get(u.context);if(g===void 0)throw Error("AssertionError: ICU sub-message should belong to a root message.");let C=o.get(d.xref);C.messagePlaceholder=s.messagePlaceholder,g.subMessages.push(C.xref);break;case j.IcuEnd:i=null,Je.remove(s);break;case j.IcuPlaceholder:if(i===null||i.context==null)throw Error("AssertionError: Unexpected ICU placeholder outside of i18n context");o.get(i.context).postprocessingParams.set(s.name,De(Sq(s))),Je.remove(s);break}}function Mq(n,o,e){let t=_6(o.params),i=_6(o.postprocessingParams),a=[...o.params.values()].some(s=>s.length>1);return MG(n.allocateXrefId(),o.xref,o.i18nBlock,o.message,null,t,i,a)}function Sq(n){if(n.strings.length!==n.expressionPlaceholders.length+1)throw Error(`AssertionError: Invalid ICU placeholder with ${n.strings.length} strings and ${n.expressionPlaceholders.length} expressions`);let o=n.expressionPlaceholders.map(Tg);return n.strings.flatMap((e,t)=>[e,o[t]||""]).join("")}function _6(n){let o=new Map;for(let[e,t]of n){let i=kq(t);i!==null&&o.set(e,De(i))}return o}function kq(n){if(n.length===0)return null;let o=n.map(e=>Tg(e));return o.length===1?o[0]:`${bq}${o.join(yq)}${xq}`}function Tg(n){if(n.flags&go.ElementTag&&n.flags&go.TemplateTag){if(typeof n.value!="object")throw Error("AssertionError: Expected i18n param value to have an element and template slot");let i=Tg(ze(q({},n),{value:n.value.element,flags:n.flags&~go.TemplateTag})),a=Tg(ze(q({},n),{value:n.value.template,flags:n.flags&~go.ElementTag}));return n.flags&go.OpenTag&&n.flags&go.CloseTag?`${a}${i}${a}`:n.flags&go.CloseTag?`${i}${a}`:`${a}${i}`}if(n.flags&go.OpenTag&&n.flags&go.CloseTag)return`${Tg(ze(q({},n),{flags:n.flags&~go.CloseTag}))}${Tg(ze(q({},n),{flags:n.flags&~go.OpenTag}))}`;if(n.flags===go.None)return`${n.value}`;let o="",e="";n.flags&go.ElementTag?o=_q:n.flags&go.TemplateTag&&(o=fq),o!==""&&(e=n.flags&go.CloseTag?vq:"");let t=n.subTemplateIndex===null?"":`${Cq}${n.subTemplateIndex}`;return`${h6}${e}${o}${n.value}${t}${h6}`}function Pq(n){for(let o of n.units){let e=new Map;for(let i of o.create){if(nh(i)){if(i.handle.slot===null)throw new Error("AssertionError: expected slots to have been allocated before generating advance() calls")}else continue;e.set(i.xref,i.handle.slot)}let t=0;for(let i of o.update){let a=null;if(v0(i)?a=i:wa(i,d=>{a===null&&v0(d)&&(a=d)}),a===null)continue;if(!e.has(a.target))throw new Error(`AssertionError: reference to unknown slot for target ${a.target}`);let s=e.get(a.target);if(t!==s){let d=s-t;if(d<0)throw new Error("AssertionError: slot counter should never need to move backwards");Je.insertBefore(oG(d,a.sourceSpan),i),t=s}}}}function Tq(n){for(let o of n.units)for(let e of o.update){if(e.kind!==j.StoreLet)continue;let t={kind:ar.Identifier,name:null,identifier:e.declaredName,local:!0};Je.replace(e,Mm(n.allocateXrefId(),t,new C0(e.target,e.value,e.sourceSpan),vl.None))}}function Eq(n){let e=[],t=0;for(let i of n.units)for(let a of i.create)a.kind===j.Projection&&(e.push(a.selector),a.projectionSlotIndex=t++);if(e.length>0){let i=null;if(e.length>1||e[0]!=="*"){let a=e.map(s=>s==="*"?s:H3(s));i=n.pool.getConstLiteral(Xg(a),!0)}n.contentSelectors=n.pool.getConstLiteral(Xg(e),!0),n.root.create.prepend([bG(i)])}}function Oq(n){Mf(n.root,null)}function Mf(n,o){let e=f6(n,o);for(let t of n.create)switch(t.kind){case j.ConditionalCreate:case j.ConditionalBranchCreate:case j.Template:Mf(n.job.views.get(t.xref),e);break;case j.Projection:t.fallbackView!==null&&Mf(n.job.views.get(t.fallbackView),e);break;case j.RepeaterCreate:Mf(n.job.views.get(t.xref),e),t.emptyView&&Mf(n.job.views.get(t.emptyView),e),t.trackByOps!==null&&t.trackByOps.prepend(Sf(n,e,!1));break;case j.Animation:case j.AnimationListener:case j.Listener:case j.TwoWayListener:t.handlerOps.prepend(Sf(n,e,!0));break}n.update.prepend(Sf(n,e,!1));for(let t of n.functions)t.ops.prepend(Sf(n,f6(n,o),!0))}function f6(n,o){let e={view:n.xref,viewContextVariable:{kind:ar.Context,name:null,view:n.xref},contextVariables:new Map,aliases:n.aliases,references:[],letDeclarations:[],parent:o};for(let t of n.contextVariables.keys())e.contextVariables.set(t,{kind:ar.Identifier,name:null,identifier:t,local:!1});for(let t of n.create)switch(t.kind){case j.ElementStart:case j.ConditionalCreate:case j.ConditionalBranchCreate:case j.Template:if(!Array.isArray(t.localRefs))throw new Error("AssertionError: expected localRefs to be an array");for(let i=0;it instanceof M0?De(n.addConst(t.expr)):t,ai.None)}var v6="style.",C6="class.",Iq="style!",b6="class!",x6="!important";function Aq(n){for(let o of n.root.update)if(o.kind===j.Binding&&o.bindingKind===Qt.Property)if(o.name.endsWith(x6)&&(o.name=o.name.substring(0,o.name.length-x6.length)),o.name.startsWith(v6)){o.bindingKind=Qt.StyleProperty,o.name=o.name.substring(v6.length),Nq(o.name)||(o.name=Fq(o.name));let{property:e,suffix:t}=Jk(o.name);o.name=e,o.unit=t}else o.name.startsWith(Iq)?(o.bindingKind=Qt.StyleProperty,o.name="style"):o.name.startsWith(C6)?(o.bindingKind=Qt.ClassName,o.name=Jk(o.name.substring(C6.length)).property):o.name.startsWith(b6)&&(o.bindingKind=Qt.ClassName,o.name=Jk(o.name.substring(b6.length)).property)}function Nq(n){return n.startsWith("--")}function Fq(n){return n.replace(/[a-z][A-Z]/g,o=>o.charAt(0)+"-"+o.charAt(1)).toLowerCase()}function Jk(n){let o=n.indexOf("!important");o!==-1&&(n=o>0?n.substring(0,o):"");let e=null,t=n,i=n.lastIndexOf(".");return i>0&&(e=n.slice(i+1),t=n.substring(0,i)),{property:t,suffix:e}}function e3(n,o=!1){return yl(Object.keys(n).map(e=>({key:e,quoted:o,value:n[e]})))}var t3=class{visitText(o){return o.value}visitContainer(o){return o.children.map(e=>e.visit(this)).join("")}visitIcu(o){let e=Object.keys(o.cases).map(i=>`${i} {${o.cases[i].visit(this)}}`);return`{${o.expressionPlaceholder}, ${o.type}, ${e.join(" ")}}`}visitTagPlaceholder(o){return o.isVoid?this.formatPh(o.startName):`${this.formatPh(o.startName)}${o.children.map(e=>e.visit(this)).join("")}${this.formatPh(o.closeName)}`}visitPlaceholder(o){return this.formatPh(o.name)}visitBlockPlaceholder(o){return`${this.formatPh(o.startName)}${o.children.map(e=>e.visit(this)).join("")}${this.formatPh(o.closeName)}`}visitIcuPlaceholder(o,e){return this.formatPh(o.name)}formatPh(o){return`{${R0(o,!1)}}`}},Rq=new t3;function vF(n){return n.visit(Rq)}var Rd=class{sourceSpan;i18n;constructor(o,e){this.sourceSpan=o,this.i18n=e}},fu=class extends Rd{value;tokens;constructor(o,e,t,i){super(e,i),this.value=o,this.tokens=t}visit(o,e){return o.visitText(this,e)}},eu=class extends Rd{switchValue;type;cases;switchValueSourceSpan;constructor(o,e,t,i,a,s){super(i,s),this.switchValue=o,this.type=e,this.cases=t,this.switchValueSourceSpan=a}visit(o,e){return o.visitExpansion(this,e)}},vx=class{value;expression;sourceSpan;valueSourceSpan;expSourceSpan;constructor(o,e,t,i,a){this.value=o,this.expression=e,this.sourceSpan=t,this.valueSourceSpan=i,this.expSourceSpan=a}visit(o,e){return o.visitExpansionCase(this,e)}},n3=class extends Rd{name;value;keySpan;valueSpan;valueTokens;constructor(o,e,t,i,a,s,d){super(t,d),this.name=o,this.value=e,this.keySpan=i,this.valueSpan=a,this.valueTokens=s}visit(o,e){return o.visitAttribute(this,e)}},ul=class extends Rd{name;attrs;directives;children;isSelfClosing;startSourceSpan;endSourceSpan;isVoid;constructor(o,e,t,i,a,s,d,p=null,u,g){super(s,g),this.name=o,this.attrs=e,this.directives=t,this.children=i,this.isSelfClosing=a,this.startSourceSpan=d,this.endSourceSpan=p,this.isVoid=u}visit(o,e){return o.visitElement(this,e)}},k0=class{value;sourceSpan;constructor(o,e){this.value=o,this.sourceSpan=e}visit(o,e){return o.visitComment(this,e)}},_l=class extends Rd{name;parameters;children;nameSpan;startSourceSpan;endSourceSpan;constructor(o,e,t,i,a,s,d=null,p){super(i,p),this.name=o,this.parameters=e,this.children=t,this.nameSpan=a,this.startSourceSpan=s,this.endSourceSpan=d}visit(o,e){return o.visitBlock(this,e)}},Jr=class extends Rd{componentName;tagName;fullName;attrs;directives;children;isSelfClosing;startSourceSpan;endSourceSpan;constructor(o,e,t,i,a,s,d,p,u,g=null,C){super(p,C),this.componentName=o,this.tagName=e,this.fullName=t,this.attrs=i,this.directives=a,this.children=s,this.isSelfClosing=d,this.startSourceSpan=u,this.endSourceSpan=g}visit(o,e){return o.visitComponent(this,e)}},i3=class{name;attrs;sourceSpan;startSourceSpan;endSourceSpan;constructor(o,e,t,i,a=null){this.name=o,this.attrs=e,this.sourceSpan=t,this.startSourceSpan=i,this.endSourceSpan=a}visit(o,e){return o.visitDirective(this,e)}},Cx=class{expression;sourceSpan;constructor(o,e){this.expression=o,this.sourceSpan=e}visit(o,e){return o.visitBlockParameter(this,e)}},bx=class{name;value;sourceSpan;nameSpan;valueSpan;constructor(o,e,t,i,a){this.name=o,this.value=e,this.sourceSpan=t,this.nameSpan=i,this.valueSpan=a}visit(o,e){return o.visitLetDeclaration(this,e)}};function ko(n,o,e=null){let t=[],i=n.visit?a=>n.visit(a,e)||a.visit(n,e):a=>a.visit(n,e);return o.forEach(a=>{let s=i(a);s&&t.push(s)}),t}var P0={AElig:"\xC6",AMP:"&",amp:"&",Aacute:"\xC1",Abreve:"\u0102",Acirc:"\xC2",Acy:"\u0410",Afr:"\u{1D504}",Agrave:"\xC0",Alpha:"\u0391",Amacr:"\u0100",And:"\u2A53",Aogon:"\u0104",Aopf:"\u{1D538}",ApplyFunction:"\u2061",af:"\u2061",Aring:"\xC5",angst:"\xC5",Ascr:"\u{1D49C}",Assign:"\u2254",colone:"\u2254",coloneq:"\u2254",Atilde:"\xC3",Auml:"\xC4",Backslash:"\u2216",setminus:"\u2216",setmn:"\u2216",smallsetminus:"\u2216",ssetmn:"\u2216",Barv:"\u2AE7",Barwed:"\u2306",doublebarwedge:"\u2306",Bcy:"\u0411",Because:"\u2235",becaus:"\u2235",because:"\u2235",Bernoullis:"\u212C",Bscr:"\u212C",bernou:"\u212C",Beta:"\u0392",Bfr:"\u{1D505}",Bopf:"\u{1D539}",Breve:"\u02D8",breve:"\u02D8",Bumpeq:"\u224E",HumpDownHump:"\u224E",bump:"\u224E",CHcy:"\u0427",COPY:"\xA9",copy:"\xA9",Cacute:"\u0106",Cap:"\u22D2",CapitalDifferentialD:"\u2145",DD:"\u2145",Cayleys:"\u212D",Cfr:"\u212D",Ccaron:"\u010C",Ccedil:"\xC7",Ccirc:"\u0108",Cconint:"\u2230",Cdot:"\u010A",Cedilla:"\xB8",cedil:"\xB8",CenterDot:"\xB7",centerdot:"\xB7",middot:"\xB7",Chi:"\u03A7",CircleDot:"\u2299",odot:"\u2299",CircleMinus:"\u2296",ominus:"\u2296",CirclePlus:"\u2295",oplus:"\u2295",CircleTimes:"\u2297",otimes:"\u2297",ClockwiseContourIntegral:"\u2232",cwconint:"\u2232",CloseCurlyDoubleQuote:"\u201D",rdquo:"\u201D",rdquor:"\u201D",CloseCurlyQuote:"\u2019",rsquo:"\u2019",rsquor:"\u2019",Colon:"\u2237",Proportion:"\u2237",Colone:"\u2A74",Congruent:"\u2261",equiv:"\u2261",Conint:"\u222F",DoubleContourIntegral:"\u222F",ContourIntegral:"\u222E",conint:"\u222E",oint:"\u222E",Copf:"\u2102",complexes:"\u2102",Coproduct:"\u2210",coprod:"\u2210",CounterClockwiseContourIntegral:"\u2233",awconint:"\u2233",Cross:"\u2A2F",Cscr:"\u{1D49E}",Cup:"\u22D3",CupCap:"\u224D",asympeq:"\u224D",DDotrahd:"\u2911",DJcy:"\u0402",DScy:"\u0405",DZcy:"\u040F",Dagger:"\u2021",ddagger:"\u2021",Darr:"\u21A1",Dashv:"\u2AE4",DoubleLeftTee:"\u2AE4",Dcaron:"\u010E",Dcy:"\u0414",Del:"\u2207",nabla:"\u2207",Delta:"\u0394",Dfr:"\u{1D507}",DiacriticalAcute:"\xB4",acute:"\xB4",DiacriticalDot:"\u02D9",dot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",dblac:"\u02DD",DiacriticalGrave:"`",grave:"`",DiacriticalTilde:"\u02DC",tilde:"\u02DC",Diamond:"\u22C4",diam:"\u22C4",diamond:"\u22C4",DifferentialD:"\u2146",dd:"\u2146",Dopf:"\u{1D53B}",Dot:"\xA8",DoubleDot:"\xA8",die:"\xA8",uml:"\xA8",DotDot:"\u20DC",DotEqual:"\u2250",doteq:"\u2250",esdot:"\u2250",DoubleDownArrow:"\u21D3",Downarrow:"\u21D3",dArr:"\u21D3",DoubleLeftArrow:"\u21D0",Leftarrow:"\u21D0",lArr:"\u21D0",DoubleLeftRightArrow:"\u21D4",Leftrightarrow:"\u21D4",hArr:"\u21D4",iff:"\u21D4",DoubleLongLeftArrow:"\u27F8",Longleftarrow:"\u27F8",xlArr:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",Longleftrightarrow:"\u27FA",xhArr:"\u27FA",DoubleLongRightArrow:"\u27F9",Longrightarrow:"\u27F9",xrArr:"\u27F9",DoubleRightArrow:"\u21D2",Implies:"\u21D2",Rightarrow:"\u21D2",rArr:"\u21D2",DoubleRightTee:"\u22A8",vDash:"\u22A8",DoubleUpArrow:"\u21D1",Uparrow:"\u21D1",uArr:"\u21D1",DoubleUpDownArrow:"\u21D5",Updownarrow:"\u21D5",vArr:"\u21D5",DoubleVerticalBar:"\u2225",par:"\u2225",parallel:"\u2225",shortparallel:"\u2225",spar:"\u2225",DownArrow:"\u2193",ShortDownArrow:"\u2193",darr:"\u2193",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",duarr:"\u21F5",DownBreve:"\u0311",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",leftharpoondown:"\u21BD",lhard:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",rhard:"\u21C1",rightharpoondown:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",top:"\u22A4",DownTeeArrow:"\u21A7",mapstodown:"\u21A7",Dscr:"\u{1D49F}",Dstrok:"\u0110",ENG:"\u014A",ETH:"\xD0",Eacute:"\xC9",Ecaron:"\u011A",Ecirc:"\xCA",Ecy:"\u042D",Edot:"\u0116",Efr:"\u{1D508}",Egrave:"\xC8",Element:"\u2208",in:"\u2208",isin:"\u2208",isinv:"\u2208",Emacr:"\u0112",EmptySmallSquare:"\u25FB",EmptyVerySmallSquare:"\u25AB",Eogon:"\u0118",Eopf:"\u{1D53C}",Epsilon:"\u0395",Equal:"\u2A75",EqualTilde:"\u2242",eqsim:"\u2242",esim:"\u2242",Equilibrium:"\u21CC",rightleftharpoons:"\u21CC",rlhar:"\u21CC",Escr:"\u2130",expectation:"\u2130",Esim:"\u2A73",Eta:"\u0397",Euml:"\xCB",Exists:"\u2203",exist:"\u2203",ExponentialE:"\u2147",ee:"\u2147",exponentiale:"\u2147",Fcy:"\u0424",Ffr:"\u{1D509}",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",blacksquare:"\u25AA",squarf:"\u25AA",squf:"\u25AA",Fopf:"\u{1D53D}",ForAll:"\u2200",forall:"\u2200",Fouriertrf:"\u2131",Fscr:"\u2131",GJcy:"\u0403",GT:">",gt:">",Gamma:"\u0393",Gammad:"\u03DC",Gbreve:"\u011E",Gcedil:"\u0122",Gcirc:"\u011C",Gcy:"\u0413",Gdot:"\u0120",Gfr:"\u{1D50A}",Gg:"\u22D9",ggg:"\u22D9",Gopf:"\u{1D53E}",GreaterEqual:"\u2265",ge:"\u2265",geq:"\u2265",GreaterEqualLess:"\u22DB",gel:"\u22DB",gtreqless:"\u22DB",GreaterFullEqual:"\u2267",gE:"\u2267",geqq:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",gl:"\u2277",gtrless:"\u2277",GreaterSlantEqual:"\u2A7E",geqslant:"\u2A7E",ges:"\u2A7E",GreaterTilde:"\u2273",gsim:"\u2273",gtrsim:"\u2273",Gscr:"\u{1D4A2}",Gt:"\u226B",NestedGreaterGreater:"\u226B",gg:"\u226B",HARDcy:"\u042A",Hacek:"\u02C7",caron:"\u02C7",Hat:"^",Hcirc:"\u0124",Hfr:"\u210C",Poincareplane:"\u210C",HilbertSpace:"\u210B",Hscr:"\u210B",hamilt:"\u210B",Hopf:"\u210D",quaternions:"\u210D",HorizontalLine:"\u2500",boxh:"\u2500",Hstrok:"\u0126",HumpEqual:"\u224F",bumpe:"\u224F",bumpeq:"\u224F",IEcy:"\u0415",IJlig:"\u0132",IOcy:"\u0401",Iacute:"\xCD",Icirc:"\xCE",Icy:"\u0418",Idot:"\u0130",Ifr:"\u2111",Im:"\u2111",image:"\u2111",imagpart:"\u2111",Igrave:"\xCC",Imacr:"\u012A",ImaginaryI:"\u2148",ii:"\u2148",Int:"\u222C",Integral:"\u222B",int:"\u222B",Intersection:"\u22C2",bigcap:"\u22C2",xcap:"\u22C2",InvisibleComma:"\u2063",ic:"\u2063",InvisibleTimes:"\u2062",it:"\u2062",Iogon:"\u012E",Iopf:"\u{1D540}",Iota:"\u0399",Iscr:"\u2110",imagline:"\u2110",Itilde:"\u0128",Iukcy:"\u0406",Iuml:"\xCF",Jcirc:"\u0134",Jcy:"\u0419",Jfr:"\u{1D50D}",Jopf:"\u{1D541}",Jscr:"\u{1D4A5}",Jsercy:"\u0408",Jukcy:"\u0404",KHcy:"\u0425",KJcy:"\u040C",Kappa:"\u039A",Kcedil:"\u0136",Kcy:"\u041A",Kfr:"\u{1D50E}",Kopf:"\u{1D542}",Kscr:"\u{1D4A6}",LJcy:"\u0409",LT:"<",lt:"<",Lacute:"\u0139",Lambda:"\u039B",Lang:"\u27EA",Laplacetrf:"\u2112",Lscr:"\u2112",lagran:"\u2112",Larr:"\u219E",twoheadleftarrow:"\u219E",Lcaron:"\u013D",Lcedil:"\u013B",Lcy:"\u041B",LeftAngleBracket:"\u27E8",lang:"\u27E8",langle:"\u27E8",LeftArrow:"\u2190",ShortLeftArrow:"\u2190",larr:"\u2190",leftarrow:"\u2190",slarr:"\u2190",LeftArrowBar:"\u21E4",larrb:"\u21E4",LeftArrowRightArrow:"\u21C6",leftrightarrows:"\u21C6",lrarr:"\u21C6",LeftCeiling:"\u2308",lceil:"\u2308",LeftDoubleBracket:"\u27E6",lobrk:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",dharl:"\u21C3",downharpoonleft:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",lfloor:"\u230A",LeftRightArrow:"\u2194",harr:"\u2194",leftrightarrow:"\u2194",LeftRightVector:"\u294E",LeftTee:"\u22A3",dashv:"\u22A3",LeftTeeArrow:"\u21A4",mapstoleft:"\u21A4",LeftTeeVector:"\u295A",LeftTriangle:"\u22B2",vartriangleleft:"\u22B2",vltri:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",ltrie:"\u22B4",trianglelefteq:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",uharl:"\u21BF",upharpoonleft:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",leftharpoonup:"\u21BC",lharu:"\u21BC",LeftVectorBar:"\u2952",LessEqualGreater:"\u22DA",leg:"\u22DA",lesseqgtr:"\u22DA",LessFullEqual:"\u2266",lE:"\u2266",leqq:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",lg:"\u2276",LessLess:"\u2AA1",LessSlantEqual:"\u2A7D",leqslant:"\u2A7D",les:"\u2A7D",LessTilde:"\u2272",lesssim:"\u2272",lsim:"\u2272",Lfr:"\u{1D50F}",Ll:"\u22D8",Lleftarrow:"\u21DA",lAarr:"\u21DA",Lmidot:"\u013F",LongLeftArrow:"\u27F5",longleftarrow:"\u27F5",xlarr:"\u27F5",LongLeftRightArrow:"\u27F7",longleftrightarrow:"\u27F7",xharr:"\u27F7",LongRightArrow:"\u27F6",longrightarrow:"\u27F6",xrarr:"\u27F6",Lopf:"\u{1D543}",LowerLeftArrow:"\u2199",swarr:"\u2199",swarrow:"\u2199",LowerRightArrow:"\u2198",searr:"\u2198",searrow:"\u2198",Lsh:"\u21B0",lsh:"\u21B0",Lstrok:"\u0141",Lt:"\u226A",NestedLessLess:"\u226A",ll:"\u226A",Map:"\u2905",Mcy:"\u041C",MediumSpace:"\u205F",Mellintrf:"\u2133",Mscr:"\u2133",phmmat:"\u2133",Mfr:"\u{1D510}",MinusPlus:"\u2213",mnplus:"\u2213",mp:"\u2213",Mopf:"\u{1D544}",Mu:"\u039C",NJcy:"\u040A",Nacute:"\u0143",Ncaron:"\u0147",Ncedil:"\u0145",Ncy:"\u041D",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",ZeroWidthSpace:"\u200B",NewLine:` +`,Nfr:"\u{1D511}",NoBreak:"\u2060",NonBreakingSpace:"\xA0",nbsp:"\xA0",Nopf:"\u2115",naturals:"\u2115",Not:"\u2AEC",NotCongruent:"\u2262",nequiv:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",npar:"\u2226",nparallel:"\u2226",nshortparallel:"\u2226",nspar:"\u2226",NotElement:"\u2209",notin:"\u2209",notinva:"\u2209",NotEqual:"\u2260",ne:"\u2260",NotEqualTilde:"\u2242\u0338",nesim:"\u2242\u0338",NotExists:"\u2204",nexist:"\u2204",nexists:"\u2204",NotGreater:"\u226F",ngt:"\u226F",ngtr:"\u226F",NotGreaterEqual:"\u2271",nge:"\u2271",ngeq:"\u2271",NotGreaterFullEqual:"\u2267\u0338",ngE:"\u2267\u0338",ngeqq:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",nGtv:"\u226B\u0338",NotGreaterLess:"\u2279",ntgl:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",NotGreaterTilde:"\u2275",ngsim:"\u2275",NotHumpDownHump:"\u224E\u0338",nbump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",nbumpe:"\u224F\u0338",NotLeftTriangle:"\u22EA",nltri:"\u22EA",ntriangleleft:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",nltrie:"\u22EC",ntrianglelefteq:"\u22EC",NotLess:"\u226E",nless:"\u226E",nlt:"\u226E",NotLessEqual:"\u2270",nle:"\u2270",nleq:"\u2270",NotLessGreater:"\u2278",ntlg:"\u2278",NotLessLess:"\u226A\u0338",nLtv:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",NotLessTilde:"\u2274",nlsim:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",NotPrecedes:"\u2280",npr:"\u2280",nprec:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",npre:"\u2AAF\u0338",npreceq:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",nprcue:"\u22E0",NotReverseElement:"\u220C",notni:"\u220C",notniva:"\u220C",NotRightTriangle:"\u22EB",nrtri:"\u22EB",ntriangleright:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",nrtrie:"\u22ED",ntrianglerighteq:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",nsqsube:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",nsqsupe:"\u22E3",NotSubset:"\u2282\u20D2",nsubset:"\u2282\u20D2",vnsub:"\u2282\u20D2",NotSubsetEqual:"\u2288",nsube:"\u2288",nsubseteq:"\u2288",NotSucceeds:"\u2281",nsc:"\u2281",nsucc:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",nsce:"\u2AB0\u0338",nsucceq:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",nsccue:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",nsupset:"\u2283\u20D2",vnsup:"\u2283\u20D2",NotSupersetEqual:"\u2289",nsupe:"\u2289",nsupseteq:"\u2289",NotTilde:"\u2241",nsim:"\u2241",NotTildeEqual:"\u2244",nsime:"\u2244",nsimeq:"\u2244",NotTildeFullEqual:"\u2247",ncong:"\u2247",NotTildeTilde:"\u2249",nap:"\u2249",napprox:"\u2249",NotVerticalBar:"\u2224",nmid:"\u2224",nshortmid:"\u2224",nsmid:"\u2224",Nscr:"\u{1D4A9}",Ntilde:"\xD1",Nu:"\u039D",OElig:"\u0152",Oacute:"\xD3",Ocirc:"\xD4",Ocy:"\u041E",Odblac:"\u0150",Ofr:"\u{1D512}",Ograve:"\xD2",Omacr:"\u014C",Omega:"\u03A9",ohm:"\u03A9",Omicron:"\u039F",Oopf:"\u{1D546}",OpenCurlyDoubleQuote:"\u201C",ldquo:"\u201C",OpenCurlyQuote:"\u2018",lsquo:"\u2018",Or:"\u2A54",Oscr:"\u{1D4AA}",Oslash:"\xD8",Otilde:"\xD5",Otimes:"\u2A37",Ouml:"\xD6",OverBar:"\u203E",oline:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",tbrk:"\u23B4",OverParenthesis:"\u23DC",PartialD:"\u2202",part:"\u2202",Pcy:"\u041F",Pfr:"\u{1D513}",Phi:"\u03A6",Pi:"\u03A0",PlusMinus:"\xB1",plusmn:"\xB1",pm:"\xB1",Popf:"\u2119",primes:"\u2119",Pr:"\u2ABB",Precedes:"\u227A",pr:"\u227A",prec:"\u227A",PrecedesEqual:"\u2AAF",pre:"\u2AAF",preceq:"\u2AAF",PrecedesSlantEqual:"\u227C",prcue:"\u227C",preccurlyeq:"\u227C",PrecedesTilde:"\u227E",precsim:"\u227E",prsim:"\u227E",Prime:"\u2033",Product:"\u220F",prod:"\u220F",Proportional:"\u221D",prop:"\u221D",propto:"\u221D",varpropto:"\u221D",vprop:"\u221D",Pscr:"\u{1D4AB}",Psi:"\u03A8",QUOT:'"',quot:'"',Qfr:"\u{1D514}",Qopf:"\u211A",rationals:"\u211A",Qscr:"\u{1D4AC}",RBarr:"\u2910",drbkarow:"\u2910",REG:"\xAE",circledR:"\xAE",reg:"\xAE",Racute:"\u0154",Rang:"\u27EB",Rarr:"\u21A0",twoheadrightarrow:"\u21A0",Rarrtl:"\u2916",Rcaron:"\u0158",Rcedil:"\u0156",Rcy:"\u0420",Re:"\u211C",Rfr:"\u211C",real:"\u211C",realpart:"\u211C",ReverseElement:"\u220B",SuchThat:"\u220B",ni:"\u220B",niv:"\u220B",ReverseEquilibrium:"\u21CB",leftrightharpoons:"\u21CB",lrhar:"\u21CB",ReverseUpEquilibrium:"\u296F",duhar:"\u296F",Rho:"\u03A1",RightAngleBracket:"\u27E9",rang:"\u27E9",rangle:"\u27E9",RightArrow:"\u2192",ShortRightArrow:"\u2192",rarr:"\u2192",rightarrow:"\u2192",srarr:"\u2192",RightArrowBar:"\u21E5",rarrb:"\u21E5",RightArrowLeftArrow:"\u21C4",rightleftarrows:"\u21C4",rlarr:"\u21C4",RightCeiling:"\u2309",rceil:"\u2309",RightDoubleBracket:"\u27E7",robrk:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",dharr:"\u21C2",downharpoonright:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rfloor:"\u230B",RightTee:"\u22A2",vdash:"\u22A2",RightTeeArrow:"\u21A6",map:"\u21A6",mapsto:"\u21A6",RightTeeVector:"\u295B",RightTriangle:"\u22B3",vartriangleright:"\u22B3",vrtri:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",rtrie:"\u22B5",trianglerighteq:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",uharr:"\u21BE",upharpoonright:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",rharu:"\u21C0",rightharpoonup:"\u21C0",RightVectorBar:"\u2953",Ropf:"\u211D",reals:"\u211D",RoundImplies:"\u2970",Rrightarrow:"\u21DB",rAarr:"\u21DB",Rscr:"\u211B",realine:"\u211B",Rsh:"\u21B1",rsh:"\u21B1",RuleDelayed:"\u29F4",SHCHcy:"\u0429",SHcy:"\u0428",SOFTcy:"\u042C",Sacute:"\u015A",Sc:"\u2ABC",Scaron:"\u0160",Scedil:"\u015E",Scirc:"\u015C",Scy:"\u0421",Sfr:"\u{1D516}",ShortUpArrow:"\u2191",UpArrow:"\u2191",uarr:"\u2191",uparrow:"\u2191",Sigma:"\u03A3",SmallCircle:"\u2218",compfn:"\u2218",Sopf:"\u{1D54A}",Sqrt:"\u221A",radic:"\u221A",Square:"\u25A1",squ:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",sqcap:"\u2293",SquareSubset:"\u228F",sqsub:"\u228F",sqsubset:"\u228F",SquareSubsetEqual:"\u2291",sqsube:"\u2291",sqsubseteq:"\u2291",SquareSuperset:"\u2290",sqsup:"\u2290",sqsupset:"\u2290",SquareSupersetEqual:"\u2292",sqsupe:"\u2292",sqsupseteq:"\u2292",SquareUnion:"\u2294",sqcup:"\u2294",Sscr:"\u{1D4AE}",Star:"\u22C6",sstarf:"\u22C6",Sub:"\u22D0",Subset:"\u22D0",SubsetEqual:"\u2286",sube:"\u2286",subseteq:"\u2286",Succeeds:"\u227B",sc:"\u227B",succ:"\u227B",SucceedsEqual:"\u2AB0",sce:"\u2AB0",succeq:"\u2AB0",SucceedsSlantEqual:"\u227D",sccue:"\u227D",succcurlyeq:"\u227D",SucceedsTilde:"\u227F",scsim:"\u227F",succsim:"\u227F",Sum:"\u2211",sum:"\u2211",Sup:"\u22D1",Supset:"\u22D1",Superset:"\u2283",sup:"\u2283",supset:"\u2283",SupersetEqual:"\u2287",supe:"\u2287",supseteq:"\u2287",THORN:"\xDE",TRADE:"\u2122",trade:"\u2122",TSHcy:"\u040B",TScy:"\u0426",Tab:" ",Tau:"\u03A4",Tcaron:"\u0164",Tcedil:"\u0162",Tcy:"\u0422",Tfr:"\u{1D517}",Therefore:"\u2234",there4:"\u2234",therefore:"\u2234",Theta:"\u0398",ThickSpace:"\u205F\u200A",ThinSpace:"\u2009",thinsp:"\u2009",Tilde:"\u223C",sim:"\u223C",thicksim:"\u223C",thksim:"\u223C",TildeEqual:"\u2243",sime:"\u2243",simeq:"\u2243",TildeFullEqual:"\u2245",cong:"\u2245",TildeTilde:"\u2248",ap:"\u2248",approx:"\u2248",asymp:"\u2248",thickapprox:"\u2248",thkap:"\u2248",Topf:"\u{1D54B}",TripleDot:"\u20DB",tdot:"\u20DB",Tscr:"\u{1D4AF}",Tstrok:"\u0166",Uacute:"\xDA",Uarr:"\u219F",Uarrocir:"\u2949",Ubrcy:"\u040E",Ubreve:"\u016C",Ucirc:"\xDB",Ucy:"\u0423",Udblac:"\u0170",Ufr:"\u{1D518}",Ugrave:"\xD9",Umacr:"\u016A",UnderBar:"_",lowbar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",bbrk:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",bigcup:"\u22C3",xcup:"\u22C3",UnionPlus:"\u228E",uplus:"\u228E",Uogon:"\u0172",Uopf:"\u{1D54C}",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",udarr:"\u21C5",UpDownArrow:"\u2195",updownarrow:"\u2195",varr:"\u2195",UpEquilibrium:"\u296E",udhar:"\u296E",UpTee:"\u22A5",bot:"\u22A5",bottom:"\u22A5",perp:"\u22A5",UpTeeArrow:"\u21A5",mapstoup:"\u21A5",UpperLeftArrow:"\u2196",nwarr:"\u2196",nwarrow:"\u2196",UpperRightArrow:"\u2197",nearr:"\u2197",nearrow:"\u2197",Upsi:"\u03D2",upsih:"\u03D2",Upsilon:"\u03A5",Uring:"\u016E",Uscr:"\u{1D4B0}",Utilde:"\u0168",Uuml:"\xDC",VDash:"\u22AB",Vbar:"\u2AEB",Vcy:"\u0412",Vdash:"\u22A9",Vdashl:"\u2AE6",Vee:"\u22C1",bigvee:"\u22C1",xvee:"\u22C1",Verbar:"\u2016",Vert:"\u2016",VerticalBar:"\u2223",mid:"\u2223",shortmid:"\u2223",smid:"\u2223",VerticalLine:"|",verbar:"|",vert:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",wr:"\u2240",wreath:"\u2240",VeryThinSpace:"\u200A",hairsp:"\u200A",Vfr:"\u{1D519}",Vopf:"\u{1D54D}",Vscr:"\u{1D4B1}",Vvdash:"\u22AA",Wcirc:"\u0174",Wedge:"\u22C0",bigwedge:"\u22C0",xwedge:"\u22C0",Wfr:"\u{1D51A}",Wopf:"\u{1D54E}",Wscr:"\u{1D4B2}",Xfr:"\u{1D51B}",Xi:"\u039E",Xopf:"\u{1D54F}",Xscr:"\u{1D4B3}",YAcy:"\u042F",YIcy:"\u0407",YUcy:"\u042E",Yacute:"\xDD",Ycirc:"\u0176",Ycy:"\u042B",Yfr:"\u{1D51C}",Yopf:"\u{1D550}",Yscr:"\u{1D4B4}",Yuml:"\u0178",ZHcy:"\u0416",Zacute:"\u0179",Zcaron:"\u017D",Zcy:"\u0417",Zdot:"\u017B",Zeta:"\u0396",Zfr:"\u2128",zeetrf:"\u2128",Zopf:"\u2124",integers:"\u2124",Zscr:"\u{1D4B5}",aacute:"\xE1",abreve:"\u0103",ac:"\u223E",mstpos:"\u223E",acE:"\u223E\u0333",acd:"\u223F",acirc:"\xE2",acy:"\u0430",aelig:"\xE6",afr:"\u{1D51E}",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",alpha:"\u03B1",amacr:"\u0101",amalg:"\u2A3F",and:"\u2227",wedge:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",angle:"\u2220",ange:"\u29A4",angmsd:"\u2221",measuredangle:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angzarr:"\u237C",aogon:"\u0105",aopf:"\u{1D552}",apE:"\u2A70",apacir:"\u2A6F",ape:"\u224A",approxeq:"\u224A",apid:"\u224B",apos:"'",aring:"\xE5",ascr:"\u{1D4B6}",ast:"*",midast:"*",atilde:"\xE3",auml:"\xE4",awint:"\u2A11",bNot:"\u2AED",backcong:"\u224C",bcong:"\u224C",backepsilon:"\u03F6",bepsi:"\u03F6",backprime:"\u2035",bprime:"\u2035",backsim:"\u223D",bsim:"\u223D",backsimeq:"\u22CD",bsime:"\u22CD",barvee:"\u22BD",barwed:"\u2305",barwedge:"\u2305",bbrktbrk:"\u23B6",bcy:"\u0431",bdquo:"\u201E",ldquor:"\u201E",bemptyv:"\u29B0",beta:"\u03B2",beth:"\u2136",between:"\u226C",twixt:"\u226C",bfr:"\u{1D51F}",bigcirc:"\u25EF",xcirc:"\u25EF",bigodot:"\u2A00",xodot:"\u2A00",bigoplus:"\u2A01",xoplus:"\u2A01",bigotimes:"\u2A02",xotime:"\u2A02",bigsqcup:"\u2A06",xsqcup:"\u2A06",bigstar:"\u2605",starf:"\u2605",bigtriangledown:"\u25BD",xdtri:"\u25BD",bigtriangleup:"\u25B3",xutri:"\u25B3",biguplus:"\u2A04",xuplus:"\u2A04",bkarow:"\u290D",rbarr:"\u290D",blacklozenge:"\u29EB",lozf:"\u29EB",blacktriangle:"\u25B4",utrif:"\u25B4",blacktriangledown:"\u25BE",dtrif:"\u25BE",blacktriangleleft:"\u25C2",ltrif:"\u25C2",blacktriangleright:"\u25B8",rtrif:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bnot:"\u2310",bopf:"\u{1D553}",bowtie:"\u22C8",boxDL:"\u2557",boxDR:"\u2554",boxDl:"\u2556",boxDr:"\u2553",boxH:"\u2550",boxHD:"\u2566",boxHU:"\u2569",boxHd:"\u2564",boxHu:"\u2567",boxUL:"\u255D",boxUR:"\u255A",boxUl:"\u255C",boxUr:"\u2559",boxV:"\u2551",boxVH:"\u256C",boxVL:"\u2563",boxVR:"\u2560",boxVh:"\u256B",boxVl:"\u2562",boxVr:"\u255F",boxbox:"\u29C9",boxdL:"\u2555",boxdR:"\u2552",boxdl:"\u2510",boxdr:"\u250C",boxhD:"\u2565",boxhU:"\u2568",boxhd:"\u252C",boxhu:"\u2534",boxminus:"\u229F",minusb:"\u229F",boxplus:"\u229E",plusb:"\u229E",boxtimes:"\u22A0",timesb:"\u22A0",boxuL:"\u255B",boxuR:"\u2558",boxul:"\u2518",boxur:"\u2514",boxv:"\u2502",boxvH:"\u256A",boxvL:"\u2561",boxvR:"\u255E",boxvh:"\u253C",boxvl:"\u2524",boxvr:"\u251C",brvbar:"\xA6",bscr:"\u{1D4B7}",bsemi:"\u204F",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bumpE:"\u2AAE",cacute:"\u0107",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",caps:"\u2229\uFE00",caret:"\u2041",ccaps:"\u2A4D",ccaron:"\u010D",ccedil:"\xE7",ccirc:"\u0109",ccups:"\u2A4C",ccupssm:"\u2A50",cdot:"\u010B",cemptyv:"\u29B2",cent:"\xA2",cfr:"\u{1D520}",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",chi:"\u03C7",cir:"\u25CB",cirE:"\u29C3",circ:"\u02C6",circeq:"\u2257",cire:"\u2257",circlearrowleft:"\u21BA",olarr:"\u21BA",circlearrowright:"\u21BB",orarr:"\u21BB",circledS:"\u24C8",oS:"\u24C8",circledast:"\u229B",oast:"\u229B",circledcirc:"\u229A",ocir:"\u229A",circleddash:"\u229D",odash:"\u229D",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",clubs:"\u2663",clubsuit:"\u2663",colon:":",comma:",",commat:"@",comp:"\u2201",complement:"\u2201",congdot:"\u2A6D",copf:"\u{1D554}",copysr:"\u2117",crarr:"\u21B5",cross:"\u2717",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",curlyeqprec:"\u22DE",cuesc:"\u22DF",curlyeqsucc:"\u22DF",cularr:"\u21B6",curvearrowleft:"\u21B6",cularrp:"\u293D",cup:"\u222A",cupbrcap:"\u2A48",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curvearrowright:"\u21B7",curarrm:"\u293C",curlyvee:"\u22CE",cuvee:"\u22CE",curlywedge:"\u22CF",cuwed:"\u22CF",curren:"\xA4",cwint:"\u2231",cylcty:"\u232D",dHar:"\u2965",dagger:"\u2020",daleth:"\u2138",dash:"\u2010",hyphen:"\u2010",dbkarow:"\u290F",rBarr:"\u290F",dcaron:"\u010F",dcy:"\u0434",ddarr:"\u21CA",downdownarrows:"\u21CA",ddotseq:"\u2A77",eDDot:"\u2A77",deg:"\xB0",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",dfr:"\u{1D521}",diamondsuit:"\u2666",diams:"\u2666",digamma:"\u03DD",gammad:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",djcy:"\u0452",dlcorn:"\u231E",llcorner:"\u231E",dlcrop:"\u230D",dollar:"$",dopf:"\u{1D555}",doteqdot:"\u2251",eDot:"\u2251",dotminus:"\u2238",minusd:"\u2238",dotplus:"\u2214",plusdo:"\u2214",dotsquare:"\u22A1",sdotb:"\u22A1",drcorn:"\u231F",lrcorner:"\u231F",drcrop:"\u230C",dscr:"\u{1D4B9}",dscy:"\u0455",dsol:"\u29F6",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",triangledown:"\u25BF",dwangle:"\u29A6",dzcy:"\u045F",dzigrarr:"\u27FF",eacute:"\xE9",easter:"\u2A6E",ecaron:"\u011B",ecir:"\u2256",eqcirc:"\u2256",ecirc:"\xEA",ecolon:"\u2255",eqcolon:"\u2255",ecy:"\u044D",edot:"\u0117",efDot:"\u2252",fallingdotseq:"\u2252",efr:"\u{1D522}",eg:"\u2A9A",egrave:"\xE8",egs:"\u2A96",eqslantgtr:"\u2A96",egsdot:"\u2A98",el:"\u2A99",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",eqslantless:"\u2A95",elsdot:"\u2A97",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",emptyv:"\u2205",varnothing:"\u2205",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",eng:"\u014B",ensp:"\u2002",eogon:"\u0119",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",epsilon:"\u03B5",epsiv:"\u03F5",straightepsilon:"\u03F5",varepsilon:"\u03F5",equals:"=",equest:"\u225F",questeq:"\u225F",equivDD:"\u2A78",eqvparsl:"\u29E5",erDot:"\u2253",risingdotseq:"\u2253",erarr:"\u2971",escr:"\u212F",eta:"\u03B7",eth:"\xF0",euml:"\xEB",euro:"\u20AC",excl:"!",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",ffr:"\u{1D523}",filig:"\uFB01",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",fopf:"\u{1D557}",fork:"\u22D4",pitchfork:"\u22D4",forkv:"\u2AD9",fpartint:"\u2A0D",frac12:"\xBD",half:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",sfrown:"\u2322",fscr:"\u{1D4BB}",gEl:"\u2A8C",gtreqqless:"\u2A8C",gacute:"\u01F5",gamma:"\u03B3",gap:"\u2A86",gtrapprox:"\u2A86",gbreve:"\u011F",gcirc:"\u011D",gcy:"\u0433",gdot:"\u0121",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",gfr:"\u{1D524}",gimel:"\u2137",gjcy:"\u0453",glE:"\u2A92",gla:"\u2AA5",glj:"\u2AA4",gnE:"\u2269",gneqq:"\u2269",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gneq:"\u2A88",gnsim:"\u22E7",gopf:"\u{1D558}",gscr:"\u210A",gsime:"\u2A8E",gsiml:"\u2A90",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtrdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrarr:"\u2978",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",hardcy:"\u044A",harrcir:"\u2948",harrw:"\u21AD",leftrightsquigarrow:"\u21AD",hbar:"\u210F",hslash:"\u210F",planck:"\u210F",plankv:"\u210F",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",mldr:"\u2026",hercon:"\u22B9",hfr:"\u{1D525}",hksearow:"\u2925",searhk:"\u2925",hkswarow:"\u2926",swarhk:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",larrhk:"\u21A9",hookrightarrow:"\u21AA",rarrhk:"\u21AA",hopf:"\u{1D559}",horbar:"\u2015",hscr:"\u{1D4BD}",hstrok:"\u0127",hybull:"\u2043",iacute:"\xED",icirc:"\xEE",icy:"\u0438",iecy:"\u0435",iexcl:"\xA1",ifr:"\u{1D526}",igrave:"\xEC",iiiint:"\u2A0C",qint:"\u2A0C",iiint:"\u222D",tint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",ijlig:"\u0133",imacr:"\u012B",imath:"\u0131",inodot:"\u0131",imof:"\u22B7",imped:"\u01B5",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",intcal:"\u22BA",intercal:"\u22BA",intlarhk:"\u2A17",intprod:"\u2A3C",iprod:"\u2A3C",iocy:"\u0451",iogon:"\u012F",iopf:"\u{1D55A}",iota:"\u03B9",iquest:"\xBF",iscr:"\u{1D4BE}",isinE:"\u22F9",isindot:"\u22F5",isins:"\u22F4",isinsv:"\u22F3",itilde:"\u0129",iukcy:"\u0456",iuml:"\xEF",jcirc:"\u0135",jcy:"\u0439",jfr:"\u{1D527}",jmath:"\u0237",jopf:"\u{1D55B}",jscr:"\u{1D4BF}",jsercy:"\u0458",jukcy:"\u0454",kappa:"\u03BA",kappav:"\u03F0",varkappa:"\u03F0",kcedil:"\u0137",kcy:"\u043A",kfr:"\u{1D528}",kgreen:"\u0138",khcy:"\u0445",kjcy:"\u045C",kopf:"\u{1D55C}",kscr:"\u{1D4C0}",lAtail:"\u291B",lBarr:"\u290E",lEg:"\u2A8B",lesseqqgtr:"\u2A8B",lHar:"\u2962",lacute:"\u013A",laemptyv:"\u29B4",lambda:"\u03BB",langd:"\u2991",lap:"\u2A85",lessapprox:"\u2A85",laquo:"\xAB",larrbfs:"\u291F",larrfs:"\u291D",larrlp:"\u21AB",looparrowleft:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",leftarrowtail:"\u21A2",lat:"\u2AAB",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lcub:"{",lbrack:"[",lsqb:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",lcaron:"\u013E",lcedil:"\u013C",lcy:"\u043B",ldca:"\u2936",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",leq:"\u2264",leftleftarrows:"\u21C7",llarr:"\u21C7",leftthreetimes:"\u22CB",lthree:"\u22CB",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessdot:"\u22D6",ltdot:"\u22D6",lfisht:"\u297C",lfr:"\u{1D529}",lgE:"\u2A91",lharul:"\u296A",lhblk:"\u2584",ljcy:"\u0459",llhard:"\u296B",lltri:"\u25FA",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnE:"\u2268",lneqq:"\u2268",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lneq:"\u2A87",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",longmapsto:"\u27FC",xmap:"\u27FC",looparrowright:"\u21AC",rarrlp:"\u21AC",lopar:"\u2985",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",loz:"\u25CA",lozenge:"\u25CA",lpar:"(",lparlt:"\u2993",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",lscr:"\u{1D4C1}",lsime:"\u2A8D",lsimg:"\u2A8F",lsquor:"\u201A",sbquo:"\u201A",lstrok:"\u0142",ltcc:"\u2AA6",ltcir:"\u2A79",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltrPar:"\u2996",ltri:"\u25C3",triangleleft:"\u25C3",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",mDDot:"\u223A",macr:"\xAF",strns:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",marker:"\u25AE",mcomma:"\u2A29",mcy:"\u043C",mdash:"\u2014",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",midcir:"\u2AF0",minus:"\u2212",minusdu:"\u2A2A",mlcp:"\u2ADB",models:"\u22A7",mopf:"\u{1D55E}",mscr:"\u{1D4C2}",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nGg:"\u22D9\u0338",nGt:"\u226B\u20D2",nLeftarrow:"\u21CD",nlArr:"\u21CD",nLeftrightarrow:"\u21CE",nhArr:"\u21CE",nLl:"\u22D8\u0338",nLt:"\u226A\u20D2",nRightarrow:"\u21CF",nrArr:"\u21CF",nVDash:"\u22AF",nVdash:"\u22AE",nacute:"\u0144",nang:"\u2220\u20D2",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",natur:"\u266E",natural:"\u266E",ncap:"\u2A43",ncaron:"\u0148",ncedil:"\u0146",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",ncy:"\u043D",ndash:"\u2013",neArr:"\u21D7",nearhk:"\u2924",nedot:"\u2250\u0338",nesear:"\u2928",toea:"\u2928",nfr:"\u{1D52B}",nharr:"\u21AE",nleftrightarrow:"\u21AE",nhpar:"\u2AF2",nis:"\u22FC",nisd:"\u22FA",njcy:"\u045A",nlE:"\u2266\u0338",nleqq:"\u2266\u0338",nlarr:"\u219A",nleftarrow:"\u219A",nldr:"\u2025",nopf:"\u{1D55F}",not:"\xAC",notinE:"\u22F9\u0338",notindot:"\u22F5\u0338",notinvb:"\u22F7",notinvc:"\u22F6",notnivb:"\u22FE",notnivc:"\u22FD",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",nrarr:"\u219B",nrightarrow:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nscr:"\u{1D4C3}",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsubseteqq:"\u2AC5\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupseteqq:"\u2AC6\u0338",ntilde:"\xF1",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvDash:"\u22AD",nvHarr:"\u2904",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwArr:"\u21D6",nwarhk:"\u2923",nwnear:"\u2927",oacute:"\xF3",ocirc:"\xF4",ocy:"\u043E",odblac:"\u0151",odiv:"\u2A38",odsold:"\u29BC",oelig:"\u0153",ofcir:"\u29BF",ofr:"\u{1D52C}",ogon:"\u02DB",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",olcir:"\u29BE",olcross:"\u29BB",olt:"\u29C0",omacr:"\u014D",omega:"\u03C9",omicron:"\u03BF",omid:"\u29B6",oopf:"\u{1D560}",opar:"\u29B7",operp:"\u29B9",or:"\u2228",vee:"\u2228",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",oscr:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oslash:"\xF8",osol:"\u2298",otilde:"\xF5",otimesas:"\u2A36",ouml:"\xF6",ovbar:"\u233D",para:"\xB6",parsim:"\u2AF3",parsl:"\u2AFD",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",pertenk:"\u2031",pfr:"\u{1D52D}",phi:"\u03C6",phiv:"\u03D5",straightphi:"\u03D5",varphi:"\u03D5",phone:"\u260E",pi:"\u03C0",piv:"\u03D6",varpi:"\u03D6",planckh:"\u210E",plus:"+",plusacir:"\u2A23",pluscir:"\u2A22",plusdu:"\u2A25",pluse:"\u2A72",plussim:"\u2A26",plustwo:"\u2A27",pointint:"\u2A15",popf:"\u{1D561}",pound:"\xA3",prE:"\u2AB3",prap:"\u2AB7",precapprox:"\u2AB7",precnapprox:"\u2AB9",prnap:"\u2AB9",precneqq:"\u2AB5",prnE:"\u2AB5",precnsim:"\u22E8",prnsim:"\u22E8",prime:"\u2032",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prurel:"\u22B0",pscr:"\u{1D4C5}",psi:"\u03C8",puncsp:"\u2008",qfr:"\u{1D52E}",qopf:"\u{1D562}",qprime:"\u2057",qscr:"\u{1D4C6}",quatint:"\u2A16",quest:"?",rAtail:"\u291C",rHar:"\u2964",race:"\u223D\u0331",racute:"\u0155",raemptyv:"\u29B3",rangd:"\u2992",range:"\u29A5",raquo:"\xBB",rarrap:"\u2975",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrpl:"\u2945",rarrsim:"\u2974",rarrtl:"\u21A3",rightarrowtail:"\u21A3",rarrw:"\u219D",rightsquigarrow:"\u219D",ratail:"\u291A",ratio:"\u2236",rbbrk:"\u2773",rbrace:"}",rcub:"}",rbrack:"]",rsqb:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",rcaron:"\u0159",rcedil:"\u0157",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdsh:"\u21B3",rect:"\u25AD",rfisht:"\u297D",rfr:"\u{1D52F}",rharul:"\u296C",rho:"\u03C1",rhov:"\u03F1",varrho:"\u03F1",rightrightarrows:"\u21C9",rrarr:"\u21C9",rightthreetimes:"\u22CC",rthree:"\u22CC",ring:"\u02DA",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",ropar:"\u2986",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rsaquo:"\u203A",rscr:"\u{1D4C7}",rtimes:"\u22CA",rtri:"\u25B9",triangleright:"\u25B9",rtriltri:"\u29CE",ruluhar:"\u2968",rx:"\u211E",sacute:"\u015B",scE:"\u2AB4",scap:"\u2AB8",succapprox:"\u2AB8",scaron:"\u0161",scedil:"\u015F",scirc:"\u015D",scnE:"\u2AB6",succneqq:"\u2AB6",scnap:"\u2ABA",succnapprox:"\u2ABA",scnsim:"\u22E9",succnsim:"\u22E9",scpolint:"\u2A13",scy:"\u0441",sdot:"\u22C5",sdote:"\u2A66",seArr:"\u21D8",sect:"\xA7",semi:";",seswar:"\u2929",tosa:"\u2929",sext:"\u2736",sfr:"\u{1D530}",sharp:"\u266F",shchcy:"\u0449",shcy:"\u0448",shy:"\xAD",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",varsigma:"\u03C2",simdot:"\u2A6A",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",smashp:"\u2A33",smeparsl:"\u29E4",smile:"\u2323",ssmile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",sqcaps:"\u2293\uFE00",sqcups:"\u2294\uFE00",sscr:"\u{1D4C8}",star:"\u2606",sub:"\u2282",subset:"\u2282",subE:"\u2AC5",subseteqq:"\u2AC5",subdot:"\u2ABD",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subsetneqq:"\u2ACB",subne:"\u228A",subsetneq:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",sung:"\u266A",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supE:"\u2AC6",supseteqq:"\u2AC6",supdot:"\u2ABE",supdsub:"\u2AD8",supedot:"\u2AC4",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supsetneqq:"\u2ACC",supne:"\u228B",supsetneq:"\u228B",supplus:"\u2AC0",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swArr:"\u21D9",swnwar:"\u292A",szlig:"\xDF",target:"\u2316",tau:"\u03C4",tcaron:"\u0165",tcedil:"\u0163",tcy:"\u0442",telrec:"\u2315",tfr:"\u{1D531}",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",vartheta:"\u03D1",thorn:"\xFE",times:"\xD7",timesbar:"\u2A31",timesd:"\u2A30",topbot:"\u2336",topcir:"\u2AF1",topf:"\u{1D565}",topfork:"\u2ADA",tprime:"\u2034",triangle:"\u25B5",utri:"\u25B5",triangleq:"\u225C",trie:"\u225C",tridot:"\u25EC",triminus:"\u2A3A",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",tscr:"\u{1D4C9}",tscy:"\u0446",tshcy:"\u045B",tstrok:"\u0167",uHar:"\u2963",uacute:"\xFA",ubrcy:"\u045E",ubreve:"\u016D",ucirc:"\xFB",ucy:"\u0443",udblac:"\u0171",ufisht:"\u297E",ufr:"\u{1D532}",ugrave:"\xF9",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",umacr:"\u016B",uogon:"\u0173",uopf:"\u{1D566}",upsi:"\u03C5",upsilon:"\u03C5",upuparrows:"\u21C8",uuarr:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",uring:"\u016F",urtri:"\u25F9",uscr:"\u{1D4CA}",utdot:"\u22F0",utilde:"\u0169",uuml:"\xFC",uwangle:"\u29A7",vBar:"\u2AE8",vBarv:"\u2AE9",vangrt:"\u299C",varsubsetneq:"\u228A\uFE00",vsubne:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",vsubnE:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",vsupne:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vsupnE:"\u2ACC\uFE00",vcy:"\u0432",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",vfr:"\u{1D533}",vopf:"\u{1D567}",vscr:"\u{1D4CB}",vzigzag:"\u299A",wcirc:"\u0175",wedbar:"\u2A5F",wedgeq:"\u2259",weierp:"\u2118",wp:"\u2118",wfr:"\u{1D534}",wopf:"\u{1D568}",wscr:"\u{1D4CC}",xfr:"\u{1D535}",xi:"\u03BE",xnis:"\u22FB",xopf:"\u{1D569}",xscr:"\u{1D4CD}",yacute:"\xFD",yacy:"\u044F",ycirc:"\u0177",ycy:"\u044B",yen:"\xA5",yfr:"\u{1D536}",yicy:"\u0457",yopf:"\u{1D56A}",yscr:"\u{1D4CE}",yucy:"\u044E",yuml:"\xFF",zacute:"\u017A",zcaron:"\u017E",zcy:"\u0437",zdot:"\u017C",zeta:"\u03B6",zfr:"\u{1D537}",zhcy:"\u0436",zigrarr:"\u21DD",zopf:"\u{1D56B}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"},CF="\uE500";P0.ngsp=CF;var o3=class{tokens;errors;nonNormalizedIcuExpressions;constructor(o,e,t){this.tokens=o,this.errors=e,this.nonNormalizedIcuExpressions=t}};function zq(n,o,e,t={}){let i=new r3(new ax(n,o),e,t);return i.tokenize(),new o3(qq(i.tokens),i.errors,i.nonNormalizedIcuExpressions)}var Lq=/\r\n?/g;function bg(n){return`Unexpected character "${n===or?"EOF":String.fromCharCode(n)}"`}function y6(n){return`Unknown entity "${n}" - use the "&#;" or "&#x;" syntax`}function Vq(n,o){return`Unable to parse entity "${o}" - ${n} character reference entities must end with ";"`}var a3=(function(n){return n.HEX="hexadecimal",n.DEC="decimal",n})(a3||{}),Bq=["@if","@else","@for","@switch","@case","@default","@empty","@defer","@placeholder","@loading","@error"],hf={start:"{{",end:"}}"},r3=class{_getTagDefinition;_cursor;_tokenizeIcu;_leadingTriviaCodePoints;_currentTokenStart=null;_currentTokenType=null;_expansionCaseStack=[];_openDirectiveCount=0;_inInterpolation=!1;_preserveLineEndings;_i18nNormalizeLineEndingsInICUs;_tokenizeBlocks;_tokenizeLet;_selectorlessEnabled;tokens=[];errors=[];nonNormalizedIcuExpressions=[];constructor(o,e,t){this._getTagDefinition=e,this._tokenizeIcu=t.tokenizeExpansionForms||!1,this._leadingTriviaCodePoints=t.leadingTriviaChars&&t.leadingTriviaChars.map(a=>a.codePointAt(0)||0);let i=t.range||{endPos:o.content.length,startPos:0,startLine:0,startCol:0};this._cursor=t.escapedString?new s3(o,i):new xx(o,i),this._preserveLineEndings=t.preserveLineEndings||!1,this._i18nNormalizeLineEndingsInICUs=t.i18nNormalizeLineEndingsInICUs||!1,this._tokenizeBlocks=t.tokenizeBlocks??!0,this._tokenizeLet=t.tokenizeLet??!0,this._selectorlessEnabled=t.selectorlessEnabled??!1;try{this._cursor.init()}catch(a){this.handleError(a)}}_processCarriageReturns(o){return this._preserveLineEndings?o:o.replace(Lq,` +`)}tokenize(){for(;this._cursor.peek()!==or;){let o=this._cursor.clone();try{this._attemptCharCode(Ig)?this._attemptCharCode(LP)?this._attemptCharCode(Lc)?this._consumeCdata(o):this._attemptCharCode(ix)?this._consumeComment(o):this._consumeDocType(o):this._attemptCharCode(gl)?this._consumeTagClose(o):this._consumeTagOpen(o):this._tokenizeLet&&this._cursor.peek()===fg&&!this._inInterpolation&&this._isLetStart()?this._consumeLetDeclaration(o):this._tokenizeBlocks&&this._isBlockStart()?this._consumeBlockStart(o):this._tokenizeBlocks&&!this._inInterpolation&&!this._isInExpansionCase()&&!this._isInExpansionForm()&&this._attemptCharCode(es)?this._consumeBlockEnd(o):this._tokenizeIcu&&this._tokenizeExpansionForm()||this._consumeWithInterpolation(5,8,()=>this._isTextEnd(),()=>this._isTagStart())}catch(e){this.handleError(e)}}this._beginToken(41),this._endToken([])}_getBlockName(){let o=!1,e=this._cursor.clone();return this._attemptCharCodeUntilFn(t=>g0(t)?!o:Gq(t)?(o=!0,!1):!0),this._cursor.getChars(e).trim()}_consumeBlockStart(o){this._requireCharCode(fg),this._beginToken(24,o);let e=this._endToken([this._getBlockName()]);if(e.parts[0]==="default never"&&this._attemptCharCode(bs)){this._beginToken(25),this._endToken([]),this._beginToken(26),this._endToken([]);return}if(this._cursor.peek()===ns)if(this._cursor.advance(),this._consumeBlockParameters(),this._attemptCharCodeUntilFn(Uo),this._attemptCharCode(Ea))this._attemptCharCodeUntilFn(Uo);else{e.type=28;return}this._attemptCharCode(fl)?(this._beginToken(25),this._endToken([])):this._isBlockStart()&&(e.parts[0]==="case"||e.parts[0]==="default")?(this._beginToken(25),this._endToken([]),this._beginToken(26),this._endToken([])):e.type=28}_consumeBlockEnd(o){this._beginToken(26,o),this._endToken([])}_consumeBlockParameters(){for(this._attemptCharCodeUntilFn(M6);this._cursor.peek()!==Ea&&this._cursor.peek()!==or;){this._beginToken(27);let o=this._cursor.clone(),e=null,t=0;for(;this._cursor.peek()!==bs&&this._cursor.peek()!==or||e!==null;){let i=this._cursor.peek();if(i===Jp)this._cursor.advance();else if(i===e)e=null;else if(e===null&&Of(i))e=i;else if(i===ns&&e===null)t++;else if(i===Ea&&e===null){if(t===0)break;t>0&&t--}this._cursor.advance()}this._endToken([this._cursor.getChars(o)]),this._attemptCharCodeUntilFn(M6)}}_consumeLetDeclaration(o){if(this._requireStr("@let"),this._beginToken(29,o),g0(this._cursor.peek()))this._attemptCharCodeUntilFn(Uo);else{let i=this._endToken([this._cursor.getChars(o)]);i.type=32;return}let e=this._endToken([this._getLetDeclarationName()]);if(this._attemptCharCodeUntilFn(Uo),!this._attemptCharCode(nr)){e.type=32;return}this._attemptCharCodeUntilFn(i=>Uo(i)&&!ox(i)),this._consumeLetDeclarationValue(),this._cursor.peek()===bs?(this._beginToken(31),this._cursor.advance(),this._endToken([])):(e.type=32,e.sourceSpan=this._cursor.getSpan(o))}_getLetDeclarationName(){let o=this._cursor.clone(),e=!1;return this._attemptCharCodeUntilFn(t=>Nm(t)||t===zx||t===Bm||e&&hl(t)?(e=!0,!1):!0),this._cursor.getChars(o).trim()}_consumeLetDeclarationValue(){let o=this._cursor.clone();for(this._beginToken(30,o);this._cursor.peek()!==or;){let e=this._cursor.peek();if(e===bs)break;Of(e)&&(this._cursor.advance(),this._attemptCharCodeUntilFn(t=>t===Jp?(this._cursor.advance(),!1):t===e)),this._cursor.advance()}this._endToken([this._cursor.getChars(o)])}_tokenizeExpansionForm(){if(this.isExpansionFormStart())return this._consumeExpansionFormStart(),!0;if(Uq(this._cursor.peek())&&this._isInExpansionForm())return this._consumeExpansionCaseStart(),!0;if(this._cursor.peek()===es){if(this._isInExpansionCase())return this._consumeExpansionCaseEnd(),!0;if(this._isInExpansionForm())return this._consumeExpansionFormEnd(),!0}return!1}_beginToken(o,e=this._cursor.clone()){this._currentTokenStart=e,this._currentTokenType=o}_endToken(o,e){if(this._currentTokenStart===null)throw new dn(this._cursor.getSpan(e),"Programming error - attempted to end a token when there was no start to the token");if(this._currentTokenType===null)throw new dn(this._cursor.getSpan(this._currentTokenStart),"Programming error - attempted to end a token which has no token type");let t={type:this._currentTokenType,parts:o,sourceSpan:(e??this._cursor).getSpan(this._currentTokenStart,this._leadingTriviaCodePoints)};return this.tokens.push(t),this._currentTokenStart=null,this._currentTokenType=null,t}_createError(o,e){this._isInExpansionForm()&&(o+=` (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)`);let t=new dn(e,o);return this._currentTokenStart=null,this._currentTokenType=null,t}handleError(o){if(o instanceof T0&&(o=this._createError(o.msg,this._cursor.getSpan(o.cursor))),o instanceof dn)this.errors.push(o);else throw o}_attemptCharCode(o){return this._cursor.peek()===o?(this._cursor.advance(),!0):!1}_attemptCharCodeCaseInsensitive(o){return Wq(this._cursor.peek(),o)?(this._cursor.advance(),!0):!1}_requireCharCode(o){let e=this._cursor.clone();if(!this._attemptCharCode(o))throw this._createError(bg(this._cursor.peek()),this._cursor.getSpan(e))}_attemptStr(o){let e=o.length;if(this._cursor.charsLeft()this._peekStr(o))}_isLetStart(){return this._cursor.peek()===fg&&this._peekStr("@let")}_consumeEntity(o){this._beginToken(9);let e=this._cursor.clone();if(this._cursor.advance(),this._attemptCharCode(HN)){let t=this._attemptCharCode(YN)||this._attemptCharCode(nW),i=this._cursor.clone();if(this._attemptCharCodeUntilFn($q),this._cursor.peek()!=bs){this._cursor.advance();let s=t?a3.HEX:a3.DEC;throw this._createError(Vq(s,this._cursor.getChars(e)),this._cursor.getSpan())}let a=this._cursor.getChars(i);this._cursor.advance();try{let s=parseInt(a,t?16:10);this._endToken([String.fromCodePoint(s),this._cursor.getChars(e)])}catch{throw this._createError(y6(this._cursor.getChars(e)),this._cursor.getSpan())}}else{let t=this._cursor.clone();if(this._attemptCharCodeUntilFn(Hq),this._cursor.peek()!=bs)this._beginToken(o,e),this._cursor=t,this._endToken(["&"]);else{let i=this._cursor.getChars(t);this._cursor.advance();let a=P0.hasOwnProperty(i)&&P0[i];if(!a)throw this._createError(y6(i),this._cursor.getSpan(e));this._endToken([a,`&${i};`])}}}_consumeRawText(o,e){this._beginToken(o?6:7);let t=[];for(;;){let i=this._cursor.clone(),a=e();if(this._cursor=i,a)break;o&&this._cursor.peek()===nx?(this._endToken([this._processCarriageReturns(t.join(""))]),t.length=0,this._consumeEntity(6),this._beginToken(6)):t.push(this._readChar())}this._endToken([this._processCarriageReturns(t.join(""))])}_consumeComment(o){this._beginToken(10,o),this._requireCharCode(ix),this._endToken([]),this._consumeRawText(!1,()=>this._attemptStr("-->")),this._beginToken(11),this._requireStr("-->"),this._endToken([])}_consumeCdata(o){this._beginToken(12,o),this._requireStr("CDATA["),this._endToken([]),this._consumeRawText(!1,()=>this._attemptStr("]]>")),this._beginToken(13),this._requireStr("]]>"),this._endToken([])}_consumeDocType(o){this._beginToken(18,o);let e=this._cursor.clone();this._attemptUntilChar(Ws);let t=this._cursor.getChars(e);this._cursor.advance(),this._endToken([t])}_consumePrefixAndName(o){let e=this._cursor.clone(),t="";for(;this._cursor.peek()!==Fc&&!jq(this._cursor.peek());)this._cursor.advance();let i;this._cursor.peek()===Fc?(t=this._cursor.getChars(e),this._cursor.advance(),i=this._cursor.clone()):i=e,this._requireCharCodeUntilFn(o,t===""?0:1);let a=this._cursor.getChars(i);return[t,a]}_consumeTagOpen(o){let e,t,i,a;try{if(this._selectorlessEnabled&&mb(this._cursor.peek()))a=this._consumeComponentOpenStart(o),[i,t,e]=a.parts,t&&(i+=`:${t}`),e&&(i+=`:${e}`),this._attemptCharCodeUntilFn(Uo);else{if(!Nm(this._cursor.peek()))throw this._createError(bg(this._cursor.peek()),this._cursor.getSpan(o));a=this._consumeTagOpenStart(o),t=a.parts[0],e=i=a.parts[1],this._attemptCharCodeUntilFn(Uo)}for(;!k6(this._cursor.peek());)if(this._selectorlessEnabled&&this._cursor.peek()===fg){let d=this._cursor.clone(),p=d.clone();p.advance(),mb(p.peek())&&this._consumeDirective(d,p)}else this._consumeAttribute();a.type===33?this._consumeComponentOpenEnd():this._consumeTagOpenEnd()}catch(d){if(d instanceof dn){a?a.type=a.type===33?37:4:(this._beginToken(5,o),this._endToken(["<"]));return}throw d}let s=this._getTagDefinition(e).getContentType(t);s===Nc.RAW_TEXT?this._consumeRawTextWithTagClose(a,i,!1):s===Nc.ESCAPABLE_RAW_TEXT&&this._consumeRawTextWithTagClose(a,i,!0)}_consumeRawTextWithTagClose(o,e,t){this._consumeRawText(t,()=>!this._attemptCharCode(Ig)||!this._attemptCharCode(gl)||(this._attemptCharCodeUntilFn(Uo),!this._attemptStrCaseInsensitive(e))?!1:(this._attemptCharCodeUntilFn(Uo),this._attemptCharCode(Ws))),this._beginToken(o.type===33?36:3),this._requireCharCodeUntilFn(i=>i===Ws,3),this._cursor.advance(),this._endToken(o.parts)}_consumeTagOpenStart(o){this._beginToken(0,o);let e=this._consumePrefixAndName(Bp);return this._endToken(e)}_consumeComponentOpenStart(o){this._beginToken(33,o);let e=this._consumeComponentName();return this._endToken(e)}_consumeComponentName(){let o=this._cursor.clone();for(;S6(this._cursor.peek());)this._cursor.advance();let e=this._cursor.getChars(o),t="",i="";return this._cursor.peek()===Fc&&(this._cursor.advance(),[t,i]=this._consumePrefixAndName(Bp)),[e,t,i]}_consumeAttribute(){this._consumeAttributeName(),this._attemptCharCodeUntilFn(Uo),this._attemptCharCode(nr)&&(this._attemptCharCodeUntilFn(Uo),this._consumeAttributeValue()),this._attemptCharCodeUntilFn(Uo)}_consumeAttributeName(){let o=this._cursor.peek();if(o===u0||o===p0)throw this._createError(bg(o),this._cursor.getSpan());this._beginToken(14);let e;if(this._openDirectiveCount>0){let i=0;e=a=>{if(this._openDirectiveCount>0){if(a===ns)i++;else if(a===Ea){if(i===0)return!0;i--}}return Bp(a)}}else if(o===Lc){let i=0;e=a=>(a===Lc?i++:a===Od&&i--,i<=0?Bp(a):ox(a))}else e=Bp;let t=this._consumePrefixAndName(e);this._endToken(t)}_consumeAttributeValue(){if(this._cursor.peek()===u0||this._cursor.peek()===p0){let o=this._cursor.peek();this._consumeQuote(o);let e=()=>this._cursor.peek()===o;this._consumeWithInterpolation(16,17,e,e),this._consumeQuote(o)}else{let o=()=>Bp(this._cursor.peek());this._consumeWithInterpolation(16,17,o,o)}}_consumeQuote(o){this._beginToken(15),this._requireCharCode(o),this._endToken([String.fromCodePoint(o)])}_consumeTagOpenEnd(){let o=this._attemptCharCode(gl)?2:1;this._beginToken(o),this._requireCharCode(Ws),this._endToken([])}_consumeComponentOpenEnd(){let o=this._attemptCharCode(gl)?35:34;this._beginToken(o),this._requireCharCode(Ws),this._endToken([])}_consumeTagClose(o){if(this._selectorlessEnabled){let t=o.clone();for(;t.peek()!==Ws&&!mb(t.peek());)t.advance();if(mb(t.peek())){this._beginToken(36,o);let i=this._consumeComponentName();this._attemptCharCodeUntilFn(Uo),this._requireCharCode(Ws),this._endToken(i);return}}this._beginToken(3,o),this._attemptCharCodeUntilFn(Uo);let e=this._consumePrefixAndName(Bp);this._attemptCharCodeUntilFn(Uo),this._requireCharCode(Ws),this._endToken(e)}_consumeExpansionFormStart(){this._beginToken(19),this._requireCharCode(fl),this._endToken([]),this._expansionCaseStack.push(19),this._beginToken(7);let o=this._readUntil(Nr),e=this._processCarriageReturns(o);if(this._i18nNormalizeLineEndingsInICUs)this._endToken([e]);else{let i=this._endToken([o]);e!==o&&this.nonNormalizedIcuExpressions.push(i)}this._requireCharCode(Nr),this._attemptCharCodeUntilFn(Uo),this._beginToken(7);let t=this._readUntil(Nr);this._endToken([t]),this._requireCharCode(Nr),this._attemptCharCodeUntilFn(Uo)}_consumeExpansionCaseStart(){this._beginToken(20);let o=this._readUntil(fl).trim();this._endToken([o]),this._attemptCharCodeUntilFn(Uo),this._beginToken(21),this._requireCharCode(fl),this._endToken([]),this._attemptCharCodeUntilFn(Uo),this._expansionCaseStack.push(21)}_consumeExpansionCaseEnd(){this._beginToken(22),this._requireCharCode(es),this._endToken([]),this._attemptCharCodeUntilFn(Uo),this._expansionCaseStack.pop()}_consumeExpansionFormEnd(){this._beginToken(23),this._requireCharCode(es),this._endToken([]),this._expansionCaseStack.pop()}_consumeWithInterpolation(o,e,t,i){this._beginToken(o);let a=[];for(;!t();){let s=this._cursor.clone();this._attemptStr(hf.start)?(this._endToken([this._processCarriageReturns(a.join(""))],s),a.length=0,this._consumeInterpolation(e,s,i),this._beginToken(o)):this._cursor.peek()===nx?(this._endToken([this._processCarriageReturns(a.join(""))]),a.length=0,this._consumeEntity(o),this._beginToken(o)):a.push(this._readChar())}this._inInterpolation=!1,this._endToken([this._processCarriageReturns(a.join(""))])}_consumeInterpolation(o,e,t){let i=[];this._beginToken(o,e),i.push(hf.start);let a=this._cursor.clone(),s=null,d=!1;for(;this._cursor.peek()!==or&&(t===null||!t());){let p=this._cursor.clone();if(this._isTagStart()){this._cursor=p,i.push(this._getProcessedChars(a,p)),this._endToken(i);return}if(s===null)if(this._attemptStr(hf.end)){i.push(this._getProcessedChars(a,p)),i.push(hf.end),this._endToken(i);return}else this._attemptStr("//")&&(d=!0);let u=this._cursor.peek();this._cursor.advance(),u===Jp?this._cursor.advance():u===s?s=null:!d&&s===null&&Of(u)&&(s=u)}i.push(this._getProcessedChars(a,this._cursor)),this._endToken(i)}_consumeDirective(o,e){for(this._requireCharCode(fg),this._cursor.advance();S6(this._cursor.peek());)this._cursor.advance();this._beginToken(38,o);let t=this._cursor.getChars(e);if(this._endToken([t]),this._attemptCharCodeUntilFn(Uo),this._cursor.peek()===ns){for(this._openDirectiveCount++,this._beginToken(39),this._cursor.advance(),this._endToken([]),this._attemptCharCodeUntilFn(Uo);!k6(this._cursor.peek())&&this._cursor.peek()!==Ea;)this._consumeAttribute();if(this._attemptCharCodeUntilFn(Uo),this._openDirectiveCount--,this._cursor.peek()!==Ea){if(this._cursor.peek()===Ws||this._cursor.peek()===gl)return;throw this._createError(bg(this._cursor.peek()),this._cursor.getSpan(o))}this._beginToken(40),this._cursor.advance(),this._endToken([]),this._attemptCharCodeUntilFn(Uo)}}_getProcessedChars(o,e){return this._processCarriageReturns(e.getChars(o))}_isTextEnd(){return!!(this._isTagStart()||this._cursor.peek()===or||this._tokenizeIcu&&!this._inInterpolation&&(this.isExpansionFormStart()||this._cursor.peek()===es&&this._isInExpansionCase())||this._tokenizeBlocks&&!this._inInterpolation&&!this._isInExpansion()&&(this._isBlockStart()||this._isLetStart()||this._cursor.peek()===es))}_isTagStart(){if(this._cursor.peek()===Ig){let o=this._cursor.clone();o.advance();let e=o.peek();if(pu<=e&&e<=z0||Vm<=e&&e<=eh||e===gl||e===LP)return!0}return!1}_readUntil(o){let e=this._cursor.clone();return this._attemptUntilChar(o),this._cursor.getChars(e)}_isInExpansion(){return this._isInExpansionCase()||this._isInExpansionForm()}_isInExpansionCase(){return this._expansionCaseStack.length>0&&this._expansionCaseStack[this._expansionCaseStack.length-1]===21}_isInExpansionForm(){return this._expansionCaseStack.length>0&&this._expansionCaseStack[this._expansionCaseStack.length-1]===19}isExpansionFormStart(){if(this._cursor.peek()!==fl)return!1;let o=this._cursor.clone(),e=this._attemptStr(hf.start);return this._cursor=o,!e}};function Uo(n){return!g0(n)||n===or}function Bp(n){return g0(n)||n===Ws||n===Ig||n===gl||n===u0||n===p0||n===nr||n===or}function jq(n){return(nWN)}function $q(n){return n===bs||n===or||!rW(n)}function Hq(n){return n===bs||n===or||!(Nm(n)||hl(n))}function Uq(n){return n!==es}function Wq(n,o){return w6(n)===w6(o)}function w6(n){return n>=pu&&n<=z0?n-pu+Vm:n}function Gq(n){return Nm(n)||hl(n)||n===Bm}function M6(n){return n!==bs&&Uo(n)}function mb(n){return n===Bm||n>=Vm&&n<=eh}function S6(n){return Nm(n)||hl(n)||n===Bm}function k6(n){return n===gl||n===Ws||n===Ig||n===or}function qq(n){let o=[],e;for(let t=0;t0&&e.indexOf(o.peek())!==-1;)t===o&&(o=o.clone()),o.advance();let i=this.locationFromCursor(o),a=this.locationFromCursor(this),s=t!==o?this.locationFromCursor(t):i;return new In(i,a,s)}getChars(o){return this.input.substring(o.state.offset,this.state.offset)}charAt(o){return this.input.charCodeAt(o)}advanceState(o){if(o.offset>=this.end)throw this.state=o,new T0('Unexpected character "EOF"',this);let e=this.charAt(o.offset);e===Zp?(o.line++,o.column=0):ox(e)||o.column++,o.offset++,this.updatePeek(o)}updatePeek(o){o.peek=o.offset>=this.end?or:this.charAt(o.offset)}locationFromCursor(o){return new h0(o.file,o.state.offset,o.state.line,o.state.column)}},s3=class n extends xx{internalState;constructor(o,e){o instanceof n?(super(o),this.internalState=q({},o.internalState)):(super(o,e),this.internalState=this.state)}advance(){this.state=this.internalState,super.advance(),this.processEscapeSequence()}init(){super.init(),this.processEscapeSequence()}clone(){return new n(this)}getChars(o){let e=o.clone(),t="";for(;e.internalState.offsetthis.internalState.peek;if(o()===Jp)if(this.internalState=q({},this.state),this.advanceState(this.internalState),o()===GN)this.state.peek=Zp;else if(o()===qN)this.state.peek=Y3;else if(o()===XN)this.state.peek=BN;else if(o()===QN)this.state.peek=X3;else if(o()===oW)this.state.peek=YU;else if(o()===J3)this.state.peek=jN;else if(o()===KN)if(this.advanceState(this.internalState),o()===fl){this.advanceState(this.internalState);let e=this.clone(),t=0;for(;o()!==es;)this.advanceState(this.internalState),t++;this.state.peek=this.decodeHexDigits(e,t)}else{let e=this.clone();this.advanceState(this.internalState),this.advanceState(this.internalState),this.advanceState(this.internalState),this.state.peek=this.decodeHexDigits(e,4)}else if(o()===YN){this.advanceState(this.internalState);let e=this.clone();this.advanceState(this.internalState),this.state.peek=this.decodeHexDigits(e,2)}else if(e6(o())){let e="",t=0,i=this.clone();for(;e6(o())&&t<3;)i=this.clone(),e+=String.fromCodePoint(o()),this.advanceState(this.internalState),t++;this.state.peek=parseInt(e,8),this.internalState=i.internalState}else ox(this.internalState.peek)?(this.advanceState(this.internalState),this.state=this.internalState):this.state.peek=this.internalState.peek}decodeHexDigits(o,e){let t=this.input.slice(o.internalState.offset,o.internalState.offset+e),i=parseInt(t,16);if(isNaN(i))throw o.state=o.internalState,new T0("Invalid hexadecimal escape sequence",o);return i}},T0=class extends Error{msg;cursor;constructor(o,e){super(o),this.msg=o,this.cursor=e,Object.setPrototypeOf(this,new.target.prototype)}},ya=class n extends dn{elementName;static create(o,e,t){return new n(o,e,t)}constructor(o,e,t){super(e,t),this.elementName=o}},yx=class{rootNodes;errors;constructor(o,e){this.rootNodes=o,this.errors=e}},Qq=class{getTagDefinition;constructor(o){this.getTagDefinition=o}parse(o,e,t){let i=zq(o,e,this.getTagDefinition,t),a=new l3(i.tokens,this.getTagDefinition);return a.build(),new yx(a.rootNodes,[...i.errors,...a.errors])}},l3=class n{tokens;tagDefinitionResolver;_index=-1;_peek;_containerStack=[];rootNodes=[];errors=[];constructor(o,e){this.tokens=o,this.tagDefinitionResolver=e,this._advance()}build(){for(;this._peek.type!==41;)this._peek.type===0||this._peek.type===4?this._consumeElementStartTag(this._advance()):this._peek.type===3?this._consumeElementEndTag(this._advance()):this._peek.type===12?(this._closeVoidElement(),this._consumeCdata(this._advance())):this._peek.type===10?(this._closeVoidElement(),this._consumeComment(this._advance())):this._peek.type===5||this._peek.type===7||this._peek.type===6?(this._closeVoidElement(),this._consumeText(this._advance())):this._peek.type===19?this._consumeExpansion(this._advance()):this._peek.type===24?(this._closeVoidElement(),this._consumeBlockOpen(this._advance())):this._peek.type===26?(this._closeVoidElement(),this._consumeBlockClose(this._advance())):this._peek.type===28?(this._closeVoidElement(),this._consumeIncompleteBlock(this._advance())):this._peek.type===29?(this._closeVoidElement(),this._consumeLet(this._advance())):this._peek.type===32?(this._closeVoidElement(),this._consumeIncompleteLet(this._advance())):this._peek.type===33||this._peek.type===37?this._consumeComponentStartTag(this._advance()):this._peek.type===36?this._consumeComponentEndTag(this._advance()):this._advance();for(let o of this._containerStack)o instanceof _l&&this.errors.push(ya.create(o.name,o.sourceSpan,`Unclosed block "${o.name}"`))}_advance(){let o=this._peek;return this._index0)return this.errors=this.errors.concat(a.errors),null;let s=new In(o.sourceSpan.start,i.sourceSpan.end,o.sourceSpan.fullStart),d=new In(e.sourceSpan.start,i.sourceSpan.end,e.sourceSpan.fullStart);return new vx(o.parts[0],a.rootNodes,s,o.sourceSpan,d)}_collectExpansionExpTokens(o){let e=[],t=[21];for(;;){if((this._peek.type===19||this._peek.type===21)&&t.push(this._peek.type),this._peek.type===22)if(P6(t,21)){if(t.pop(),t.length===0)return e}else return this.errors.push(ya.create(null,o.sourceSpan,"Invalid ICU message. Missing '}'.")),null;if(this._peek.type===23)if(P6(t,19))t.pop();else return this.errors.push(ya.create(null,o.sourceSpan,"Invalid ICU message. Missing '}'.")),null;if(this._peek.type===41)return this.errors.push(ya.create(null,o.sourceSpan,"Invalid ICU message. Missing '}'.")),null;e.push(this._advance())}}_consumeText(o){let e=[o],t=o.sourceSpan,i=o.parts[0];if(i.length>0&&i[0]===` +`){let a=this._getContainer();a!=null&&a.children.length===0&&this._getTagDefinition(a)?.ignoreFirstLf&&(i=i.substring(1),e[0]={type:o.type,sourceSpan:o.sourceSpan,parts:[i]})}for(;this._peek.type===8||this._peek.type===5||this._peek.type===9;)o=this._advance(),e.push(o),o.type===8?i+=o.parts.join("").replace(/&([^;]+);/g,T6):o.type===9?i+=o.parts[0]:i+=o.parts.join("");if(i.length>0){let a=o.sourceSpan;this._addToParent(new fu(i,new In(t.start,a.end,t.fullStart,t.details),e))}}_closeVoidElement(){let o=this._getContainer();o!==null&&this._getTagDefinition(o)?.isVoid&&this._containerStack.pop()}_consumeElementStartTag(o){let e=[],t=[];this._consumeAttributesAndDirectives(e,t);let i=this._getElementFullName(o,this._getClosestElementLikeParent()),a=this._getTagDefinition(i),s=!1;this._peek.type===2?(this._advance(),s=!0,a?.canSelfClose||PP(i)!==null||a?.isVoid||this.errors.push(ya.create(i,o.sourceSpan,`Only void, custom and foreign elements can be self closed "${o.parts[1]}"`))):this._peek.type===1&&(this._advance(),s=!1);let d=this._peek.sourceSpan.fullStart,p=new In(o.sourceSpan.start,d,o.sourceSpan.fullStart),u=new In(o.sourceSpan.start,d,o.sourceSpan.fullStart),g=new ul(i,e,t,[],s,p,u,void 0,a?.isVoid??!1),C=this._getContainer(),M=C!==null&&!!this._getTagDefinition(C)?.isClosedByChild(g.name);this._pushContainer(g,M),s?this._popContainer(i,ul,p):o.type===4&&(this._popContainer(i,ul,null),this.errors.push(ya.create(i,p,`Opening tag "${i}" not terminated.`)))}_consumeComponentStartTag(o){let e=o.parts[0],t=[],i=[];this._consumeAttributesAndDirectives(t,i);let a=this._getClosestElementLikeParent(),s=this._getComponentTagName(o,a),d=this._getComponentFullName(o,a),p=this._peek.type===35;this._advance();let u=this._peek.sourceSpan.fullStart,g=new In(o.sourceSpan.start,u,o.sourceSpan.fullStart),C=new In(o.sourceSpan.start,u,o.sourceSpan.fullStart),M=new Jr(e,s,d,t,i,[],p,g,C,void 0),x=this._getContainer(),b=x!==null&&M.tagName!==null&&!!this._getTagDefinition(x)?.isClosedByChild(M.tagName);this._pushContainer(M,b),p?this._popContainer(d,Jr,g):o.type===37&&(this._popContainer(d,Jr,null),this.errors.push(ya.create(d,g,`Opening tag "${d}" not terminated.`)))}_consumeAttributesAndDirectives(o,e){for(;this._peek.type===14||this._peek.type===38;)this._peek.type===38?e.push(this._consumeDirective(this._peek)):o.push(this._consumeAttr(this._advance()))}_consumeComponentEndTag(o){let e=this._getComponentFullName(o,this._getClosestElementLikeParent());if(!this._popContainer(e,Jr,o.sourceSpan)){let t=this._containerStack[this._containerStack.length-1],i;t instanceof Jr&&t.componentName===o.parts[0]?i=`, did you mean "${t.fullName}"?`:i=". It may happen when the tag has already been closed by another tag.";let a=`Unexpected closing tag "${e}"${i}`;this.errors.push(ya.create(e,o.sourceSpan,a))}}_getTagDefinition(o){return typeof o=="string"?this.tagDefinitionResolver(o):o instanceof ul?this.tagDefinitionResolver(o.name):o instanceof Jr&&o.tagName!==null?this.tagDefinitionResolver(o.tagName):null}_pushContainer(o,e){e&&this._containerStack.pop(),this._addToParent(o),this._containerStack.push(o)}_consumeElementEndTag(o){let e=this._getElementFullName(o,this._getClosestElementLikeParent());if(this._getTagDefinition(e)?.isVoid)this.errors.push(ya.create(e,o.sourceSpan,`Void elements do not have end tags "${o.parts[1]}"`));else if(!this._popContainer(e,ul,o.sourceSpan)){let t=`Unexpected closing tag "${e}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`;this.errors.push(ya.create(e,o.sourceSpan,t))}}_popContainer(o,e,t){let i=!1;for(let a=this._containerStack.length-1;a>=0;a--){let s=this._containerStack[a];if(((s instanceof Jr?s.fullName:s.name)===o||o===null)&&s instanceof e)return s.endSourceSpan=t,s.sourceSpan.end=t!==null?t.end:s.sourceSpan.end,this._containerStack.splice(a,this._containerStack.length-a),!i;(s instanceof _l||!this._getTagDefinition(s)?.closedByParent)&&(i=!0)}return!1}_consumeAttr(o){let e=wb(o.parts[0],o.parts[1]),t=o.sourceSpan.end;this._peek.type===15&&this._advance();let i="",a=[],s,d;if(this._peek.type===16)for(s=this._peek.sourceSpan,d=this._peek.sourceSpan.end;this._peek.type===16||this._peek.type===17||this._peek.type===9;){let g=this._advance();a.push(g),g.type===17?i+=g.parts.join("").replace(/&([^;]+);/g,T6):g.type===9?i+=g.parts[0]:i+=g.parts.join(""),d=t=g.sourceSpan.end}this._peek.type===15&&(t=this._advance().sourceSpan.end);let u=s&&d&&new In(s.start,d,s.fullStart);return new n3(e,i,new In(o.sourceSpan.start,t,o.sourceSpan.fullStart),o.sourceSpan,u,a.length>0?a:void 0,void 0)}_consumeDirective(o){let e=[],t=o.sourceSpan.end,i=null;if(this._advance(),this._peek.type===39){for(t=this._peek.sourceSpan.end,this._advance();this._peek.type===14;)e.push(this._consumeAttr(this._advance()));this._peek.type===40?(i=this._peek.sourceSpan,this._advance()):this.errors.push(ya.create(null,o.sourceSpan,"Unterminated directive definition"))}let a=new In(o.sourceSpan.start,t,o.sourceSpan.fullStart),s=new In(a.start,i===null?o.sourceSpan.end:i.end,a.fullStart);return new i3(o.parts[0],e,s,a,i)}_consumeBlockOpen(o){let e=[];for(;this._peek.type===27;){let d=this._advance();e.push(new Cx(d.parts[0],d.sourceSpan))}this._peek.type===25&&this._advance();let t=this._peek.sourceSpan.fullStart,i=new In(o.sourceSpan.start,t,o.sourceSpan.fullStart),a=new In(o.sourceSpan.start,t,o.sourceSpan.fullStart),s=new _l(o.parts[0],e,[],i,o.sourceSpan,a);this._pushContainer(s,!1)}_consumeBlockClose(o){let e=this._containerStack.length,t=this._containerStack[e-1];if(!this._popContainer(null,_l,o.sourceSpan)){if(this._containerStack.length element? If you meant to write the \`}\` character, you should use the "}" HTML entity instead.`));return}this.errors.push(ya.create(null,o.sourceSpan,'Unexpected closing block. The block may have been closed earlier. If you meant to write the `}` character, you should use the "}" HTML entity instead.'))}}_consumeIncompleteBlock(o){let e=[];for(;this._peek.type===27;){let d=this._advance();e.push(new Cx(d.parts[0],d.sourceSpan))}let t=this._peek.sourceSpan.fullStart,i=new In(o.sourceSpan.start,t,o.sourceSpan.fullStart),a=new In(o.sourceSpan.start,t,o.sourceSpan.fullStart),s=new _l(o.parts[0],e,[],i,o.sourceSpan,a);this._pushContainer(s,!1),this._popContainer(null,_l,null),this.errors.push(ya.create(o.parts[0],i,`Incomplete block "${o.parts[0]}". If you meant to write the @ character, you should use the "@" HTML entity instead.`))}_consumeLet(o){let e=o.parts[0],t,i;if(this._peek.type!==30){this.errors.push(ya.create(o.parts[0],o.sourceSpan,`Invalid @let declaration "${e}". Declaration must have a value.`));return}else t=this._advance();if(this._peek.type!==31){this.errors.push(ya.create(o.parts[0],o.sourceSpan,`Unterminated @let declaration "${e}". Declaration must be terminated with a semicolon.`));return}else i=this._advance();let a=i.sourceSpan.end,s=new In(o.sourceSpan.start,a,o.sourceSpan.fullStart),d=o.sourceSpan.toString().lastIndexOf(e),p=o.sourceSpan.start.moveBy(d),u=new In(p,o.sourceSpan.end),g=new bx(e,t.parts[0],s,u,t.sourceSpan);this._addToParent(g)}_consumeIncompleteLet(o){let e=o.parts[0]??"",t=e?` "${e}"`:"";if(e.length>0){let i=o.sourceSpan.toString().lastIndexOf(e),a=o.sourceSpan.start.moveBy(i),s=new In(a,o.sourceSpan.end),d=new In(o.sourceSpan.start,o.sourceSpan.start.moveBy(0)),p=new bx(e,"",o.sourceSpan,s,d);this._addToParent(p)}this.errors.push(ya.create(o.parts[0],o.sourceSpan,`Incomplete @let declaration${t}. @let declarations must be written as \`@let = ;\``))}_getContainer(){return this._containerStack.length>0?this._containerStack[this._containerStack.length-1]:null}_getClosestElementLikeParent(){for(let o=this._containerStack.length-1;o>-1;o--){let e=this._containerStack[o];if(e instanceof ul||e instanceof Jr)return e}return null}_addToParent(o){let e=this._getContainer();e===null?this.rootNodes.push(o):e.children.push(o)}_getElementFullName(o,e){let t=this._getPrefix(o,e);return wb(t,o.parts[1])}_getComponentFullName(o,e){let t=o.parts[0],i=this._getComponentTagName(o,e);return i===null?t:i.startsWith(":")?t+i:`${t}:${i}`}_getComponentTagName(o,e){let t=this._getPrefix(o,e),i=o.parts[2];return!t&&!i?null:!t&&i?i:wb(t,i||"ng-component")}_getPrefix(o,e){let t,i;if(o.type===33||o.type===37||o.type===36?(t=o.parts[1],i=o.parts[2]):(t=o.parts[0],i=o.parts[1]),t=t||this._getTagDefinition(i)?.implicitNamespacePrefix||"",!t&&e){let a=e instanceof ul?e.name:e.tagName;if(a!==null){let s=hr(a)[1],d=this._getTagDefinition(s);d!==null&&!d.preventNamespaceInheritance&&(t=PP(a))}}return t}};function P6(n,o){return n.length>0&&n[n.length-1]===o}function T6(n,o){return P0[o]!==void 0?P0[o]||n:/^#x[a-f0-9]+$/i.test(o)?String.fromCodePoint(parseInt(o.slice(2),16)):/^#\d+$/.test(o)?String.fromCodePoint(parseInt(o.slice(1),10)):n}var bF="ngPreserveWhitespaces",E6=new Set(["pre","template","textarea","script","style"]),xF=` \f +\r \v\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`,Kq=new RegExp(`[^${xF}]`),Xq=new RegExp(`[${xF}]{2,}`,"g");function O6(n){return n.some(o=>o.name===bF)}function yF(n){return n.replace(new RegExp(CF,"g")," ")}var wx=class{preserveSignificantWhitespace;originalNodeMap;requireContext;icuExpansionDepth=0;constructor(o,e,t=!0){this.preserveSignificantWhitespace=o,this.originalNodeMap=e,this.requireContext=t}visitElement(o,e){if(E6.has(o.name)||O6(o.attrs)){let i=new ul(o.name,Dc(this,o.attrs),Dc(this,o.directives),o.children,o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,o.isVoid,o.i18n);return this.originalNodeMap?.set(i,o),i}let t=new ul(o.name,o.attrs,o.directives,Dc(this,o.children),o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,o.isVoid,o.i18n);return this.originalNodeMap?.set(t,o),t}visitAttribute(o,e){return o.name!==bF?o:null}visitText(o,e){let t=o.value.match(Kq),i=e&&(e.prev instanceof eu||e.next instanceof eu);if(this.icuExpansionDepth>0&&this.preserveSignificantWhitespace)return o;if(t||i){let s=o.tokens.map(g=>g.type===5?eQ(g):g);if(!this.preserveSignificantWhitespace&&s.length>0){let g=s[0];s.splice(0,1,Yq(g,e));let C=s[s.length-1];s.splice(s.length-1,1,Zq(C,e))}let d=MF(o.value),p=this.preserveSignificantWhitespace?d:Jq(d,e),u=new fu(p,o.sourceSpan,s,o.i18n);return this.originalNodeMap?.set(u,o),u}return null}visitComment(o,e){return o}visitExpansion(o,e){this.icuExpansionDepth++;let t;try{t=new eu(o.switchValue,o.type,Dc(this,o.cases),o.sourceSpan,o.switchValueSourceSpan,o.i18n)}finally{this.icuExpansionDepth--}return this.originalNodeMap?.set(t,o),t}visitExpansionCase(o,e){let t=new vx(o.value,Dc(this,o.expression),o.sourceSpan,o.valueSourceSpan,o.expSourceSpan);return this.originalNodeMap?.set(t,o),t}visitBlock(o,e){let t=new _l(o.name,o.parameters,Dc(this,o.children),o.sourceSpan,o.nameSpan,o.startSourceSpan,o.endSourceSpan);return this.originalNodeMap?.set(t,o),t}visitBlockParameter(o,e){return o}visitLetDeclaration(o,e){return o}visitComponent(o,e){if(o.tagName&&E6.has(o.tagName)||O6(o.attrs)){let i=new Jr(o.componentName,o.tagName,o.fullName,Dc(this,o.attrs),Dc(this,o.directives),o.children,o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,o.i18n);return this.originalNodeMap?.set(i,o),i}let t=new Jr(o.componentName,o.tagName,o.fullName,o.attrs,o.directives,Dc(this,o.children),o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,o.i18n);return this.originalNodeMap?.set(t,o),t}visitDirective(o,e){return o}visit(o,e){if(this.requireContext&&!e)throw new Error("WhitespaceVisitor requires context. Visit via `visitAllWithSiblings` to get this context.");return!1}};function Yq(n,o){return n.type!==5||!!o?.prev?n:wF(n,t=>t.trimStart())}function Zq(n,o){return n.type!==5||!!o?.next?n:wF(n,t=>t.trimEnd())}function Jq(n,o){let e=!o?.prev,t=!o?.next,i=e?n.trimStart():n;return t?i.trimEnd():i}function eQ({type:n,parts:o,sourceSpan:e}){return{type:n,parts:[MF(o[0])],sourceSpan:e}}function wF({type:n,parts:o,sourceSpan:e},t){return{type:n,parts:[t(o[0])],sourceSpan:e}}function MF(n){return yF(n).replace(Xq," ")}function Dc(n,o){let e=[];return o.forEach((t,i)=>{let a={prev:o[i-1],next:o[i+1]},s=t.visit(n,a);s&&e.push(s)}),e}var Cn=(function(n){return n[n.Character=0]="Character",n[n.Identifier=1]="Identifier",n[n.PrivateIdentifier=2]="PrivateIdentifier",n[n.Keyword=3]="Keyword",n[n.String=4]="String",n[n.Operator=5]="Operator",n[n.Number=6]="Number",n[n.RegExpBody=7]="RegExpBody",n[n.RegExpFlags=8]="RegExpFlags",n[n.Error=9]="Error",n})(Cn||{}),tu=(function(n){return n[n.Plain=0]="Plain",n[n.TemplateLiteralPart=1]="TemplateLiteralPart",n[n.TemplateLiteralEnd=2]="TemplateLiteralEnd",n})(tu||{}),tQ=["var","let","as","null","undefined","true","false","if","else","this","typeof","void","in","instanceof"],E0=class{tokenize(o){return new c3(o).scan()}},el=class{index;end;type;numValue;strValue;constructor(o,e,t,i,a){this.index=o,this.end=e,this.type=t,this.numValue=i,this.strValue=a}isCharacter(o){return this.type===Cn.Character&&this.numValue===o}isNumber(){return this.type===Cn.Number}isString(){return this.type===Cn.String}isOperator(o){return this.type===Cn.Operator&&this.strValue===o}isIdentifier(){return this.type===Cn.Identifier}isPrivateIdentifier(){return this.type===Cn.PrivateIdentifier}isKeyword(){return this.type===Cn.Keyword}isKeywordLet(){return this.type===Cn.Keyword&&this.strValue==="let"}isKeywordAs(){return this.type===Cn.Keyword&&this.strValue==="as"}isKeywordNull(){return this.type===Cn.Keyword&&this.strValue==="null"}isKeywordUndefined(){return this.type===Cn.Keyword&&this.strValue==="undefined"}isKeywordTrue(){return this.type===Cn.Keyword&&this.strValue==="true"}isKeywordFalse(){return this.type===Cn.Keyword&&this.strValue==="false"}isKeywordThis(){return this.type===Cn.Keyword&&this.strValue==="this"}isKeywordTypeof(){return this.type===Cn.Keyword&&this.strValue==="typeof"}isKeywordVoid(){return this.type===Cn.Keyword&&this.strValue==="void"}isKeywordIn(){return this.type===Cn.Keyword&&this.strValue==="in"}isKeywordInstanceOf(){return this.type===Cn.Keyword&&this.strValue==="instanceof"}isError(){return this.type===Cn.Error}isRegExpBody(){return this.type===Cn.RegExpBody}isRegExpFlags(){return this.type===Cn.RegExpFlags}toNumber(){return this.type===Cn.Number?this.numValue:-1}isTemplateLiteralPart(){return this.isString()&&this.kind===tu.TemplateLiteralPart}isTemplateLiteralEnd(){return this.isString()&&this.kind===tu.TemplateLiteralEnd}isTemplateLiteralInterpolationStart(){return this.isOperator("${")}toString(){switch(this.type){case Cn.Character:case Cn.Identifier:case Cn.Keyword:case Cn.Operator:case Cn.PrivateIdentifier:case Cn.String:case Cn.Error:case Cn.RegExpBody:case Cn.RegExpFlags:return this.strValue;case Cn.Number:return this.numValue.toString();default:return null}}},Df=class extends el{kind;constructor(o,e,t,i){super(o,e,Cn.String,0,t),this.kind=i}};function _f(n,o,e){return new el(n,o,Cn.Character,e,String.fromCharCode(e))}function nQ(n,o,e){return new el(n,o,Cn.Identifier,0,e)}function iQ(n,o,e){return new el(n,o,Cn.PrivateIdentifier,0,e)}function oQ(n,o,e){return new el(n,o,Cn.Keyword,0,e)}function vm(n,o,e){return new el(n,o,Cn.Operator,0,e)}function aQ(n,o,e){return new el(n,o,Cn.Number,e,"")}function rQ(n,o,e){return new el(n,o,Cn.Error,0,e)}function sQ(n,o,e){return new el(n,o,Cn.RegExpBody,0,e)}function lQ(n,o,e){return new el(n,o,Cn.RegExpFlags,0,e)}var ff=new el(-1,-1,Cn.Character,0,""),c3=class{input;tokens=[];length;peek=0;index=-1;braceStack=[];constructor(o){this.input=o,this.length=o.length,this.advance()}scan(){let o=this.scanToken();for(;o!==null;)this.tokens.push(o),o=this.scanToken();return this.tokens}advance(){this.peek=++this.index>=this.length?or:this.input.charCodeAt(this.index)}scanToken(){let o=this.input,e=this.length,t=this.peek,i=this.index;for(;t<=$N;)if(++i>=e){t=or;break}else t=o.charCodeAt(i);if(this.peek=t,this.index=i,i>=e)return null;if(D6(t))return this.scanIdentifier();if(hl(t))return this.scanNumber(i);let a=i;switch(t){case jp:return this.advance(),hl(this.peek)?this.scanNumber(a):this.peek!==jp?_f(a,this.index,jp):(this.advance(),this.peek===jp?(this.advance(),vm(a,this.index,"...")):this.error(`Unexpected character [${String.fromCharCode(t)}]`,0));case ns:case Ea:case Lc:case Od:case Nr:case Fc:case bs:return this.scanCharacter(a,t);case fl:return this.scanOpenBrace(a,t);case es:return this.scanCloseBrace(a,t);case u0:case p0:return this.scanString();case VP:return this.advance(),this.scanTemplateLiteralPart(a);case HN:return this.scanPrivateIdentifier();case UN:return this.scanComplexOperator(a,"+",nr,"=");case ix:return this.scanComplexOperator(a,"-",nr,"=");case gl:return this.isStartOfRegex()?this.scanRegex(i):this.scanComplexOperator(a,"/",nr,"=");case ZU:return this.scanComplexOperator(a,"%",nr,"=");case iW:return this.scanOperator(a,"^");case Y5:return this.scanStar(a);case Z5:return this.scanQuestion(a);case Ig:case Ws:return this.scanComplexOperator(a,String.fromCharCode(t),nr,"=");case LP:return this.scanComplexOperator(a,"!",nr,"=",nr,"=");case nr:return this.scanEquals(a);case nx:return this.scanComplexOperator(a,"&",nx,"&",nr,"=");case J5:return this.scanComplexOperator(a,"|",J5,"|",nr,"=");case ZN:for(;g0(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(t)}]`,0)}scanCharacter(o,e){return this.advance(),_f(o,this.index,e)}scanOperator(o,e){return this.advance(),vm(o,this.index,e)}scanOpenBrace(o,e){return this.braceStack.push("expression"),this.advance(),_f(o,this.index,e)}scanCloseBrace(o,e){return this.advance(),this.braceStack.pop()==="interpolation"?(this.tokens.push(_f(o,this.index,es)),this.scanTemplateLiteralPart(this.index)):_f(o,this.index,e)}scanComplexOperator(o,e,t,i,a,s){this.advance();let d=e;return this.peek==t&&(this.advance(),d+=i),a!=null&&this.peek==a&&(this.advance(),d+=s),vm(o,this.index,d)}scanEquals(o){this.advance();let e="=";if(this.peek===nr)this.advance(),e+="=";else if(this.peek===Ws)return this.advance(),e+=">",vm(o,this.index,e);return this.peek===nr&&(this.advance(),e+="="),vm(o,this.index,e)}scanIdentifier(){let o=this.index;for(this.advance();I6(this.peek);)this.advance();let e=this.input.substring(o,this.index);return tQ.indexOf(e)>-1?oQ(o,this.index,e):nQ(o,this.index,e)}scanPrivateIdentifier(){let o=this.index;if(this.advance(),!D6(this.peek))return this.error("Invalid character [#]",-1);for(;I6(this.peek);)this.advance();let e=this.input.substring(o,this.index);return iQ(o,this.index,e)}scanNumber(o){let e=this.index===o,t=!1;for(this.advance();;){if(!hl(this.peek))if(this.peek===Bm){if(!hl(this.input.charCodeAt(this.index-1))||!hl(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);t=!0}else if(this.peek===jp)e=!1;else if(cQ(this.peek)){if(this.advance(),dQ(this.peek)&&this.advance(),!hl(this.peek))return this.error("Invalid exponent",-1);e=!1}else break;this.advance()}let i=this.input.substring(o,this.index);t&&(i=i.replace(/_/g,""));let a=e?pQ(i):parseFloat(i);return aQ(o,this.index,a)}scanString(){let o=this.index,e=this.peek;this.advance();let t="",i=this.index,a=this.input;for(;this.peek!=e;)if(this.peek==Jp){let d=this.scanStringBackslash(t,i);if(typeof d!="string")return d;t=d,i=this.index}else{if(this.peek==or)return this.error("Unterminated quote",0);this.advance()}let s=a.substring(i,this.index);return this.advance(),new Df(o,this.index,t+s,tu.Plain)}scanQuestion(o){this.advance();let e="?";return this.peek===Z5?(e+="?",this.advance(),this.peek===nr&&(e+="=",this.advance())):this.peek===jp&&(e+=".",this.advance()),vm(o,this.index,e)}scanTemplateLiteralPart(o){let e="",t=this.index;for(;this.peek!==VP;)if(this.peek===Jp){let a=this.scanStringBackslash(e,t);if(typeof a!="string")return a;e=a,t=this.index}else if(this.peek===zx){let a=this.index;if(this.advance(),this.peek===fl)return this.braceStack.push("interpolation"),this.tokens.push(new Df(o,a,e+this.input.substring(t,a),tu.TemplateLiteralPart)),this.advance(),vm(a,this.index,this.input.substring(a,this.index))}else{if(this.peek===or)return this.error("Unterminated template literal",0);this.advance()}let i=this.input.substring(t,this.index);return this.advance(),new Df(o,this.index,e+i,tu.TemplateLiteralEnd)}error(o,e){let t=this.index+e;return rQ(t,this.index,`Lexer Error: ${o} at column ${t} in expression [${this.input}]`)}scanStringBackslash(o,e){o+=this.input.substring(e,this.index);let t;if(this.advance(),this.peek===KN){let i=this.input.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(i))t=parseInt(i,16);else return this.error(`Invalid unicode escape [\\u${i}]`,0);for(let a=0;a<5;a++)this.advance()}else t=mQ(this.peek),this.advance();return o+=String.fromCharCode(t),o}scanStar(o){this.advance();let e="*";return this.peek===Y5?(e+="*",this.advance(),this.peek===nr&&(e+="=",this.advance())):this.peek===nr&&(e+="=",this.advance()),vm(o,this.index,e)}isStartOfRegex(){if(this.tokens.length===0)return!0;let o=this.tokens[this.tokens.length-1];if(o.isOperator("!")){let e=this.tokens.length>1?this.tokens[this.tokens.length-2]:null;return e===null||e.type!==Cn.Identifier&&!e.isCharacter(Ea)&&!e.isCharacter(Od)}return o.type===Cn.Operator||o.isCharacter(ns)||o.isCharacter(Lc)||o.isCharacter(Nr)||o.isCharacter(Fc)}scanRegex(o){this.advance();let e=this.index,t=!1,i=!1;for(;;){let p=this.peek;if(p===or)return this.error("Unterminated regular expression",0);if(t)t=!1;else if(p===Jp)t=!0;else if(p===Lc)i=!0;else if(p===Od)i=!1;else if(p===gl&&!i)break;this.advance()}let a=this.input.substring(e,this.index);this.advance();let s=sQ(o,this.index,a),d=this.scanRegexFlags(this.index);return d!==null?(this.tokens.push(s),d):s}scanRegexFlags(o){if(!Nm(this.peek))return null;for(;Nm(this.peek);)this.advance();return lQ(o,this.index,this.input.substring(o,this.index))}};function D6(n){return pu<=n&&n<=z0||Vm<=n&&n<=eh||n==Bm||n==zx}function I6(n){return Nm(n)||hl(n)||n==Bm||n==zx}function cQ(n){return n==aW||n==eW}function dQ(n){return n==ix||n==UN}function mQ(n){switch(n){case GN:return Zp;case J3:return jN;case qN:return Y3;case QN:return X3;case XN:return BN;default:return n}}function pQ(n){let o=parseInt(n);if(isNaN(o))throw new Error("Invalid integer literal when parsing "+n);return o}var d3=class{strings;expressions;offsets;constructor(o,e,t){this.strings=o,this.expressions=e,this.offsets=t}},m3=class{templateBindings;warnings;errors;constructor(o,e,t){this.templateBindings=o,this.warnings=e,this.errors=t}};function wm(n){return n.start.toString()||"(unknown)"}var Mx=class{_lexer;_supportsDirectPipeReferences;constructor(o,e=!1){this._lexer=o,this._supportsDirectPipeReferences=e}parseAction(o,e,t){let i=[];this._checkNoInterpolation(i,o,e);let{stripped:a}=this._stripComments(o),s=this._lexer.tokenize(a),d=new Wp(o,e,t,s,1,i,0,this._supportsDirectPipeReferences).parseChain();return new xs(d,o,wm(e),t,i)}parseBinding(o,e,t){let i=[],a=this._parseBindingAst(o,e,t,i);return new xs(a,o,wm(e),t,i)}checkSimpleExpression(o){let e=new p3;return o.visit(e),e.errors}parseSimpleBinding(o,e,t){let i=[],a=this._parseBindingAst(o,e,t,i),s=this.checkSimpleExpression(a);return s.length>0&&i.push(Eg(`Host binding expression cannot contain ${s.join(" ")}`,o,"",e)),new xs(a,o,wm(e),t,i)}_parseBindingAst(o,e,t,i){this._checkNoInterpolation(i,o,e);let{stripped:a}=this._stripComments(o),s=this._lexer.tokenize(a);return new Wp(o,e,t,s,0,i,0,this._supportsDirectPipeReferences).parseChain()}parseTemplateBindings(o,e,t,i,a){let s=this._lexer.tokenize(e),d=[];return new Wp(e,t,a,s,0,d,0,this._supportsDirectPipeReferences).parseTemplateBindings({source:o,span:new qs(i,i+o.length)})}parseInterpolation(o,e,t,i){let a=[],{strings:s,expressions:d,offsets:p}=this.splitInterpolation(o,e,a,i);if(d.length===0)return null;let u=[];for(let g=0;gg.text),u,o,wm(e),t,a)}parseInterpolationExpression(o,e,t){let{stripped:i}=this._stripComments(o),a=this._lexer.tokenize(i),s=[],d=new Wp(o,e,t,a,0,s,0,this._supportsDirectPipeReferences).parseChain(),p=["",""];return this.createInterpolationAst(p,[d],o,wm(e),t,s)}createInterpolationAst(o,e,t,i,a,s){let d=new lu(0,t.length),p=new F0(d,d.toAbsolute(a),o,e);return new xs(p,t,i,a,s)}splitInterpolation(o,e,t,i){let a=[],s=[],d=[],p=i?uQ(i):null,u=0,g=!1,C=!1,M="{{",x="}}";for(;u-1)break;i>-1&&a>-1&&o.push(Eg("Got interpolation ({{}}) where expression was expected",e,`at column ${i} in`,t))}_getInterpolationEndIndex(o,e,t){for(let i of this._forEachUnquotedChar(o,t)){if(o.startsWith(e,i))return i;if(o.startsWith("//",i))return o.indexOf(e,i)}return-1}*_forEachUnquotedChar(o,e){let t=null,i=0;for(let a=e;a=this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(o,e){let t=this.currentEndIndex;if(e!==void 0&&e>this.currentEndIndex&&(t=e),o>t){let i=t;t=o,o=i}return new lu(o,t)}sourceSpan(o,e){let t=`${o}@${this.inputIndex}:${e}`;return this.sourceSpanCache.has(t)||this.sourceSpanCache.set(t,this.span(o,e).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(t)}advance(){this.index++}withContext(o,e){this.context|=o;let t=e();return this.context^=o,t}consumeOptionalCharacter(o){return this.next.isCharacter(o)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(o){this.consumeOptionalCharacter(o)||this.error(`Missing expected ${String.fromCharCode(o)}`)}consumeOptionalOperator(o){return this.next.isOperator(o)?(this.advance(),!0):!1}isAssignmentOperator(o){return o.type===Cn.Operator&&Zr.isAssignmentOperation(o.strValue)}expectOperator(o){this.consumeOptionalOperator(o)||this.error(`Missing expected operator ${o}`)}prettyPrintToken(o){return o===ff?"end of input":`token ${o}`}expectIdentifierOrKeyword(){let o=this.next;return!o.isIdentifier()&&!o.isKeyword()?(o.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(o,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(o)}, expected identifier or keyword`),null):(this.advance(),o.toString())}expectIdentifierOrKeywordOrString(){let o=this.next;return!o.isIdentifier()&&!o.isKeyword()&&!o.isString()?(o.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(o,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(o)}, expected identifier, keyword, or string`),""):(this.advance(),o.toString())}parseChain(){let o=[],e=this.inputIndex;for(;this.index=Vm&&u<=eh?yb.ReferencedDirectly:yb.ReferencedByName}else p=yb.ReferencedByName;e=new jb(this.span(o),this.sourceSpan(o,s),e,i,d,p,a)}while(this.consumeOptionalOperator("|"))}return e}parseExpression(){return this.parseConditional()}parseConditional(){let o=this.inputIndex,e=this.parseLogicalOr();if(this.consumeOptionalOperator("?")){let t=this.parsePipe(),i;if(this.consumeOptionalCharacter(Fc))i=this.parsePipe();else{let a=this.inputIndex,s=this.input.substring(o,a);this.error(`Conditional expression ${s} requires all 3 expressions`),i=new Ar(this.span(o),this.sourceSpan(o))}return new Bb(this.span(o),this.sourceSpan(o),e,t,i)}else return e}parseLogicalOr(){let o=this.inputIndex,e=this.parseLogicalAnd();for(;this.consumeOptionalOperator("||");){let t=this.parseLogicalAnd();e=new Zr(this.span(o),this.sourceSpan(o),"||",e,t)}return e}parseLogicalAnd(){let o=this.inputIndex,e=this.parseNullishCoalescing();for(;this.consumeOptionalOperator("&&");){let t=this.parseNullishCoalescing();e=new Zr(this.span(o),this.sourceSpan(o),"&&",e,t)}return e}parseNullishCoalescing(){let o=this.inputIndex,e=this.parseEquality();for(;this.consumeOptionalOperator("??");){let t=this.parseEquality();e=new Zr(this.span(o),this.sourceSpan(o),"??",e,t)}return e}parseEquality(){let o=this.inputIndex,e=this.parseRelational();for(;this.next.type==Cn.Operator;){let t=this.next.strValue;switch(t){case"==":case"===":case"!=":case"!==":this.advance();let i=this.parseRelational();e=new Zr(this.span(o),this.sourceSpan(o),t,e,i);continue}break}return e}parseRelational(){let o=this.inputIndex,e=this.parseAdditive();for(;this.next.type==Cn.Operator||this.next.isKeywordIn()||this.next.isKeywordInstanceOf();){let t=this.next.strValue;switch(t){case"<":case">":case"<=":case">=":case"in":case"instanceof":this.advance();let i=this.parseAdditive();e=new Zr(this.span(o),this.sourceSpan(o),t,e,i);continue}break}return e}parseAdditive(){let o=this.inputIndex,e=this.parseMultiplicative();for(;this.next.type==Cn.Operator;){let t=this.next.strValue;switch(t){case"+":case"-":this.advance();let i=this.parseMultiplicative();e=new Zr(this.span(o),this.sourceSpan(o),t,e,i);continue}break}return e}parseMultiplicative(){let o=this.inputIndex,e=this.parseExponentiation();for(;this.next.type==Cn.Operator;){let t=this.next.strValue;switch(t){case"*":case"%":case"/":this.advance();let i=this.parseExponentiation();e=new Zr(this.span(o),this.sourceSpan(o),t,e,i);continue}break}return e}parseExponentiation(){let o=this.inputIndex,e=this.parsePrefix();for(;this.next.type==Cn.Operator&&this.next.strValue==="**";){(e instanceof Dg||e instanceof Kf||e instanceof Xf||e instanceof Yf)&&this.error("Unary operator used immediately before exponentiation expression. Parenthesis must be used to disambiguate operator precedence"),this.advance();let t=this.parseExponentiation();e=new Zr(this.span(o),this.sourceSpan(o),"**",e,t)}return e}parsePrefix(){if(this.next.type==Cn.Operator){let o=this.inputIndex,e=this.next.strValue,t;switch(e){case"+":return this.advance(),t=this.parsePrefix(),Dg.createPlus(this.span(o),this.sourceSpan(o),t);case"-":return this.advance(),t=this.parsePrefix(),Dg.createMinus(this.span(o),this.sourceSpan(o),t);case"!":return this.advance(),t=this.parsePrefix(),new Kf(this.span(o),this.sourceSpan(o),t)}}else if(this.next.isKeywordTypeof()){let o=this.inputIndex;this.advance();let e=this.parsePrefix();return new Xf(this.span(o),this.sourceSpan(o),e)}else if(this.next.isKeywordVoid()){let o=this.inputIndex;this.advance();let e=this.parsePrefix();return new Yf(this.span(o),this.sourceSpan(o),e)}return this.parseCallChain()}parseCallChain(){let o=this.inputIndex,e=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(jp))e=this.parseAccessMember(e,o,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(ns)?e=this.parseCall(e,o,!0):e=this.consumeOptionalCharacter(Lc)?this.parseKeyedReadOrWrite(e,o,!0):this.parseAccessMember(e,o,!0);else if(this.consumeOptionalCharacter(Lc))e=this.parseKeyedReadOrWrite(e,o,!1);else if(this.consumeOptionalCharacter(ns))e=this.parseCall(e,o,!1);else if(this.consumeOptionalOperator("!"))e=new Zf(this.span(o),this.sourceSpan(o),e);else if(this.next.isTemplateLiteralEnd())e=this.parseNoInterpolationTaggedTemplateLiteral(e,o);else if(this.next.isTemplateLiteralPart())e=this.parseTaggedTemplateLiteral(e,o);else return e}parsePrimary(){let o=this.inputIndex;if(this.isArrowFunction())return this.parseArrowFunction(o);if(this.consumeOptionalCharacter(ns)){this.rparensExpected++;let e=this.parsePipe();return this.consumeOptionalCharacter(Ea)||(this.error("Missing closing parentheses"),this.consumeOptionalCharacter(Ea)),this.rparensExpected--,new t0(this.span(o),this.sourceSpan(o),e)}else{if(this.next.isKeywordNull())return this.advance(),new Cs(this.span(o),this.sourceSpan(o),null);if(this.next.isKeywordUndefined())return this.advance(),new Cs(this.span(o),this.sourceSpan(o),void 0);if(this.next.isKeywordTrue())return this.advance(),new Cs(this.span(o),this.sourceSpan(o),!0);if(this.next.isKeywordFalse())return this.advance(),new Cs(this.span(o),this.sourceSpan(o),!1);if(this.next.isKeywordIn())return this.advance(),new Cs(this.span(o),this.sourceSpan(o),"in");if(this.next.isKeywordThis())return this.advance(),new Wf(this.span(o),this.sourceSpan(o));if(this.consumeOptionalCharacter(Lc))return this.parseLiteralArray(o);if(this.next.isCharacter(fl))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new Hc(this.span(o),this.sourceSpan(o)),o,!1);if(this.next.isNumber()){let e=this.next.toNumber();return this.advance(),new Cs(this.span(o),this.sourceSpan(o),e)}else{if(this.next.isTemplateLiteralEnd())return this.parseNoInterpolationTemplateLiteral();if(this.next.isTemplateLiteralPart())return this.parseTemplateLiteral();if(this.next.isString()&&this.next.kind===tu.Plain){let e=this.next.toString();return this.advance(),new Cs(this.span(o),this.sourceSpan(o),e)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new Ar(this.span(o),this.sourceSpan(o))):this.next.isRegExpBody()?this.parseRegularExpressionLiteral():this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new Ar(this.span(o),this.sourceSpan(o))):(this.error(`Unexpected token ${this.next}`),new Ar(this.span(o),this.sourceSpan(o)))}}}parseLiteralArray(o){this.rbracketsExpected++;let e=[];do if(this.next.isOperator("..."))e.push(this.parseSpreadElement());else if(!this.next.isCharacter(Od))e.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(Nr));return this.rbracketsExpected--,this.expectCharacter(Od),new Qf(this.span(o),this.sourceSpan(o),e)}parseLiteralMap(){let o=[],e=[],t=this.inputIndex;if(this.expectCharacter(fl),!this.consumeOptionalCharacter(es)){this.rbracesExpected++;do{let i=this.inputIndex;if(this.next.isOperator("...")){this.advance(),o.push({kind:"spread",span:this.span(i),sourceSpan:this.sourceSpan(i)}),e.push(this.parsePipe());continue}let a=this.next.isString(),s=this.expectIdentifierOrKeywordOrString(),d=this.span(i),p=this.sourceSpan(i),u={kind:"property",key:s,quoted:a,span:d,sourceSpan:p};o.push(u),a?(this.expectCharacter(Fc),e.push(this.parsePipe())):this.consumeOptionalCharacter(Fc)?e.push(this.parsePipe()):(u.isShorthandInitialized=!0,e.push(new zc(d,p,p,new Hc(d,p),s)))}while(this.consumeOptionalCharacter(Nr)&&!this.next.isCharacter(es));this.rbracesExpected--,this.expectCharacter(es)}return new du(this.span(t),this.sourceSpan(t),o,e)}parseAccessMember(o,e,t){let i=this.inputIndex,a=this.withContext(kf.Writable,()=>{let d=this.expectIdentifierOrKeyword()??"";return d.length===0&&this.error("Expected identifier for property access",o.span.end),d}),s=this.sourceSpan(i);if(t)return this.isAssignmentOperator(this.next)?(this.advance(),this.error("The '?.' operator cannot be used in the assignment"),new Ar(this.span(e),this.sourceSpan(e))):new Gf(this.span(e),this.sourceSpan(e),s,o,a);if(this.isAssignmentOperator(this.next)){let d=this.next.strValue;if(!(this.parseFlags&1))return this.advance(),this.error("Bindings cannot contain assignments"),new Ar(this.span(e),this.sourceSpan(e));let p=new zc(this.span(e),this.sourceSpan(e),s,o,a);this.advance();let u=this.parseConditional();return new Zr(this.span(e),this.sourceSpan(e),d,p,u)}else return new zc(this.span(e),this.sourceSpan(e),s,o,a)}parseCall(o,e,t){let i=this.inputIndex;this.rparensExpected++;let a=this.parseCallArguments(),s=this.span(i,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(Ea),this.rparensExpected--;let d=this.span(e),p=this.sourceSpan(e);return t?new Hb(d,p,o,a,s):new Vg(d,p,o,a,s)}parseCallArguments(){if(this.next.isCharacter(Ea))return[];let o=[];do o.push(this.next.isOperator("...")?this.parseSpreadElement():this.parsePipe());while(this.consumeOptionalCharacter(Nr));return o}parseSpreadElement(){this.next.isOperator("...")||this.error("Spread element must start with '...' operator");let o=this.inputIndex;this.advance();let e=this.parsePipe(),t=this.span(o),i=this.sourceSpan(o);return new $b(t,i,e)}expectTemplateBindingKey(){let o="",e=!1,t=this.currentAbsoluteOffset;do o+=this.expectIdentifierOrKeywordOrString(),e=this.consumeOptionalOperator("-"),e&&(o+="-");while(e);return{source:o,span:new qs(t,t+o.length)}}parseTemplateBindings(o){let e=[];for(e.push(...this.parseDirectiveKeywordBindings(o));this.index{this.rbracketsExpected++;let i=this.parsePipe();if(i instanceof Ar&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(Od),this.isAssignmentOperator(this.next)){let a=this.next.strValue;if(t)this.advance(),this.error("The '?.' operator cannot be used in the assignment");else{let s=new cu(this.span(e),this.sourceSpan(e),o,i);this.advance();let d=this.parseConditional();return new Zr(this.span(e),this.sourceSpan(e),a,s,d)}}else return t?new qf(this.span(e),this.sourceSpan(e),o,i):new cu(this.span(e),this.sourceSpan(e),o,i);return new Ar(this.span(e),this.sourceSpan(e))})}parseDirectiveKeywordBindings(o){let e=[];this.consumeOptionalCharacter(Fc);let t=this.getDirectiveBoundTarget(),i=this.currentAbsoluteOffset,a=this.parseAsBinding(o);a||(this.consumeStatementTerminator(),i=this.currentAbsoluteOffset);let s=new qs(o.span.start,i);return e.push(new MP(s,o,t)),a&&e.push(a),e}getDirectiveBoundTarget(){if(this.next===ff||this.peekKeywordAs()||this.peekKeywordLet())return null;let o=this.parsePipe(),{start:e,end:t}=o.span,i=this.input.substring(e,t);return new xs(o,i,wm(this.parseSourceSpan),this.absoluteOffset+e,this.errors)}parseAsBinding(o){if(!this.peekKeywordAs())return null;this.advance();let e=this.expectTemplateBindingKey();this.consumeStatementTerminator();let t=new qs(o.span.start,this.currentAbsoluteOffset);return new n0(t,e,o)}parseLetBinding(){if(!this.peekKeywordLet())return null;let o=this.currentAbsoluteOffset;this.advance();let e=this.expectTemplateBindingKey(),t=null;this.consumeOptionalOperator("=")&&(t=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let i=new qs(o,this.currentAbsoluteOffset);return new n0(i,e,t)}parseNoInterpolationTaggedTemplateLiteral(o,e){let t=this.parseNoInterpolationTemplateLiteral();return new Jf(this.span(e),this.sourceSpan(e),o,t)}parseNoInterpolationTemplateLiteral(){let o=this.next.strValue,e=this.inputIndex;this.advance();let t=this.span(e),i=this.sourceSpan(e);return new e0(t,i,[new Ub(t,i,o)],[])}parseTaggedTemplateLiteral(o,e){let t=this.parseTemplateLiteral();return new Jf(this.span(e),this.sourceSpan(e),o,t)}parseTemplateLiteral(){let o=[],e=[],t=this.inputIndex;for(;this.next!==ff;){let i=this.next;if(i.isTemplateLiteralPart()||i.isTemplateLiteralEnd()){let a=this.inputIndex;if(this.advance(),o.push(new Ub(this.span(a),this.sourceSpan(a),i.strValue)),i.isTemplateLiteralEnd())break}else if(i.isTemplateLiteralInterpolationStart()){this.advance(),this.rbracesExpected++;let a=this.parsePipe();a instanceof Ar?this.error("Template literal interpolation cannot be empty"):e.push(a),this.rbracesExpected--}else this.advance()}return new e0(this.span(t),this.sourceSpan(t),o,e)}parseRegularExpressionLiteral(){let o=this.next;if(this.advance(),!o.isRegExpBody())return new Ar(this.span(this.inputIndex),this.sourceSpan(this.inputIndex));let e=null;if(this.next.isRegExpFlags()){e=this.next,this.advance();let a=new Set;for(let s=0;s`"${p}"`).join(", "),e.index+s)}}let t=o.index,i=e?e.end:o.end;return new Gb(this.span(t,i),this.sourceSpan(t,i),o.strValue,e?e.strValue:null)}parseArrowFunction(o){let e;if(this.next.isIdentifier()){let i=this.next;this.advance(),e=[this.getArrowFunctionIdentifierArg(i)]}else this.next.isCharacter(ns)?(this.rparensExpected++,this.advance(),e=this.parseArrowFunctionParameters(),this.rparensExpected--):(e=[],this.error(`Unexpected token ${this.next}`));this.expectOperator("=>");let t;if(this.next.isCharacter(fl))this.error("Multi-line arrow functions are not supported. If you meant to return an object literal, wrap it with parentheses."),t=new Ar(this.span(o),this.sourceSpan(o));else{let i=this.parseFlags;this.parseFlags=1,t=this.parseExpression(),this.parseFlags=i}return new Wb(this.span(o),this.sourceSpan(o),e,t)}parseArrowFunctionParameters(){let o=[];if(!this.consumeOptionalCharacter(Ea))for(;this.next!==ff;)if(this.next.isIdentifier()){let e=this.next;if(this.advance(),o.push(this.getArrowFunctionIdentifierArg(e)),this.consumeOptionalCharacter(Ea))break;this.expectCharacter(Nr)}else{this.error(`Unexpected token ${this.next}`);break}return o}getArrowFunctionIdentifierArg(o){return new wP(o.strValue,this.span(o.index),this.sourceSpan(o.index))}isArrowFunction(){let o=this.index,e=this.tokens;if(o>e.length-2)return!1;if(e[o].isIdentifier()&&e[o+1].isOperator("=>"))return!0;if(e[o].isCharacter(ns)){let t=o+1;for(t;t")}return!1}consumeStatementTerminator(){this.consumeOptionalCharacter(bs)||this.consumeOptionalCharacter(Nr)}error(o,e=this.index){this.errors.push(Eg(o,this.input,this.getErrorLocationText(e),this.parseSourceSpan)),this.skip()}getErrorLocationText(o){return o0&&(e=` ${e} `);let i=wm(t),a=`Parser Error: ${n}${e}[${o}] in ${i}`;return new dn(t,a)}var p3=class extends Bg{errors=[];visitPipe(){this.errors.push("pipes")}};function uQ(n){let o=new Map,e=0,t=0,i=0;for(;id+p.length,0);t+=s,e+=s}o.set(t,e),i++}return o}function gQ(n){return n.visit(new u3)}var u3=class{visitUnary(o,e){return`${o.operator}${o.expr.visit(this,e)}`}visitBinary(o,e){return`${o.left.visit(this,e)} ${o.operation} ${o.right.visit(this,e)}`}visitChain(o,e){return o.expressions.map(t=>t.visit(this,e)).join("; ")}visitConditional(o,e){return`${o.condition.visit(this,e)} ? ${o.trueExp.visit(this,e)} : ${o.falseExp.visit(this,e)}`}visitThisReceiver(){return"this"}visitImplicitReceiver(){return""}visitInterpolation(o,e){return _Q(o.strings,o.expressions.map(t=>t.visit(this,e))).join("")}visitKeyedRead(o,e){return`${o.receiver.visit(this,e)}[${o.key.visit(this,e)}]`}visitLiteralArray(o,e){return`[${o.expressions.map(t=>t.visit(this,e)).join(", ")}]`}visitLiteralMap(o,e){return`{${hQ(o.keys.map(t=>t.kind==="spread"?"...":t.quoted?`'${t.key}'`:t.key),o.values.map(t=>t.visit(this,e))).map(([t,i])=>`${t}: ${i}`).join(", ")}}`}visitLiteralPrimitive(o){if(o.value===null)return"null";switch(typeof o.value){case"number":case"boolean":return o.value.toString();case"undefined":return"undefined";case"string":return`'${o.value.replace(/'/g,"\\'")}'`;default:throw new Error(`Unsupported primitive type: ${o.value}`)}}visitPipe(o,e){return`${o.exp.visit(this,e)} | ${o.name}`}visitPrefixNot(o,e){return`!${o.expression.visit(this,e)}`}visitNonNullAssert(o,e){return`${o.expression.visit(this,e)}!`}visitPropertyRead(o,e){return o.receiver instanceof Hc||o.receiver instanceof Wf?o.name:`${o.receiver.visit(this,e)}.${o.name}`}visitSafePropertyRead(o,e){return`${o.receiver.visit(this,e)}?.${o.name}`}visitSafeKeyedRead(o,e){return`${o.receiver.visit(this,e)}?.[${o.key.visit(this,e)}]`}visitCall(o,e){return`${o.receiver.visit(this,e)}(${o.args.map(t=>t.visit(this,e)).join(", ")})`}visitSafeCall(o,e){return`${o.receiver.visit(this,e)}?.(${o.args.map(t=>t.visit(this,e)).join(", ")})`}visitTypeofExpression(o,e){return`typeof ${o.expression.visit(this,e)}`}visitVoidExpression(o,e){return`void ${o.expression.visit(this,e)}`}visitRegularExpressionLiteral(o,e){return`/${o.body}/${o.flags||""}`}visitArrowFunction(o,e){let t;return o.parameters.length===1?t=o.parameters[0].name:t=`(${o.parameters.map(i=>i.name).join(", ")})`,`${t} => ${o.body.visit(this,e)}`}visitASTWithSource(o,e){return o.ast.visit(this,e)}visitTemplateLiteral(o,e){let t="";for(let i=0;i[e,o[t]])}function _Q(n,o){let e=[];for(let t=0;t(n.set(o,e),n),new Map),Yg=class extends g3{_schema=new Map;_eventSchema=new Map;constructor(){super(),xQ.forEach(o=>{let e=new Map,t=new Set,[i,a]=o.split("|"),s=a.split(","),[d,p]=i.split("^");d.split(",").forEach(g=>{this._schema.set(g.toLowerCase(),e),this._eventSchema.set(g.toLowerCase(),t)});let u=p&&this._schema.get(p.toLowerCase());if(u){for(let[g,C]of u)e.set(g,C);for(let g of this._eventSchema.get(p.toLowerCase()))t.add(g)}s.forEach(g=>{if(g.length>0)switch(g[0]){case"*":t.add(g.substring(1));break;case"!":e.set(g.substring(1),fQ);break;case"#":e.set(g.substring(1),vQ);break;case"%":e.set(g.substring(1),bQ);break;default:e.set(g,CQ)}})})}hasProperty(o,e,t){if(t.some(s=>s.name===N5.name))return!0;let i=vf(o);if(i.includes("-")){if(G5(i)||kP(i))return!1;if(t.some(s=>s.name===A5.name))return!0}return(this._schema.get(i)||this._schema.get("unknown")).has(e)}hasElement(o,e){if(e.some(i=>i.name===N5.name))return!0;let t=vf(o);return t.includes("-")&&(G5(t)||kP(t)||e.some(i=>i.name===A5.name))?!0:this._schema.has(t)}securityContext(o,e,t){t&&(e=this.getMappedPropName(e));let i=vf(o);e=e.toLowerCase();let[a]=hr(i,!1),s=HH();return s[i+"|"+e]??(a?s[`:${a}:*|${e}`]:void 0)??s["*|"+e]??gi.NONE}getMappedPropName(o){return SF.get(o)??o}getDefaultComponentElementName(){return"ng-component"}validateProperty(o){return o.toLowerCase().startsWith("on")?{error:!0,msg:`Binding to event property '${o}' is disallowed for security reasons, please use (${o.slice(2)})=... +If '${o}' is a directive input, make sure the directive is imported by the current module.`}:{error:!1}}validateAttribute(o){return o.toLowerCase().startsWith("on")?{error:!0,msg:`Binding to event attribute '${o}' is disallowed for security reasons, please use (${o.slice(2)})=...`}:{error:!1}}allKnownElementNames(){return Array.from(this._schema.keys())}allKnownAttributesOfElement(o){let e=vf(o),t=this._schema.get(e)||this._schema.get("unknown");return Array.from(t.keys()).map(i=>yQ.get(i)??i)}allKnownEventsOfElement(o){let e=vf(o);return Array.from(this._eventSchema.get(e)??[])}normalizeAnimationStyleProperty(o){return vU(o)}normalizeAnimationStyleValue(o,e,t){let i="",a=t.toString().trim(),s=null;if(wQ(o)&&t!==0&&t!=="0")if(typeof t=="number")i="px";else{let d=t.match(/^[+-]?[\d\.]+([a-z]*)$/);d&&d[1].length==0&&(s=`Please provide a CSS unit value for ${e}:${t}`)}return{error:s,value:a+i}}};function wQ(n){switch(n){case"width":case"height":case"minWidth":case"minHeight":case"maxWidth":case"maxHeight":case"left":case"top":case"bottom":case"right":case"fontSize":case"outlineWidth":case"outlineOffset":case"paddingTop":case"paddingLeft":case"paddingBottom":case"paddingRight":case"marginTop":case"marginLeft":case"marginBottom":case"marginRight":case"borderRadius":case"borderWidth":case"borderTopWidth":case"borderLeftWidth":case"borderRightWidth":case"borderBottomWidth":case"textIndent":return!0;default:return!1}}var ci=class{closedByChildren={};contentType;closedByParent=!1;implicitNamespacePrefix;isVoid;ignoreFirstLf;canSelfClose;preventNamespaceInheritance;constructor({closedByChildren:o,implicitNamespacePrefix:e,contentType:t=Nc.PARSABLE_DATA,closedByParent:i=!1,isVoid:a=!1,ignoreFirstLf:s=!1,preventNamespaceInheritance:d=!1,canSelfClose:p=!1}={}){o&&o.length>0&&o.forEach(u=>this.closedByChildren[u]=!0),this.isVoid=a,this.closedByParent=i||a,this.implicitNamespacePrefix=e||null,this.contentType=t,this.ignoreFirstLf=s,this.preventNamespaceInheritance=d,this.canSelfClose=p??a}isClosedByChild(o){return this.isVoid||o.toLowerCase()in this.closedByChildren}getContentType(o){return typeof this.contentType=="object"?(o===void 0?void 0:this.contentType[o])??this.contentType.default:this.contentType}},N6,xg;function h3(n){return xg||(N6=new ci({canSelfClose:!0}),xg=Object.assign(Object.create(null),{base:new ci({isVoid:!0}),meta:new ci({isVoid:!0}),area:new ci({isVoid:!0}),embed:new ci({isVoid:!0}),link:new ci({isVoid:!0}),img:new ci({isVoid:!0}),input:new ci({isVoid:!0}),param:new ci({isVoid:!0}),hr:new ci({isVoid:!0}),br:new ci({isVoid:!0}),source:new ci({isVoid:!0}),track:new ci({isVoid:!0}),wbr:new ci({isVoid:!0}),p:new ci({closedByChildren:["address","article","aside","blockquote","div","dl","fieldset","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","main","nav","ol","p","pre","section","table","ul"],closedByParent:!0}),thead:new ci({closedByChildren:["tbody","tfoot"]}),tbody:new ci({closedByChildren:["tbody","tfoot"],closedByParent:!0}),tfoot:new ci({closedByChildren:["tbody"],closedByParent:!0}),tr:new ci({closedByChildren:["tr"],closedByParent:!0}),td:new ci({closedByChildren:["td","th"],closedByParent:!0}),th:new ci({closedByChildren:["td","th"],closedByParent:!0}),col:new ci({isVoid:!0}),svg:new ci({implicitNamespacePrefix:"svg"}),foreignObject:new ci({implicitNamespacePrefix:"svg",preventNamespaceInheritance:!0}),math:new ci({implicitNamespacePrefix:"math"}),li:new ci({closedByChildren:["li"],closedByParent:!0}),dt:new ci({closedByChildren:["dt","dd"]}),dd:new ci({closedByChildren:["dt","dd"],closedByParent:!0}),rb:new ci({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),rt:new ci({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),rtc:new ci({closedByChildren:["rb","rtc","rp"],closedByParent:!0}),rp:new ci({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),optgroup:new ci({closedByChildren:["optgroup"],closedByParent:!0}),option:new ci({closedByChildren:["option","optgroup"],closedByParent:!0}),pre:new ci({ignoreFirstLf:!0}),listing:new ci({ignoreFirstLf:!0}),style:new ci({contentType:Nc.RAW_TEXT}),script:new ci({contentType:Nc.RAW_TEXT}),title:new ci({contentType:{default:Nc.ESCAPABLE_RAW_TEXT,svg:Nc.PARSABLE_DATA}}),textarea:new ci({contentType:Nc.ESCAPABLE_RAW_TEXT,ignoreFirstLf:!0})}),new Yg().allKnownElementNames().forEach(o=>{!xg[o]&&PP(o)===null&&(xg[o]=new ci({canSelfClose:!1}))})),xg[n]??xg[n.toLowerCase()]??N6}var F6={A:"LINK",B:"BOLD_TEXT",BR:"LINE_BREAK",EM:"EMPHASISED_TEXT",H1:"HEADING_LEVEL1",H2:"HEADING_LEVEL2",H3:"HEADING_LEVEL3",H4:"HEADING_LEVEL4",H5:"HEADING_LEVEL5",H6:"HEADING_LEVEL6",HR:"HORIZONTAL_RULE",I:"ITALIC_TEXT",LI:"LIST_ITEM",LINK:"MEDIA_LINK",OL:"ORDERED_LIST",P:"PARAGRAPH",Q:"QUOTATION",S:"STRIKETHROUGH_TEXT",SMALL:"SMALL_TEXT",SUB:"SUBSTRIPT",SUP:"SUPERSCRIPT",TBODY:"TABLE_BODY",TD:"TABLE_CELL",TFOOT:"TABLE_FOOTER",TH:"TABLE_HEADER_CELL",THEAD:"TABLE_HEADER",TR:"TABLE_ROW",TT:"MONOSPACED_TEXT",U:"UNDERLINED_TEXT",UL:"UNORDERED_LIST"},_3=class{_placeHolderNameCounts={};_signatureToName={};getStartTagPlaceholderName(o,e,t){let i=this._hashTag(o,e,t);if(this._signatureToName[i])return this._signatureToName[i];let a=o.toUpperCase(),s=F6[a]||`TAG_${a}`,d=this._generateUniqueName(t?s:`START_${s}`);return this._signatureToName[i]=d,d}getCloseTagPlaceholderName(o){let e=this._hashClosingTag(o);if(this._signatureToName[e])return this._signatureToName[e];let t=o.toUpperCase(),i=F6[t]||`TAG_${t}`,a=this._generateUniqueName(`CLOSE_${i}`);return this._signatureToName[e]=a,a}getPlaceholderName(o,e){let t=o.toUpperCase(),i=`PH: ${t}=${e}`;if(this._signatureToName[i])return this._signatureToName[i];let a=this._generateUniqueName(t);return this._signatureToName[i]=a,a}getUniquePlaceholder(o){return this._generateUniqueName(o.toUpperCase())}getStartBlockPlaceholderName(o,e){let t=this._hashBlock(o,e);if(this._signatureToName[t])return this._signatureToName[t];let i=this._generateUniqueName(`START_BLOCK_${this._toSnakeCase(o)}`);return this._signatureToName[t]=i,i}getCloseBlockPlaceholderName(o){let e=this._hashClosingBlock(o);if(this._signatureToName[e])return this._signatureToName[e];let t=this._generateUniqueName(`CLOSE_BLOCK_${this._toSnakeCase(o)}`);return this._signatureToName[e]=t,t}_hashTag(o,e,t){let i=`<${o}`,a=Object.keys(e).sort().map(d=>` ${d}=${e[d]}`).join(""),s=t?"/>":`>`;return i+a+s}_hashClosingTag(o){return this._hashTag(`/${o}`,{},!1)}_hashBlock(o,e){let t=e.length===0?"":` (${e.sort().join("; ")})`;return`@${o}${t} {}`}_hashClosingBlock(o){return this._hashBlock(`close_${o}`,[])}_toSnakeCase(o){return o.toUpperCase().replace(/[^A-Z0-9]/g,"_")}_generateUniqueName(o){if(!this._placeHolderNameCounts.hasOwnProperty(o))return this._placeHolderNameCounts[o]=1,o;let t=this._placeHolderNameCounts[o];return this._placeHolderNameCounts[o]=t+1,`${o}_${t}`}},MQ=new Mx(new E0);function SQ(n,o){let e=new f3(MQ,n,o);return(t,i,a,s,d)=>e.toI18nMessage(t,i,a,s,d)}function kQ(n,o){return o}var f3=class{_expressionParser;_retainEmptyTokens;_preserveExpressionWhitespace;constructor(o,e,t){this._expressionParser=o,this._retainEmptyTokens=e,this._preserveExpressionWhitespace=t}toI18nMessage(o,e="",t="",i="",a){let s={isIcu:o.length==1&&o[0]instanceof eu,icuDepth:0,placeholderRegistry:new _3,placeholderToContent:{},placeholderToMessage:{},visitNodeFn:a||kQ},d=ko(this,o,s);return new os(d,s.placeholderToContent,s.placeholderToMessage,e,t,i)}visitElement(o,e){return this._visitElementLike(o,e)}visitComponent(o,e){return this._visitElementLike(o,e)}visitDirective(o,e){throw new Error("Unreachable code")}visitAttribute(o,e){let t=o.valueTokens===void 0||o.valueTokens.length===1?new uf(o.value,o.valueSpan||o.sourceSpan):this._visitTextWithInterpolation(o.valueTokens,o.valueSpan||o.sourceSpan,e,o.i18n);return e.visitNodeFn(o,t)}visitText(o,e){let t=o.tokens.length===1?new uf(o.value,o.sourceSpan):this._visitTextWithInterpolation(o.tokens,o.sourceSpan,e,o.i18n);return e.visitNodeFn(o,t)}visitComment(o,e){return null}visitExpansion(o,e){e.icuDepth++;let t={},i=new tx(o.switchValue,o.type,t,o.sourceSpan);if(o.cases.forEach(d=>{t[d.value]=new Id(d.expression.map(p=>p.visit(this,e)),d.expSourceSpan)}),e.icuDepth--,e.isIcu||e.icuDepth>0){let d=e.placeholderRegistry.getUniquePlaceholder(`VAR_${o.type}`);return i.expressionPlaceholder=d,e.placeholderToContent[d]={text:o.switchValue,sourceSpan:o.switchValueSourceSpan},e.visitNodeFn(o,i)}let a=e.placeholderRegistry.getPlaceholderName("ICU",o.sourceSpan.toString());e.placeholderToMessage[a]=this.toI18nMessage([o],"","","",void 0);let s=new Wg(i,a,o.sourceSpan);return e.visitNodeFn(o,s)}visitExpansionCase(o,e){throw new Error("Unreachable code")}visitBlock(o,e){let t=ko(this,o.children,e);if(o.name==="switch")return new Id(t,o.sourceSpan);let i=o.parameters.map(p=>p.expression),a=e.placeholderRegistry.getStartBlockPlaceholderName(o.name,i),s=e.placeholderRegistry.getCloseBlockPlaceholderName(o.name);e.placeholderToContent[a]={text:o.startSourceSpan.toString(),sourceSpan:o.startSourceSpan},e.placeholderToContent[s]={text:o.endSourceSpan?o.endSourceSpan.toString():"}",sourceSpan:o.endSourceSpan??o.sourceSpan};let d=new Im(o.name,i,a,s,t,o.sourceSpan,o.startSourceSpan,o.endSourceSpan);return e.visitNodeFn(o,d)}visitBlockParameter(o,e){throw new Error("Unreachable code")}visitLetDeclaration(o,e){return null}_visitElementLike(o,e){let t=ko(this,o.children,e),i={},a=C=>{i[C.name]=C.value},s,d;o instanceof ul?(s=o.name,d=h3(o.name).isVoid):(s=o.fullName,d=o.tagName?h3(o.tagName).isVoid:!1),o.attrs.forEach(a),o.directives.forEach(C=>C.attrs.forEach(a));let p=e.placeholderRegistry.getStartTagPlaceholderName(s,i,d);e.placeholderToContent[p]={text:o.startSourceSpan.toString(),sourceSpan:o.startSourceSpan};let u="";d||(u=e.placeholderRegistry.getCloseTagPlaceholderName(s),e.placeholderToContent[u]={text:``,sourceSpan:o.endSourceSpan??o.sourceSpan});let g=new Dm(s,i,p,u,t,d,o.sourceSpan,o.startSourceSpan,o.endSourceSpan);return e.visitNodeFn(o,g)}_visitTextWithInterpolation(o,e,t,i){let a=[],s=!1;for(let d of o)switch(d.type){case 8:case 17:s=!0;let[p,u,g]=d.parts,C=DQ(u)||"INTERPOLATION",M=t.placeholderRegistry.getPlaceholderName(C,u);if(this._preserveExpressionWhitespace)t.placeholderToContent[M]={text:d.parts.join(""),sourceSpan:d.sourceSpan},a.push(new m0(u,M,d.sourceSpan));else{let x=this.normalizeExpression(d);t.placeholderToContent[M]={text:`${p}${x}${g}`,sourceSpan:d.sourceSpan},a.push(new m0(x,M,d.sourceSpan))}break;default:if(d.parts[0].length>0||this._retainEmptyTokens){let x=a[a.length-1];x instanceof uf?(x.value+=d.parts[0],x.sourceSpan=new In(x.sourceSpan.start,d.sourceSpan.end,x.sourceSpan.fullStart,x.sourceSpan.details)):a.push(new uf(d.parts[0],d.sourceSpan))}else this._retainEmptyTokens&&a.push(new uf(d.parts[0],d.sourceSpan));break}return s?(PQ(a,i),new Id(a,e)):a[0]}normalizeExpression(o){let e=o.parts[1],t=this._expressionParser.parseBinding(e,o.sourceSpan,o.sourceSpan.start.offset);return gQ(t)}};function PQ(n,o){if(o instanceof os&&(TQ(o),o=o.nodes[0]),o instanceof Id){EQ(o.children,n);for(let e=0;e`"${e.sourceSpan.toString()}"`).join(` +`)} + +Second pass (${o.length} tokens): +${o.map(e=>`"${e.sourceSpan.toString()}"`).join(` +`)} + `.trim());if(n.some((e,t)=>o[t].constructor!==e.constructor))throw new Error("The types of the i18n message children changed between first and second pass.")}var OQ=/\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g;function DQ(n){return n.split(OQ)[2]}var R6=new Set(["iframe|srcdoc","*|innerhtml","*|outerhtml","embed|src","iframe|src","object|codebase","object|data"]);function z6(n,o){return n=n.toLowerCase(),o=o.toLowerCase(),R6.has(n+"|"+o)||R6.has("*|"+o)}var IQ=n=>(o,e)=>{let t=n.get(o)??o;return t instanceof Rd&&(e instanceof Wg&&t.i18n instanceof os&&(e.previousMessage=t.i18n),t.i18n=e),e},Sx=class{keepI18nAttrs;enableI18nLegacyMessageIdFormat;preserveSignificantWhitespace;retainEmptyTokens;hasI18nMeta=!1;_errors=[];constructor(o=!1,e=!1,t=!0,i=!t){this.keepI18nAttrs=o,this.enableI18nLegacyMessageIdFormat=e,this.preserveSignificantWhitespace=t,this.retainEmptyTokens=i}_generateI18nMessage(o,e="",t){let{meaning:i,description:a,customId:s}=this._parseMetadata(e),p=SQ(this.retainEmptyTokens,this.preserveSignificantWhitespace)(o,i,a,s,t);return this._setMessageId(p,e),this._setLegacyIds(p,e),p}visitAllWithErrors(o){let e=o.map(t=>t.visit(this,null));return new yx(e,this._errors)}visitElement(o){return this._visitElementLike(o),o}visitComponent(o,e){return this._visitElementLike(o),o}visitExpansion(o,e){let t,i=o.i18n;if(this.hasI18nMeta=!0,i instanceof Wg){let a=i.name;t=this._generateI18nMessage([o],i);let s=LN(t);s.name=a,e!==null&&(e.placeholderToMessage[a]=t)}else t=this._generateI18nMessage([o],e||i);return o.i18n=t,o}visitText(o){return o}visitAttribute(o){return o}visitComment(o){return o}visitExpansionCase(o){return o}visitBlock(o,e){return ko(this,o.children,e),o}visitBlockParameter(o,e){return o}visitLetDeclaration(o,e){return o}visitDirective(o,e){return o}_visitElementLike(o){let e;if(GU(o)){this.hasI18nMeta=!0;let t=[],i={};for(let a of o.attrs)if(a.name===RN){let s=o.i18n||a.value,d=new Map,p=this.preserveSignificantWhitespace?o.children:Dc(new wx(!1,d),o.children);e=this._generateI18nMessage(p,s,IQ(d)),e.nodes.length===0&&(e=void 0),o.i18n=e}else if(a.name.startsWith(zP)){let s=a.name.slice(zP.length),d;o instanceof Jr?d=o.tagName===null?!1:z6(o.tagName,s):d=z6(o.name,s),d||zQ(s)?this._reportError(a,`Translating attribute '${s}' is disallowed for security reasons.`):i[s]=a.value}else t.push(a);if(Object.keys(i).length)for(let a of t){let s=i[a.name];s!==void 0&&a.value&&(a.i18n=this._generateI18nMessage([a],a.i18n||s))}this.keepI18nAttrs||(o.attrs=t)}ko(this,o.children,e)}_parseMetadata(o){return typeof o=="string"?FQ(o):o instanceof os?o:{}}_setMessageId(o,e){o.id||(o.id=e instanceof os&&e.id||QH(o))}_setLegacyIds(o,e){if(this.enableI18nLegacyMessageIdFormat)o.legacyIds=[qH(o),PN(o)];else if(typeof e!="string"){let t=e instanceof os?e:e instanceof Wg?e.previousMessage:void 0;o.legacyIds=t?t.legacyIds:[]}}_reportError(o,e){this._errors.push(new dn(o.sourceSpan,e))}},AQ="|",NQ="@@";function FQ(n=""){let o,e,t;if(n=n.trim(),n){let i=n.indexOf(NQ),a=n.indexOf(AQ),s;[s,o]=i>-1?[n.slice(0,i),n.slice(i+2)]:[n,""],[e,t]=a>-1?[s.slice(0,a),s.slice(a+1)]:["",s]}return{customId:o,meaning:e,description:t}}function RQ(n){let o=[];return n.description?o.push({tagName:"desc",text:n.description}):o.push({tagName:"suppress",text:"{msgDescriptions}"}),n.meaning&&o.push({tagName:"meaning",text:n.meaning}),cU(o)}function zQ(n){let o=n.toLowerCase();return o.length>2&&o!=="only"&&o.startsWith("on")}var LQ="goog.getMsg";function VQ(n,o,e,t){let i=jQ(o),a=[De(i)];Object.keys(t).length&&(a.push(e3(Q3(t,!0),!0)),a.push(e3({original_code:yl(Object.keys(t).map(p=>({key:R0(p),quoted:!0,value:o.placeholders[p]?De(o.placeholders[p].sourceSpan.toString()):De(o.placeholderToMessage[p].nodes.map(u=>u.sourceSpan.toString()).join(""))})))})));let s=new Ga(e.name,di(LQ).callFn(a),ic,ur.Final);s.addLeadingComment(RQ(o));let d=new fr(n.set(e));return[s,d]}var v3=class{formatPh(o){return`{$${R0(o)}}`}visitText(o){return o.value}visitContainer(o){return o.children.map(e=>e.visit(this)).join("")}visitIcu(o){return vF(o)}visitTagPlaceholder(o){return o.isVoid?this.formatPh(o.startName):`${this.formatPh(o.startName)}${o.children.map(e=>e.visit(this)).join("")}${this.formatPh(o.closeName)}`}visitPlaceholder(o){return this.formatPh(o.name)}visitBlockPlaceholder(o){return`${this.formatPh(o.startName)}${o.children.map(e=>e.visit(this)).join("")}${this.formatPh(o.closeName)}`}visitIcuPlaceholder(o,e){return this.formatPh(o.name)}},BQ=new v3;function jQ(n){return n.nodes.map(o=>o.visit(BQ,null)).join("")}function $Q(n,o,e){let{messageParts:t,placeHolders:i}=HQ(o),a=UQ(o),s=i.map(u=>e[u.text]),d=pU(o,t,i,s,a),p=n.set(d);return[new fr(p)]}var C3=class{placeholderToMessage;pieces;constructor(o,e){this.placeholderToMessage=o,this.pieces=e}visitText(o){if(this.pieces[this.pieces.length-1]instanceof Xp)this.pieces[this.pieces.length-1].text+=o.value;else{let e=new In(o.sourceSpan.fullStart,o.sourceSpan.end,o.sourceSpan.fullStart,o.sourceSpan.details);this.pieces.push(new Xp(o.value,e))}}visitContainer(o){o.children.forEach(e=>e.visit(this))}visitIcu(o){this.pieces.push(new Xp(vF(o),o.sourceSpan))}visitTagPlaceholder(o){this.pieces.push(this.createPlaceholderPiece(o.startName,o.startSourceSpan??o.sourceSpan)),o.isVoid||(o.children.forEach(e=>e.visit(this)),this.pieces.push(this.createPlaceholderPiece(o.closeName,o.endSourceSpan??o.sourceSpan)))}visitPlaceholder(o){this.pieces.push(this.createPlaceholderPiece(o.name,o.sourceSpan))}visitBlockPlaceholder(o){this.pieces.push(this.createPlaceholderPiece(o.startName,o.startSourceSpan??o.sourceSpan)),o.children.forEach(e=>e.visit(this)),this.pieces.push(this.createPlaceholderPiece(o.closeName,o.endSourceSpan??o.sourceSpan))}visitIcuPlaceholder(o){this.pieces.push(this.createPlaceholderPiece(o.name,o.sourceSpan,this.placeholderToMessage[o.name]))}createPlaceholderPiece(o,e,t){return new Og(R0(o,!1),e,t)}};function HQ(n){let o=[],e=new C3(n.placeholderToMessage,o);return n.nodes.forEach(t=>t.visit(e)),WQ(o)}function UQ(n){let o=n.nodes[0],e=n.nodes[n.nodes.length-1];return new In(o.sourceSpan.fullStart,e.sourceSpan.end,o.sourceSpan.fullStart,o.sourceSpan.details)}function WQ(n){let o=[],e=[];n[0]instanceof Og&&o.push(eP(n[0].sourceSpan.start));for(let t=0;t{let P=M.has(b.name);return M.add(b.name),!P});let x=C.flatMap(b=>{let P=s.get(b.context);if(P===void 0)throw new Error("AssertionError: Could not find i18n expression's value");return[De(b.name),P]});g.i18nAttributesConfig=n.addConst(new $c(x))}for(let p of n.units)for(let u of p.create)if(u.kind===j.I18nStart){let g=d.get(u.root);if(g===void 0)throw new Error("AssertionError: Could not find corresponding i18n block index for an i18n message op; was an i18n message incorrectly assumed to correspond to an attribute?");u.messageIndex=g}}function kF(n,o,e,t){let i=[],a=new Map;for(let u of t.subMessages){let g=e.get(u),{mainVar:C,statements:M}=kF(n,o,e,g);i.push(...M);let x=a.get(g.messagePlaceholder)??[];x.push(C),a.set(g.messagePlaceholder,x)}YQ(t,a),t.params=new Map([...t.params.entries()].sort());let s=di(n.pool.uniqueName(GQ)),d=eK(n.pool,t.message.id,o,n.i18nUseExternalIds),p;if(t.needsPostprocessing||t.postprocessingParams.size>0){let u=Object.fromEntries([...t.postprocessingParams.entries()].sort()),g=Q3(u,!1),C=[];t.postprocessingParams.size>0&&C.push(e3(g,!0)),p=M=>Ht(ge.i18nPostprocess).callFn([M,...C])}return i.push(...ZQ(t.message,s,d,t.params,p)),{mainVar:s,statements:i}}function YQ(n,o){for(let[e,t]of o)t.length===1?n.params.set(e,t[0]):(n.params.set(e,De(`${V6}${qQ}${e}${V6}`)),n.postprocessingParams.set(e,io(t)))}function ZQ(n,o,e,t,i){let a=Object.fromEntries(t),s=[KQ(o),Nx(JQ(),VQ(o,n,e,a),$Q(o,n,Q3(a,!1)))];return i&&s.push(new fr(o.set(i(o)))),s}function JQ(){return N0(di(L6)).notIdentical(De("undefined",W3)).and(di(L6))}function eK(n,o,e,t){let i,a=e;if(t){let s=B6("EXTERNAL_"),d=n.uniqueName(a);i=`${s}${Up(o)}$$${d}`}else{let s=B6(a);i=n.uniqueName(s)}return di(i)}function tK(n){for(let o of n.units){let e=null,t=null,i=new Map,a=new Map,s=new Map;for(let d of o.create)switch(d.kind){case j.I18nStart:if(d.context===null)throw Error("I18n op should have its context set.");e=d;break;case j.I18nEnd:e=null;break;case j.IcuStart:if(d.context===null)throw Error("Icu op should have its context set.");t=d;break;case j.IcuEnd:t=null;break;case j.Text:if(e!==null)if(i.set(d.xref,e),a.set(d.xref,t),d.icuPlaceholder!==null){let p=PG(n.allocateXrefId(),d.icuPlaceholder,[d.initialValue]);Je.replace(d,p),s.set(d.xref,p)}else Je.remove(d);break}for(let d of o.update)switch(d.kind){case j.InterpolateText:if(!i.has(d.target))continue;let p=i.get(d.target),u=a.get(d.target),g=s.get(d.target),C=u?u.context:p.context,M=u?f0.Postproccessing:f0.Creation,x=[];for(let b=0;b0){let t=iK(e.localRefs);e.localRefs=n.addConst(t)}else e.localRefs=null;break}}function iK(n){let o=[];for(let e of n)o.push(De(e.name),De(e.target));return io(o)}function oK(n){for(let o of n.units){let e=Oa.HTML;for(let t of o.create)t.kind===j.ElementStart&&t.namespace!==e&&(Je.insertBefore(CG(t.namespace),t),e=t.namespace)}}function aK(n){let o=[],e=0,t=0,i=0,a=0,s=0,d=null;for(;e0&&t===0&&i===0){let u=n.substring(a,e-1).trim();o.push(d,u),s=e,a=0,d=null}break}if(d&&a){let p=n.slice(a).trim();o.push(d,p)}return o}function PF(n){return n.replace(/[a-z][A-Z]/g,o=>o.charAt(0)+"-"+o.charAt(1)).toLowerCase()}function rK(n){let o=new Map;for(let e of n.units)for(let t of e.create)Lm(t)&&o.set(t.xref,t);for(let e of n.units)for(let t of e.create)if(t.kind===j.ExtractedAttribute&&t.bindingKind===Qt.Attribute&&aF(t.expression)){let i=o.get(t.target);if(i!==void 0&&(i.kind===j.Template||i.kind===j.ConditionalCreate||i.kind===j.ConditionalBranchCreate)&&i.templateKind===ys.Structural)continue;if(t.name==="style"){let a=aK(t.expression.value);for(let s=0;s{if(!(!(a instanceof Ad)||a.name!==null)){if(!t.has(a.xref))throw new Error(`Variable ${a.xref} not yet named`);a.name=t.get(a.xref)}})}function lK(n,o){if(n.name===null)switch(n.kind){case ar.Context:n.name=`ctx_r${o.index++}`;break;case ar.Identifier:let e=n.identifier===Zs?"i":"";n.name=`${n.identifier}_${e}r${++o.index}`;break;default:n.name=`_r${++o.index}`;break}return n.name}function cK(n){return n.startsWith("--")?n:PF(n)}function j6(n){let o=n.indexOf("!important");return o>-1?n.substring(0,o):n}function dK(n){for(let o of n.units){for(let e of o.functions)tP(e.ops);for(let e of o.create)(e.kind===j.Listener||e.kind===j.Animation||e.kind===j.AnimationListener||e.kind===j.TwoWayListener)&&tP(e.handlerOps);tP(o.update)}}function tP(n){for(let o of n){if(o.kind!==j.Statement||!(o.statement instanceof fr)||!(o.statement.expr instanceof cx))continue;let e=o.statement.expr.steps,t=!0;for(let i=o.next;i.kind!==j.ListEnd&&t;i=i.next)wa(i,(a,s)=>{if(!Gc(a))return a;if(t&&!(s&ai.InChildOperation))switch(a.kind){case Jt.NextContext:a.steps+=e,Je.remove(o),t=!1;break;case Jt.GetCurrentView:case Jt.Reference:case Jt.ContextLetReference:t=!1;break}})}}var mK="ng-container";function pK(n){for(let o of n.units){let e=new Set;for(let t of o.create)t.kind===j.ElementStart&&t.tag===mK&&(t.kind=j.ContainerStart,e.add(t.xref)),t.kind===j.ElementEnd&&e.has(t.xref)&&(t.kind=j.ContainerEnd)}}function uK(n,o){let e=n.get(o);if(e===void 0)throw new Error("All attributes should have an element-like target.");return e}function gK(n){let o=new Map;for(let e of n.units)for(let t of e.create)Lm(t)&&o.set(t.xref,t);for(let e of n.units)for(let t of e.create)(t.kind===j.ElementStart||t.kind===j.ContainerStart)&&t.nonBindable&&Je.insertAfter(gG(t.xref),t),(t.kind===j.ElementEnd||t.kind===j.ContainerEnd)&&uK(o,t.xref).nonBindable&&Je.insertBefore(hG(t.xref),t)}function Rc(n){return o=>o.kind===n}function If(n,o){return e=>e.kind===n&&o===e.expression instanceof aa}function hK(n){return n.kind===j.Listener&&!(n.hostListener&&n.isLegacyAnimationListener)||n.kind===j.TwoWayListener||n.kind===j.Animation||n.kind===j.AnimationListener}function _K(n){return(n.kind===j.Property||n.kind===j.TwoWayProperty)&&!(n.expression instanceof aa)}var fK=[{test:n=>n.kind===j.Listener&&n.hostListener&&n.isLegacyAnimationListener},{test:hK}],vK=[{test:Rc(j.StyleMap),transform:kx},{test:Rc(j.ClassMap),transform:kx},{test:Rc(j.StyleProp)},{test:Rc(j.ClassProp)},{test:If(j.Attribute,!0)},{test:If(j.Property,!0)},{test:_K},{test:If(j.Attribute,!1)},{test:Rc(j.Control)}],CK=[{test:If(j.DomProperty,!0)},{test:If(j.DomProperty,!1)},{test:Rc(j.Attribute)},{test:Rc(j.StyleMap),transform:kx},{test:Rc(j.ClassMap),transform:kx},{test:Rc(j.StyleProp)},{test:Rc(j.ClassProp)}],$6=new Set([j.Listener,j.TwoWayListener,j.AnimationListener,j.StyleMap,j.ClassMap,j.StyleProp,j.ClassProp,j.Property,j.TwoWayProperty,j.DomProperty,j.Attribute,j.Animation,j.Control]);function bK(n){for(let o of n.units){H6(o.create,fK);let e=o.job.kind===Dt.Host?CK:vK;H6(o.update,e)}}function H6(n,o){let e=[],t=null;for(let i of n){let a=v0(i)?i.target:null;(!$6.has(i.kind)||a!==t&&t!==null&&a!==null)&&(Je.insertBefore(U6(e,o),i),e=[],t=null),$6.has(i.kind)&&(e.push(i),Je.remove(i),t=a??t)}n.push(U6(e,o))}function U6(n,o){let e=Array.from(o,()=>new Array);for(let t of n){let i=o.findIndex(a=>a.test(t));e[i].push(t)}return e.flatMap((t,i)=>{let a=o[i].transform;return a?a(t):t})}function kx(n){return n.slice(n.length-1)}function xK(n){for(let o of n.units){let e=gF(o);for(let t of o.ops())if(t.kind===j.Binding){let i=wK(e,t.target);yK(t.name)&&i.kind===j.Projection&&Je.remove(t)}}}function yK(n){return n.toLowerCase()==="select"}function wK(n,o){let e=n.get(o);if(e===void 0)throw new Error("All attributes should have an slottable target.");return e}function MK(n){for(let o of n.units)SK(o)}function SK(n){for(let o of n.update)wa(o,(e,t)=>{if(!Gc(e)||e.kind!==Jt.PipeBinding)return;if(t&ai.InChildOperation)throw new Error("AssertionError: pipe bindings should not appear in child expressions");if(o.target==null)throw new Error("AssertionError: expected slot handle to be assigned for pipe creation");kK(n,o.target,e)})}function kK(n,o,e){for(let t=n.create.head.next;t.kind!==j.ListEnd;t=t.next){if(!nh(t)||t.xref!==o)continue;for(;t.next.kind===j.Pipe;)t=t.next;let i=vG(e.target,e.targetSlot,e.name);Je.insertBefore(i,t.next);return}throw new Error(`AssertionError: unable to find insertion point for pipe ${e.name}`)}function PK(n){for(let o of n.units)for(let e of o.update)ra(e,t=>!(t instanceof hu)||t.args.length<=4?t:new y0(t.target,t.targetSlot,t.name,io(t.args),t.args.length),ai.None)}function TK(n){TF(n.root,0)}function TF(n,o){let e=null;for(let t of n.create)switch(t.kind){case j.I18nStart:t.subTemplateIndex=o===0?null:o,e=t;break;case j.I18nEnd:e.subTemplateIndex===null&&(o=0),e=null;break;case j.ConditionalCreate:case j.ConditionalBranchCreate:case j.Template:o=pb(n.job.views.get(t.xref),e,t.i18nPlaceholder,o);break;case j.RepeaterCreate:let i=n.job.views.get(t.xref);o=pb(i,e,t.i18nPlaceholder,o),t.emptyView!==null&&(o=pb(n.job.views.get(t.emptyView),e,t.emptyI18nPlaceholder,o));break;case j.Projection:t.fallbackView!==null&&(o=pb(n.job.views.get(t.fallbackView),e,t.fallbackViewI18nPlaceholder,o));break}return o}function pb(n,o,e,t){if(e!==void 0){if(o===null)throw Error("Expected template with i18n placeholder to be in an i18n block.");t++,EK(n,o)}return TF(n,t)}function EK(n,o){if(n.create.head.next?.kind!==j.I18nStart){let e=n.job.allocateXrefId();Je.insertAfter(Lx(e,o.message,o.root,null),n.create.head),Je.insertBefore(Vx(e,null),n.create.tail)}}function OK(n){for(let o of n.units)for(let e of o.ops())wa(e,t=>{if(!(t instanceof gu)||t.body===null)return;let i=new b3(t.args.length);t.fn=n.pool.getSharedConstant(i,t.body),t.body=null})}var b3=class extends Hf{numArgs;constructor(o){super(),this.numArgs=o}keyOf(o){return o instanceof Rm?`param(${o.index})`:super.keyOf(o)}toSharedConstantDeclaration(o,e){let t=[];for(let a=0;aa instanceof Rm?di("a"+a.index):a,ai.None);return new Ga(o,new vu(t,i),void 0,ur.Final)}};function DK(n){for(let o of n.units)for(let e of o.update)ra(e,(t,i)=>i&ai.InChildOperation?t:t instanceof $c?IK(t):t instanceof rc?AK(t):t,ai.None)}function IK(n){let o=[],e=[];for(let t of n.entries){if(t instanceof ru){if(t.expression.isConstant())o.push(t);else{let i=e.length;e.push(t.expression),o.push(new ru(new Rm(i)))}continue}if(t.isConstant())o.push(t);else{let i=e.length;e.push(t),o.push(new Rm(i))}}return new gu(io(o),e)}function AK(n){let o=[],e=[];for(let t of n.entries){if(t instanceof Tm){if(t.expression.isConstant())o.push(t);else{let i=e.length;e.push(t.expression),o.push(new Tm(new Rm(i)))}continue}if(t.value.isConstant())o.push(t);else{let i=e.length;e.push(t.value),o.push(new Rg(t.key,new Rm(i),t.quoted))}}return new gu(new rc(o),e)}function NK(n){for(let o of n.units)for(let e of o.ops())ra(e,t=>t instanceof Fg&&(t.flags===null||!t.flags.includes("g"))?n.pool.getSharedConstant(new x3,t):t,ai.None)}var x3=class extends Hf{toSharedConstantDeclaration(o,e){return new Ga(o,e,void 0,ur.Final)}};function FK(n,o,e,t,i){return jm(ge.element,n,o,e,t,i)}function RK(n,o,e,t,i){return jm(ge.elementStart,n,o,e,t,i)}function jm(n,o,e,t,i,a){let s=[De(o)];return e!==null&&s.push(De(e)),i!==null?s.push(De(t),De(i)):t!==null&&s.push(De(t)),$n(n,s,a)}function EF(n,o,e,t,i,a,s,d,p){let u=[De(o),e,De(t),De(i),De(a),De(s)];for(d!==null&&(u.push(De(d)),u.push(Ht(ge.templateRefExtractor)));u[u.length-1].isEquivalent(zg);)u.pop();return $n(n,u,p)}function oT(n,o,e,t,i){let a=[De(o)];return e instanceof aa?a.push(ih(e,i)):a.push(e),t!==null&&a.push(t),$n(n,a,i)}function zK(n){return $n(ge.elementEnd,[],n)}function LK(n,o,e,t){return jm(ge.elementContainerStart,n,null,o,e,t)}function VK(n,o,e,t){return jm(ge.elementContainer,n,null,o,e,t)}function BK(){return $n(ge.elementContainerEnd,[],null)}function jK(n,o,e,t,i,a,s,d){return EF(ge.templateCreate,n,o,e,t,i,a,s,d)}function $K(){return $n(ge.disableBindings,[],null)}function HK(){return $n(ge.enableBindings,[],null)}function UK(n,o,e,t,i){let a=[De(n),o];return e!==null&&a.push(Ht(e)),$n(t?ge.syntheticHostListener:ge.listener,a,i)}function W6(n,o){return Ht(ge.twoWayBindingSet).callFn([n,o])}function WK(n,o,e){return $n(ge.twoWayListener,[De(n),o],e)}function GK(n,o){return $n(ge.pipe,[De(n),De(o)],null)}function qK(){return $n(ge.namespaceHTML,[],null)}function QK(){return $n(ge.namespaceSVG,[],null)}function KK(){return $n(ge.namespaceMathML,[],null)}function XK(n,o){return $n(ge.advance,n>1?[De(n)]:[],o)}function YK(n){return Ht(ge.reference).callFn([De(n)])}function ZK(n){return Ht(ge.nextContext).callFn(n===1?[]:[De(n)])}function JK(){return Ht(ge.getCurrentView).callFn([])}function eX(n){return Ht(ge.restoreView).callFn([n])}function tX(n){return Ht(ge.resetView).callFn([n])}function nX(n,o,e){let t=[De(n,null)];return o!==""&&t.push(De(o)),$n(ge.text,t,e)}function iX(n,o,e,t,i,a,s,d,p,u,g){let C=[De(n),De(o),e??De(null),De(t),De(i),De(a),s??De(null),d??De(null),p?Ht(ge.deferEnableTimerScheduling):De(null),De(g)],M;for(;(M=C[C.length-1])!==null&&M instanceof _r&&M.value===null;)C.pop();return $n(ge.defer,C,u)}var oX=new Map([[lo.Idle,{none:ge.deferOnIdle,prefetch:ge.deferPrefetchOnIdle,hydrate:ge.deferHydrateOnIdle}],[lo.Immediate,{none:ge.deferOnImmediate,prefetch:ge.deferPrefetchOnImmediate,hydrate:ge.deferHydrateOnImmediate}],[lo.Timer,{none:ge.deferOnTimer,prefetch:ge.deferPrefetchOnTimer,hydrate:ge.deferHydrateOnTimer}],[lo.Hover,{none:ge.deferOnHover,prefetch:ge.deferPrefetchOnHover,hydrate:ge.deferHydrateOnHover}],[lo.Interaction,{none:ge.deferOnInteraction,prefetch:ge.deferPrefetchOnInteraction,hydrate:ge.deferHydrateOnInteraction}],[lo.Viewport,{none:ge.deferOnViewport,prefetch:ge.deferPrefetchOnViewport,hydrate:ge.deferHydrateOnViewport}],[lo.Never,{none:ge.deferHydrateNever,prefetch:ge.deferHydrateNever,hydrate:ge.deferHydrateNever}]]);function aX(n,o,e,t){let i=oX.get(n)?.[e];if(i===void 0)throw new Error(`Unable to determine instruction for trigger ${n}`);return $n(i,o,t)}function rX(n){return $n(ge.projectionDef,n?[n]:[],null)}function sX(n,o,e,t,i,a,s){let d=[De(n)];return(o!==0||e!==null||t!==null)&&(d.push(De(o)),e!==null&&d.push(e),t!==null&&(e===null&&d.push(De(null)),d.push(di(t),De(i),De(a)))),$n(ge.projection,d,s)}function lX(n,o,e,t){let i=[De(n),De(o)];return e!==null&&i.push(De(e)),$n(ge.i18nStart,i,t)}function cX(n,o,e,t,i,a,s,d){let p=[De(n),o,De(e),De(t),De(i),De(a)];for(s!==null&&(p.push(De(s)),p.push(Ht(ge.templateRefExtractor)));p[p.length-1].isEquivalent(zg);)p.pop();return $n(ge.conditionalCreate,p,d)}function dX(n,o,e,t,i,a,s,d){let p=[De(n),o,De(e),De(t),De(i),De(a)];for(s!==null&&(p.push(De(s)),p.push(Ht(ge.templateRefExtractor)));p[p.length-1].isEquivalent(zg);)p.pop();return $n(ge.conditionalBranchCreate,p,d)}function mX(n,o,e,t,i,a,s,d,p,u,g,C,M,x){let b=[De(n),di(o),De(e),De(t),De(i),De(a),s];return(d||p!==null)&&(b.push(De(d)),p!==null&&(b.push(di(p),De(u),De(g)),(C!==null||M!==null)&&b.push(De(C)),M!==null&&b.push(De(M)))),$n(ge.repeaterCreate,b,x)}function pX(n,o){return $n(ge.repeater,[n],o)}function uX(n,o,e){return n==="prefetch"?$n(ge.deferPrefetchWhen,[o],e):n==="hydrate"?$n(ge.deferHydrateWhen,[o],e):$n(ge.deferWhen,[o],e)}function gX(n,o){return $n(ge.declareLet,[De(n)],o)}function hX(n,o){return Ht(ge.storeLet).callFn([n],o)}function _X(n){return Ht(ge.readContextLet).callFn([De(n)])}function fX(n,o,e,t){let i=[De(n),De(o)];return e&&i.push(De(e)),$n(ge.i18n,i,t)}function vX(n){return $n(ge.i18nEnd,[],n)}function CX(n,o){let e=[De(n),De(o)];return $n(ge.i18nAttributes,e,null)}function bX(n,o,e){return oT(ge.ariaProperty,n,o,null,e)}function xX(n,o,e,t){return oT(ge.property,n,o,e,t)}function yX(n){return $n(ge.control,[],n)}function wX(n){return $n(ge.controlCreate,[],n)}function MX(n,o,e,t){let i=[De(n),o];return e!==null&&i.push(e),$n(ge.twoWayProperty,i,t)}function SX(n,o,e,t,i){let a=[De(n)];return o instanceof aa?a.push(ih(o,i)):a.push(o),(e!==null||t!==null)&&a.push(e??De(null)),t!==null&&a.push(De(t)),$n(ge.attribute,a,null)}function kX(n,o,e,t){let i=[De(n)];return o instanceof aa?i.push(ih(o,t)):i.push(o),e!==null&&i.push(De(e)),$n(ge.styleProp,i,t)}function PX(n,o,e){return $n(ge.classProp,[De(n),o],e)}function TX(n,o){let e=n instanceof aa?ih(n,o):n;return $n(ge.styleMap,[e],o)}function EX(n,o){let e=n instanceof aa?ih(n,o):n;return $n(ge.classMap,[e],o)}function OX(n,o,e,t,i){return jm(ge.domElement,n,o,e,t,i)}function DX(n,o,e,t,i){return jm(ge.domElementStart,n,o,e,t,i)}function IX(n){return $n(ge.domElementEnd,[],n)}function AX(n,o,e,t){return jm(ge.domElementContainerStart,n,null,o,e,t)}function NX(n,o,e,t){return jm(ge.domElementContainer,n,null,o,e,t)}function FX(){return $n(ge.domElementContainerEnd,[],null)}function RX(n,o,e,t){let i=[De(n),o];return e!==null&&i.push(Ht(e)),$n(ge.domListener,i,t)}function zX(n,o,e,t,i,a,s,d){return EF(ge.domTemplate,n,o,e,t,i,a,s,d)}var G6=[ge.pipeBind1,ge.pipeBind2,ge.pipeBind3,ge.pipeBind4];function LX(n,o,e){if(e.length<1||e.length>G6.length)throw new Error("pipeBind() argument count out of bounds");let t=G6[e.length-1];return Ht(t).callFn([De(n),De(o),...e])}function VX(n,o,e){return Ht(ge.pipeBindV).callFn([De(n),De(o),e])}function BX(n,o,e){let t=OF(n,o);return tY(ZX,[],t,e)}function jX(n,o){return $n(ge.i18nExp,[n],o)}function $X(n,o){return $n(ge.i18nApply,[De(n)],o)}function HX(n,o,e,t){return oT(ge.domProperty,n,o,e,t)}function UX(n,o,e,t){let i=[o];e!==null&&i.push(e);let a=n==="enter"?ge.animationEnter:ge.animationLeave;return $n(a,i,t)}function WX(n,o,e,t){let a=[o instanceof aa?ih(o,t):o];e!==null&&a.push(e);let s=n==="enter"?ge.animationEnter:ge.animationLeave;return $n(s,a,t)}function GX(n,o,e,t){let i=[o],a=n==="enter"?ge.animationEnterListener:ge.animationLeaveListener;return $n(a,i,t)}function qX(n,o,e){return $n(ge.syntheticHostProperty,[De(n),o],e)}function QX(n,o,e){return aT(eY,[De(n),o],e,null)}function KX(n,o){return $n(ge.attachSourceLocations,[De(n),o],null)}function XX(n,o,e){return Ht(ge.arrowFunction).callFn([De(n),o,e])}function OF(n,o){if(n.length<1||o.length!==n.length-1)throw new Error("AssertionError: expected specific shape of args for strings/expressions in interpolation");let e=[];if(o.length===1&&n[0]===""&&n[1]==="")e.push(o[0]);else{let t;for(t=0;t{if(n%2===0)throw new Error("Expected odd number of arguments");return(n-1)/2}},JX={constant:[ge.interpolate,ge.interpolate1,ge.interpolate2,ge.interpolate3,ge.interpolate4,ge.interpolate5,ge.interpolate6,ge.interpolate7,ge.interpolate8],variable:ge.interpolateV,mapping:n=>{if(n%2===0)throw new Error("Expected odd number of arguments");return(n-1)/2}},eY={constant:[ge.pureFunction0,ge.pureFunction1,ge.pureFunction2,ge.pureFunction3,ge.pureFunction4,ge.pureFunction5,ge.pureFunction6,ge.pureFunction7,ge.pureFunction8],variable:ge.pureFunctionV,mapping:n=>n};function aT(n,o,e,t){let i=n.mapping(e.length),a=e.at(-1);if(e.length>1&&a instanceof _r&&a.value===""&&e.pop(),iDF(n,t),ai.None),e.kind){case j.Text:Je.replace(e,nX(e.handle.slot,e.initialValue,e.sourceSpan));break;case j.ElementStart:Je.replace(e,n.job.mode===vs.DomOnly?DX(e.handle.slot,e.tag,e.attributes,e.localRefs,e.startSourceSpan):RK(e.handle.slot,e.tag,e.attributes,e.localRefs,e.startSourceSpan));break;case j.Element:Je.replace(e,n.job.mode===vs.DomOnly?OX(e.handle.slot,e.tag,e.attributes,e.localRefs,e.wholeSourceSpan):FK(e.handle.slot,e.tag,e.attributes,e.localRefs,e.wholeSourceSpan));break;case j.ElementEnd:Je.replace(e,n.job.mode===vs.DomOnly?IX(e.sourceSpan):zK(e.sourceSpan));break;case j.ContainerStart:Je.replace(e,n.job.mode===vs.DomOnly?AX(e.handle.slot,e.attributes,e.localRefs,e.startSourceSpan):LK(e.handle.slot,e.attributes,e.localRefs,e.startSourceSpan));break;case j.Container:Je.replace(e,n.job.mode===vs.DomOnly?NX(e.handle.slot,e.attributes,e.localRefs,e.wholeSourceSpan):VK(e.handle.slot,e.attributes,e.localRefs,e.wholeSourceSpan));break;case j.ContainerEnd:Je.replace(e,n.job.mode===vs.DomOnly?FX():BK());break;case j.I18nStart:Je.replace(e,lX(e.handle.slot,e.messageIndex,e.subTemplateIndex,e.sourceSpan));break;case j.I18nEnd:Je.replace(e,vX(e.sourceSpan));break;case j.I18n:Je.replace(e,fX(e.handle.slot,e.messageIndex,e.subTemplateIndex,e.sourceSpan));break;case j.I18nAttributes:if(e.i18nAttributesConfig===null)throw new Error("AssertionError: i18nAttributesConfig was not set");Je.replace(e,CX(e.handle.slot,e.i18nAttributesConfig));break;case j.Template:if(!(n instanceof bl))throw new Error("AssertionError: must be compiling a component");if(Array.isArray(e.localRefs))throw new Error("AssertionError: local refs array should have been extracted into a constant");let t=n.job.views.get(e.xref);Je.replace(e,e.templateKind===ys.Block||n.job.mode===vs.DomOnly?zX(e.handle.slot,di(t.fnName),t.decls,t.vars,e.tag,e.attributes,e.localRefs,e.startSourceSpan):jK(e.handle.slot,di(t.fnName),t.decls,t.vars,e.tag,e.attributes,e.localRefs,e.startSourceSpan));break;case j.DisableBindings:Je.replace(e,$K());break;case j.EnableBindings:Je.replace(e,HK());break;case j.Pipe:Je.replace(e,GK(e.handle.slot,e.name));break;case j.DeclareLet:Je.replace(e,gX(e.handle.slot,e.sourceSpan));break;case j.AnimationString:Je.replace(e,WX(e.animationKind,e.expression,e.sanitizer,e.sourceSpan));break;case j.Animation:let i=ub(n,e.handlerFnName,e.handlerOps,!1);Je.replace(e,UX(e.animationKind,i,e.sanitizer,e.sourceSpan));break;case j.AnimationListener:let a=ub(n,e.handlerFnName,e.handlerOps,e.consumesDollarEvent);Je.replace(e,GX(e.animationKind,a,null,e.sourceSpan));break;case j.Listener:let s=ub(n,e.handlerFnName,e.handlerOps,e.consumesDollarEvent),d=e.eventTarget?nY.get(e.eventTarget):null;if(d===void 0)throw new Error(`Unexpected global target '${e.eventTarget}' defined for '${e.name}' event. Supported list of global targets: window,document,body.`);Je.replace(e,n.job.mode===vs.DomOnly&&!e.hostListener&&!e.isLegacyAnimationListener?RX(e.name,s,d,e.sourceSpan):UK(e.name,s,d,e.hostListener&&e.isLegacyAnimationListener,e.sourceSpan));break;case j.TwoWayListener:Je.replace(e,WK(e.name,ub(n,e.handlerFnName,e.handlerOps,!0),e.sourceSpan));break;case j.Variable:if(e.variable.name===null)throw new Error(`AssertionError: unnamed variable ${e.xref}`);Je.replace(e,Js(new Ga(e.variable.name,e.initializer,void 0,ur.Final)));break;case j.Namespace:switch(e.active){case Oa.HTML:Je.replace(e,qK());break;case Oa.SVG:Je.replace(e,QK());break;case Oa.Math:Je.replace(e,KK());break}break;case j.Defer:let p=!!e.loadingMinimumTime||!!e.loadingAfterTime||!!e.placeholderMinimumTime;Je.replace(e,iX(e.handle.slot,e.mainSlot.slot,e.resolverFn,e.loadingSlot?.slot??null,e.placeholderSlot?.slot??null,e.errorSlot?.slot??null,e.loadingConfig,e.placeholderConfig,p,e.sourceSpan,e.flags));break;case j.DeferOn:let u=[];switch(e.trigger.kind){case lo.Never:case lo.Idle:case lo.Immediate:break;case lo.Timer:u=[De(e.trigger.delay)];break;case lo.Viewport:e.modifier==="hydrate"?u=e.trigger.options?[e.trigger.options]:[]:(u=[De(e.trigger.targetSlot?.slot??null)],e.trigger.targetSlotViewSteps!==0?u.push(De(e.trigger.targetSlotViewSteps)):e.trigger.options&&u.push(De(null)),e.trigger.options&&u.push(e.trigger.options));break;case lo.Interaction:case lo.Hover:e.modifier==="hydrate"?u=[]:(u=[De(e.trigger.targetSlot?.slot??null)],e.trigger.targetSlotViewSteps!==0&&u.push(De(e.trigger.targetSlotViewSteps)));break;default:throw new Error(`AssertionError: Unsupported reification of defer trigger kind ${e.trigger.kind}`)}Je.replace(e,aX(e.trigger.kind,u,e.modifier,e.sourceSpan));break;case j.ProjectionDef:Je.replace(e,rX(e.def));break;case j.Projection:if(e.handle.slot===null)throw new Error("No slot was assigned for project instruction");let g=null,C=null,M=null;if(e.fallbackView!==null){if(!(n instanceof bl))throw new Error("AssertionError: must be compiling a component");let D=n.job.views.get(e.fallbackView);if(D===void 0)throw new Error("AssertionError: projection had fallback view xref, but fallback view was not found");if(D.fnName===null||D.decls===null||D.vars===null)throw new Error("AssertionError: expected projection fallback view to have been named and counted");g=D.fnName,C=D.decls,M=D.vars}Je.replace(e,sX(e.handle.slot,e.projectionSlotIndex,e.attributes,g,C,M,e.sourceSpan));break;case j.ConditionalCreate:if(!(n instanceof bl))throw new Error("AssertionError: must be compiling a component");if(Array.isArray(e.localRefs))throw new Error("AssertionError: local refs array should have been extracted into a constant");let x=n.job.views.get(e.xref);Je.replace(e,cX(e.handle.slot,di(x.fnName),x.decls,x.vars,e.tag,e.attributes,e.localRefs,e.startSourceSpan));break;case j.ConditionalBranchCreate:if(!(n instanceof bl))throw new Error("AssertionError: must be compiling a component");if(Array.isArray(e.localRefs))throw new Error("AssertionError: local refs array should have been extracted into a constant");let b=n.job.views.get(e.xref);Je.replace(e,dX(e.handle.slot,di(b.fnName),b.decls,b.vars,e.tag,e.attributes,e.localRefs,e.startSourceSpan));break;case j.RepeaterCreate:if(e.handle.slot===null)throw new Error("No slot was assigned for repeater instruction");if(!(n instanceof bl))throw new Error("AssertionError: must be compiling a component");let P=n.job.views.get(e.xref);if(P.fnName===null)throw new Error("AssertionError: expected repeater primary view to have been named");let k=null,S=null,O=null;if(e.emptyView!==null){let D=n.job.views.get(e.emptyView);if(D===void 0)throw new Error("AssertionError: repeater had empty view xref, but empty view was not found");if(D.fnName===null||D.decls===null||D.vars===null)throw new Error("AssertionError: expected repeater empty view to have been named and counted");k=D.fnName,S=D.decls,O=D.vars}Je.replace(e,mX(e.handle.slot,P.fnName,e.decls,e.vars,e.tag,e.attributes,lY(n,e),e.usesComponentInstance,k,S,O,e.emptyTag,e.emptyAttributes,e.wholeSourceSpan));break;case j.SourceLocation:let A=io(e.locations.map(({targetSlot:D,offset:F,line:I,column:B})=>{if(D.slot===null)throw new Error("No slot was assigned for source location");return io([De(D.slot),De(F),De(I),De(B)])}));Je.replace(e,KX(e.templatePath,A));break;case j.ControlCreate:Je.replace(e,wX(e.sourceSpan));break;case j.Statement:break;default:throw new Error(`AssertionError: Unsupported reification of create op ${j[e.kind]}`)}}function $x(n,o){for(let e of o)switch(ra(e,t=>DF(n,t),ai.None),e.kind){case j.Advance:Je.replace(e,XK(e.delta,e.sourceSpan));break;case j.Property:Je.replace(e,n.job.mode===vs.DomOnly&&e.bindingKind!==Qt.LegacyAnimation&&e.bindingKind!==Qt.Animation?q6(e):rY(e));break;case j.Control:Je.replace(e,sY(e));break;case j.TwoWayProperty:Je.replace(e,MX(e.name,e.expression,e.sanitizer,e.sourceSpan));break;case j.StyleProp:Je.replace(e,kX(e.name,e.expression,e.unit,e.sourceSpan));break;case j.ClassProp:Je.replace(e,PX(e.name,e.expression,e.sourceSpan));break;case j.StyleMap:Je.replace(e,TX(e.expression,e.sourceSpan));break;case j.ClassMap:Je.replace(e,EX(e.expression,e.sourceSpan));break;case j.I18nExpression:Je.replace(e,jX(e.expression,e.sourceSpan));break;case j.I18nApply:Je.replace(e,$X(e.handle.slot,e.sourceSpan));break;case j.InterpolateText:Je.replace(e,BX(e.interpolation.strings,e.interpolation.expressions,e.sourceSpan));break;case j.Attribute:Je.replace(e,SX(e.name,e.expression,e.sanitizer,e.namespace,e.sourceSpan));break;case j.DomProperty:if(e.expression instanceof aa)throw new Error("not yet handled");e.bindingKind===Qt.LegacyAnimation||e.bindingKind===Qt.Animation?Je.replace(e,qX(e.name,e.expression,e.sourceSpan)):Je.replace(e,q6(e));break;case j.Variable:if(e.variable.name===null)throw new Error(`AssertionError: unnamed variable ${e.xref}`);Je.replace(e,Js(new Ga(e.variable.name,e.initializer,void 0,ur.Final)));break;case j.Conditional:if(e.processed===null)throw new Error("Conditional test was not set.");Je.replace(e,YX(e.processed,e.contextValue,e.sourceSpan));break;case j.Repeater:Je.replace(e,pX(e.collection,e.sourceSpan));break;case j.DeferWhen:Je.replace(e,uX(e.modifier,e.expr,e.sourceSpan));break;case j.StoreLet:throw new Error(`AssertionError: unexpected storeLet ${e.declaredName}`);case j.Statement:break;default:throw new Error(`AssertionError: Unsupported reification of update op ${j[e.kind]}`)}}function q6(n){return HX(iY.get(n.name)??n.name,n.expression,n.sanitizer,n.sourceSpan)}function rY(n){return hF(n.name)?bX(n.name,n.expression,n.sourceSpan):xX(n.name,n.expression,n.sanitizer,n.sourceSpan)}function sY(n){return yX(n.sourceSpan)}function DF(n,o){if(!Gc(o))return o;switch(o.kind){case Jt.NextContext:return ZK(o.steps);case Jt.Reference:return YK(o.targetSlot.slot+1+o.offset);case Jt.LexicalRead:throw new Error(`AssertionError: unresolved LexicalRead of ${o.name}`);case Jt.TwoWayBindingSet:throw new Error("AssertionError: unresolved TwoWayBindingSet");case Jt.RestoreView:if(typeof o.view=="number")throw new Error("AssertionError: unresolved RestoreView");return eX(o.view);case Jt.ResetView:return tX(o.expr);case Jt.GetCurrentView:return JK();case Jt.ReadVariable:if(o.name===null)throw new Error(`Read of unnamed variable ${o.xref}`);return di(o.name);case Jt.ReadTemporaryExpr:if(o.name===null)throw new Error(`Read of unnamed temporary ${o.xref}`);return di(o.name);case Jt.AssignTemporaryExpr:if(o.name===null)throw new Error(`Assign of unnamed temporary ${o.xref}`);return di(o.name).set(o.expr);case Jt.PureFunctionExpr:if(o.fn===null)throw new Error("AssertionError: expected PureFunctions to have been extracted");return QX(o.varOffset,o.fn,o.args);case Jt.PureFunctionParameterExpr:throw new Error("AssertionError: expected PureFunctionParameterExpr to have been extracted");case Jt.PipeBinding:return LX(o.targetSlot.slot,o.varOffset,o.args);case Jt.PipeBindingVariadic:return VX(o.targetSlot.slot,o.varOffset,o.args);case Jt.SlotLiteralExpr:return De(o.slot.slot);case Jt.ContextLetReference:return _X(o.targetSlot.slot);case Jt.StoreLet:return hX(o.value,o.sourceSpan);case Jt.TrackContext:return di("this");case Jt.ArrowFunction:if(o.varOffset===null)throw new Error("AssertionError: variable offset was not assigned to arrow function");return XX(o.varOffset,n.job.pool.getSharedFunctionReference(cY(n,o),"arrowFn"),di(Zs));default:throw new Error(`AssertionError: Unsupported reification of ir.Expression kind: ${Jt[o.kind]}`)}}function ub(n,o,e,t){$x(n,e);let i=[];for(let s of e){if(s.kind!==j.Statement)throw new Error(`AssertionError: expected reified statements, but found op ${j[s.kind]}`);i.push(s.statement)}let a=[];return t&&a.push(new Da("$event",ws)),Em(a,i,void 0,void 0,o)}function lY(n,o){if(o.trackByFn!==null)return o.trackByFn;let e=[new Da("$index",iu),new Da("$item",ws)],t;if(o.trackByOps===null)t=o.usesComponentInstance?Em(e,[new Ia(o.track)]):Ys(e,o.track);else{$x(n,o.trackByOps);let i=[];for(let a of o.trackByOps){if(a.kind!==j.Statement)throw new Error(`AssertionError: expected reified statements, but found op ${j[a.kind]}`);i.push(a.statement)}t=o.usesComponentInstance||i.length!==1||!(i[0]instanceof Ia)?Em(e,i):Ys(e,i[0].value)}return o.trackByFn=n.job.pool.getSharedFunctionReference(t,"_forTrack"),o.trackByFn}function cY(n,o){$x(n,o.ops);let e=[];for(let i of o.ops){if(i.kind!==j.Statement)throw new Error(`AssertionError: expected reified statements, but found op ${j[i.kind]}`);e.push(i.statement)}let t=e.length===1&&e[0]instanceof Ia?e[0].value:e;return Ys([new Da(o.contextName,ws),new Da(o.currentViewName,ws)],Ys(o.parameters,t))}function dY(n){for(let o of n.units)for(let e of o.update)switch(e.kind){case j.Attribute:case j.Binding:case j.ClassProp:case j.ClassMap:case j.Property:case j.StyleProp:case j.StyleMap:e.expression instanceof w0&&Je.remove(e);break}}function mY(n){for(let o of n.units)for(let e of o.create)switch(e.kind){case j.I18nContext:Je.remove(e);break;case j.I18nStart:e.context=null;break}}function pY(n){for(let o of n.units)for(let e of o.update){if(e.kind!==j.Variable||e.variable.kind!==ar.Identifier||!(e.initializer instanceof C0))continue;let t=e.variable.identifier,i=e;for(;i&&i.kind!==j.ListEnd;)ra(i,a=>a instanceof ir&&a.name===t?De(void 0):a,ai.None),i=i.prev}}function uY(n){for(let o of n.units){let e=new Set;for(let t of o.update)t.kind===j.I18nExpression&&e.add(t.i18nOwner);for(let t of o.create)switch(t.kind){case j.I18nAttributes:if(e.has(t.xref))continue;Je.remove(t)}}}function gY(n){for(let o of n.units){for(let e of o.functions)Af(o,e.ops);Af(o,o.create),Af(o,o.update)}}function Af(n,o){let e=new Map;e.set(n.xref,di(Zs));for(let t of o)switch(t.kind){case j.Variable:t.variable.kind===ar.Context&&e.set(t.variable.view,new Ad(t.xref));break;case j.Animation:case j.AnimationListener:case j.Listener:case j.TwoWayListener:Af(n,t.handlerOps);break;case j.RepeaterCreate:t.trackByOps!==null&&Af(n,t.trackByOps);break}n===n.job.root&&e.set(n.xref,di(Zs));for(let t of o)ra(t,i=>{if(i instanceof Fm){if(!e.has(i.view))throw new Error(`No context found for reference to view ${i.view} from view ${n.xref}`);return e.get(i.view)}else return i},ai.None)}function hY(n){for(let o of n.units)for(let e of o.create)if(e.kind===j.Defer){if(e.resolverFn!==null)continue;if(e.ownResolverFn!==null){if(e.handle.slot===null)throw new Error("AssertionError: slot must be assigned before extracting defer deps functions");let t=o.fnName?.replace("_Template","");e.resolverFn=n.pool.getSharedFunctionReference(e.ownResolverFn,`${t}_Defer_${e.handle.slot}_DepsFn`,!1)}}}function _Y(n){for(let o of n.units)Q6(o.create),Q6(o.update)}function Q6(n){for(let o of n)(o.kind===j.Listener||o.kind===j.TwoWayListener||o.kind===j.AnimationListener)&&ra(o,e=>e instanceof ir&&e.name==="$event"?((o.kind===j.Listener||o.kind===j.AnimationListener)&&(o.consumesDollarEvent=!0),new oc(e.name)):e,ai.InChildOperation)}function fY(n){let o=new Map,e=new Map;for(let t of n.units)for(let i of t.create)switch(i.kind){case j.I18nContext:o.set(i.xref,i);break;case j.ElementStart:e.set(i.xref,i);break}Ic(n,n.root,o,e)}function Ic(n,o,e,t,i){let a=null,s=new Map;for(let d of o.create)switch(d.kind){case j.I18nStart:if(!d.context)throw Error("Could not find i18n context for i18n op");a={i18nBlock:d,i18nContext:e.get(d.context)};break;case j.I18nEnd:a=null;break;case j.ElementStart:if(d.i18nPlaceholder!==void 0){if(a===null)throw Error("i18n tag placeholder should only occur inside an i18n block");K6(d,a.i18nContext,a.i18nBlock,i),i&&d.i18nPlaceholder.closeName&&s.set(d.xref,i),i=void 0}break;case j.ElementEnd:let p=t.get(d.xref);if(p&&p.i18nPlaceholder!==void 0){if(a===null)throw Error("AssertionError: i18n tag placeholder should only occur inside an i18n block");X6(p,a.i18nContext,a.i18nBlock,s.get(d.xref)),s.delete(d.xref)}break;case j.Projection:if(d.i18nPlaceholder!==void 0){if(a===null)throw Error("i18n tag placeholder should only occur inside an i18n block");K6(d,a.i18nContext,a.i18nBlock,i),X6(d,a.i18nContext,a.i18nBlock,i),i=void 0}if(d.fallbackView!==null){let M=n.views.get(d.fallbackView);if(d.fallbackViewI18nPlaceholder===void 0)Ic(n,M,e,t);else{if(a===null)throw Error("i18n tag placeholder should only occur inside an i18n block");gb(n,M,d.handle.slot,d.fallbackViewI18nPlaceholder,a.i18nContext,a.i18nBlock,i),Ic(n,M,e,t),hb(n,M,d.handle.slot,d.fallbackViewI18nPlaceholder,a.i18nContext,a.i18nBlock,i),i=void 0}}break;case j.ConditionalCreate:case j.ConditionalBranchCreate:case j.Template:let u=n.views.get(d.xref);if(d.i18nPlaceholder===void 0)Ic(n,u,e,t);else{if(a===null)throw Error("i18n tag placeholder should only occur inside an i18n block");d.templateKind===ys.Structural?Ic(n,u,e,t,d):(gb(n,u,d.handle.slot,d.i18nPlaceholder,a.i18nContext,a.i18nBlock,i),Ic(n,u,e,t),hb(n,u,d.handle.slot,d.i18nPlaceholder,a.i18nContext,a.i18nBlock,i),i=void 0)}break;case j.RepeaterCreate:if(i!==void 0)throw Error("AssertionError: Unexpected structural directive associated with @for block");let g=d.handle.slot+1,C=n.views.get(d.xref);if(d.i18nPlaceholder===void 0)Ic(n,C,e,t);else{if(a===null)throw Error("i18n tag placeholder should only occur inside an i18n block");gb(n,C,g,d.i18nPlaceholder,a.i18nContext,a.i18nBlock,i),Ic(n,C,e,t),hb(n,C,g,d.i18nPlaceholder,a.i18nContext,a.i18nBlock,i),i=void 0}if(d.emptyView!==null){let M=d.handle.slot+2,x=n.views.get(d.emptyView);if(d.emptyI18nPlaceholder===void 0)Ic(n,x,e,t);else{if(a===null)throw Error("i18n tag placeholder should only occur inside an i18n block");gb(n,x,M,d.emptyI18nPlaceholder,a.i18nContext,a.i18nBlock,i),Ic(n,x,e,t),hb(n,x,M,d.emptyI18nPlaceholder,a.i18nContext,a.i18nBlock,i),i=void 0}}break}}function K6(n,o,e,t){let{startName:i,closeName:a}=n.i18nPlaceholder,s=go.ElementTag|go.OpenTag,d=n.handle.slot;t!==void 0&&(s|=go.TemplateTag,d={element:d,template:t.handle.slot}),a||(s|=go.CloseTag),Zg(o.params,i,d,e.subTemplateIndex,s)}function X6(n,o,e,t){let{closeName:i}=n.i18nPlaceholder;if(i){let a=go.ElementTag|go.CloseTag,s=n.handle.slot;t!==void 0&&(a|=go.TemplateTag,s={element:s,template:t.handle.slot}),Zg(o.params,i,s,e.subTemplateIndex,a)}}function gb(n,o,e,t,i,a,s){let{startName:d,closeName:p}=t,u=go.TemplateTag|go.OpenTag;p||(u|=go.CloseTag),s!==void 0&&Zg(i.params,d,s.handle.slot,a.subTemplateIndex,u),Zg(i.params,d,e,IF(n,a,o),u)}function hb(n,o,e,t,i,a,s){let{closeName:d}=t,p=go.TemplateTag|go.CloseTag;d&&(Zg(i.params,d,e,IF(n,a,o),p),s!==void 0&&Zg(i.params,d,s.handle.slot,a.subTemplateIndex,p))}function IF(n,o,e){for(let t of e.create)if(t.kind===j.I18nStart)return t.subTemplateIndex;return o.subTemplateIndex}function Zg(n,o,e,t,i){let a=n.get(o)??[];a.push({value:e,subTemplateIndex:t,flags:i}),n.set(o,a)}function vY(n){let o=new Map,e=new Map,t=new Map;for(let s of n.units)for(let d of s.create)switch(d.kind){case j.I18nStart:o.set(d.xref,d.subTemplateIndex);break;case j.I18nContext:e.set(d.xref,d);break;case j.IcuPlaceholder:t.set(d.xref,d);break}let i=new Map,a=s=>s.usage===th.I18nText?s.i18nOwner:s.context;for(let s of n.units)for(let d of s.update)if(d.kind===j.I18nExpression){let p=i.get(a(d))||0,u=o.get(d.i18nOwner)??null,g={value:p,subTemplateIndex:u,flags:go.ExpressionIndex};CY(d,g,e,t),i.set(a(d),p+1)}}function CY(n,o,e,t){if(n.i18nPlaceholder!==null){let i=e.get(n.context),a=n.resolutionTime===f0.Creation?i.params:i.postprocessingParams,s=a.get(n.i18nPlaceholder)||[];s.push(o),a.set(n.i18nPlaceholder,s)}n.icuPlaceholder!==null&&t.get(n.icuPlaceholder)?.expressionPlaceholders.push(o)}function bY(n){let o=new Map;for(let e of n.units)for(let t of e.ops())if(t.kind===j.ElementStart||t.kind===j.Template){let i=t.tag??"";switch(t.namespace){case Oa.SVG:i=`:${Bx}:${i}`;break;case Oa.Math:i=`:${jx}:${i}`;break}o.set(t.xref,i)}for(let e of n.units)for(let t of e.create)if(t.kind===j.ExtractedAttribute&&t.i18nContext!==null&&t.expression!==null){let i=o.get(t.target)??"",a=t.expression;switch(t.securityContext){case gi.HTML:a=Ht(ge.sanitizeHtml).callFn([a]);break;case gi.STYLE:a=Ht(ge.sanitizeStyle).callFn([a]);break;case gi.SCRIPT:a=Ht(ge.sanitizeScript).callFn([a]);break;case gi.URL:a=Ht(ge.sanitizeUrl).callFn([a]);break;case gi.RESOURCE_URL:a=Ht(ge.sanitizeResourceUrl).callFn([a]);break;case gi.ATTRIBUTE_NO_BINDING:a=Ht(ge.validateAttribute).callFn([a,De(i),De(t.name)]);break}t.expression=a}}function xY(n){for(let o of n.units){for(let e of o.functions)Nf(o,e.ops,null);Nf(o,o.create,null),Nf(o,o.update,null)}}function Nf(n,o,e){let t=new Map,i=new Map;for(let a of o)switch(a.kind){case j.Variable:switch(a.variable.kind){case ar.Identifier:if(a.variable.local){if(i.has(a.variable.identifier))continue;i.set(a.variable.identifier,a.xref)}else if(t.has(a.variable.identifier))continue;t.set(a.variable.identifier,a.xref);break;case ar.Alias:if(t.has(a.variable.identifier))continue;t.set(a.variable.identifier,a.xref);break;case ar.SavedView:e={view:a.variable.view,variable:a.xref};break}break;case j.Animation:case j.AnimationListener:case j.Listener:case j.TwoWayListener:Nf(n,a.handlerOps,e);break;case j.RepeaterCreate:a.trackByOps!==null&&Nf(n,a.trackByOps,e);break}for(let a of o)a.kind===j.Listener||a.kind===j.TwoWayListener||a.kind===j.Animation||a.kind===j.AnimationListener||ra(a,s=>{if(s instanceof ir)return i.has(s.name)?new Ad(i.get(s.name)):t.has(s.name)?new Ad(t.get(s.name)):new Xs(new Fm(n.job.root.xref),s.name);if(s instanceof x0&&typeof s.view=="number"){if(e===null||e.view!==s.view)throw new Error(`AssertionError: no saved view ${s.view} from view ${n.xref}`);return s.view=new Ad(e.variable),s}else return s},ai.None);for(let a of o)wa(a,s=>{if(s instanceof ir)throw new Error(`AssertionError: no lexical reads should remain, but found read of ${s.name}`)})}var yY=new Map([[gi.HTML,ge.sanitizeHtml],[gi.RESOURCE_URL,ge.sanitizeResourceUrl],[gi.SCRIPT,ge.sanitizeScript],[gi.STYLE,ge.sanitizeStyle],[gi.URL,ge.sanitizeUrl],[gi.ATTRIBUTE_NO_BINDING,ge.validateAttribute]]),wY=new Map([[gi.HTML,ge.trustConstantHtml],[gi.RESOURCE_URL,ge.trustConstantResourceUrl]]);function MY(n){for(let o of n.units){if(n.kind!==Dt.Host){for(let e of o.create)if(e.kind===j.ExtractedAttribute){let t=wY.get(Y6(e.securityContext))??null;e.trustedValueFn=t!==null?Ht(t):null}}for(let e of o.update)switch(e.kind){case j.Property:case j.Attribute:case j.DomProperty:case j.TwoWayProperty:let t=null;Array.isArray(e.securityContext)&&SY(e.securityContext)?t=ge.sanitizeUrlOrResourceUrl:t=yY.get(Y6(e.securityContext))??null,e.sanitizer=t!==null?Ht(t):null;break}}}function SY(n){let o=!1,e=!1,t=!1;for(let i of n)switch(i){case gi.URL:o=!0;break;case gi.RESOURCE_URL:e=!0;break;case gi.NONE:t=!0;break;default:return!1}return(o||e)&&t||o&&e}function Y6(n){if(!Array.isArray(n))return n;if(n.length<2)return n[0]??gi.NONE;let o=n.filter(e=>e!==gi.NONE);if(o.length>1)throw Error("AssertionError: Ambiguous security context");return o[0]??gi.NONE}function kY(n){for(let o of n.units){for(let e of o.functions)Z6(n,o,e.ops)&&J6(o,e.ops,di(e.currentViewName));o.create.prepend([Mm(o.job.allocateXrefId(),{kind:ar.SavedView,name:null,view:o.xref},new KP,vl.None)]);for(let e of o.create)(e.kind===j.Listener||e.kind===j.TwoWayListener||e.kind===j.Animation||e.kind===j.AnimationListener)&&Z6(n,o,e.handlerOps)&&J6(o,e.handlerOps,o.xref)}}function Z6(n,o,e){let t=o!==n.root;if(!t)for(let i of e)wa(i,a=>{(a instanceof lx||a instanceof b0)&&(t=!0)});return t}function J6(n,o,e){o.prepend([Mm(n.job.allocateXrefId(),{kind:ar.Context,name:null,view:n.xref},new x0(e),vl.None)]);for(let t of o)t.kind===j.Statement&&t.statement instanceof Ia&&(t.statement.value=new dx(t.statement.value))}function PY(n){let o=new Map;for(let e of n.units){let t=0;for(let i of e.create)nh(i)&&(i.handle.slot=t,o.set(i.xref,i.handle.slot),t+=i.numSlotsUsed);e.decls=t}for(let e of n.units)for(let t of e.ops())if(t.kind===j.Template||t.kind===j.ConditionalCreate||t.kind===j.ConditionalBranchCreate||t.kind===j.RepeaterCreate){let i=n.views.get(t.xref);t.decls=i.decls}}function TY(n){let o=new Set,e=new Map;for(let t of n.units)for(let i of t.ops())i.kind===j.DeclareLet&&e.set(i.xref,i),wa(i,a=>{a instanceof b0&&o.add(a.target)});for(let t of n.units)for(let i of t.update)ra(i,a=>a instanceof C0&&!o.has(a.target)?(EY(a)||Je.remove(e.get(a.target)),a.value):a,ai.None)}function EY(n){let o=!1;return Bt(n,e=>((e instanceof hu||e instanceof y0)&&(o=!0),e),ai.None),o}function OY(n){let o=new Set;for(let e of n.units)for(let t of e.ops())wa(t,i=>{if(i instanceof Pi)switch(i.operator){case lt.Exponentiation:DY(i,o);break;case lt.NullishCoalesce:IY(i,o);break;case lt.And:case lt.Or:AY(i,o)}});for(let e of n.units)for(let t of e.ops())ra(t,i=>i instanceof ac?o.has(i)?i:i.expr:i,ai.None)}function DY(n,o){n.lhs instanceof ac&&n.lhs.expr instanceof au&&o.add(n.lhs)}function IY(n,o){n.lhs instanceof ac&&(eN(n.lhs.expr)||n.lhs.expr instanceof jc)&&o.add(n.lhs),n.rhs instanceof ac&&(eN(n.rhs.expr)||n.rhs.expr instanceof jc)&&o.add(n.rhs)}function AY(n,o){n.lhs instanceof ac&&n.lhs.expr instanceof Pi&&n.lhs.expr.operator===lt.NullishCoalesce&&o.add(n.lhs)}function eN(n){return n instanceof Pi&&(n.operator===lt.And||n.operator===lt.Or)}function NY(n){for(let o of n.units)for(let e of o.update)if(e.kind===j.Binding)switch(e.bindingKind){case Qt.ClassName:if(e.expression instanceof aa)throw new Error("Unexpected interpolation in ClassName binding");Je.replace(e,tG(e.target,e.name,e.expression,e.sourceSpan));break;case Qt.StyleProperty:Je.replace(e,eG(e.target,e.name,e.expression,e.unit,e.sourceSpan));break;case Qt.Property:case Qt.Template:e.name==="style"?Je.replace(e,nG(e.target,e.expression,e.sourceSpan)):e.name==="class"&&Je.replace(e,iG(e.target,e.expression,e.sourceSpan));break}}function FY(n){for(let o of n.units){o.create.prepend(Ff(o.create)),o.update.prepend(Ff(o.update));for(let e of o.functions)e.ops.prepend(Ff(e.ops))}}function Ff(n){let o=0,e=[];for(let t of n){let i=new Map;wa(t,(u,g)=>{g&ai.InChildOperation||u instanceof zm&&i.set(u.xref,u)});let a=0,s=new Set,d=new Set,p=new Map;wa(t,(u,g)=>{g&ai.InChildOperation||(u instanceof qc?(s.has(u.xref)||(s.add(u.xref),p.set(u.xref,`tmp_${o}_${a++}`)),tN(p,u)):u instanceof zm&&(i.get(u.xref)===u&&(d.add(u.xref),a--),tN(p,u)))}),e.push(...Array.from(new Set(p.values())).map(u=>Js(new Ga(u)))),o++,t.kind===j.Listener||t.kind===j.Animation||t.kind===j.AnimationListener||t.kind===j.TwoWayListener?t.handlerOps.prepend(Ff(t.handlerOps)):t.kind===j.RepeaterCreate&&t.trackByOps!==null&&t.trackByOps.prepend(Ff(t.trackByOps))}return e}function tN(n,o){let e=n.get(o.xref);if(e===void 0)throw new Error(`Found xref with unassigned name: ${o.xref}`);o.name=e}function RY(n){for(let o of n.units)for(let e of o.create)if(e.kind===j.RepeaterCreate)if(e.track instanceof oc&&e.track.name==="$index")e.trackByFn=Ht(ge.repeaterTrackByIndex);else if(e.track instanceof oc&&e.track.name==="$item")e.trackByFn=Ht(ge.repeaterTrackByIdentity);else if(zY(n.root.xref,e.track))e.usesComponentInstance=!0,e.track.receiver.receiver.view===o.xref?e.trackByFn=e.track.receiver:(e.trackByFn=Ht(ge.componentInstance).callFn([]).prop(e.track.receiver.name),e.track=e.trackByFn);else{e.track=Bt(e.track,i=>{if(i instanceof hu||i instanceof y0)throw new Error("Illegal State: Pipes are not allowed in this context");return i instanceof Fm?(e.usesComponentInstance=!0,new QP(i.view)):i},ai.None);let t=new Je;t.push(Js(new Ia(e.track,e.track.sourceSpan))),e.trackByOps=t}}function zY(n,o){if(!(o instanceof Ms)||o.args.length===0||o.args.length>2||!(o.receiver instanceof Xs&&o.receiver.receiver instanceof Fm)||o.receiver.receiver.view!==n)return!1;let[e,t]=o.args;return!(e instanceof oc)||e.name!=="$index"?!1:o.args.length===1?!0:!(!(t instanceof oc)||t.name!=="$item")}function LY(n){for(let o of n.units)for(let e of o.create)e.kind===j.RepeaterCreate&&(e.track=Bt(e.track,t=>{if(t instanceof ir){if(e.varNames.$index.has(t.name))return di("$index");if(t.name===e.varNames.$implicit)return di("$item")}return t},ai.None))}function VY(n){for(let o of n.units)for(let e of o.create)e.kind===j.TwoWayListener&&ra(e,t=>{if(!(t instanceof mx))return t;let{target:i,value:a}=t;if(i instanceof Xs||i instanceof Fd)return W6(i,a).or(i.set(a));if(i instanceof Ad)return W6(i,a);throw new Error("Unsupported expression in two-way action binding.")},ai.InChildOperation)}function BY(n){for(let o of n.units){let e=0;for(let a of o.ops())Xk(a)&&(e+=jY(a));let t=a=>{Gc(a)&&(a instanceof gu||(l6(a)&&(a.varOffset=e),Xk(a)&&(e+=nN(a))))},i=a=>{!Gc(a)||!(a instanceof gu)||(l6(a)&&(a.varOffset=e),Xk(a)&&(e+=nN(a)))};for(let a of o.create)wa(a,t);for(let a of o.update)wa(a,t);for(let a of o.create)wa(a,i);for(let a of o.update)wa(a,i);o.vars=e}if(n instanceof S0)for(let o of n.units)for(let e of o.create){if(e.kind!==j.Template&&e.kind!==j.RepeaterCreate&&e.kind!==j.ConditionalCreate&&e.kind!==j.ConditionalBranchCreate)continue;let t=n.views.get(e.xref);e.vars=t.vars}}function jY(n){let o;switch(n.kind){case j.Attribute:return o=1,n.expression instanceof aa&&!$Y(n.expression)&&(o+=n.expression.expressions.length),o;case j.Property:case j.DomProperty:return o=1,n.expression instanceof aa&&(o+=n.expression.expressions.length),o;case j.Control:return 2;case j.TwoWayProperty:return 1;case j.StyleProp:case j.ClassProp:case j.StyleMap:case j.ClassMap:return o=2,n.expression instanceof aa&&(o+=n.expression.expressions.length),o;case j.InterpolateText:return n.interpolation.expressions.length;case j.I18nExpression:case j.Conditional:case j.DeferWhen:case j.StoreLet:return 1;case j.RepeaterCreate:return n.emptyView?1:0;default:throw new Error(`Unhandled op: ${j[n.kind]}`)}}function nN(n){switch(n.kind){case Jt.PureFunctionExpr:return 1+n.args.length;case Jt.PipeBinding:return 1+n.args.length;case Jt.PipeBindingVariadic:return 1+n.numArgs;case Jt.StoreLet:case Jt.ArrowFunction:return 1;default:throw new Error(`AssertionError: unhandled ConsumesVarsTrait expression ${n.constructor.name}`)}}function $Y(n){return!(n.expressions.length!==1||n.strings.length!==2||n.strings[0]!==""||n.strings[1]!=="")}function HY(n){for(let o of n.units){for(let e of o.functions)Cf(e.ops);Cf(o.create),Cf(o.update);for(let e of o.create)e.kind===j.Listener||e.kind===j.Animation||e.kind===j.AnimationListener||e.kind===j.TwoWayListener?Cf(e.handlerOps):e.kind===j.RepeaterCreate&&e.trackByOps!==null&&Cf(e.trackByOps);for(let e of o.functions)bf(e.ops,null),iN(e.ops);for(let e of o.create)e.kind===j.Listener||e.kind===j.Animation||e.kind===j.AnimationListener||e.kind===j.TwoWayListener?(bf(e.handlerOps,_b),iN(e.handlerOps)):e.kind===j.RepeaterCreate&&e.trackByOps!==null&&bf(e.trackByOps,_b);bf(o.create,_b),bf(o.update,_b)}}var Wa=(function(n){return n[n.None=0]="None",n[n.ViewContextRead=1]="ViewContextRead",n[n.ViewContextWrite=2]="ViewContextWrite",n[n.SideEffectful=4]="SideEffectful",n})(Wa||{});function _b(n){return!(n&ai.InArrowFunctionOperation)}function Cf(n){let o=new Map;for(let e of n)e.kind===j.Variable&&e.flags&vl.AlwaysInline&&(wa(e,t=>{if(Gc(t)&&rT(t)!==Wa.None)throw new Error("AssertionError: A context-sensitive variable was marked AlwaysInline")}),o.set(e.xref,e)),ra(e,t=>t instanceof Ad&&o.has(t.xref)?o.get(t.xref).initializer.clone():t,ai.None);for(let e of o.values())Je.remove(e)}function bf(n,o){let e=new Map,t=new Map,i=new Set,a=new Map;for(let u of n){if(u.kind===j.Variable){if(e.has(u.xref)||t.has(u.xref))throw new Error(`Should not see two declarations of the same variable: ${u.xref}`);e.set(u.xref,u),t.set(u.xref,0)}a.set(u,UY(u,o)),WY(u,t,i,o)}let s=!1;for(let u of n.reversed()){let g=a.get(u);if(u.kind===j.Variable&&t.get(u.xref)===0){if(s&&g.fences&Wa.ViewContextWrite||g.fences&Wa.SideEffectful){let C=Js(u.initializer.toStmt());a.set(C,g),Je.replace(u,C)}else GY(u,t),Je.remove(u);a.delete(u),e.delete(u.xref),t.delete(u.xref);continue}g.fences&Wa.ViewContextRead&&(s=!0)}let d=[];for(let[u,g]of t){let M=!!(e.get(u).flags&vl.AlwaysInline);g!==1||M||i.has(u)||d.push(u)}let p;for(;p=d.pop();){let u=e.get(p),g=a.get(u);if(!!(u.flags&vl.AlwaysInline))throw new Error("AssertionError: Found an 'AlwaysInline' variable after the always inlining pass.");for(let M=u.next;M.kind!==j.ListEnd;M=M.next){let x=a.get(M);if(x.variablesUsed.has(p)){if(!QY(u,M))break;if(qY(p,u.initializer,M,g.fences)){x.variablesUsed.delete(p);for(let b of g.variablesUsed)x.variablesUsed.add(b);x.fences|=g.fences,e.delete(p),t.delete(p),a.delete(u),Je.remove(u)}break}if(!AF(x.fences,g.fences))break}}}function rT(n){switch(n.kind){case Jt.NextContext:return Wa.ViewContextRead|Wa.ViewContextWrite;case Jt.RestoreView:return Wa.ViewContextRead|Wa.ViewContextWrite|Wa.SideEffectful;case Jt.StoreLet:return Wa.SideEffectful;case Jt.Reference:case Jt.ContextLetReference:return Wa.ViewContextRead;default:return Wa.None}}function UY(n,o){let e=Wa.None,t=new Set;return wa(n,(i,a)=>{!Gc(i)||o!==null&&!o(a)||(i.kind===Jt.ReadVariable?t.add(i.xref):e|=rT(i))}),{fences:e,variablesUsed:t}}function WY(n,o,e,t){wa(n,(i,a)=>{if(!Gc(i)||t!==null&&!t(a)||i.kind!==Jt.ReadVariable)return;let s=o.get(i.xref);s!==void 0&&(o.set(i.xref,s+1),a&ai.InChildOperation&&e.add(i.xref))})}function GY(n,o){wa(n,e=>{if(!Gc(e)||e.kind!==Jt.ReadVariable)return;let t=o.get(e.xref);if(t!==void 0){if(t===0)throw new Error(`Inaccurate variable count: ${e.xref} - found another read but count is already 0`);o.set(e.xref,t-1)}})}function AF(n,o){if(n&Wa.ViewContextWrite){if(o&Wa.ViewContextRead)return!1}else if(n&Wa.ViewContextRead&&o&Wa.ViewContextWrite)return!1;return!0}function qY(n,o,e,t){let i=!1,a=!0;return ra(e,(s,d)=>{if(!Gc(s)||i||!a)return s;if(d&ai.InChildOperation&&t&Wa.ViewContextRead)return s;switch(s.kind){case Jt.ReadVariable:if(s.xref===n)return i=!0,o;break;default:let p=rT(s);a=a&&AF(p,t);break}return s},ai.None),i}function QY(n,o){switch(n.variable.kind){case ar.Identifier:return n.initializer instanceof oc&&n.initializer.name===Zs;case ar.Context:return o.kind===j.Variable;default:return!0}}function iN(n){let o=n.head.next,e=n.tail.prev;o!==null&&e!==null&&o.next===e&&o.kind===j.Statement&&o.statement instanceof fr&&o.statement.expr instanceof x0&&e.kind===j.Statement&&e.statement instanceof Ia&&e.statement.value instanceof dx&&(Je.remove(o),e.statement.value=e.statement.value.expr)}function KY(n){for(let o of n.units){let e=null,t=null;for(let i of o.create)switch(i.kind){case j.I18nStart:e=i;break;case j.I18nEnd:e=null;break;case j.IcuStart:e===null&&(t=n.allocateXrefId(),Je.insertBefore(Lx(t,i.message,void 0,null),i));break;case j.IcuEnd:t!==null&&(Je.insertAfter(Vx(t,null),i),t=null);break}}}function XY(n){for(let o of n.units){for(let e of o.create)e.kind!==j.Animation&&e.kind!==j.AnimationListener&&e.kind!==j.Listener&&e.kind!==j.TwoWayListener&&oN(o,e);for(let e of o.update)oN(o,e)}}function oN(n,o){ra(o,(e,t)=>{if(!(e instanceof vu)||t&ai.InChildOperation)return e;if(Array.isArray(e.body))throw new Error("AssertionError: unexpected multi-line arrow function");let i=new XP(e.params,e.body);return n.functions.add(i),i},ai.None)}var YY=new Set(["formField"]);function ZY(n){for(let o of n.units)JY(o)}function JY(n){for(let o of n.update)o.kind===j.Property&&YY.has(o.name)&&iZ(n,o)}var eZ=new Set([j.Container,j.ContainerStart,j.ContainerEnd,j.Element,j.ElementStart,j.ElementEnd,j.Template]);function tZ(n){return eZ.has(n.kind)}function nZ(n,o){let e=null;for(let t of n.create)!tZ(t)||t.xref!==o||(e=t);return e}function iZ(n,o){let e=nZ(n,o.target);if(e===null)throw new Error(`No create instruction found for control target ${o.target}`);let t=EG(o.sourceSpan);Je.insertAfter(t,e),Je.insertAfter(cG(o.target,o.sourceSpan),o)}var oZ=[{kind:Dt.Tmpl,fn:xK},{kind:Dt.Both,fn:NK},{kind:Dt.Host,fn:Aq},{kind:Dt.Tmpl,fn:oK},{kind:Dt.Tmpl,fn:TK},{kind:Dt.Tmpl,fn:KY},{kind:Dt.Both,fn:tq},{kind:Dt.Both,fn:NY},{kind:Dt.Both,fn:BG},{kind:Dt.Tmpl,fn:ZY},{kind:Dt.Both,fn:YG},{kind:Dt.Both,fn:zG},{kind:Dt.Tmpl,fn:eq},{kind:Dt.Both,fn:rK},{kind:Dt.Tmpl,fn:dY},{kind:Dt.Both,fn:HG},{kind:Dt.Both,fn:bK},{kind:Dt.Tmpl,fn:UG},{kind:Dt.Tmpl,fn:MK},{kind:Dt.Tmpl,fn:nq},{kind:Dt.Tmpl,fn:PK},{kind:Dt.Both,fn:XY},{kind:Dt.Both,fn:DK},{kind:Dt.Tmpl,fn:Eq},{kind:Dt.Tmpl,fn:Tq},{kind:Dt.Tmpl,fn:Oq},{kind:Dt.Tmpl,fn:kY},{kind:Dt.Both,fn:DG},{kind:Dt.Both,fn:_Y},{kind:Dt.Tmpl,fn:LY},{kind:Dt.Tmpl,fn:pY},{kind:Dt.Both,fn:xY},{kind:Dt.Tmpl,fn:iq},{kind:Dt.Tmpl,fn:VY},{kind:Dt.Tmpl,fn:RY},{kind:Dt.Both,fn:gY},{kind:Dt.Both,fn:MY},{kind:Dt.Tmpl,fn:nK},{kind:Dt.Both,fn:lq},{kind:Dt.Both,fn:OY},{kind:Dt.Both,fn:FY},{kind:Dt.Both,fn:HY},{kind:Dt.Both,fn:TY},{kind:Dt.Tmpl,fn:tK},{kind:Dt.Tmpl,fn:JG},{kind:Dt.Tmpl,fn:uY},{kind:Dt.Tmpl,fn:FG},{kind:Dt.Tmpl,fn:AG},{kind:Dt.Tmpl,fn:PY},{kind:Dt.Tmpl,fn:fY},{kind:Dt.Tmpl,fn:vY},{kind:Dt.Tmpl,fn:wq},{kind:Dt.Tmpl,fn:XQ},{kind:Dt.Tmpl,fn:bY},{kind:Dt.Tmpl,fn:Dq},{kind:Dt.Both,fn:QG},{kind:Dt.Tmpl,fn:mY},{kind:Dt.Both,fn:BY},{kind:Dt.Tmpl,fn:Pq},{kind:Dt.Both,fn:sK},{kind:Dt.Tmpl,fn:hY},{kind:Dt.Tmpl,fn:dK},{kind:Dt.Tmpl,fn:pK},{kind:Dt.Tmpl,fn:sq},{kind:Dt.Tmpl,fn:RG},{kind:Dt.Tmpl,fn:gK},{kind:Dt.Both,fn:OK},{kind:Dt.Both,fn:oY},{kind:Dt.Both,fn:$G}];function NF(n,o){for(let e of oZ)(e.kind===o||e.kind===Dt.Both)&&e.fn(n)}function aZ(n,o){let e=RF(n.root);return FF(n.root,o),e}function FF(n,o){for(let e of n.job.units){if(e.parent!==n.xref)continue;FF(e,o);let t=RF(e);o.statements.push(t.toDeclStmt(t.name))}}function RF(n){if(n.fnName===null)throw new Error(`AssertionError: view ${n.xref} is unnamed`);let o=[];for(let a of n.create){if(a.kind!==j.Statement)throw new Error(`AssertionError: expected all create ops to have been compiled, but got ${j[a.kind]}`);o.push(a.statement)}let e=[];for(let a of n.update){if(a.kind!==j.Statement)throw new Error(`AssertionError: expected all update ops to have been compiled, but got ${j[a.kind]}`);e.push(a.statement)}let t=Px(1,o),i=Px(2,e);return Em([new Da(Jg,iu),new Da(Zs,ws)],[...t,...i],void 0,void 0,n.fnName)}function Px(n,o){return o.length===0?[]:[Nx(new Pi(lt.BitwiseAnd,di(Jg),De(n)),o)]}function rZ(n){if(n.root.fnName===null)throw new Error("AssertionError: host binding function is unnamed");let o=[];for(let a of n.root.create){if(a.kind!==j.Statement)throw new Error(`AssertionError: expected all create ops to have been compiled, but got ${j[a.kind]}`);o.push(a.statement)}let e=[];for(let a of n.root.update){if(a.kind!==j.Statement)throw new Error(`AssertionError: expected all update ops to have been compiled, but got ${j[a.kind]}`);e.push(a.statement)}if(o.length===0&&e.length===0)return null;let t=Px(1,o),i=Px(2,e);return Em([new Da(Jg,iu),new Da(Zs,ws)],[...t,...i],void 0,void 0,n.root.fnName)}var fb=".",sZ="attr",nP="animate",lZ="class",cZ="style",dZ="*",iP="animate-",y3=class{_exprParser;_schemaRegistry;errors;constructor(o,e,t){this._exprParser=o,this._schemaRegistry=e,this.errors=t}createBoundHostProperties(o,e){let t=[];for(let i of Object.keys(o)){let a=o[i];typeof a=="string"?this.parsePropertyBinding(i,a,!0,!1,e,e.start.offset,void 0,[],t,e):this._reportError(`Value of the host property binding "${i}" needs to be a string representing an expression but got "${a}" (${typeof a})`,e)}return t}createDirectiveHostEventAsts(o,e){let t=[];for(let i of Object.keys(o)){let a=o[i];typeof a=="string"?this.parseEvent(i,a,!1,e,e,[],t,e):this._reportError(`Value of the host listener "${i}" needs to be a string representing an expression but got "${a}" (${typeof a})`,e)}return t}parseInterpolation(o,e,t){let i=e.fullStart.offset;try{let a=this._exprParser.parseInterpolation(o,e,i,t);return a&&this.errors.push(...a.errors),a}catch(a){return this._reportError(`${a}`,e),this._exprParser.wrapLiteralPrimitive("ERROR",e,i)}}parseInterpolationExpression(o,e){let t=e.start.offset;try{let i=this._exprParser.parseInterpolationExpression(o,e,t);return i&&this.errors.push(...i.errors),i}catch(i){return this._reportError(`${i}`,e),this._exprParser.wrapLiteralPrimitive("ERROR",e,t)}}parseInlineTemplateBinding(o,e,t,i,a,s,d,p){let u=t.start.offset+dZ.length,g=this._parseTemplateBindings(o,e,t,u,i);for(let C of g){let M=Cm(t,C.sourceSpan),x=C.key.source,b=Cm(t,C.key.span);if(C instanceof n0){let P=C.value?C.value.source:"$implicit",k=C.value?Cm(t,C.value.span):void 0;d.push(new SP(x,P,M,b,k))}else if(C.value){let P=p?M:t,k=Cm(t,C.value.ast.sourceSpan);this._parsePropertyAst(x,C.value,!1,P,b,k,a,s)}else a.push([x,""]),this.parseLiteralAttr(x,null,b,i,void 0,a,s,b)}}_parseTemplateBindings(o,e,t,i,a){try{let s=this._exprParser.parseTemplateBindings(o,e,t,i,a);return s.errors.forEach(d=>this.errors.push(d)),s.warnings.forEach(d=>{this._reportError(d,t,Sm.WARNING)}),s.templateBindings}catch(s){return this._reportError(`${s}`,t),[]}}parseLiteralAttr(o,e,t,i,a,s,d,p){oP(o)?(o=o.substring(1),p!==void 0&&(p=Cm(p,new qs(p.start.offset+1,p.end.offset))),e&&this._reportError('Assigning animation triggers via @prop="exp" attributes with an expression is invalid. Use property bindings (e.g. [@prop]="exp") or use an attribute without a value (e.g. @prop) instead.',t,Sm.ERROR),this._parseLegacyAnimation(o,e,t,i,p,a,s,d)):d.push(new Sg(o,this._exprParser.wrapLiteralPrimitive(e,"",i),Ac.LITERAL_ATTR,t,p,a))}parsePropertyBinding(o,e,t,i,a,s,d,p,u,g){o.length===0&&this._reportError("Property name is missing in binding",a);let C=!1;o.startsWith(iP)?(C=!0,o=o.substring(iP.length),g!==void 0&&(g=Cm(g,new qs(g.start.offset+iP.length,g.end.offset)))):oP(o)&&(C=!0,o=o.substring(1),g!==void 0&&(g=Cm(g,new qs(g.start.offset+1,g.end.offset)))),C?this._parseLegacyAnimation(o,e,a,s,g,d,p,u):o.startsWith(`${nP}${fb}`)?this._parseAnimation(o,this.parseBinding(e,t,d||a,s),a,g,d,p,u):this._parsePropertyAst(o,this.parseBinding(e,t,d||a,s),i,a,g,d,p,u)}parsePropertyInterpolation(o,e,t,i,a,s,d,p){let u=this.parseInterpolation(e,i||t,p);return u?(this._parsePropertyAst(o,u,!1,t,d,i,a,s),!0):!1}_parsePropertyAst(o,e,t,i,a,s,d,p){d.push([o,e.source]),p.push(new Sg(o,e,t?Ac.TWO_WAY:Ac.DEFAULT,i,a,s))}_parseAnimation(o,e,t,i,a,s,d){s.push([o,e.source]),d.push(new Sg(o,e,Ac.ANIMATION,t,i,a))}_parseLegacyAnimation(o,e,t,i,a,s,d,p){o.length===0&&this._reportError("Animation trigger is missing",t);let u=this.parseBinding(e||"undefined",!1,s||t,i);d.push([o,u.source]),p.push(new Sg(o,u,Ac.LEGACY_ANIMATION,t,a,s))}parseBinding(o,e,t,i){try{let a=e?this._exprParser.parseSimpleBinding(o,t,i):this._exprParser.parseBinding(o,t,i);return a&&this.errors.push(...a.errors),a}catch(a){return this._reportError(`${a}`,t),this._exprParser.wrapLiteralPrimitive("ERROR",t,i)}}createBoundElementProperty(o,e,t=!1,i=!0){if(e.isLegacyAnimation)return new Qb(e.name,Fi.LegacyAnimation,gi.NONE,e.expression,null,e.sourceSpan,e.keySpan,e.valueSpan);let a=null,s,d=null,p=e.name.split(fb),u;if(p.length>1)if(p[0]==sZ){d=p.slice(1).join(fb),t||this._validatePropertyOrAttributeName(d,e.sourceSpan,!0),u=Mb(this._schemaRegistry,o,d,!0);let g=d.indexOf(":");if(g>-1){let C=d.substring(0,g),M=d.substring(g+1);d=wb(C,M)}s=Fi.Attribute}else p[0]==lZ?(d=p[1],s=Fi.Class,u=[gi.NONE]):p[0]==cZ?(a=p.length>2?p[2]:null,d=p[1],s=Fi.Style,u=[gi.STYLE]):p[0]==nP&&(d=e.name,s=Fi.Animation,u=[gi.NONE]);if(d===null){let g=this._schemaRegistry.getMappedPropName(e.name);d=i?g:e.name,u=Mb(this._schemaRegistry,o,g,!1),s=e.type===Ac.TWO_WAY?Fi.TwoWay:Fi.Property,t||this._validatePropertyOrAttributeName(g,e.sourceSpan,!1)}return new Qb(d,s,u[0],e.expression,a,e.sourceSpan,e.keySpan,e.valueSpan)}parseEvent(o,e,t,i,a,s,d,p){o.length===0&&this._reportError("Event name is missing in binding",i),oP(o)?(o=o.slice(1),p!==void 0&&(p=Cm(p,new qs(p.start.offset+1,p.end.offset))),this._parseLegacyAnimationEvent(o,e,i,a,d,p)):this._parseRegularEvent(o,e,t,i,a,s,d,p)}calcPossibleSecurityContexts(o,e,t){let i=this._schemaRegistry.getMappedPropName(e);return Mb(this._schemaRegistry,o,i,t)}parseEventListenerName(o){let[e,t]=CU(o,[null,o]);return{eventName:t,target:e}}parseLegacyAnimationEventName(o){let e=bU(o,[o,null]);return{eventName:e[0],phase:e[1]===null?null:e[1].toLowerCase()}}_parseLegacyAnimationEvent(o,e,t,i,a,s){let{eventName:d,phase:p}=this.parseLegacyAnimationEventName(o),u=this._parseAction(e,i);a.push(new qb(d,p,is.LegacyAnimation,u,t,i,s)),d.length===0&&this._reportError("Animation event name is missing in binding",t),p?p!=="start"&&p!=="done"&&this._reportError(`The provided animation output phase value "${p}" for "@${d}" is not supported (use start or done)`,t):this._reportError(`The animation trigger output event (@${d}) is missing its phase value name (start or done are currently supported)`,t)}_parseRegularEvent(o,e,t,i,a,s,d,p){let{eventName:u,target:g}=this.parseEventListenerName(o),C=this.errors.length,M=this._parseAction(e,a),x=this.errors.length===C;s.push([o,M.source]),t&&x&&!this._isAllowedAssignmentEvent(M)&&this._reportError("Unsupported expression in a two-way binding",i);let b=is.Regular;t&&(b=is.TwoWay),o.startsWith(`${nP}${fb}`)&&(b=is.Animation),d.push(new qb(u,g,b,M,i,a,p))}_parseAction(o,e){let t=e&&e.start?e.start.offset:0;try{let i=this._exprParser.parseAction(o,e,t);return i&&this.errors.push(...i.errors),!i||i.ast instanceof Ar?(this._reportError("Empty expressions are not allowed",e),this._exprParser.wrapLiteralPrimitive("ERROR",e,t)):i}catch(i){return this._reportError(`${i}`,e),this._exprParser.wrapLiteralPrimitive("ERROR",e,t)}}_reportError(o,e,t=Sm.ERROR){this.errors.push(new dn(e,o,t))}_validatePropertyOrAttributeName(o,e,t){let i=t?this._schemaRegistry.validateAttribute(o):this._schemaRegistry.validateProperty(o);i.error&&this._reportError(i.msg,e,Sm.ERROR)}_isAllowedAssignmentEvent(o){return o instanceof xs?this._isAllowedAssignmentEvent(o.ast):o instanceof Zf?this._isAllowedAssignmentEvent(o.expression):o instanceof Vg&&o.args.length===1&&o.receiver instanceof zc&&o.receiver.name==="$any"&&o.receiver.receiver instanceof Hc?this._isAllowedAssignmentEvent(o.args[0]):(o instanceof zc||o instanceof cu)&&!w3(o)}};function w3(n){return n instanceof Gf||n instanceof qf?!0:n instanceof t0?w3(n.expression):n instanceof zc||n instanceof cu||n instanceof Vg?w3(n.receiver):!1}function oP(n){return n[0]=="@"}function Mb(n,o,e,t){let i,[a,s]=o?hr(o,!1):[null,o],d=u=>{let[g,C]=hr(u,!1),M=g??a,x=M?`:${M}:${C}`:C;return n.securityContext(x,e,t)},p=n.allKnownElementNames();return s===null?i=p.map(d):(i=[],Ag.parse(s).forEach(u=>{let g=u.element?[u.element]:p;if(u.element&&!n.hasElement(u.element,[])){let x=`:${Bx}:${u.element}`,b=`:${jx}:${u.element}`;n.hasElement(x,[])?g=[x]:n.hasElement(b,[])&&(g=[b])}let C=new Set(u.notSelectors.filter(x=>x.isElementSelector()).map(x=>x.element?.toLowerCase())),M=g.filter(x=>{let b=x.toLowerCase();return!C.has(b)&&!C.has(hr(b)[1])});i.push(...M.map(d))})),i.length===0?[gi.NONE]:Array.from(new Set(i)).sort()}function Cm(n,o){let e=o.start-n.start.offset,t=o.end-n.end.offset;return new In(n.start.moveBy(e),n.end.moveBy(t),n.fullStart.moveBy(e),n.details)}var Nd=new Yg,nu="ng-template",mZ="animate.";function Sb(n){return n instanceof os}function pZ(n){return Sb(n)&&n.nodes.length===1&&n.nodes[0]instanceof tx}function uZ(n,o,e,t,i,a,s,d,p,u){let g=new S0(n,e,t,i,a,s,d,p,u);return zd(g.root,o),g}function gZ(n,o,e){let t=new fx(n.componentName,e,vs.DomOnly);for(let i of n.properties??[]){let a=Qt.Property;i.name.startsWith("attr.")&&(i.name=i.name.substring(5),a=Qt.Attribute),i.isLegacyAnimation&&(a=Qt.LegacyAnimation),i.isAnimation&&(a=Qt.Animation);let s=aN(o,n.componentSelector,i.name,a===Qt.Attribute);hZ(t,i,a,s)}for(let[i,a]of Object.entries(n.attributes)??[]){let s=aN(o,n.componentSelector,i,!0);_Z(t,i,a,s)}for(let i of n.events??[])fZ(t,i);return t}function aN(n,o,e,t){let i=n.calcPossibleSecurityContexts(o,e,t),a=Mb(Nd,null,Nd.getMappedPropName(e),t),s=a.filter(u=>u!==gi.NONE),d=s.length;return d!==a.length&&d>0||s.some(u=>!i.includes(u))?a:i.filter(u=>u!==gi.NONE)}function hZ(n,o,e,t){let i,a=o.expression.ast;a instanceof F0?i=new aa(a.strings,a.expressions.map(s=>Yn(s,n,o.sourceSpan)),[]):i=Yn(a,n,o.sourceSpan),n.root.update.push(uu(n.root.xref,e,o.name,i,null,t,!1,!1,null,null,o.sourceSpan))}function _Z(n,o,e,t){let i=uu(n.root.xref,Qt.Attribute,o,e,null,t,!0,!1,null,null,e.sourceSpan);n.root.update.push(i)}function fZ(n,o){let e;if(o.type===is.Animation)e=dF(n.root.xref,new vr,o.name,null,O0(n.root,o.handler,o.handlerSpan),o.name.endsWith("enter")?"enter":"leave",o.targetOrPhase,!0,o.sourceSpan);else{let[t,i]=o.type!==is.LegacyAnimation?[null,o.targetOrPhase]:[o.targetOrPhase,null];e=iT(n.root.xref,new vr,o.name,null,O0(n.root,o.handler,o.handlerSpan),t,i,!0,o.sourceSpan)}n.root.create.push(e)}function zd(n,o){for(let e of o)if(e instanceof Uc)vZ(n,e);else if(e instanceof Qs)CZ(n,e);else if(e instanceof Ug)bZ(n,e);else if(e instanceof Qp)zF(n,e,null);else if(e instanceof jg)LF(n,e,null);else if(e instanceof Jb)xZ(n,e);else if(e instanceof Zb)yZ(n,e);else if(e instanceof mu)wZ(n,e);else if(e instanceof FN)SZ(n,e);else if(e instanceof Hg)kZ(n,e);else if(e instanceof q3)TZ(n,e);else if(!(e instanceof Ef))throw new Error(`Unsupported template node: ${e.constructor.name}`)}function vZ(n,o){if(o.i18n!==void 0&&!(o.i18n instanceof os||o.i18n instanceof Dm))throw Error(`Unhandled i18n metadata type for element: ${o.i18n.constructor.name}`);let e=n.job.allocateXrefId(),[t,i]=hr(o.name),a=mG(i,e,_F(t),o.i18n instanceof Dm?o.i18n:void 0,o.startSourceSpan,o.sourceSpan);n.create.push(a),OZ(n,a,o),jF(a,o);let s=null;o.i18n instanceof os&&(s=n.job.allocateXrefId(),n.create.push(Lx(s,o.i18n,void 0,o.startSourceSpan))),zd(n,o.children);let d=uG(e,o.endSourceSpan??o.startSourceSpan);n.create.push(d),s!==null&&Je.insertBefore(Vx(s,o.endSourceSpan??o.startSourceSpan),d)}function CZ(n,o){if(o.i18n!==void 0&&!(o.i18n instanceof os||o.i18n instanceof Dm))throw Error(`Unhandled i18n metadata type for template: ${o.i18n.constructor.name}`);let e=n.job.allocateView(n.xref),t=o.tagName,i="";o.tagName&&([i,t]=hr(o.tagName));let a=o.i18n instanceof Dm?o.i18n:void 0,s=_F(i),d=t===null?"":qG(t,s),p=EZ(o)?ys.NgTemplate:ys.Structural,u=rF(e.xref,p,t,d,s,a,o.startSourceSpan,o.sourceSpan);n.create.push(u),DZ(n,u,o,p),jF(u,o),zd(e,o.children);for(let{name:g,value:C}of o.variables)e.contextVariables.set(g,C!==""?C:"$implicit");if(p===ys.NgTemplate&&o.i18n instanceof os){let g=n.job.allocateXrefId();Je.insertAfter(Lx(g,o.i18n,void 0,o.startSourceSpan),e.create.head),Je.insertBefore(Vx(g,o.endSourceSpan??o.startSourceSpan),e.create.tail)}}function bZ(n,o){if(o.i18n!==void 0&&!(o.i18n instanceof Dm))throw Error(`Unhandled i18n metadata type for element: ${o.i18n.constructor.name}`);let e=null;o.children.some(a=>!(a instanceof Rx)&&(!(a instanceof Qp)||a.value.trim().length>0))&&(e=n.job.allocateView(n.xref),zd(e,o.children));let t=n.job.allocateXrefId(),i=xG(t,o.selector,o.i18n,e?.xref??null,o.sourceSpan);for(let a of o.attributes){let s=Nd.securityContext(o.name,a.name,!0);n.update.push(uu(i.xref,Qt.Attribute,a.name,De(a.value),null,s,!0,!1,null,Dd(a.i18n),a.sourceSpan))}n.create.push(i)}function zF(n,o,e){n.create.push(cF(n.job.allocateXrefId(),o.value,e,o.sourceSpan))}function LF(n,o,e){let t=o.value;if(t instanceof xs&&(t=t.ast),!(t instanceof F0))throw new Error(`AssertionError: expected Interpolation for BoundText node, got ${t.constructor.name}`);if(o.i18n!==void 0&&!(o.i18n instanceof Id))throw Error(`Unhandled i18n metadata type for text interpolation: ${o.i18n?.constructor.name}`);let i=o.i18n instanceof Id?o.i18n.children.filter(s=>s instanceof m0).map(s=>s.name):[];if(i.length>0&&i.length!==t.expressions.length)throw Error(`Unexpected number of i18n placeholders (${t.expressions.length}) for BoundText with ${t.expressions.length} expressions`);let a=n.job.allocateXrefId();n.create.push(cF(a,"",e,o.sourceSpan)),n.update.push(YW(a,new aa(t.strings,t.expressions.map(s=>Yn(s,n.job,null)),i),o.sourceSpan))}function xZ(n,o){let e=null,t=[];for(let i=0;iM.modifier==="none")||g.some(M=>M.modifier==="none")||u.push(xm(d,{kind:lo.Idle},"none",null)),n.create.push(u),n.update.push(g)}function MZ(n){return Object.keys(n.hydrateTriggers).length>0?1:null}function aP(n,o,e,t,i,a){if(o.idle!==void 0){let s=xm(a,{kind:lo.Idle},n,o.idle.sourceSpan);e.push(s)}if(o.immediate!==void 0){let s=xm(a,{kind:lo.Immediate},n,o.immediate.sourceSpan);e.push(s)}if(o.timer!==void 0){let s=xm(a,{kind:lo.Timer,delay:o.timer.delay},n,o.timer.sourceSpan);e.push(s)}if(o.hover!==void 0){let s=xm(a,{kind:lo.Hover,targetName:o.hover.reference,targetXref:null,targetSlot:null,targetView:null,targetSlotViewSteps:null},n,o.hover.sourceSpan);e.push(s)}if(o.interaction!==void 0){let s=xm(a,{kind:lo.Interaction,targetName:o.interaction.reference,targetXref:null,targetSlot:null,targetView:null,targetSlotViewSteps:null},n,o.interaction.sourceSpan);e.push(s)}if(o.viewport!==void 0){let s=xm(a,{kind:lo.Viewport,targetName:o.viewport.reference,targetXref:null,targetSlot:null,targetView:null,targetSlotViewSteps:null,options:o.viewport.options?Yn(o.viewport.options,i.job,o.viewport.sourceSpan):null},n,o.viewport.sourceSpan);e.push(s)}if(o.never!==void 0){let s=xm(a,{kind:lo.Never},n,o.never.sourceSpan);e.push(s)}if(o.when!==void 0){if(o.when.value instanceof F0)throw new Error("Unexpected interpolation in defer block when trigger");let s=rG(a,Yn(o.when.value,i.job,o.when.sourceSpan),n,o.when.sourceSpan);t.push(s)}}function SZ(n,o){if(o.i18n instanceof os&&pZ(o.i18n)){let e=n.job.allocateXrefId();n.create.push(SG(e,o.i18n,LN(o.i18n).name,null));for(let[t,i]of Object.entries(q(q({},o.vars),o.placeholders)))i instanceof jg?LF(n,i,t):zF(n,i,t);n.create.push(kG(e))}else throw Error(`Unhandled i18n metadata type for ICU: ${o.i18n?.constructor.name}`)}function kZ(n,o){let e=n.job.allocateView(n.xref),t=`\u0275$index_${e.xref}`,i=`\u0275$count_${e.xref}`,a=new Set;e.contextVariables.set(o.item.name,o.item.value);for(let S of o.contextVariables)S.value==="$index"&&a.add(S.name),S.name==="$index"?e.contextVariables.set("$index",S.value).set(t,S.value):S.name==="$count"?e.contextVariables.set("$count",S.value).set(i,S.value):e.aliases.add({kind:ar.Alias,name:null,identifier:S.name,expression:PZ(S,t,i)});let s=Ha(o.trackBy.span,o.sourceSpan),d=Yn(o.trackBy,n.job,s);zd(e,o.children);let p=null,u=null;o.empty!==null&&(p=n.job.allocateView(n.xref),zd(p,o.empty.children),u=Tx(n,p.xref,o.empty));let g={$index:a,$implicit:o.item.name};if(o.i18n!==void 0&&!(o.i18n instanceof Im))throw Error("AssertionError: Unhandled i18n metadata type or @for");if(o.empty?.i18n!==void 0&&!(o.empty.i18n instanceof Im))throw Error("AssertionError: Unhandled i18n metadata type or @empty");let C=o.i18n,M=o.empty?.i18n,x=Tx(n,e.xref,o),b=pG(e.xref,p?.xref??null,x,d,g,u,C,M,o.startSourceSpan,o.sourceSpan);n.create.push(b);let P=Yn(o.expression,n.job,Ha(o.expression.span,o.sourceSpan)),k=aG(b.xref,b.handle,P,o.sourceSpan);n.update.push(k)}function PZ(n,o,e){switch(n.value){case"$index":return new ir(o);case"$count":return new ir(e);case"$first":return new ir(o).identical(De(0));case"$last":return new ir(o).identical(new ir(e).minus(De(1)));case"$even":return new ir(o).modulo(De(2)).identical(De(0));case"$odd":return new ir(o).modulo(De(2)).notIdentical(De(0));default:throw new Error(`AssertionError: unknown @for loop variable ${n.value}`)}}function TZ(n,o){let e=n.job.allocateXrefId();n.create.push(wG(e,o.name,o.sourceSpan)),n.update.push(lG(e,o.name,Yn(o.value,n.job,o.valueSpan),o.sourceSpan))}function Yn(n,o,e){if(n instanceof xs)return Yn(n.ast,o,e);if(n instanceof zc)return n.receiver instanceof Hc?new ir(n.name):new Xs(Yn(n.receiver,o,e),n.name,null,Ha(n.span,e));if(n instanceof Vg){if(n.receiver instanceof Hc)throw new Error("Unexpected ImplicitReceiver");return new Ms(Yn(n.receiver,o,e),n.args.map(t=>Yn(t,o,e)),void 0,Ha(n.span,e))}else{if(n instanceof Cs)return De(n.value,void 0,Ha(n.span,e));if(n instanceof Dg)switch(n.operator){case"+":return new au(zf.Plus,Yn(n.expr,o,e),void 0,Ha(n.span,e));case"-":return new au(zf.Minus,Yn(n.expr,o,e),void 0,Ha(n.span,e));default:throw new Error(`AssertionError: unknown unary operator ${n.operator}`)}else if(n instanceof Zr){let t=WG.get(n.operation);if(t===void 0)throw new Error(`AssertionError: unknown binary operator ${n.operation}`);return new Pi(t,Yn(n.left,o,e),Yn(n.right,o,e),void 0,Ha(n.span,e))}else{if(n instanceof Wf)return new Fm(o.root.xref);if(n instanceof cu)return new Fd(Yn(n.receiver,o,e),Yn(n.key,o,e),void 0,Ha(n.span,e));if(n instanceof Lg)throw new Error("AssertionError: Chain in unknown context");if(n instanceof du){let t=n.keys.map((i,a)=>{let s=Yn(n.values[a],o,e);return i.kind==="spread"?new Tm(s):new Rg(i.key,s,i.quoted)});return new rc(t,void 0,Ha(n.span,e))}else{if(n instanceof Qf)return new $c(n.expressions.map(t=>Yn(t,o,e)));if(n instanceof Bb)return new jc(Yn(n.condition,o,e),Yn(n.trueExp,o,e),Yn(n.falseExp,o,e),void 0,Ha(n.span,e));if(n instanceof Zf)return Yn(n.expression,o,e);if(n instanceof jb)return new hu(o.allocateXrefId(),new vr,n.name,[Yn(n.exp,o,e),...n.args.map(t=>Yn(t,o,e))]);if(n instanceof qf)return new Qg(Yn(n.receiver,o,e),Yn(n.key,o,e),Ha(n.span,e));if(n instanceof Gf)return new qg(Yn(n.receiver,o,e),n.name);if(n instanceof Hb)return new _u(Yn(n.receiver,o,e),n.args.map(t=>Yn(t,o,e)));if(n instanceof Ar)return new w0(Ha(n.span,e));if(n instanceof Kf)return dU(Yn(n.expression,o,e),Ha(n.span,e));if(n instanceof Xf)return N0(Yn(n.expression,o,e));if(n instanceof Yf)return new Db(Yn(n.expression,o,e),void 0,Ha(n.span,e));if(n instanceof e0)return rN(n,o,e);if(n instanceof Jf)return new Lf(Yn(n.tag,o,e),rN(n.template,o,e),void 0,Ha(n.span,e));if(n instanceof t0)return new ac(Yn(n.expression,o,e),void 0,Ha(n.span,e));if(n instanceof Gb)return new Fg(n.body,n.flags,e);if(n instanceof $b)return new ru(Yn(n.expression,o,e));if(n instanceof Wb)return AZ(Ys(n.parameters.map(t=>new Da(t.name,ws)),Yn(n.body,o,e)));throw new Error(`Unhandled expression type "${n.constructor.name}" in file "${e?.start.file.url}"`)}}}}function rN(n,o,e){return new Bf(n.elements.map(t=>new Ib(t.text,Ha(t.span,e))),n.expressions.map(t=>Yn(t,o,e)),Ha(n.span,e))}function M3(n,o,e,t){let i;return o instanceof F0?i=new aa(o.strings,o.expressions.map(a=>Yn(a,n,null)),Object.keys(Dd(e)?.placeholders??{})):o instanceof co?i=Yn(o,n,null):i=De(o),i}var VF=new Map([[Fi.Property,Qt.Property],[Fi.TwoWay,Qt.TwoWayProperty],[Fi.Attribute,Qt.Attribute],[Fi.Class,Qt.ClassName],[Fi.Style,Qt.StyleProperty],[Fi.LegacyAnimation,Qt.LegacyAnimation],[Fi.Animation,Qt.Animation]]);function EZ(n){return hr(n.tagName??"")[1]===nu}function Dd(n){if(n==null)return null;if(!(n instanceof os))throw Error(`Expected i18n meta to be a Message, but got: ${n.constructor.name}`);return n}function OZ(n,o,e){let t=new Array,i=new Set;for(let a of e.attributes){let[s,d]=hr(e.name),p=s;if(!s)switch(o.namespace){case Oa.SVG:p=Bx;break;case Oa.Math:p=jx;break}let u=Nd.securityContext(p?`:${p}:${d}`:d,a.name,!0);t.push(uu(o.xref,Qt.Attribute,a.name,M3(n.job,a.value,a.i18n),null,u,!0,!1,null,Dd(a.i18n),a.sourceSpan)),a.i18n&&i.add(a.name)}for(let a of e.inputs)i.has(a.name)&&console.error(`On component ${n.job.componentName}, the binding ${a.name} is both an i18n attribute and a property. You may want to remove the property binding. This will become a compilation error in future versions of Angular.`),t.push(uu(o.xref,VF.get(a.type),a.name,M3(n.job,D0(a.value),a.i18n),a.unit,a.securityContext,!1,!1,null,Dd(a.i18n)??null,a.sourceSpan));n.create.push(t.filter(a=>a?.kind===j.ExtractedAttribute)),n.update.push(t.filter(a=>a?.kind===j.Binding));for(let a of e.outputs){if(a.type===is.LegacyAnimation&&a.phase===null)throw Error("Animation listener should have a phase");a.type===is.TwoWay?n.create.push(mF(o.xref,o.handle,a.name,o.tag,BF(n,a.handler,a.handlerSpan),a.sourceSpan)):a.type===is.Animation?n.create.push(dF(o.xref,o.handle,a.name,o.tag,O0(n,a.handler,a.handlerSpan),a.name.endsWith("enter")?"enter":"leave",a.target,!1,a.sourceSpan)):n.create.push(iT(o.xref,o.handle,a.name,o.tag,O0(n,a.handler,a.handlerSpan),a.phase,a.target,!1,a.sourceSpan))}t.some(a=>a?.i18nMessage)!==null&&n.create.push(pF(n.job.allocateXrefId(),new vr,o.xref))}function DZ(n,o,e,t){let i=new Array;for(let a of e.templateAttrs)if(a instanceof $g){let s=Nd.securityContext(nu,a.name,!0);i.push(Cb(n,o.xref,Fi.Attribute,a.name,a.value,null,s,!0,t,Dd(a.i18n),a.sourceSpan))}else i.push(Cb(n,o.xref,a.type,a.name,D0(a.value),a.unit,a.securityContext,!0,t,Dd(a.i18n),a.sourceSpan));for(let a of e.attributes){let s=Nd.securityContext(nu,a.name,!0);i.push(Cb(n,o.xref,Fi.Attribute,a.name,a.value,null,s,!1,t,Dd(a.i18n),a.sourceSpan))}for(let a of e.inputs)i.push(Cb(n,o.xref,a.type,a.name,D0(a.value),a.unit,a.securityContext,!1,t,Dd(a.i18n),a.sourceSpan));n.create.push(i.filter(a=>a?.kind===j.ExtractedAttribute)),n.update.push(i.filter(a=>a?.kind===j.Binding));for(let a of e.outputs){if(a.type===is.LegacyAnimation&&a.phase===null)throw Error("Animation listener should have a phase");if(t===ys.NgTemplate&&(a.type===is.TwoWay?n.create.push(mF(o.xref,o.handle,a.name,o.tag,BF(n,a.handler,a.handlerSpan),a.sourceSpan)):n.create.push(iT(o.xref,o.handle,a.name,o.tag,O0(n,a.handler,a.handlerSpan),a.phase,a.target,!1,a.sourceSpan))),t===ys.Structural&&a.type!==is.LegacyAnimation){let s=Nd.securityContext(nu,a.name,!1);n.create.push(Cl(o.xref,Qt.Property,null,a.name,null,null,null,s))}}i.some(a=>a?.i18nMessage)!==null&&n.create.push(pF(n.job.allocateXrefId(),new vr,o.xref))}function Cb(n,o,e,t,i,a,s,d,p,u,g){let C=typeof i=="string";if(p===ys.Structural){if(!d)switch(e){case Fi.Property:case Fi.Class:case Fi.Style:return Cl(o,Qt.Property,null,t,null,null,u,s);case Fi.TwoWay:return Cl(o,Qt.TwoWayProperty,null,t,null,null,u,s)}if(!C&&(e===Fi.Attribute||e===Fi.LegacyAnimation||e===Fi.Animation))return null}let M=VF.get(e);return p===ys.NgTemplate&&(e===Fi.Class||e===Fi.Style||e===Fi.Attribute&&!C)&&(M=Qt.Property),uu(o,M,t,M3(n.job,i,u),a,s,C,d,p,u,g)}function O0(n,o,e){o=D0(o);let t=new Array,i=o instanceof Lg?o.expressions:[o];if(i.length===0)throw new Error("Expected listener to have non-empty expression list.");let a=i.map(d=>Yn(d,n.job,e)),s=a.pop();return t.push(...a.map(d=>Js(new fr(d,d.sourceSpan)))),t.push(Js(new Ia(s,s.sourceSpan))),t}function BF(n,o,e){o=D0(o);let t=new Array;if(o instanceof Lg)if(o.expressions.length===1)o=o.expressions[0];else throw new Error("Expected two-way listener to have a single expression.");let i=Yn(o,n.job,e),a=new ir("$event"),s=new mx(i,a);return t.push(Js(new fr(s))),t.push(Js(new Ia(a))),t}function D0(n){return n instanceof xs?n.ast:n}function jF(n,o){IZ(n.localRefs);for(let{name:e,value:t}of o.references)n.localRefs.push({name:e,target:t})}function IZ(n){if(!Array.isArray(n))throw new Error("AssertionError: expected an array")}function Ha(n,o){if(o===null)return null;let e=o.start.moveBy(n.start),t=o.start.moveBy(n.end),i=o.fullStart.moveBy(n.start);return new In(e,t,i)}function Tx(n,o,e){let t=null;for(let i of e.children)if(!(i instanceof Rx||i instanceof q3)){if(t!==null)return null;if(i instanceof Uc||i instanceof Qs&&i.tagName!==null)t=i;else return null}if(t!==null){for(let a of t.attributes)if(!a.name.startsWith(mZ)){let s=Nd.securityContext(nu,a.name,!0);n.update.push(uu(o,Qt.Attribute,a.name,De(a.value),null,s,!0,!1,null,Dd(a.i18n),a.sourceSpan))}for(let a of t.inputs)if(a.type!==Fi.LegacyAnimation&&a.type!==Fi.Animation&&a.type!==Fi.Attribute){let s=Nd.securityContext(nu,a.name,!0);n.create.push(Cl(o,Qt.Property,null,a.name,null,null,null,s))}let i=t instanceof Uc?t.name:t.tagName;return i===nu?null:i}return null}function AZ(n){let o=new Set(n.params.map(e=>e.name));return Bt(n,e=>{if(e instanceof vu)for(let t of e.params)o.add(t.name);else if(e instanceof ir&&o.has(e.name))return di(e.name);return e},ai.None)}var NZ=!1;function FZ(){return NZ}function Ex(n,o){return Nx(di(Jg).bitwiseAnd(De(n),null),o)}function RZ(n){return(n.descendants?1:0)|(n.static?2:0)|(n.emitDistinctChangesOnly?4:0)}function zZ(n,o){if(Array.isArray(n.predicate)){let e=[];return n.predicate.forEach(t=>{let i=t.split(",").map(a=>De(a.trim()));e.push(...i)}),o.getConstLiteral(io(e),!0)}else switch(n.predicate.forwardRef){case 0:case 2:return n.predicate.expression;case 1:return Ht(ge.resolveForwardRef).callFn([n.predicate.expression])}}function $F(n,o,e){let t=[];return e!==void 0&&t.push(...e),n.isSignal&&t.push(new Xs(di(Zs),n.propertyName)),t.push(zZ(n,o),De(RZ(n))),n.read&&t.push(n.read),t}var sT=Symbol("queryAdvancePlaceholder");function HF(n){let o=[],e=0,t=()=>{e>0&&(o.unshift(Ht(ge.queryAdvance).callFn(e===1?[]:[De(e)]).toStmt()),e=0)};for(let i=n.length-1;i>=0;i--){let a=n[i];a===sT?e++:(t(),o.unshift(a))}return t(),o}function LZ(n,o,e){let t=[],i=[],a=VN(u=>i.push(u),K3),s=null,d=null;n.forEach(u=>{let g=$F(u,o);if(u.isSignal?(s??=Ht(ge.viewQuerySignal),s=s.callFn(g)):(d??=Ht(ge.viewQuery),d=d.callFn(g)),u.isSignal){i.push(sT);return}let C=a(),M=Ht(ge.loadQuery).callFn([]),x=Ht(ge.queryRefresh).callFn([C.set(M)]),b=di(Zs).prop(u.propertyName).set(u.first?C.prop("first"):C);i.push(x.and(b).toStmt())}),s!==null&&t.push(new fr(s)),d!==null&&t.push(new fr(d));let p=e?`${e}_Query`:null;return Em([new Da(Jg,iu),new Da(Zs,ws)],[Ex(1,t),Ex(2,HF(i))],ic,null,p)}function VZ(n,o,e){let t=[],i=[],a=VN(u=>i.push(u),K3),s=null,d=null;for(let u of n){let g=$F(u,o,[di("dirIndex")]);if(u.isSignal?(s??=Ht(ge.contentQuerySignal),s=s.callFn(g)):(d??=Ht(ge.contentQuery),d=d.callFn(g)),u.isSignal){i.push(sT);continue}let C=a(),M=Ht(ge.loadQuery).callFn([]),x=Ht(ge.queryRefresh).callFn([C.set(M)]),b=di(Zs).prop(u.propertyName).set(u.first?C.prop("first"):C);i.push(x.and(b).toStmt())}s!==null&&t.push(new fr(s)),d!==null&&t.push(new fr(d));let p=e?`${e}_ContentQueries`:null;return Em([new Da(Jg,iu),new Da(Zs,ws),new Da("dirIndex",iu)],[Ex(1,t),Ex(2,HF(i))],ic,null,p)}var S3=class extends Qq{constructor(){super(h3)}parse(o,e,t){return super.parse(o,e,t)}};function BZ(n){if(n==null||n.length===0||n[0]=="/")return!1;let o=n.match(jZ);return o===null||o[1]=="package"||o[1]=="asset"}var jZ=/^([^:/?#]+):/,$Z="select",HZ="link",UZ="rel",WZ="href",GZ="stylesheet",qZ="style",QZ=new Set([":svg:script","script"]),KZ="ngNonBindable",XZ="ngProjectAs";function UF(n){let o=null,e=null,t=null,i=!1,a="";for(let p of n.attrs){let u=p.name.toLowerCase();u==$Z?o=p.value:u==WZ?e=p.value:u==UZ?t=p.value:p.name==KZ?i=!0:p.name==XZ&&p.value.length>0&&(a=p.value)}o||="*";let s=n.name.toLowerCase(),d=Gs.OTHER;return kP(s)?d=Gs.NG_CONTENT:qZ===s?d=Gs.STYLE:QZ.has(s)?d=Gs.SCRIPT:s==HZ&&t==GZ&&(d=Gs.STYLESHEET),new k3(d,o,e,i,a)}var Gs=(function(n){return n[n.NG_CONTENT=0]="NG_CONTENT",n[n.STYLE=1]="STYLE",n[n.STYLESHEET=2]="STYLESHEET",n[n.SCRIPT=3]="SCRIPT",n[n.OTHER=4]="OTHER",n})(Gs||{}),k3=class{type;selectAttr;hrefAttr;nonBindable;projectAs;constructor(o,e,t,i,a){this.type=o,this.selectAttr=e,this.hrefAttr=t,this.nonBindable=i,this.projectAs=a}},YZ=/^\s*([0-9A-Za-z_$]*)\s+of\s+([\S\s]*)/,ZZ=/^track\s+([\S\s]*)/,JZ=/^(as\s+)(.*)/,Hx=/^else[^\S\r\n]+if/,eJ=/^let\s+([\S\s]*)/,tJ=/^[$A-Z_][0-9A-Z_$]*$/i,sN=/(\s*)(\S+)(\s*)/,Rf=new Set(["$index","$first","$last","$even","$odd","$count"]);function lN(n){return n==="empty"}function cN(n){return n==="else"||Hx.test(n)}function nJ(n,o,e,t){let i=lJ(o),a=[],s=dN(n,i,t);s!==null&&a.push(new Yp(s.expression,ko(e,n.children,n.children),s.expressionAlias,n.sourceSpan,n.startSourceSpan,n.endSourceSpan,n.nameSpan,n.i18n));for(let C of o)if(Hx.test(C.name)){let M=dN(C,i,t);if(M!==null){let x=ko(e,C.children,C.children);a.push(new Yp(M.expression,x,M.expressionAlias,C.sourceSpan,C.startSourceSpan,C.endSourceSpan,C.nameSpan,C.i18n))}}else if(C.name==="else"){let M=ko(e,C.children,C.children);a.push(new Yp(null,M,null,C.sourceSpan,C.startSourceSpan,C.endSourceSpan,C.nameSpan,C.i18n))}let d=a.length>0?a[0].startSourceSpan:n.startSourceSpan,p=a.length>0?a[a.length-1].endSourceSpan:n.endSourceSpan,u=n.sourceSpan,g=a[a.length-1];return g!==void 0&&(u=new In(d.start,g.sourceSpan.end)),{node:new Jb(a,u,n.startSourceSpan,p,n.nameSpan),errors:i}}function iJ(n,o,e,t){let i=[],a=aJ(n,i,t),s=null,d=null;for(let p of o)p.name==="empty"?d!==null?i.push(new dn(p.sourceSpan,"@for loop can only have one @empty block")):p.parameters.length>0?i.push(new dn(p.sourceSpan,"@empty block cannot have parameters")):d=new l0(ko(e,p.children,p.children),p.sourceSpan,p.startSourceSpan,p.endSourceSpan,p.nameSpan,p.i18n):i.push(new dn(p.sourceSpan,`Unrecognized @for loop block "${p.name}"`));if(a!==null)if(a.trackBy===null)i.push(new dn(n.startSourceSpan,'@for loop must have a "track" expression'));else{let p=d?.endSourceSpan??n.endSourceSpan,u=new In(n.sourceSpan.start,p?.end??n.sourceSpan.end);rJ(a.trackBy.expression,a.trackBy.keywordSpan,i),s=new Hg(a.itemName,a.expression,a.trackBy.expression,a.trackBy.keywordSpan,a.context,ko(e,n.children,n.children),d,u,n.sourceSpan,n.startSourceSpan,p,n.nameSpan,n.i18n)}return{node:s,errors:i}}function oJ(n,o,e){let t=cJ(n),i=n.parameters.length>0?I0(n.parameters[0],e):e.parseBinding("",!1,n.sourceSpan,0),a=[],s=[],d=[],p=null,u=null;for(let C of n.children){if(!(C instanceof _l))continue;if((C.name!=="case"||C.parameters.length===0)&&C.name!=="default"&&C.name!=="default never"){s.push(new ex(C.name,C.sourceSpan,C.nameSpan));continue}u!==null&&t.push(new dn(C.sourceSpan,'@default block with "never" parameter must be the last case in a switch'));let M=C.name==="case",x=null;if(M)x=I0(C.parameters[0],e);else if(C.name==="default never"){(C.children.length>0||C.endSourceSpan!==null&&C.endSourceSpan.start.offset!==C.endSourceSpan.end.offset)&&t.push(new dn(C.sourceSpan,'@default block with "never" parameter cannot have a body')),d.length>0&&t.push(new dn(C.sourceSpan,'A @case block with no body cannot be followed by a @default block with "never" parameter')),u=new FP(C.sourceSpan,C.startSourceSpan,C.endSourceSpan,C.nameSpan);continue}let b=new NP(x,C.sourceSpan,C.startSourceSpan,C.endSourceSpan,C.nameSpan);if(d.push(b),C.children.length===0&&C.endSourceSpan!==null&&C.endSourceSpan.start.offset===C.endSourceSpan.end.offset){p===null&&(p=C.sourceSpan);continue}let k=C.sourceSpan,S=C.startSourceSpan;p!==null&&(k=new In(p.start,C.sourceSpan.end),S=new In(p.start,C.startSourceSpan.end),p=null);let O=new s0(d,ko(o,C.children,C.children),k,S,C.endSourceSpan,C.nameSpan,C.i18n);a.push(O),d=[]}return{node:new Zb(i,a,s,u,n.sourceSpan,n.startSourceSpan,n.endSourceSpan,n.nameSpan),errors:t}}function aJ(n,o,e){if(n.parameters.length===0)return o.push(new dn(n.startSourceSpan,"@for loop does not have an expression")),null;let[t,...i]=n.parameters,a=dJ(t,o)?.match(YZ);if(!a||a[2].trim().length===0)return o.push(new dn(t.sourceSpan,'Cannot parse expression. @for loop expression must match the pattern " of "')),null;let[,s,d]=a;Rf.has(s)&&o.push(new dn(t.sourceSpan,`@for loop item name cannot be one of ${Array.from(Rf).join(", ")}.`));let p=t.expression.split(" ")[0],u=new In(t.sourceSpan.start,t.sourceSpan.start.moveBy(p.length)),g={itemName:new Om(s,"$implicit",u,u),trackBy:null,expression:I0(t,e,d),context:Array.from(Rf,C=>{let M=new In(n.startSourceSpan.end,n.startSourceSpan.end);return new Om(C,C,M,M)})};for(let C of i){let M=C.expression.match(eJ);if(M!==null){let b=new In(C.sourceSpan.start.moveBy(M[0].length-M[1].length),C.sourceSpan.end);sJ(C.sourceSpan,M[1],b,s,g.context,o);continue}let x=C.expression.match(ZZ);if(x!==null){if(g.trackBy!==null)o.push(new dn(C.sourceSpan,'@for loop can only have one "track" expression'));else{let b=I0(C,e,x[1]);b.ast instanceof Ar&&o.push(new dn(n.startSourceSpan,'@for loop must have a "track" expression'));let P=new In(C.sourceSpan.start,C.sourceSpan.start.moveBy(5));g.trackBy={expression:b,keywordSpan:P}}continue}o.push(new dn(C.sourceSpan,`Unrecognized @for loop parameter "${C.expression}"`))}return g}function rJ(n,o,e){let t=new P3;n.ast.visit(t),t.hasPipe&&e.push(new dn(o,"Cannot use pipes in track expressions"))}function sJ(n,o,e,t,i,a){let s=o.split(","),d=e.start;for(let p of s){let u=p.split("="),g=u.length===2?u[0].trim():"",C=u.length===2?u[1].trim():"";if(g.length===0||C.length===0)a.push(new dn(n,'Invalid @for loop "let" parameter. Parameter should match the pattern " = "'));else if(!Rf.has(C))a.push(new dn(n,`Unknown "let" parameter variable "${C}". The allowed variables are: ${Array.from(Rf).join(", ")}`));else if(g===t)a.push(new dn(n,`Invalid @for loop "let" parameter. Variable cannot be called "${t}"`));else if(i.some(M=>M.name===g))a.push(new dn(n,`Duplicate "let" parameter variable "${C}"`));else{let[,M,x]=u[0].match(sN)??[],b=M!==void 0&&u.length===2?new In(d.moveBy(M.length),d.moveBy(M.length+x.length)):e,P;if(u.length===2){let[,S,O]=u[1].match(sN)??[];P=S!==void 0?new In(d.moveBy(u[0].length+1+S.length),d.moveBy(u[0].length+1+S.length+O.length)):void 0}let k=new In(b.start,P?.end??b.end);i.push(new Om(g,C,k,b,P))}d=d.moveBy(p.length+1)}}function lJ(n){let o=[],e=!1;for(let t=0;t1&&t0&&o.push(new dn(i.startSourceSpan,"@else block cannot have parameters")),e=!0):Hx.test(i.name)||o.push(new dn(i.startSourceSpan,`Unrecognized conditional block @${i.name}`))}return o}function cJ(n){let o=[],e=!1;if(n.parameters.length!==1)return o.push(new dn(n.startSourceSpan,"@switch block must have exactly one parameter")),o;for(let t of n.children)if(!(t instanceof k0||t instanceof fu&&t.value.trim().length===0)){if(!(t instanceof _l)||t.name!=="case"&&t.name!=="default"&&t.name!=="default never"){o.push(new dn(t.sourceSpan,"@switch block can only contain @case and @default blocks"));continue}t.name==="default never"?(e&&o.push(new dn(t.startSourceSpan,"@switch block can only have one @default block")),e=!0):t.name==="default"?(e?o.push(new dn(t.startSourceSpan,"@switch block can only have one @default block")):t.parameters.length>0&&o.push(new dn(t.startSourceSpan,"@default block cannot have parameters")),e=!0):t.name==="case"&&t.parameters.length!==1&&o.push(new dn(t.startSourceSpan,"@case block must have exactly one parameter"))}return o}function I0(n,o,e){let t,i;return typeof e=="string"?(t=Math.max(0,n.expression.lastIndexOf(e)),i=t+e.length):(t=0,i=n.expression.length),o.parseBinding(n.expression.slice(t,i),!1,n.sourceSpan,n.sourceSpan.start.offset+t)}function dN(n,o,e){if(n.parameters.length===0)return o.push(new dn(n.startSourceSpan,"Conditional block does not have an expression")),null;let t=I0(n.parameters[0],e),i=null;for(let a=1;a-1;d--){let p=e[d];if(p===")"){if(s=d,i--,i===0)break}else{if(t.test(p))continue;break}}return i!==0?(o.push(new dn(n.sourceSpan,"Unclosed parentheses in expression")),null):e.slice(a,s)}var P3=class extends Bg{hasPipe=!1;visitPipe(){this.hasPipe=!0}},mJ=/^\d+\.?\d*(ms|s)?$/,pJ=/^\s$/,mN=new Map([[fl,es],[Lc,Od],[ns,Ea]]),ts=(function(n){return n.IDLE="idle",n.TIMER="timer",n.INTERACTION="interaction",n.IMMEDIATE="immediate",n.HOVER="hover",n.VIEWPORT="viewport",n.NEVER="never",n})(ts||{});function uJ({expression:n,sourceSpan:o},e,t){let i=n.indexOf("never"),a=new In(o.start.moveBy(i),o.start.moveBy(i+5)),s=lT(n,o),d=cT(n,o);i===-1?t.push(new dn(o,'Could not find "never" keyword in expression')):dT("never",e,t,new OP(a,o,s,null,d))}function rP({expression:n,sourceSpan:o},e,t,i){let a=n.indexOf("when"),s=new In(o.start.moveBy(a),o.start.moveBy(a+4)),d=lT(n,o),p=cT(n,o);if(a===-1)i.push(new dn(o,'Could not find "when" keyword in expression'));else{let u=A0(n,a+1),g=e.parseBinding(n.slice(u),!1,o,o.start.offset+u);dT("when",t,i,new Kb(g,o,d,s,p))}}function sP({expression:n,sourceSpan:o},e,t,i,a){let s=n.indexOf("on"),d=new In(o.start.moveBy(s),o.start.moveBy(s+2)),p=lT(n,o),u=cT(n,o);if(s===-1)i.push(new dn(o,'Could not find "on" keyword in expression'));else{let g=A0(n,s+1),C=n.startsWith("hydrate");new T3(n,e,g,o,t,i,C?xJ:bJ,C,p,d,u).parse()}}function lT(n,o){return n.startsWith("prefetch")?new In(o.start,o.start.moveBy(8)):null}function cT(n,o){return n.startsWith("hydrate")?new In(o.start,o.start.moveBy(7)):null}var T3=class{expression;bindingParser;start;span;triggers;errors;validator;isHydrationTrigger;prefetchSpan;onSourceSpan;hydrateSpan;index=0;tokens;constructor(o,e,t,i,a,s,d,p,u,g,C){this.expression=o,this.bindingParser=e,this.start=t,this.span=i,this.triggers=a,this.errors=s,this.validator=d,this.isHydrationTrigger=p,this.prefetchSpan=u,this.onSourceSpan=g,this.hydrateSpan=C,this.tokens=new E0().tokenize(o.slice(t))}parse(){for(;this.tokens.length>0&&this.index0&&i.isCharacter(e[e.length-1])&&e.pop(),e.length===0&&i.isCharacter(Nr)&&t.length>0){o.push({expression:this.tokenRangeText(t),start:t[0].index}),this.advance(),t=[];continue}t.push(i),this.advance()}return(!this.token().isCharacter(Ea)||e.length>0)&&this.error(this.token(),"Unexpected end of expression"),this.index0)throw new Error(`"${ts.IDLE}" trigger cannot have parameters`);return new DP(o,e,t,i,a)}function hJ(n,o,e,t,i,a){if(n.length!==1)throw new Error(`"${ts.TIMER}" trigger must have exactly one parameter`);let s=Ox(n[0].expression);if(s===null)throw new Error(`Could not parse time value of trigger "${ts.TIMER}"`);return new AP(s,o,e,t,i,a)}function _J(n,o,e,t,i,a){if(n.length>0)throw new Error(`"${ts.IMMEDIATE}" trigger cannot have parameters`);return new IP(o,e,t,i,a)}function fJ(n,o,e,t,i,a,s){return s(ts.HOVER,n),new Xb(n[0]?.expression??null,o,e,t,i,a)}function vJ(n,o,e,t,i,a,s){return s(ts.INTERACTION,n),new Yb(n[0]?.expression??null,o,e,t,i,a)}function CJ(n,o,e,t,i,a,s,d,p,u){u(ts.VIEWPORT,t);let g,C;if(t.length===0)g=C=null;else if(!t[0].expression.startsWith("{"))g=t[0].expression,C=null;else{let M=e.parseBinding(t[0].expression,!1,a,a.start.offset+n+t[0].start);if(M.ast instanceof du){if(M.ast.keys.some(b=>b.kind==="spread"))throw new Error("Spread operator are not allowed in this context");if(M.ast.keys.some(b=>b.kind==="property"&&b.key==="root"))throw new Error('The "root" option is not supported in the options parameter of the "viewport" trigger')}else throw new Error('Options parameter of the "viewport" trigger must be an object literal');let x=M.ast.keys.findIndex(b=>b.kind==="property"&&b.key==="trigger");if(x===-1)g=null,C=M.ast;else{let b=M.ast.values[x],P=(k,S)=>S!==x;if(!(b instanceof zc)||!(b.receiver instanceof Hc))throw new Error('"trigger" option of the "viewport" trigger must be an identifier');g=b.name,C=new du(M.ast.span,M.ast.sourceSpan,M.ast.keys.filter(P),M.ast.values.filter(P))}}if(o&&g!==null)throw new Error('"viewport" hydration trigger cannot have a "trigger"');if(C){let M=E3.findDynamicNode(C);if(M!==null)throw new Error(`Options of the "viewport" trigger must be an object literal containing only literal values, but "${M.constructor.name}" was found`)}return new i0(g,C,i,a,s,d,p)}function bJ(n,o){if(o.length>1)throw new Error(`"${n}" trigger can only have zero or one parameters`)}function xJ(n,o){if(n===ts.VIEWPORT){if(o.length>1)throw new Error(`Hydration trigger "${n}" cannot have more than one parameter`);return}if(o.length>0)throw new Error(`Hydration trigger "${n}" cannot have parameters`)}function A0(n,o=0){let e=!1;for(let t=o;t0){let P=o[o.length-1];C=P.endSourceSpan,M=P.sourceSpan.end}let x=new In(n.sourceSpan.start,M);return{node:new mu(ko(e,n.children,n.children),p,u,g,a,s,d,n.nameSpan,x,n.sourceSpan,n.startSourceSpan,C,n.i18n),errors:i}}function DJ(n,o,e){let t=null,i=null,a=null;for(let s of n)try{if(!O3(s.name)){o.push(new dn(s.startSourceSpan,`Unrecognized block "@${s.name}"`));break}switch(s.name){case"placeholder":t!==null?o.push(new dn(s.startSourceSpan,"@defer block can only have one @placeholder block")):t=IJ(s,e);break;case"loading":i!==null?o.push(new dn(s.startSourceSpan,"@defer block can only have one @loading block")):i=AJ(s,e);break;case"error":a!==null?o.push(new dn(s.startSourceSpan,"@defer block can only have one @error block")):a=NJ(s,e);break}}catch(d){o.push(new dn(s.startSourceSpan,d.message))}return{placeholder:t,loading:i,error:a}}function IJ(n,o){let e=null;for(let t of n.parameters)if(WF.test(t.expression)){if(e!=null)throw new Error('@placeholder block can only have one "minimum" parameter');let i=Ox(t.expression.slice(A0(t.expression)));if(i===null)throw new Error('Could not parse time value of parameter "minimum"');e=i}else throw new Error(`Unrecognized parameter in @placeholder block: "${t.expression}"`);return new o0(ko(o,n.children,n.children),e,n.nameSpan,n.sourceSpan,n.startSourceSpan,n.endSourceSpan,n.i18n)}function AJ(n,o){let e=null,t=null;for(let i of n.parameters)if(PJ.test(i.expression)){if(e!=null)throw new Error('@loading block can only have one "after" parameter');let a=Ox(i.expression.slice(A0(i.expression)));if(a===null)throw new Error('Could not parse time value of parameter "after"');e=a}else if(WF.test(i.expression)){if(t!=null)throw new Error('@loading block can only have one "minimum" parameter');let a=Ox(i.expression.slice(A0(i.expression)));if(a===null)throw new Error('Could not parse time value of parameter "minimum"');t=a}else throw new Error(`Unrecognized parameter in @loading block: "${i.expression}"`);return new a0(ko(o,n.children,n.children),e,t,n.nameSpan,n.sourceSpan,n.startSourceSpan,n.endSourceSpan,n.i18n)}function NJ(n,o){if(n.parameters.length>0)throw new Error("@error block cannot have parameters");return new r0(ko(o,n.children,n.children),n.nameSpan,n.sourceSpan,n.startSourceSpan,n.endSourceSpan,n.i18n)}function FJ(n,o,e,t){let i={},a={},s={};for(let d of n.parameters)TJ.test(d.expression)?rP(d,o,i,e):EJ.test(d.expression)?sP(d,o,i,e):yJ.test(d.expression)?rP(d,o,a,e):wJ.test(d.expression)?sP(d,o,a,e):MJ.test(d.expression)?rP(d,o,s,e):SJ.test(d.expression)?sP(d,o,s,e):kJ.test(d.expression)?uJ(d,s,e):e.push(new dn(d.sourceSpan,"Unrecognized trigger"));return s.never&&Object.keys(s).length>1&&e.push(new dn(n.startSourceSpan,"Cannot specify additional `hydrate` triggers if `hydrate never` is present")),{triggers:i,prefetchTriggers:a,hydrateTriggers:s}}var RJ=/^(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.*)$/,pN=1,uN=2,gN=3,hN=4,_N=5,zJ=6,xf=7,bm={BANANA_BOX:{start:"[(",end:")]"},PROPERTY:{start:"[",end:"]"},EVENT:{start:"(",end:")"}},lP="*",LJ=new Set(["link","style","script","ng-template","ng-container","ng-content"]),VJ=new Set(["ngProjectAs","ngNonBindable"]);function BJ(n,o,e){let t=new D3(o,e),i=ko(t,n,n),a=o.errors.concat(t.errors),s={nodes:i,errors:a,styleUrls:t.styleUrls,styles:t.styles,ngContentSelectors:t.ngContentSelectors};return e.collectCommentNodes&&(s.commentNodes=t.commentNodes),s}var D3=class{bindingParser;options;errors=[];styles=[];styleUrls=[];ngContentSelectors=[];commentNodes=[];inI18nBlock=!1;processedNodes=new Set;constructor(o,e){this.bindingParser=o,this.options=e}visitElement(o){let e=Sb(o.i18n);e&&(this.inI18nBlock&&this.reportError("Cannot mark an element as translatable inside of a translatable section. Please remove the nested i18n marker.",o.sourceSpan),this.inI18nBlock=!0);let t=UF(o);if(t.type===Gs.SCRIPT)return null;if(t.type===Gs.STYLE){let S=jJ(o);return S!==null&&this.styles.push(S),null}else if(t.type===Gs.STYLESHEET&&BZ(t.hrefAttr))return this.styleUrls.push(t.hrefAttr),null;let i=jU(o.name),{attributes:a,boundEvents:s,references:d,variables:p,templateVariables:u,elementHasInlineTemplate:g,parsedProperties:C,templateParsedProperties:M,i18nAttrsMeta:x}=this.prepareAttributes(o.attrs,i),b=this.extractDirectives(o),P;t.nonBindable?P=ko(fN,o.children).flat(1/0):P=ko(this,o.children,o.children);let k;if(t.type===Gs.NG_CONTENT){let S=t.selectAttr,O=o.attrs.map(A=>this.visitAttribute(A));k=new Ug(S,O,P,o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,o.i18n),this.ngContentSelectors.push(S)}else if(i){let S=this.categorizePropertyAttributes(o.name,C,x);k=new Qs(o.name,a,S.bound,s,b,[],P,d,p,o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,o.i18n)}else{let S=this.categorizePropertyAttributes(o.name,C,x);if(o.name==="ng-container")for(let O of S.bound)O.type===Fi.Attribute&&this.reportError("Attribute bindings are not supported on ng-container. Use property bindings instead.",O.sourceSpan);k=new Uc(o.name,a,S.bound,s,b,P,d,o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,o.isVoid,o.i18n)}return g&&(k=this.wrapInTemplate(k,M,u,x,i,e)),e&&(this.inI18nBlock=!1),k}visitAttribute(o){return new $g(o.name,o.value,o.sourceSpan,o.keySpan,o.valueSpan,o.i18n)}visitText(o){return this.processedNodes.has(o)?null:this._visitTextWithInterpolation(o.value,o.sourceSpan,o.tokens,o.i18n)}visitExpansion(o){if(!o.i18n)return null;if(!Sb(o.i18n))throw new Error(`Invalid type "${o.i18n.constructor}" for "i18n" property of ${o.sourceSpan.toString()}. Expected a "Message"`);let e=o.i18n,t={},i={};return Object.keys(e.placeholders).forEach(a=>{let s=e.placeholders[a];if(a.startsWith(WU)){let d=a.trim(),p=this.bindingParser.parseInterpolationExpression(s.text,s.sourceSpan);t[d]=new jg(p,s.sourceSpan)}else i[a]=this._visitTextWithInterpolation(s.text,s.sourceSpan,null)}),new FN(t,i,o.sourceSpan,e)}visitExpansionCase(o){return null}visitComment(o){return this.options.collectCommentNodes&&this.commentNodes.push(new Rx(o.value||"",o.sourceSpan)),null}visitLetDeclaration(o,e){let t=this.bindingParser.parseBinding(o.value,!1,o.valueSpan,o.valueSpan.start.offset);return t.errors.length===0&&t.ast instanceof Ar&&this.reportError("@let declaration value cannot be empty",o.valueSpan),new q3(o.name,t,o.sourceSpan,o.nameSpan,o.valueSpan)}visitComponent(o){let e=Sb(o.i18n);if(e&&(this.inI18nBlock&&this.reportError("Cannot mark a component as translatable inside of a translatable section. Please remove the nested i18n marker.",o.sourceSpan),this.inI18nBlock=!0),o.tagName!==null&&LJ.has(o.tagName))return this.reportError(`Tag name "${o.tagName}" cannot be used as a component tag`,o.startSourceSpan),null;let{attributes:t,boundEvents:i,references:a,templateVariables:s,elementHasInlineTemplate:d,parsedProperties:p,templateParsedProperties:u,i18nAttrsMeta:g}=this.prepareAttributes(o.attrs,!1);this.validateSelectorlessReferences(a);let C=this.extractDirectives(o),M;o.attrs.find(P=>P.name==="ngNonBindable")?M=ko(fN,o.children).flat(1/0):M=ko(this,o.children,o.children);let x=this.categorizePropertyAttributes(o.tagName,p,g),b=new Ef(o.componentName,o.tagName,o.fullName,t,x.bound,i,C,M,a,o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,o.i18n);return d&&(b=this.wrapInTemplate(b,u,s,g,!1,e)),e&&(this.inI18nBlock=!1),b}visitDirective(){return null}visitBlockParameter(){return null}visitBlock(o,e){let t=Array.isArray(e)?e.indexOf(o):-1;if(t===-1)throw new Error("Visitor invoked incorrectly. Expecting visitBlock to be invoked siblings array as its context");if(this.processedNodes.has(o))return null;let i=null;switch(o.name){case"defer":i=OJ(o,this.findConnectedBlocks(t,e,O3),this,this.bindingParser);break;case"switch":i=oJ(o,this,this.bindingParser);break;case"for":i=iJ(o,this.findConnectedBlocks(t,e,lN),this,this.bindingParser);break;case"if":i=nJ(o,this.findConnectedBlocks(t,e,cN),this,this.bindingParser);break;default:let a;O3(o.name)?(a=`@${o.name} block can only be used after an @defer block.`,this.processedNodes.add(o)):lN(o.name)?(a=`@${o.name} block can only be used after an @for block.`,this.processedNodes.add(o)):cN(o.name)?(a=`@${o.name} block can only be used after an @if or @else if block.`,this.processedNodes.add(o)):a=`Unrecognized block @${o.name}.`,i={node:new ex(o.name,o.sourceSpan,o.nameSpan),errors:[new dn(o.sourceSpan,a)]};break}return this.errors.push(...i.errors),i.node}findConnectedBlocks(o,e,t){let i=[];for(let a=o+1;a{let d=t[s.name];if(s.isLiteral)a.push(new $g(s.name,s.expression.source||"",s.sourceSpan,s.keySpan,s.valueSpan,d));else{let p=s.name.toLowerCase().startsWith("attr.on"),u=this.bindingParser.createBoundElementProperty(o,s,!p,!1);i.push(TP.fromBoundElementProperty(u,d))}}),{bound:i,literal:a}}prepareAttributes(o,e){let t=[],i=[],a=[],s=[],d=[],p={},u=[],g=[],C=!1;for(let M of o){let x=!1,b=vN(M.name),P=!1;if(M.i18n&&(p[M.name]=M.i18n),b.startsWith(lP)){C&&this.reportError("Can't have multiple template bindings on one element. Use only one attribute prefixed with *",M.sourceSpan),P=!0,C=!0;let k=M.value,S=b.substring(lP.length),O=[],A=M.valueSpan?M.valueSpan.fullStart.offset:M.sourceSpan.fullStart.offset+M.name.length;this.bindingParser.parseInlineTemplateBinding(S,k,M.sourceSpan,A,[],u,O,!0),g.push(...O.map(D=>new Om(D.name,D.value,D.sourceSpan,D.keySpan,D.valueSpan)))}else x=this.parseAttribute(e,M,[],t,i,a,s);!x&&!P&&d.push(this.visitAttribute(M))}return{attributes:d,boundEvents:i,references:s,variables:a,templateVariables:g,elementHasInlineTemplate:C,parsedProperties:t,templateParsedProperties:u,i18nAttrsMeta:p}}parseAttribute(o,e,t,i,a,s,d){let p=vN(e.name),u=e.value,g=e.sourceSpan,C=e.valueSpan?e.valueSpan.fullStart.offset:g.fullStart.offset;function M(S,O,A){let D=e.name.length-p.length,F=S.start.moveBy(O.length+D),I=F.moveBy(A.length);return new In(F,I,F,A)}let x=p.match(RJ);if(x){if(x[pN]!=null){let S=x[xf],O=M(g,x[pN],S);this.bindingParser.parsePropertyBinding(S,u,!1,!1,g,C,e.valueSpan,t,i,O)}else if(x[uN])if(o){let S=x[xf],O=M(g,x[uN],S);this.parseVariable(S,u,g,O,e.valueSpan,s)}else this.reportError('"let-" is only supported on ng-template elements.',g);else if(x[gN]){let S=x[xf],O=M(g,x[gN],S);this.parseReference(S,u,g,O,e.valueSpan,d)}else if(x[hN]){let S=[],O=x[xf],A=M(g,x[hN],O);this.bindingParser.parseEvent(O,u,!1,g,e.valueSpan||g,t,S,A),cP(S,a)}else if(x[_N]){let S=x[xf],O=M(g,x[_N],S);this.bindingParser.parsePropertyBinding(S,u,!1,!0,g,C,e.valueSpan,t,i,O),this.parseAssignmentEvent(S,u,g,e.valueSpan,t,a,O,C)}else if(x[zJ]){let S=M(g,"",p);this.bindingParser.parseLiteralAttr(p,u,g,C,e.valueSpan,t,i,S)}return!0}let b=null;if(p.startsWith(bm.BANANA_BOX.start)?b=bm.BANANA_BOX:p.startsWith(bm.PROPERTY.start)?b=bm.PROPERTY:p.startsWith(bm.EVENT.start)&&(b=bm.EVENT),b!==null&&p.endsWith(b.end)&&p.length>b.start.length+b.end.length){let S=p.substring(b.start.length,p.length-b.end.length),O=M(g,b.start,S);if(b.start===bm.BANANA_BOX.start)this.bindingParser.parsePropertyBinding(S,u,!1,!0,g,C,e.valueSpan,t,i,O),this.parseAssignmentEvent(S,u,g,e.valueSpan,t,a,O,C);else if(b.start===bm.PROPERTY.start)this.bindingParser.parsePropertyBinding(S,u,!1,!1,g,C,e.valueSpan,t,i,O);else{let A=[];this.bindingParser.parseEvent(S,u,!1,g,e.valueSpan||g,t,A,O),cP(A,a)}return!0}let P=M(g,"",p);return this.bindingParser.parsePropertyInterpolation(p,u,g,e.valueSpan,t,i,P,e.valueTokens??null)}extractDirectives(o){let e=o instanceof Jr?o.tagName:o.name,t=[],i=new Set;for(let a of o.directives){let s=!1;for(let x of a.attrs)x.name.startsWith(lP)?(s=!0,this.reportError(`Shorthand template syntax "${x.name}" is not supported inside a directive context`,x.sourceSpan)):VJ.has(x.name)&&(s=!0,this.reportError(`Attribute "${x.name}" is not supported in a directive context`,x.sourceSpan));if(!s&&i.has(a.name)&&(s=!0,this.reportError(`Cannot apply directive "${a.name}" multiple times on the same element`,a.sourceSpan)),s)continue;let{attributes:d,parsedProperties:p,boundEvents:u,references:g,i18nAttrsMeta:C}=this.prepareAttributes(a.attrs,!1);this.validateSelectorlessReferences(g);let{bound:M}=this.categorizePropertyAttributes(e,p,C);for(let x of M)x.type!==Fi.Property&&x.type!==Fi.TwoWay&&(s=!0,this.reportError("Binding is not supported in a directive context",x.sourceSpan));s||(i.add(a.name),t.push(new NN(a.name,d,M,u,g,a.sourceSpan,a.startSourceSpan,a.endSourceSpan,void 0)))}return t}filterAnimationAttributes(o){return o.filter(e=>!e.name.startsWith("animate."))}filterAnimationInputs(o){return o.filter(e=>e.type!==Fi.Animation)}wrapInTemplate(o,e,t,i,a,s){let d=this.categorizePropertyAttributes("ng-template",e,i),p=[];d.literal.forEach(M=>p.push(M)),d.bound.forEach(M=>p.push(M));let u={attributes:[],inputs:[],outputs:[]};(o instanceof Uc||o instanceof Ef)&&(u.attributes.push(...this.filterAnimationAttributes(o.attributes)),u.inputs.push(...this.filterAnimationInputs(o.inputs)),u.outputs.push(...o.outputs));let g=a&&s?void 0:o.i18n,C;return o instanceof Ef?C=o.tagName:o instanceof Qs?C=null:C=o.name,new Qs(C,u.attributes,u.inputs,u.outputs,[],p,[o],[],t,!1,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,g)}_visitTextWithInterpolation(o,e,t,i){let a=yF(o),s=this.bindingParser.parseInterpolation(a,e,t);return s?new jg(s,e,i):new Qp(a,e)}parseVariable(o,e,t,i,a,s){o.indexOf("-")>-1?this.reportError('"-" is not allowed in variable names',t):o.length===0&&this.reportError("Variable does not have a name",t),s.push(new Om(o,e,t,i,a))}parseReference(o,e,t,i,a,s){o.indexOf("-")>-1?this.reportError('"-" is not allowed in reference names',t):o.length===0?this.reportError("Reference does not have a name",t):s.some(d=>d.name===o)&&this.reportError(`Reference "#${o}" is defined more than once`,t),s.push(new c0(o,e,t,i,a))}parseAssignmentEvent(o,e,t,i,a,s,d,p){let u=[];this.bindingParser.parseEvent(`${o}Change`,e,!0,t,i||t,a,u,d),cP(u,s)}validateSelectorlessReferences(o){if(o.length===0)return;let e=new Set;for(let t of o)t.value.length>0?this.reportError("Cannot specify a value for a local reference in this context",t.valueSpan||t.sourceSpan):e.has(t.name)?this.reportError("Duplicate reference names are not allowed",t.sourceSpan):e.add(t.name)}reportError(o,e,t=Sm.ERROR){this.errors.push(new dn(e,o,t))}},I3=class{visitElement(o){let e=UF(o);if(e.type===Gs.SCRIPT||e.type===Gs.STYLE||e.type===Gs.STYLESHEET)return null;let t=ko(this,o.children,null);return new Uc(o.name,ko(this,o.attrs),[],[],[],t,[],o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,o.isVoid)}visitComment(o){return null}visitAttribute(o){return new $g(o.name,o.value,o.sourceSpan,o.keySpan,o.valueSpan,o.i18n)}visitText(o){return new Qp(o.value,o.sourceSpan)}visitExpansion(o){return null}visitExpansionCase(o){return null}visitBlock(o,e){let t=[new Qp(o.startSourceSpan.toString(),o.startSourceSpan),...ko(this,o.children)];return o.endSourceSpan!==null&&t.push(new Qp(o.endSourceSpan.toString(),o.endSourceSpan)),t}visitBlockParameter(o,e){return null}visitLetDeclaration(o,e){return new Qp(`@let ${o.name} = ${o.value};`,o.sourceSpan)}visitComponent(o,e){let t=ko(this,o.children,null);return new Uc(o.fullName,ko(this,o.attrs),[],[],[],t,[],o.isSelfClosing,o.sourceSpan,o.startSourceSpan,o.endSourceSpan,!1)}visitDirective(o,e){return null}},fN=new I3;function vN(n){return/^data-/i.test(n)?n.substring(5):n}function cP(n,o){o.push(...n.map(e=>EP.fromParsedEvent(e)))}function jJ(n){return n.children.length!==1||!(n.children[0]instanceof fu)?null:n.children[0].value}var $J=[" ",` +`,"\r"," "];function HJ(n,o,e={}){let{preserveWhitespaces:t,enableI18nLegacyMessageIdFormat:i}=e,a=e.enableSelectorless??!1,s=Dx(a),p=new S3().parse(n,o,ze(q({leadingTriviaChars:$J},e),{tokenizeExpansionForms:!0,tokenizeBlocks:e.enableBlockSyntax??!0,tokenizeLet:e.enableLetSyntax??!0,selectorlessEnabled:a}));if(!e.alwaysAttemptHtmlToR3AstConversion&&p.errors&&p.errors.length>0){let D={preserveWhitespaces:t,errors:p.errors,nodes:[],styleUrls:[],styles:[],ngContentSelectors:[]};return e.collectCommentNodes&&(D.commentNodes=[]),D}let u=p.rootNodes,g=!(e.preserveSignificantWhitespace??!0),C=new Sx(!t,i,e.preserveSignificantWhitespace,g),M=C.visitAllWithErrors(u);if(!e.alwaysAttemptHtmlToR3AstConversion&&M.errors&&M.errors.length>0){let D={preserveWhitespaces:t,errors:M.errors,nodes:[],styleUrls:[],styles:[],ngContentSelectors:[]};return e.collectCommentNodes&&(D.commentNodes=[]),D}u=M.rootNodes,t||(u=ko(new wx(!0,void 0,!1),u),C.hasI18nMeta&&(u=ko(new Sx(!1,void 0,!0,g),u)));let{nodes:x,errors:b,styleUrls:P,styles:k,ngContentSelectors:S,commentNodes:O}=BJ(u,s,{collectCommentNodes:!!e.collectCommentNodes});b.push(...p.errors,...M.errors);let A={preserveWhitespaces:t,errors:b.length>0?b:null,nodes:x,styleUrls:P,styles:k,ngContentSelectors:S};return e.collectCommentNodes&&(A.commentNodes=O),A}var UJ=new Yg;function Dx(n=!1){return new y3(new Mx(new E0,n),UJ,[])}var GF="%COMP%",WJ=`_nghost-${GF}`,GJ=`_ngcontent-${GF}`;function qF(n,o,e){let t=new Am,i=H3(n.selector);return t.set("type",n.type.value),i.length>0&&t.set("selectors",kg(i)),n.queries.length>0&&t.set("contentQueries",VZ(n.queries,o,n.name)),n.viewQueries.length&&t.set("viewQuery",LZ(n.viewQueries,o,n.name)),t.set("hostBindings",eee(n.host,n.typeSourceSpan,e,o,n.selector||"",n.name,t)),t.set("inputs",q5(n.inputs,!0)),t.set("outputs",q5(n.outputs)),n.exportAs!==null&&t.set("exportAs",io(n.exportAs.map(a=>De(a)))),n.isStandalone===!1&&t.set("standalone",De(!1)),n.isSignal&&t.set("signals",De(!0)),t}function QF(n,o){let e=[],t=o.providers,i=o.viewProviders;if(t||i){let a=[t||new $c([])];i&&a.push(i),e.push(Ht(ge.ProvidersFeature).callFn(a))}if(o.hostDirectives?.length&&e.push(Ht(ge.HostDirectivesFeature).callFn([aee(o.hostDirectives)])),o.usesInheritance&&e.push(Ht(ge.InheritDefinitionFeature)),o.lifecycle.usesOnChanges&&e.push(Ht(ge.NgOnChangesFeature)),o.controlCreate!==null&&e.push(Ht(ge.ControlFeature).callFn([De(o.controlCreate.passThroughInput)])),"externalStyles"in o&&o.externalStyles?.length){let a=o.externalStyles.map(s=>De(s));e.push(Ht(ge.ExternalStylesFeature).callFn([io(a)]))}e.length&&n.set("features",io(e))}function qJ(n,o,e){let t=qF(n,o,e);QF(t,n);let i=Ht(ge.defineDirective).callFn([t.toLiteralMap()],void 0,!0),a=JJ(n);return{expression:i,type:a,statements:[]}}function QJ(n,o,e){let t=qF(n,o,e);QF(t,n);let i=n.selector&&Ag.parse(n.selector),a=i&&i[0];if(a){let b=a.getAttrs();b.length&&t.set("attrs",o.getConstLiteral(io(b.map(P=>P!=null?De(P):De(void 0))),!0))}let s=n.name,d=null;if(n.defer.mode===1&&n.defer.dependenciesFn!==null){let b=`${s}_DeferFn`;o.statements.push(new Ga(b,n.defer.dependenciesFn,void 0,ur.Final)),d=di(b)}let p=n.isStandalone&&!n.hasDirectiveDependencies?vs.DomOnly:vs.Full,u=uZ(n.name,n.template.nodes,o,p,n.relativeContextFilePath,n.i18nUseExternalIds,n.defer,d,n.relativeTemplatePath,FZ());NF(u,Dt.Tmpl);let g=aZ(u,o);if(u.contentSelectors!==null&&t.set("ngContentSelectors",u.contentSelectors),t.set("decls",De(u.root.decls)),t.set("vars",De(u.root.vars)),u.consts.length>0&&(u.constsInitializers.length>0?t.set("consts",Ys([],[...u.constsInitializers,new Ia(io(u.consts))])):t.set("consts",io(u.consts))),t.set("template",g),n.declarationListEmitMode!==3&&n.declarations.length>0)t.set("dependencies",XJ(io(n.declarations.map(b=>b.type)),n.declarationListEmitMode));else if(n.declarationListEmitMode===3){let b=[n.type.value];n.rawImports&&b.push(n.rawImports),t.set("dependencies",Ht(ge.getComponentDepsFactory).callFn(b))}n.encapsulation===null&&(n.encapsulation=$p.Emulated);let C=!!n.externalStyles?.length;if(n.styles&&n.styles.length){let P=(n.encapsulation==$p.Emulated?oee(n.styles,GJ,WJ):n.styles).reduce((k,S)=>(S.trim().length>0&&k.push(o.getConstLiteral(De(S))),k),[]);P.length>0&&(C=!0,t.set("styles",io(P)))}!C&&n.encapsulation===$p.Emulated&&(n.encapsulation=$p.None),n.encapsulation!==$p.Emulated&&t.set("encapsulation",De(n.encapsulation)),n.animations!==null&&t.set("data",yl([{key:"animation",value:n.animations,quoted:!1}])),n.changeDetection!==null&&(typeof n.changeDetection=="number"&&n.changeDetection!==$3.Default?t.set("changeDetection",De(n.changeDetection)):typeof n.changeDetection=="object"&&t.set("changeDetection",n.changeDetection));let M=Ht(ge.defineComponent).callFn([t.toLiteralMap()],void 0,!0),x=KJ(n);return{expression:M,type:x,statements:[]}}function KJ(n){let o=KF(n);return o.push(N3(n.template.ngContentSelectors)),o.push(gr(De(n.isStandalone))),o.push(XF(n)),n.isSignal&&o.push(gr(De(n.isSignal))),gr(Ht(ge.ComponentDeclaration,o))}function XJ(n,o){switch(o){case 0:return n;case 1:return Ys([],n);case 2:let e=n.prop("map").callFn([Ht(ge.resolveForwardRef)]);return Ys([],e);case 3:throw new Error("Unsupported with an array of pre-resolved dependencies")}}function YJ(n){return gr(De(n))}function A3(n){let o=Object.keys(n).map(e=>{let t=Array.isArray(n[e])?n[e][0]:n[e];return{key:e,value:De(t),quoted:!0}});return yl(o)}function N3(n){return n.length>0?gr(io(n.map(o=>De(o)))):Bc}function KF(n){let o=n.selector!==null?n.selector.replace(/\n/g,""):null;return[Fx(n.type.type,n.typeArgumentCount),o!==null?YJ(o):Bc,n.exportAs!==null?N3(n.exportAs):Bc,gr(ZJ(n)),gr(A3(n.outputs)),N3(n.queries.map(e=>e.propertyName))]}function ZJ(n){return yl(Object.keys(n.inputs).map(o=>{let e=n.inputs[o],t=[{key:"alias",value:De(e.bindingPropertyName),quoted:!0},{key:"required",value:De(e.required),quoted:!0}];return e.isSignal&&t.push({key:"isSignal",value:De(e.isSignal),quoted:!0}),{key:o,value:yl(t),quoted:!0}}))}function JJ(n){let o=KF(n);return o.push(Bc),o.push(gr(De(n.isStandalone))),o.push(XF(n)),n.isSignal&&o.push(gr(De(n.isSignal))),gr(Ht(ge.DirectiveDeclaration,o))}function eee(n,o,e,t,i,a,s){let d=e.createBoundHostProperties(n.properties,o),p=e.createDirectiveHostEventAsts(n.listeners,o);n.specialAttributes.styleAttr&&(n.attributes.style=De(n.specialAttributes.styleAttr)),n.specialAttributes.classAttr&&(n.attributes.class=De(n.specialAttributes.classAttr));let u=gZ({componentName:a,componentSelector:i,properties:d,events:p,attributes:n.attributes},e,t);NF(u,Dt.Host),s.set("hostAttrs",u.root.attributes);let g=u.root.vars;return g!==null&&g>0&&s.set("hostVars",De(g)),rZ(u)}function tee(n){let o={},e={},t={},i={};for(let a of Object.keys(n)){let s=n[a];if(a.startsWith("(")&&a.endsWith(")")){if(typeof s!="string")throw new Error("Event binding must be string");e[a.slice(1,-1)]=s}else if(a.startsWith("[")&&a.endsWith("]")){if(typeof s!="string")throw new Error("Property binding must be string");t[a.slice(1,-1)]=s}else switch(a){case"class":if(typeof s!="string")throw new Error("Class binding must be string");i.classAttr=s;break;case"style":if(typeof s!="string")throw new Error("Style binding must be string");i.styleAttr=s;break;default:typeof s=="string"?o[a]=De(s):o[a]=s}}return{attributes:o,listeners:e,properties:t,specialAttributes:i}}function nee(n,o){let e=Dx();return e.createDirectiveHostEventAsts(n.listeners,o),e.createBoundHostProperties(n.properties,o),iee(n,e,o),e.errors}function iee(n,o,e){for(let t in n.properties){let i=t.startsWith("attr."),a=i?t.slice(5):t;if(a.toLowerCase().startsWith("on")){let s=i?"attribute":"property",d=`(${a.slice(2)})=...`,p=`Binding to event ${s} '${a}' is disallowed for security reasons, please use ${d}`;i||(p+=` +If '${t}' is a directive input, make sure the directive is imported by the current module.`),o.errors.push(new dn(e,p))}}}function oee(n,o,e){let t=new UP;return n.map(i=>t.shimCssText(i,o,e))}function XF(n){return n.hostDirectives?.length?gr(io(n.hostDirectives.map(o=>yl([{key:"directive",value:N0(o.directive.type),quoted:!1},{key:"inputs",value:A3(o.inputs||{}),quoted:!1},{key:"outputs",value:A3(o.outputs||{}),quoted:!1}])))):Bc}function aee(n){let o=[],e=!1;for(let t of n){if(!t.inputs&&!t.outputs)o.push(t.directive.type);else{let i=[{key:"directive",value:t.directive.type,quoted:!1}];if(t.inputs){let a=CN(t.inputs);a&&i.push({key:"inputs",value:a,quoted:!1})}if(t.outputs){let a=CN(t.outputs);a&&i.push({key:"outputs",value:a,quoted:!1})}o.push(yl(i))}t.isForwardReference&&(e=!0)}return e?new Pm([],[new Ia(io(o))]):io(o)}function CN(n){let o=[];for(let e in n)n.hasOwnProperty(e)&&o.push(De(e),De(n[e]));return o.length>0?io(o):null}var F3=class extends Bg{visit(o){o instanceof xs?this.visit(o.ast):o.visit(this)}visitElement(o){this.visitAllTemplateNodes(o.attributes),this.visitAllTemplateNodes(o.inputs),this.visitAllTemplateNodes(o.outputs),this.visitAllTemplateNodes(o.directives),this.visitAllTemplateNodes(o.references),this.visitAllTemplateNodes(o.children)}visitTemplate(o){this.visitAllTemplateNodes(o.attributes),this.visitAllTemplateNodes(o.inputs),this.visitAllTemplateNodes(o.outputs),this.visitAllTemplateNodes(o.directives),this.visitAllTemplateNodes(o.templateAttrs),this.visitAllTemplateNodes(o.variables),this.visitAllTemplateNodes(o.references),this.visitAllTemplateNodes(o.children)}visitContent(o){this.visitAllTemplateNodes(o.children)}visitBoundAttribute(o){this.visit(o.value)}visitBoundEvent(o){this.visit(o.handler)}visitBoundText(o){this.visit(o.value)}visitIcu(o){Object.keys(o.vars).forEach(e=>this.visit(o.vars[e])),Object.keys(o.placeholders).forEach(e=>this.visit(o.placeholders[e]))}visitDeferredBlock(o){o.visitAll(this)}visitDeferredTrigger(o){o instanceof Kb?this.visit(o.value):o instanceof i0&&o.options!==null&&this.visit(o.options)}visitDeferredBlockPlaceholder(o){this.visitAllTemplateNodes(o.children)}visitDeferredBlockError(o){this.visitAllTemplateNodes(o.children)}visitDeferredBlockLoading(o){this.visitAllTemplateNodes(o.children)}visitSwitchBlock(o){this.visit(o.expression),this.visitAllTemplateNodes(o.groups)}visitSwitchBlockCase(o){o.expression&&this.visit(o.expression)}visitSwitchBlockCaseGroup(o){this.visitAllTemplateNodes(o.cases),this.visitAllTemplateNodes(o.children)}visitSwitchExhaustiveCheck(o){}visitForLoopBlock(o){o.item.visit(this),this.visitAllTemplateNodes(o.contextVariables),this.visit(o.expression),this.visitAllTemplateNodes(o.children),o.empty?.visit(this)}visitForLoopBlockEmpty(o){this.visitAllTemplateNodes(o.children)}visitIfBlock(o){this.visitAllTemplateNodes(o.branches)}visitIfBlockBranch(o){o.expression&&this.visit(o.expression),o.expressionAlias?.visit(this),this.visitAllTemplateNodes(o.children)}visitLetDeclaration(o){this.visit(o.value)}visitComponent(o){this.visitAllTemplateNodes(o.attributes),this.visitAllTemplateNodes(o.inputs),this.visitAllTemplateNodes(o.outputs),this.visitAllTemplateNodes(o.directives),this.visitAllTemplateNodes(o.references),this.visitAllTemplateNodes(o.children)}visitDirective(o){this.visitAllTemplateNodes(o.attributes),this.visitAllTemplateNodes(o.inputs),this.visitAllTemplateNodes(o.outputs),this.visitAllTemplateNodes(o.references)}visitVariable(o){}visitReference(o){}visitTextAttribute(o){}visitText(o){}visitUnknownBlock(o){}visitAllTemplateNodes(o){for(let e of o)this.visit(e)}};var R3=class{directiveMatcher;constructor(o){this.directiveMatcher=o}bind(o){if(!o.template&&!o.host)throw new Error("Empty bound targets are not supported");let e=new Map,t=[],i=new Set,a=new Map,s=new Map,d=new Map,p=new Map,u=new Map,g=new Map,C=new Set,M=new Set,x=[];if(o.template){let b=Ix.apply(o.template);ree(b,d),z3.apply(o.template,this.directiveMatcher,e,t,i,a,s),Ax.applyWithScope(o.template,b,p,u,g,C,M,x)}return o.host&&(e.set(o.host.node,o.host.directives),Ax.applyWithScope(o.host.node,Ix.apply(o.host.node),p,u,g,C,M,x)),new L3(o,e,t,i,a,s,p,u,g,d,C,M,x)}},Ix=class n{parentScope;rootNode;namedEntities=new Map;elementLikeInScope=new Set;childScopes=new Map;isDeferred;constructor(o,e){this.parentScope=o,this.rootNode=e,this.isDeferred=o!==null&&o.isDeferred?!0:e instanceof mu}static newRootScope(){return new n(null,null)}static apply(o){let e=n.newRootScope();return e.ingest(o),e}ingest(o){o instanceof Qs?(o.variables.forEach(e=>this.visitVariable(e)),o.children.forEach(e=>e.visit(this))):o instanceof Yp?(o.expressionAlias!==null&&this.visitVariable(o.expressionAlias),o.children.forEach(e=>e.visit(this))):o instanceof Hg?(this.visitVariable(o.item),o.contextVariables.forEach(e=>this.visitVariable(e)),o.children.forEach(e=>e.visit(this))):o instanceof s0||o instanceof l0||o instanceof mu||o instanceof r0||o instanceof o0||o instanceof a0||o instanceof Ug?o.children.forEach(e=>e.visit(this)):o instanceof d0||o.forEach(e=>e.visit(this))}visitElement(o){this.visitElementLike(o)}visitTemplate(o){o.directives.forEach(e=>e.visit(this)),o.references.forEach(e=>this.visitReference(e)),this.ingestScopedNode(o)}visitVariable(o){this.maybeDeclare(o)}visitReference(o){this.maybeDeclare(o)}visitDeferredBlock(o){this.ingestScopedNode(o),o.placeholder?.visit(this),o.loading?.visit(this),o.error?.visit(this)}visitDeferredBlockPlaceholder(o){this.ingestScopedNode(o)}visitDeferredBlockError(o){this.ingestScopedNode(o)}visitDeferredBlockLoading(o){this.ingestScopedNode(o)}visitSwitchBlock(o){o.groups.forEach(e=>e.visit(this))}visitSwitchBlockCase(o){}visitSwitchBlockCaseGroup(o){this.ingestScopedNode(o)}visitSwitchExhaustiveCheck(o){}visitForLoopBlock(o){this.ingestScopedNode(o),o.empty?.visit(this)}visitForLoopBlockEmpty(o){this.ingestScopedNode(o)}visitIfBlock(o){o.branches.forEach(e=>e.visit(this))}visitIfBlockBranch(o){this.ingestScopedNode(o)}visitContent(o){this.ingestScopedNode(o)}visitLetDeclaration(o){this.maybeDeclare(o)}visitComponent(o){this.visitElementLike(o)}visitDirective(o){o.references.forEach(e=>this.visitReference(e))}visitBoundAttribute(o){}visitBoundEvent(o){}visitBoundText(o){}visitText(o){}visitTextAttribute(o){}visitIcu(o){}visitDeferredTrigger(o){}visitUnknownBlock(o){}visitElementLike(o){o.directives.forEach(e=>e.visit(this)),o.references.forEach(e=>this.visitReference(e)),o.children.forEach(e=>e.visit(this)),this.elementLikeInScope.add(o)}maybeDeclare(o){this.namedEntities.has(o.name)||this.namedEntities.set(o.name,o)}lookup(o){return this.namedEntities.has(o)?this.namedEntities.get(o):this.parentScope!==null?this.parentScope.lookup(o):null}getChildScope(o){let e=this.childScopes.get(o);if(e===void 0)throw new Error(`Assertion error: child scope for ${o} not found`);return e}ingestScopedNode(o){let e=new n(this,o);e.ingest(o),this.childScopes.set(o,e)}},z3=class n{directiveMatcher;directives;eagerDirectives;missingDirectives;bindings;references;isInDeferBlock=!1;constructor(o,e,t,i,a,s){this.directiveMatcher=o,this.directives=e,this.eagerDirectives=t,this.missingDirectives=i,this.bindings=a,this.references=s}static apply(o,e,t,i,a,s,d){new n(e,t,i,a,s,d).ingest(o)}ingest(o){o.forEach(e=>e.visit(this))}visitElement(o){this.visitElementOrTemplate(o)}visitTemplate(o){this.visitElementOrTemplate(o)}visitDeferredBlock(o){let e=this.isInDeferBlock;this.isInDeferBlock=!0,o.children.forEach(t=>t.visit(this)),this.isInDeferBlock=e,o.placeholder?.visit(this),o.loading?.visit(this),o.error?.visit(this)}visitDeferredBlockPlaceholder(o){o.children.forEach(e=>e.visit(this))}visitDeferredBlockError(o){o.children.forEach(e=>e.visit(this))}visitDeferredBlockLoading(o){o.children.forEach(e=>e.visit(this))}visitSwitchBlock(o){o.groups.forEach(e=>e.visit(this))}visitSwitchBlockCase(o){}visitSwitchBlockCaseGroup(o){o.children.forEach(e=>e.visit(this))}visitSwitchExhaustiveCheck(o){}visitForLoopBlock(o){o.item.visit(this),o.contextVariables.forEach(e=>e.visit(this)),o.children.forEach(e=>e.visit(this)),o.empty?.visit(this)}visitForLoopBlockEmpty(o){o.children.forEach(e=>e.visit(this))}visitIfBlock(o){o.branches.forEach(e=>e.visit(this))}visitIfBlockBranch(o){o.expressionAlias?.visit(this),o.children.forEach(e=>e.visit(this))}visitContent(o){o.children.forEach(e=>e.visit(this))}visitComponent(o){if(this.directiveMatcher instanceof Pb){let e=this.directiveMatcher.match(o.componentName);e.length>0?this.trackSelectorlessMatchesAndDirectives(o,e):this.missingDirectives.add(o.componentName)}o.directives.forEach(e=>e.visit(this)),o.children.forEach(e=>e.visit(this))}visitDirective(o){if(this.directiveMatcher instanceof Pb){let e=this.directiveMatcher.match(o.name);e.length>0?this.trackSelectorlessMatchesAndDirectives(o,e):this.missingDirectives.add(o.name)}}visitElementOrTemplate(o){if(this.directiveMatcher instanceof kb){let e=[],t=QU(o);this.directiveMatcher.match(t,(i,a)=>e.push(...a)),this.trackSelectorBasedBindingsAndDirectives(o,e)}else o.references.forEach(e=>{e.value.trim()===""&&this.references.set(e,o)});o.directives.forEach(e=>e.visit(this)),o.children.forEach(e=>e.visit(this))}trackMatchedDirectives(o,e){e.length>0&&(this.directives.set(o,e),this.isInDeferBlock||this.eagerDirectives.push(...e))}trackSelectorlessMatchesAndDirectives(o,e){if(e.length===0)return;this.trackMatchedDirectives(o,e);let t=(i,a,s)=>{i[s].hasBindingPropertyName(a.name)&&this.bindings.set(a,i)};for(let i of e)o.inputs.forEach(a=>t(i,a,"inputs")),o.attributes.forEach(a=>t(i,a,"inputs")),o.outputs.forEach(a=>t(i,a,"outputs"));o.references.forEach(i=>this.references.set(i,{directive:e[0],node:o}))}trackSelectorBasedBindingsAndDirectives(o,e){this.trackMatchedDirectives(o,e),o.references.forEach(i=>{let a=null;if(i.value.trim()==="")a=e.find(s=>s.isComponent)||null;else if(a=e.find(s=>s.exportAs!==null&&s.exportAs.some(d=>d===i.value))||null,a===null)return;a!==null?this.references.set(i,{directive:a,node:o}):this.references.set(i,o)});let t=(i,a)=>{let s=e.find(p=>p[a].hasBindingPropertyName(i.name)),d=s!==void 0?s:o;this.bindings.set(i,d)};o.inputs.forEach(i=>t(i,"inputs")),o.attributes.forEach(i=>t(i,"inputs")),o instanceof Qs&&o.templateAttrs.forEach(i=>t(i,"inputs")),o.outputs.forEach(i=>t(i,"outputs"))}visitVariable(o){}visitReference(o){}visitTextAttribute(o){}visitBoundAttribute(o){}visitBoundEvent(o){}visitBoundAttributeOrEvent(o){}visitText(o){}visitBoundText(o){}visitIcu(o){}visitDeferredTrigger(o){}visitUnknownBlock(o){}visitLetDeclaration(o){}},Ax=class n extends F3{bindings;symbols;usedPipes;eagerPipes;deferBlocks;nestingLevel;scope;rootNode;level;visitNode=o=>o.visit(this);constructor(o,e,t,i,a,s,d,p,u){super(),this.bindings=o,this.symbols=e,this.usedPipes=t,this.eagerPipes=i,this.deferBlocks=a,this.nestingLevel=s,this.scope=d,this.rootNode=p,this.level=u}static applyWithScope(o,e,t,i,a,s,d,p){let u=o instanceof Qs?o:null;new n(t,i,s,d,p,a,e,u,0).ingest(o)}ingest(o){if(o instanceof Qs)o.variables.forEach(this.visitNode),o.children.forEach(this.visitNode),this.nestingLevel.set(o,this.level);else if(o instanceof Yp)o.expressionAlias!==null&&this.visitNode(o.expressionAlias),o.children.forEach(this.visitNode),this.nestingLevel.set(o,this.level);else if(o instanceof Hg)this.visitNode(o.item),o.contextVariables.forEach(e=>this.visitNode(e)),o.trackBy.visit(this),o.children.forEach(this.visitNode),this.nestingLevel.set(o,this.level);else if(o instanceof mu){if(this.scope.rootNode!==o)throw new Error(`Assertion error: resolved incorrect scope for deferred block ${o}`);this.deferBlocks.push([o,this.scope]),o.children.forEach(e=>e.visit(this)),this.nestingLevel.set(o,this.level)}else o instanceof s0||o instanceof l0||o instanceof r0||o instanceof o0||o instanceof a0||o instanceof Ug?(o.children.forEach(e=>e.visit(this)),this.nestingLevel.set(o,this.level)):o instanceof d0?this.nestingLevel.set(o,0):o.forEach(this.visitNode)}visitTemplate(o){o.inputs.forEach(this.visitNode),o.outputs.forEach(this.visitNode),o.directives.forEach(this.visitNode),o.templateAttrs.forEach(this.visitNode),o.references.forEach(this.visitNode),this.ingestScopedNode(o)}visitVariable(o){this.rootNode!==null&&this.symbols.set(o,this.rootNode)}visitReference(o){this.rootNode!==null&&this.symbols.set(o,this.rootNode)}visitDeferredBlock(o){this.ingestScopedNode(o),o.triggers.when?.value.visit(this),o.prefetchTriggers.when?.value.visit(this),o.hydrateTriggers.when?.value.visit(this),o.hydrateTriggers.never?.visit(this),o.placeholder&&this.visitNode(o.placeholder),o.loading&&this.visitNode(o.loading),o.error&&this.visitNode(o.error)}visitDeferredBlockPlaceholder(o){this.ingestScopedNode(o)}visitDeferredBlockError(o){this.ingestScopedNode(o)}visitDeferredBlockLoading(o){this.ingestScopedNode(o)}visitSwitchBlockCase(o){o.expression?.visit(this)}visitSwitchBlockCaseGroup(o){o.cases.forEach(e=>e.visit(this)),this.ingestScopedNode(o)}visitSwitchExhaustiveCheck(o){}visitForLoopBlock(o){o.expression.visit(this),this.ingestScopedNode(o),o.empty?.visit(this)}visitForLoopBlockEmpty(o){this.ingestScopedNode(o)}visitIfBlockBranch(o){o.expression?.visit(this),this.ingestScopedNode(o)}visitContent(o){this.ingestScopedNode(o)}visitLetDeclaration(o){super.visitLetDeclaration(o),this.rootNode!==null&&this.symbols.set(o,this.rootNode)}visitPipe(o,e){return this.usedPipes.add(o.name),this.scope.isDeferred||this.eagerPipes.add(o.name),super.visitPipe(o,e)}visitPropertyRead(o,e){return this.maybeMap(o,o.name),super.visitPropertyRead(o,e)}visitSafePropertyRead(o,e){return this.maybeMap(o,o.name),super.visitSafePropertyRead(o,e)}ingestScopedNode(o){let e=this.scope.getChildScope(o);new n(this.bindings,this.symbols,this.usedPipes,this.eagerPipes,this.deferBlocks,this.nestingLevel,e,o,this.level+1).ingest(o)}maybeMap(o,e){if(!(o.receiver instanceof Hc))return;let t=this.scope.lookup(e);t!==null&&this.bindings.set(o,t)}},L3=class{target;directives;eagerDirectives;missingDirectives;bindings;references;exprTargets;symbols;nestingLevel;scopedNodeEntities;usedPipes;eagerPipes;deferredBlocks;deferredScopes;constructor(o,e,t,i,a,s,d,p,u,g,C,M,x){this.target=o,this.directives=e,this.eagerDirectives=t,this.missingDirectives=i,this.bindings=a,this.references=s,this.exprTargets=d,this.symbols=p,this.nestingLevel=u,this.scopedNodeEntities=g,this.usedPipes=C,this.eagerPipes=M,this.deferredBlocks=x.map(b=>b[0]),this.deferredScopes=new Map(x)}getEntitiesInScope(o){return this.scopedNodeEntities.get(o)??new Set}getDirectivesOfNode(o){return this.directives.get(o)||null}getReferenceTarget(o){return this.references.get(o)||null}getConsumerOfBinding(o){return this.bindings.get(o)||null}getExpressionTarget(o){return this.exprTargets.get(o)||null}getDefinitionNodeOfSymbol(o){return this.symbols.get(o)||null}getNestingLevel(o){return this.nestingLevel.get(o)||0}getUsedDirectives(){let o=new Set;return this.directives.forEach(e=>e.forEach(t=>o.add(t))),Array.from(o.values())}getEagerlyUsedDirectives(){let o=new Set(this.eagerDirectives);return Array.from(o.values())}getUsedPipes(){return Array.from(this.usedPipes)}getEagerlyUsedPipes(){return Array.from(this.eagerPipes)}getDeferBlocks(){return this.deferredBlocks}getDeferredTriggerTarget(o,e){if(!(e instanceof Yb)&&!(e instanceof i0)&&!(e instanceof Xb))return null;let t=e.reference;if(t===null){let a=null;if(o.placeholder!==null){for(let s of o.placeholder.children)if(!(s instanceof Rx)){if(a!==null)return null;s instanceof Uc&&(a=s)}}return a}let i=this.findEntityInScope(o,t);if(i instanceof c0&&this.getDefinitionNodeOfSymbol(i)!==o){let a=this.getReferenceTarget(i);if(a!==null)return this.referenceTargetToElement(a)}if(o.placeholder!==null){let a=this.findEntityInScope(o.placeholder,t),s=a instanceof c0?this.getReferenceTarget(a):null;if(s!==null)return this.referenceTargetToElement(s)}return null}isDeferred(o){for(let e of this.deferredBlocks){if(!this.deferredScopes.has(e))continue;let t=[this.deferredScopes.get(e)];for(;t.length>0;){let i=t.pop();if(i.elementLikeInScope.has(o))return!0;t.push(...i.childScopes.values())}}return!1}referencedDirectiveExists(o){return!this.missingDirectives.has(o)}findEntityInScope(o,e){let t=this.getEntitiesInScope(o);for(let i of t)if(i.name===e)return i;return null}referenceTargetToElement(o){return o instanceof Uc?o:o instanceof Qs||o.node instanceof Ef||o.node instanceof NN||o.node instanceof d0?null:this.referenceTargetToElement(o.node)}};function ree(n,o){let e=new Map;function t(a){if(e.has(a.rootNode))return e.get(a.rootNode);let s=a.namedEntities,d;return a.parentScope!==null?d=new Map([...t(a.parentScope),...s]):d=new Map(s),e.set(a.rootNode,d),d}let i=[n];for(;i.length>0;){let a=i.pop();for(let s of a.childScopes.values())i.push(s);t(a)}for(let[a,s]of e)o.set(a,new Set(s.values()))}var V3=class{},B3=class{jitEvaluator;FactoryTarget=Ed;ResourceLoader=V3;elementSchemaRegistry=new Yg;constructor(o=new jP){this.jitEvaluator=o}compilePipe(o,e,t){let i={name:t.name,type:Ua(t.type),typeArgumentCount:0,pipeName:t.pipeName,pure:t.pure,isStandalone:t.isStandalone},a=o6(i);return this.jitExpression(a.expression,o,e,[])}compilePipeDeclaration(o,e,t){let i=wee(t),a=o6(i);return this.jitExpression(a.expression,o,e,[])}compileInjectable(o,e,t){let{expression:i,statements:a}=Q5({name:t.name,type:Ua(t.type),typeArgumentCount:t.typeArgumentCount,providedIn:SN(t.providedIn),useClass:yg(t,"useClass"),useFactory:MN(t,"useFactory"),useValue:yg(t,"useValue"),useExisting:yg(t,"useExisting"),deps:t.deps?.map(e8)},!0);return this.jitExpression(i,o,e,a)}compileInjectableDeclaration(o,e,t){let{expression:i,statements:a}=Q5({name:t.type.name,type:Ua(t.type),typeArgumentCount:0,providedIn:SN(t.providedIn),useClass:yg(t,"useClass"),useFactory:MN(t,"useFactory"),useValue:yg(t,"useValue"),useExisting:yg(t,"useExisting"),deps:t.deps?.map(kN)},!0);return this.jitExpression(i,o,e,a)}compileInjector(o,e,t){let i={type:Ua(t.type),providers:t.providers&&t.providers.length>0?new _i(t.providers):null,imports:t.imports.map(s=>new _i(s))},a=i6(i);return this.jitExpression(a.expression,o,e,[])}compileInjectorDeclaration(o,e,t){let i=Mee(t),a=i6(i);return this.jitExpression(a.expression,o,e,[])}compileNgModule(o,e,t){let i={kind:km.Global,type:Ua(t.type),bootstrap:t.bootstrap.map(Ua),declarations:t.declarations.map(Ua),publicDeclarationTypes:null,imports:t.imports.map(Ua),includeImportTypes:!0,exports:t.exports.map(Ua),selectorScopeMode:rx.Inline,containsForwardDecls:!1,schemas:t.schemas?t.schemas.map(Ua):null,id:t.id?new _i(t.id):null},a=gW(i);return this.jitExpression(a.expression,o,e,[])}compileNgModuleDeclaration(o,e,t){let i=hW(t);return this.jitExpression(i,o,e,[])}compileDirective(o,e,t){let i=yN(t);return this.compileDirectiveFromMeta(o,e,i)}compileDirectiveDeclaration(o,e,t){let i=this.createParseSourceSpan("Directive",t.type.name,e),a=ZF(t,i);return this.compileDirectiveFromMeta(o,e,a)}compileDirectiveFromMeta(o,e,t){let i=new zb,a=Dx(),s=qJ(t,i,a);return this.jitExpression(s.expression,o,e,i.statements)}compileComponent(o,e,t){let{template:i,defer:a}=JF(t.template,t.name,e,t.preserveWhitespaces,void 0),s=ze(q(q({},t),yN(t)),{selector:t.selector||this.elementSchemaRegistry.getDefaultComponentElementName(),template:i,declarations:t.declarations.map(dee),declarationListEmitMode:0,defer:a,styles:[...t.styles,...i.styles],encapsulation:t.encapsulation,changeDetection:t.changeDetection??null,animations:t.animations!=null?new _i(t.animations):null,viewProviders:t.viewProviders!=null?new _i(t.viewProviders):null,relativeContextFilePath:"",i18nUseExternalIds:!0,relativeTemplatePath:null}),d=`ng:///${t.name}.js`;return this.compileComponentFromMeta(o,d,s)}compileComponentDeclaration(o,e,t){let i=this.createParseSourceSpan("Component",t.type.name,e),a=cee(t,i,e);return this.compileComponentFromMeta(o,e,a)}compileComponentFromMeta(o,e,t){let i=new zb,a=Dx(),s=QJ(t,i,a);return this.jitExpression(s.expression,o,e,i.statements)}compileFactory(o,e,t){let i=Hp({name:t.name,type:Ua(t.type),typeArgumentCount:t.typeArgumentCount,deps:uee(t.deps),target:t.target});return this.jitExpression(i.expression,o,e,i.statements)}compileFactoryDeclaration(o,e,t){let i=Hp({name:t.type.name,type:Ua(t.type),typeArgumentCount:0,deps:Array.isArray(t.deps)?t.deps.map(kN):t.deps,target:t.target});return this.jitExpression(i.expression,o,e,i.statements)}createParseSourceSpan(o,e,t){return sW(o,e,t)}jitExpression(o,e,t,i){let a=[...i,new Ga("$def",o,void 0,ur.Exported)];return this.jitEvaluator.evaluateStatements(t,a,new HP(e),!0).$def}};function bN(n){return ze(q({},n),{isSignal:n.isSignal,predicate:YF(n.predicate),read:n.read?new _i(n.read):null,static:n.static,emitDistinctChangesOnly:n.emitDistinctChangesOnly})}function xN(n){return{propertyName:n.propertyName,first:n.first??!1,predicate:YF(n.predicate),descendants:n.descendants??!1,read:n.read?new _i(n.read):null,static:n.static??!1,emitDistinctChangesOnly:n.emitDistinctChangesOnly??!0,isSignal:!!n.isSignal}}function YF(n){return Array.isArray(n)?n:G3(new _i(n),1)}function yN(n){let o=yee(n.inputs||[]),e=mP(n.outputs||[]),t=n.propMetadata,i={},a={};for(let d in t)t.hasOwnProperty(d)&&t[d].forEach(p=>{vee(p)?i[d]={bindingPropertyName:p.alias||d,classPropertyName:d,required:p.required||!1,isSignal:!!p.isSignal,transformFunction:p.transform!=null?new _i(p.transform):null}:Cee(p)&&(a[d]=p.alias||d)});let s=n.hostDirectives?.length?n.hostDirectives.map(d=>typeof d=="function"?{directive:Ua(d),inputs:null,outputs:null,isForwardReference:!1}:{directive:Ua(d.directive),isForwardReference:!1,inputs:d.inputs?mP(d.inputs):null,outputs:d.outputs?mP(d.outputs):null}):null;return ze(q({},n),{typeArgumentCount:0,typeSourceSpan:n.typeSourceSpan,type:Ua(n.type),deps:null,host:q({},hee(n.propMetadata,n.typeSourceSpan,n.host)),inputs:q(q({},o),i),outputs:q(q({},e),a),queries:n.queries.map(bN),providers:n.providers!=null?new _i(n.providers):null,viewQueries:n.viewQueries.map(bN),hostDirectives:s})}function ZF(n,o){let e=n.hostDirectives?.length?n.hostDirectives.map(t=>({directive:Ua(t.directive),isForwardReference:!1,inputs:t.inputs?wN(t.inputs):null,outputs:t.outputs?wN(t.outputs):null})):null;return{name:n.type.name,type:Ua(n.type),typeSourceSpan:o,selector:n.selector??null,inputs:n.inputs?bee(n.inputs):{},outputs:n.outputs??{},host:see(n.host),queries:(n.queries??[]).map(xN),viewQueries:(n.viewQueries??[]).map(xN),providers:n.providers!==void 0?new _i(n.providers):null,exportAs:n.exportAs??null,usesInheritance:n.usesInheritance??!1,controlCreate:n.controlCreate??null,lifecycle:{usesOnChanges:n.usesOnChanges??!1},deps:null,typeArgumentCount:0,isStandalone:n.isStandalone??AN(n.version),isSignal:n.isSignal??!1,hostDirectives:e}}function see(n={}){return{attributes:lee(n.attributes??{}),listeners:n.listeners??{},properties:n.properties??{},specialAttributes:{classAttr:n.classAttribute,styleAttr:n.styleAttribute}}}function wN(n){let o=null;for(let e=1;edP(d,!0))),n.directives&&a.push(...n.directives.map(d=>dP(d))),n.pipes&&a.push(...mee(n.pipes)));let s=a.some(({kind:d})=>d===Gg.Directive||d===Gg.NgModule);return ze(q({},ZF(n,o)),{template:t,styles:n.styles??[],declarations:a,viewProviders:n.viewProviders!==void 0?new _i(n.viewProviders):null,animations:n.animations!==void 0?new _i(n.animations):null,defer:i,changeDetection:n.changeDetection??$3.Default,encapsulation:n.encapsulation??$p.Emulated,declarationListEmitMode:2,relativeContextFilePath:"",i18nUseExternalIds:!0,relativeTemplatePath:null,hasDirectiveDependencies:s})}function dee(n){return ze(q({},n),{type:new _i(n.type)})}function dP(n,o=null){return{kind:Gg.Directive,isComponent:o||n.kind==="component",selector:n.selector,type:new _i(n.type),inputs:n.inputs??[],outputs:n.outputs??[],exportAs:n.exportAs??null}}function mee(n){return n?Object.keys(n).map(o=>({kind:Gg.Pipe,name:o,type:new _i(n[o])})):[]}function pee(n){return{kind:Gg.Pipe,name:n.name,type:new _i(n.type)}}function JF(n,o,e,t,i){let a=HJ(n,e,{preserveWhitespaces:t});if(a.errors!==null){let p=a.errors.map(u=>u.toString()).join(", ");throw new Error(`Errors during JIT compilation of template for ${o}: ${p}`)}let d=new R3(null).bind({template:a.nodes});return{template:a,defer:gee(d,i)}}function yg(n,o){if(n.hasOwnProperty(o))return G3(new _i(n[o]),0)}function MN(n,o){if(n.hasOwnProperty(o))return new _i(n[o])}function SN(n){let o=typeof n=="function"?new _i(n):new _r(n??null);return G3(o,0)}function uee(n){return n==null?null:n.map(e8)}function e8(n){let o=n.attribute!=null,e=n.token===null?null:new _i(n.token),t=o?new _i(n.attribute):e;return t8(t,o,n.host,n.optional,n.self,n.skipSelf)}function kN(n){let o=n.attribute??!1,e=n.token===null?null:new _i(n.token);return t8(e,o,n.host??!1,n.optional??!1,n.self??!1,n.skipSelf??!1)}function t8(n,o,e,t,i,a){let s=o?De("unknown"):null;return{token:n,attributeNameType:s,host:e,optional:t,self:i,skipSelf:a}}function gee(n,o){let e=n.getDeferBlocks(),t=new Map;for(let i=0;i{_ee(s)?t.properties[s.hostPropertyName||a]=OU("this",a):fee(s)&&(t.listeners[s.eventName||a]=`${a}(${(s.args||[]).join(",")})`)});let i=nee(t,o);if(i.length)throw new Error(i.map(a=>a.msg).join(` +`));return t}function _ee(n){return n.ngMetadataName==="HostBinding"}function fee(n){return n.ngMetadataName==="HostListener"}function vee(n){return n.ngMetadataName==="Input"}function Cee(n){return n.ngMetadataName==="Output"}function bee(n){return Object.keys(n).reduce((o,e)=>{let t=n[e];return typeof t=="string"||Array.isArray(t)?o[e]=xee(t):o[e]={bindingPropertyName:t.publicName,classPropertyName:e,transformFunction:t.transformFunction!==null?new _i(t.transformFunction):null,required:t.isRequired,isSignal:t.isSignal},o},{})}function xee(n){return typeof n=="string"?{bindingPropertyName:n,classPropertyName:n,transformFunction:null,required:!1,isSignal:!1}:{bindingPropertyName:n[0],classPropertyName:n[1],transformFunction:n[2]?new _i(n[2]):null,required:!1,isSignal:!1}}function yee(n){return n.reduce((o,e)=>{if(typeof e=="string"){let[t,i]=n8(e);o[i]={bindingPropertyName:t,classPropertyName:i,required:!1,isSignal:!1,transformFunction:null}}else o[e.name]={bindingPropertyName:e.alias||e.name,classPropertyName:e.name,required:e.required||!1,isSignal:!1,transformFunction:e.transform!=null?new _i(e.transform):null};return o},{})}function mP(n){return n.reduce((o,e)=>{let[t,i]=n8(e);return o[i]=t,o},{})}function n8(n){let[o,e]=n.split(":",2).map(t=>t.trim());return[e??o,o]}function wee(n){return{name:n.type.name,type:Ua(n.type),typeArgumentCount:0,pipeName:n.name,deps:null,pure:n.pure??!0,isStandalone:n.isStandalone??AN(n.version)}}function Mee(n){return{name:n.type.name,type:Ua(n.type),providers:n.providers!==void 0&&n.providers.length>0?new _i(n.providers):null,imports:n.imports!==void 0?n.imports.map(o=>new _i(o)):[]}}function See(n){let o=n.ng||(n.ng={});o.\u0275compilerFacade=new B3}var j3=class{closedByParent=!1;implicitNamespacePrefix=null;isVoid=!1;ignoreFirstLf=!1;canSelfClose=!0;preventNamespaceInheritance=!1;requireExtraParent(o){return!1}isClosedByChild(o){return!1}getContentType(){return Nc.PARSABLE_DATA}},PHe=new j3;var THe=new vP("21.2.25");See(Tf);function uT(n){let o=n.cloneNode(!0),e=o.querySelectorAll("[id]"),t=n.nodeName.toLowerCase();o.removeAttribute("id");for(let i=0;i=t&&e<=i&&o>=a&&o<=s}function Pee(n,o){let e=o.leftn.right,i=o.topn.bottom;return e||t||i||a}function j0(n,o,e){n.top+=o,n.bottom=n.top+n.height,n.left+=e,n.right=n.left+n.width}function r8(n,o,e,t){let{top:i,right:a,bottom:s,left:d,width:p,height:u}=n,g=p*o,C=u*o;return t>i-C&&td-g&&e{this.positions.set(e,{scrollPosition:{top:e.scrollTop,left:e.scrollLeft},clientRect:bT(e)})})}handleScroll(o){let e=Rp(o),t=this.positions.get(e);if(!t)return null;let i=t.scrollPosition,a,s;if(e===this._document){let u=this.getViewportScrollPosition();a=u.top,s=u.left}else a=e.scrollTop,s=e.scrollLeft;let d=i.top-a,p=i.left-s;return this.positions.forEach((u,g)=>{u.clientRect&&e!==g&&e.contains(g)&&j0(u.clientRect,d,p)}),i.top=a,i.left=s,{top:d,left:p}}getViewportScrollPosition(){return{top:window.scrollY,left:window.scrollX}}};function f8(n,o){let e=n.rootNodes;if(e.length===1&&e[0].nodeType===o.ELEMENT_NODE)return e[0];let t=o.createElement("div");return e.forEach(i=>t.appendChild(i)),t}function xT(n,o,e){for(let t in o)if(o.hasOwnProperty(t)){let i=o[t];i?n.setProperty(t,i,e?.has(t)?"important":""):n.removeProperty(t)}return n}function oh(n,o){let e=o?"":"none";xT(n.style,{"touch-action":o?"":"none","-webkit-user-drag":o?"":"none","-webkit-tap-highlight-color":o?"":"transparent","user-select":e,"-ms-user-select":e,"-webkit-user-select":e,"-moz-user-select":e})}function s8(n,o,e){xT(n.style,{position:o?"":"fixed",top:o?"":"0",opacity:o?"":"0",left:o?"":"-999em"},e)}function Wx(n,o){return o&&o!="none"?n+" "+o:n}function l8(n,o){n.style.width=`${o.width}px`,n.style.height=`${o.height}px`,n.style.transform=$0(o.left,o.top)}function $0(n,o){return`translate3d(${Math.round(n)}px, ${Math.round(o)}px, 0)`}var V0={capture:!0},mT={passive:!1,capture:!0},Tee=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["ng-component"]],hostAttrs:["cdk-drag-resets-container",""],decls:0,vars:0,template:function(t,i){},styles:[`@layer cdk-resets { + .cdk-drag-preview { + background: none; + border: none; + padding: 0; + color: inherit; + inset: auto; + } +} +.cdk-drag-placeholder *, +.cdk-drag-preview * { + pointer-events: none !important; +} +`],encapsulation:2,changeDetection:0})}return n})(),qx=(()=>{class n{_ngZone=f(Gi);_document=f(Do);_styleLoader=f(Ta);_renderer=f(Fp).createRenderer(null,null);_cleanupDocumentTouchmove;_scroll=new Ye;_dropInstances=new Set;_dragInstances=new Set;_activeDragInstances=z([]);_globalListeners;_draggingPredicate=e=>e.isDragging();_domNodesToDirectives=null;pointerMove=new Ye;pointerUp=new Ye;constructor(){}registerDropContainer(e){this._dropInstances.has(e)||this._dropInstances.add(e)}registerDragItem(e){this._dragInstances.add(e),this._dragInstances.size===1&&this._ngZone.runOutsideAngular(()=>{this._cleanupDocumentTouchmove?.(),this._cleanupDocumentTouchmove=this._renderer.listen(this._document,"touchmove",this._persistentTouchmoveListener,mT)})}removeDropContainer(e){this._dropInstances.delete(e)}removeDragItem(e){this._dragInstances.delete(e),this.stopDragging(e),this._dragInstances.size===0&&this._cleanupDocumentTouchmove?.()}startDragging(e,t){if(!(this._activeDragInstances().indexOf(e)>-1)&&(this._styleLoader.load(Tee),this._activeDragInstances.update(i=>[...i,e]),this._activeDragInstances().length===1)){let i=t.type.startsWith("touch"),a=d=>this.pointerUp.next(d),s=[["scroll",d=>this._scroll.next(d),V0],["selectstart",this._preventDefaultWhileDragging,mT]];i?s.push(["touchend",a,V0],["touchcancel",a,V0]):s.push(["mouseup",a,V0]),i||s.push(["mousemove",d=>this.pointerMove.next(d),mT]),this._ngZone.runOutsideAngular(()=>{this._globalListeners=s.map(([d,p,u])=>this._renderer.listen(this._document,d,p,u))})}}stopDragging(e){this._activeDragInstances.update(t=>{let i=t.indexOf(e);return i>-1?(t.splice(i,1),[...t]):t}),this._activeDragInstances().length===0&&this._clearGlobalListeners()}isDragging(e){return this._activeDragInstances().indexOf(e)>-1}scrolled(e){let t=[this._scroll];return e&&e!==this._document&&t.push(new Sr(i=>this._ngZone.runOutsideAngular(()=>{let a=this._renderer.listen(e,"scroll",s=>{this._activeDragInstances().length&&i.next(s)},V0);return()=>{a()}}))),ro(...t)}registerDirectiveNode(e,t){this._domNodesToDirectives??=new WeakMap,this._domNodesToDirectives.set(e,t)}removeDirectiveNode(e){this._domNodesToDirectives?.delete(e)}getDragDirectiveForNode(e){return this._domNodesToDirectives?.get(e)||null}ngOnDestroy(){this._dragInstances.forEach(e=>this.removeDragItem(e)),this._dropInstances.forEach(e=>this.removeDropContainer(e)),this._domNodesToDirectives=null,this._clearGlobalListeners(),this.pointerMove.complete(),this.pointerUp.complete()}_preventDefaultWhileDragging=e=>{this._activeDragInstances().length>0&&e.preventDefault()};_persistentTouchmoveListener=e=>{this._activeDragInstances().length>0&&(this._activeDragInstances().some(this._draggingPredicate)&&e.preventDefault(),this.pointerMove.next(e))};_clearGlobalListeners(){this._globalListeners?.forEach(e=>e()),this._globalListeners=void 0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=J({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function c8(n){let o=n.toLowerCase().indexOf("ms")>-1?1:1e3;return parseFloat(n)*o}function Eee(n){let o=getComputedStyle(n),e=pT(o,"transition-property"),t=e.find(d=>d==="transform"||d==="all");if(!t)return 0;let i=e.indexOf(t),a=pT(o,"transition-duration"),s=pT(o,"transition-delay");return c8(a[i])+c8(s[i])}function pT(n,o){return n.getPropertyValue(o).split(",").map(t=>t.trim())}var Oee=new Set(["position"]),hT=class{_document;_rootElement;_direction;_initialDomRect;_previewTemplate;_previewClass;_pickupPositionOnPage;_initialTransform;_zIndex;_renderer;_previewEmbeddedView=null;_preview;get element(){return this._preview}constructor(o,e,t,i,a,s,d,p,u,g){this._document=o,this._rootElement=e,this._direction=t,this._initialDomRect=i,this._previewTemplate=a,this._previewClass=s,this._pickupPositionOnPage=d,this._initialTransform=p,this._zIndex=u,this._renderer=g}attach(o){this._preview=this._createPreview(),o.appendChild(this._preview),d8(this._preview)&&this._preview.showPopover()}destroy(){this._preview.remove(),this._previewEmbeddedView?.destroy(),this._preview=this._previewEmbeddedView=null}setTransform(o){this._preview.style.transform=o}getBoundingClientRect(){return this._preview.getBoundingClientRect()}addClass(o){this._preview.classList.add(o)}getTransitionDuration(){return Eee(this._preview)}addEventListener(o,e){return this._renderer.listen(this._preview,o,e)}_createPreview(){let o=this._previewTemplate,e=this._previewClass,t=o?o.template:null,i;if(t&&o){let a=o.matchSize?this._initialDomRect:null,s=o.viewContainer.createEmbeddedView(t,o.context);s.detectChanges(),i=f8(s,this._document),this._previewEmbeddedView=s,o.matchSize?l8(i,a):i.style.transform=$0(this._pickupPositionOnPage.x,this._pickupPositionOnPage.y)}else i=uT(this._rootElement),l8(i,this._initialDomRect),this._initialTransform&&(i.style.transform=this._initialTransform);return xT(i.style,{"pointer-events":"none",margin:d8(i)?"0 auto 0 0":"0",position:"fixed",top:"0",left:"0","z-index":this._zIndex+""},Oee),oh(i,!1),i.classList.add("cdk-drag-preview"),i.setAttribute("popover","manual"),i.setAttribute("dir",this._direction),e&&(Array.isArray(e)?e.forEach(a=>i.classList.add(a)):i.classList.add(e)),i}};function d8(n){return"showPopover"in n}var Dee={passive:!0},m8={passive:!1},Iee={passive:!1,capture:!0},Aee=800,p8="cdk-drag-placeholder",u8=new Set(["position"]);function v8(n,o,e={dragStartThreshold:5,pointerDirectionChangeThreshold:5}){let t=n.get(qi,null,{optional:!0})||n.get(Fp).createRenderer(null,null);return new _T(o,e,n.get(Do),n.get(Gi),n.get(kd),n.get(qx),t)}var _T=class{_config;_document;_ngZone;_viewportRuler;_dragDropRegistry;_renderer;_rootElementCleanups;_cleanupShadowRootSelectStart;_preview=null;_previewContainer;_placeholderRef=null;_placeholder;_pickupPositionInElement;_pickupPositionOnPage;_marker;_anchor=null;_passiveTransform={x:0,y:0};_activeTransform={x:0,y:0};_initialTransform;_hasStartedDragging=z(!1);_hasMoved=!1;_initialContainer;_initialIndex;_parentPositions;_moveEvents=new Ye;_pointerDirectionDelta;_pointerPositionAtLastDirectionChange;_lastKnownPointerPosition;_rootElement;_ownerSVGElement=null;_rootElementTapHighlight;_pointerMoveSubscription=Oo.EMPTY;_pointerUpSubscription=Oo.EMPTY;_scrollSubscription=Oo.EMPTY;_resizeSubscription=Oo.EMPTY;_lastTouchEventTime;_dragStartTime;_boundaryElement=null;_nativeInteractionsEnabled=!0;_initialDomRect;_previewRect;_boundaryRect;_previewTemplate;_placeholderTemplate;_handles=[];_disabledHandles=new Set;_dropContainer;_direction="ltr";_parentDragRef=null;_cachedShadowRoot;lockAxis=null;dragStartDelay=0;previewClass;scale=1;get disabled(){return this._disabled||!!(this._dropContainer&&this._dropContainer.disabled)}set disabled(o){o!==this._disabled&&(this._disabled=o,this._toggleNativeDragInteractions(),this._handles.forEach(e=>oh(e,o)))}_disabled=!1;beforeStarted=new Ye;started=new Ye;released=new Ye;ended=new Ye;entered=new Ye;exited=new Ye;dropped=new Ye;moved=this._moveEvents;data;constrainPosition;constructor(o,e,t,i,a,s,d){this._config=e,this._document=t,this._ngZone=i,this._viewportRuler=a,this._dragDropRegistry=s,this._renderer=d,this.withRootElement(o).withParent(e.parentDragRef||null),this._parentPositions=new Ux(t),s.registerDragItem(this)}getPlaceholderElement(){return this._placeholder}getRootElement(){return this._rootElement}getVisibleElement(){return this.isDragging()?this.getPlaceholderElement():this.getRootElement()}withHandles(o){this._handles=o.map(t=>cl(t)),this._handles.forEach(t=>oh(t,this.disabled)),this._toggleNativeDragInteractions();let e=new Set;return this._disabledHandles.forEach(t=>{this._handles.indexOf(t)>-1&&e.add(t)}),this._disabledHandles=e,this}withPreviewTemplate(o){return this._previewTemplate=o,this}withPlaceholderTemplate(o){return this._placeholderTemplate=o,this}withRootElement(o){let e=cl(o);if(e!==this._rootElement){this._removeRootElementListeners();let t=this._renderer;this._rootElementCleanups=this._ngZone.runOutsideAngular(()=>[t.listen(e,"mousedown",this._pointerDown,m8),t.listen(e,"touchstart",this._pointerDown,Dee),t.listen(e,"dragstart",this._nativeDragStart,m8)]),this._initialTransform=void 0,this._rootElement=e}return typeof SVGElement<"u"&&this._rootElement instanceof SVGElement&&(this._ownerSVGElement=this._rootElement.ownerSVGElement),this}withBoundaryElement(o){return this._boundaryElement=o?cl(o):null,this._resizeSubscription.unsubscribe(),o&&(this._resizeSubscription=this._viewportRuler.change(10).subscribe(()=>this._containInsideBoundaryOnResize())),this}withParent(o){return this._parentDragRef=o,this}dispose(){this._removeRootElementListeners(),this.isDragging()&&this._rootElement?.remove(),this._marker?.remove(),this._destroyPreview(),this._destroyPlaceholder(),this._dragDropRegistry.removeDragItem(this),this._removeListeners(),this.beforeStarted.complete(),this.started.complete(),this.released.complete(),this.ended.complete(),this.entered.complete(),this.exited.complete(),this.dropped.complete(),this._moveEvents.complete(),this._handles=[],this._disabledHandles.clear(),this._dropContainer=void 0,this._resizeSubscription.unsubscribe(),this._parentPositions.clear(),this._boundaryElement=this._rootElement=this._ownerSVGElement=this._placeholderTemplate=this._previewTemplate=this._marker=this._parentDragRef=null}isDragging(){return this._hasStartedDragging()&&this._dragDropRegistry.isDragging(this)}reset(){this._rootElement.style.transform=this._initialTransform||"",this._activeTransform={x:0,y:0},this._passiveTransform={x:0,y:0}}resetToBoundary(){if(this._boundaryElement&&this._rootElement&&Pee(this._boundaryElement.getBoundingClientRect(),this._rootElement.getBoundingClientRect())){let o=this._boundaryElement.getBoundingClientRect(),e=this._rootElement.getBoundingClientRect(),t=0,i=0;e.lefto.right&&(t=o.right-e.right),e.topo.bottom&&(i=o.bottom-e.bottom);let a=this._activeTransform.x,s=this._activeTransform.y,d=a+t,p=s+i;this._rootElement.style.transform=$0(d,p),this._activeTransform={x:d,y:p},this._passiveTransform={x:d,y:p}}}disableHandle(o){!this._disabledHandles.has(o)&&this._handles.indexOf(o)>-1&&(this._disabledHandles.add(o),oh(o,!0))}enableHandle(o){this._disabledHandles.has(o)&&(this._disabledHandles.delete(o),oh(o,this.disabled))}withDirection(o){return this._direction=o,this}_withDropContainer(o){this._dropContainer=o}getFreeDragPosition(){let o=this.isDragging()?this._activeTransform:this._passiveTransform;return{x:o.x,y:o.y}}setFreeDragPosition(o){return this._activeTransform={x:0,y:0},this._passiveTransform.x=o.x,this._passiveTransform.y=o.y,this._dropContainer||this._applyRootElementTransform(o.x,o.y),this}withPreviewContainer(o){return this._previewContainer=o,this}_sortFromLastPointerPosition(){let o=this._lastKnownPointerPosition;o&&this._dropContainer&&this._updateActiveDropContainer(this._getConstrainedPointerPosition(o),o)}_removeListeners(){this._pointerMoveSubscription.unsubscribe(),this._pointerUpSubscription.unsubscribe(),this._scrollSubscription.unsubscribe(),this._cleanupShadowRootSelectStart?.(),this._cleanupShadowRootSelectStart=void 0}_destroyPreview(){this._preview?.destroy(),this._preview=null}_destroyPlaceholder(){this._anchor?.remove(),this._placeholder?.remove(),this._placeholderRef?.destroy(),this._placeholder=this._anchor=this._placeholderRef=null}_pointerDown=o=>{if(this.beforeStarted.next(),this._handles.length){let e=this._getTargetHandle(o);e&&!this._disabledHandles.has(e)&&!this.disabled&&this._initializeDragSequence(e,o)}else this.disabled||this._initializeDragSequence(this._rootElement,o)};_pointerMove=o=>{let e=this._getPointerPositionOnPage(o);if(!this._hasStartedDragging()){let i=Math.abs(e.x-this._pickupPositionOnPage.x),a=Math.abs(e.y-this._pickupPositionOnPage.y);if(i+a>=this._config.dragStartThreshold){let d=Date.now()>=this._dragStartTime+this._getDragStartDelay(o),p=this._dropContainer;if(!d){this._endDragSequence(o);return}(!p||!p.isDragging()&&!p.isReceiving())&&(o.cancelable&&o.preventDefault(),this._hasStartedDragging.set(!0),this._ngZone.run(()=>this._startDragSequence(o)))}return}o.cancelable&&o.preventDefault();let t=this._getConstrainedPointerPosition(e);if(this._hasMoved=!0,this._lastKnownPointerPosition=e,this._updatePointerDirectionDelta(t),this._dropContainer)this._updateActiveDropContainer(t,e);else{let i=this.constrainPosition?this._initialDomRect:this._pickupPositionOnPage,a=this._activeTransform;a.x=t.x-i.x+this._passiveTransform.x,a.y=t.y-i.y+this._passiveTransform.y,this._applyRootElementTransform(a.x,a.y)}this._moveEvents.observers.length&&this._ngZone.run(()=>{this._moveEvents.next({source:this,pointerPosition:t,event:o,distance:this._getDragDistance(t),delta:this._pointerDirectionDelta})})};_pointerUp=o=>{this._endDragSequence(o)};_endDragSequence(o){if(this._dragDropRegistry.isDragging(this)&&(this._removeListeners(),this._dragDropRegistry.stopDragging(this),this._toggleNativeDragInteractions(),this._handles&&(this._rootElement.style.webkitTapHighlightColor=this._rootElementTapHighlight),!!this._hasStartedDragging()))if(this.released.next({source:this,event:o}),this._dropContainer)this._dropContainer._stopScrolling(),this._animatePreviewToPlaceholder().then(()=>{this._cleanupDragArtifacts(o),this._cleanupCachedDimensions(),this._dragDropRegistry.stopDragging(this)});else{this._passiveTransform.x=this._activeTransform.x;let e=this._getPointerPositionOnPage(o);this._passiveTransform.y=this._activeTransform.y,this._ngZone.run(()=>{this.ended.next({source:this,distance:this._getDragDistance(e),dropPoint:e,event:o})}),this._cleanupCachedDimensions(),this._dragDropRegistry.stopDragging(this)}}_startDragSequence(o){B0(o)&&(this._lastTouchEventTime=Date.now()),this._toggleNativeDragInteractions();let e=this._getShadowRoot(),t=this._dropContainer;if(e&&this._ngZone.runOutsideAngular(()=>{this._cleanupShadowRootSelectStart=this._renderer.listen(e,"selectstart",Nee,Iee)}),t){let i=this._rootElement,a=i.parentNode,s=this._placeholder=this._createPlaceholderElement(),d=this._marker=this._marker||this._document.createComment("");a.insertBefore(d,i),this._initialTransform=i.style.transform||"",this._preview=new hT(this._document,this._rootElement,this._direction,this._initialDomRect,this._previewTemplate||null,this.previewClass||null,this._pickupPositionOnPage,this._initialTransform,this._config.zIndex||1e3,this._renderer),this._preview.attach(this._getPreviewInsertionPoint(a,e)),s8(i,!1,u8),this._document.body.appendChild(a.replaceChild(s,i)),this.started.next({source:this,event:o}),t.start(),this._initialContainer=t,this._initialIndex=t.getItemIndex(this)}else this.started.next({source:this,event:o}),this._initialContainer=this._initialIndex=void 0;this._parentPositions.cache(t?t.getScrollableParents():[])}_initializeDragSequence(o,e){this._parentDragRef&&e.stopPropagation();let t=this.isDragging(),i=B0(e),a=!i&&e.button!==0,s=this._rootElement,d=Rp(e),p=!i&&this._lastTouchEventTime&&this._lastTouchEventTime+Aee>Date.now(),u=i?OA(e):EA(e);if(d&&d.draggable&&e.type==="mousedown"&&e.preventDefault(),t||a||p||u)return;if(this._handles.length){let M=s.style;this._rootElementTapHighlight=M.webkitTapHighlightColor||"",M.webkitTapHighlightColor="transparent"}this._hasMoved=!1,this._hasStartedDragging.set(this._hasMoved),this._removeListeners(),this._initialDomRect=this._rootElement.getBoundingClientRect(),this._pointerMoveSubscription=this._dragDropRegistry.pointerMove.subscribe(this._pointerMove),this._pointerUpSubscription=this._dragDropRegistry.pointerUp.subscribe(this._pointerUp),this._scrollSubscription=this._dragDropRegistry.scrolled(this._getShadowRoot()).subscribe(M=>this._updateOnScroll(M)),this._boundaryElement&&(this._boundaryRect=bT(this._boundaryElement));let g=this._previewTemplate;this._pickupPositionInElement=g&&g.template&&!g.matchSize?{x:0,y:0}:this._getPointerPositionInElement(this._initialDomRect,o,e);let C=this._pickupPositionOnPage=this._lastKnownPointerPosition=this._getPointerPositionOnPage(e);this._pointerDirectionDelta={x:0,y:0},this._pointerPositionAtLastDirectionChange={x:C.x,y:C.y},this._dragStartTime=Date.now(),this._dragDropRegistry.startDragging(this,e)}_cleanupDragArtifacts(o){s8(this._rootElement,!0,u8),this._marker.parentNode.replaceChild(this._rootElement,this._marker),this._destroyPreview(),this._destroyPlaceholder(),this._initialDomRect=this._boundaryRect=this._previewRect=this._initialTransform=void 0,this._ngZone.run(()=>{let e=this._dropContainer,t=e.getItemIndex(this),i=this._getPointerPositionOnPage(o),a=this._getDragDistance(i),s=e._isOverContainer(i.x,i.y);this.ended.next({source:this,distance:a,dropPoint:i,event:o}),this.dropped.next({item:this,currentIndex:t,previousIndex:this._initialIndex,container:e,previousContainer:this._initialContainer,isPointerOverContainer:s,distance:a,dropPoint:i,event:o}),e.drop(this,t,this._initialIndex,this._initialContainer,s,a,i,o),this._dropContainer=this._initialContainer})}_updateActiveDropContainer({x:o,y:e},{x:t,y:i}){let a=this._initialContainer._getSiblingContainerFromPosition(this,o,e);!a&&this._dropContainer!==this._initialContainer&&this._initialContainer._isOverContainer(o,e)&&(a=this._initialContainer),a&&a!==this._dropContainer&&this._ngZone.run(()=>{let s=this._dropContainer.getItemIndex(this),d=this._dropContainer.getItemAtIndex(s+1)?.getVisibleElement()||null;this.exited.next({item:this,container:this._dropContainer}),this._dropContainer.exit(this),this._conditionallyInsertAnchor(a,this._dropContainer,d),this._dropContainer=a,this._dropContainer.enter(this,o,e,a===this._initialContainer&&a.sortingDisabled?this._initialIndex:void 0),this.entered.next({item:this,container:a,currentIndex:a.getItemIndex(this)})}),this.isDragging()&&(this._dropContainer._startScrollingIfNecessary(t,i),this._dropContainer._sortItem(this,o,e,this._pointerDirectionDelta),this.constrainPosition?this._applyPreviewTransform(o,e):this._applyPreviewTransform(o-this._pickupPositionInElement.x,e-this._pickupPositionInElement.y))}_animatePreviewToPlaceholder(){if(!this._hasMoved)return Promise.resolve();let o=this._placeholder.getBoundingClientRect();this._preview.addClass("cdk-drag-animating"),this._applyPreviewTransform(o.left,o.top);let e=this._preview.getTransitionDuration();return e===0?Promise.resolve():this._ngZone.runOutsideAngular(()=>new Promise(t=>{let i=d=>{(!d||this._preview&&Rp(d)===this._preview.element&&d.propertyName==="transform")&&(s(),t(),clearTimeout(a))},a=setTimeout(i,e*1.5),s=this._preview.addEventListener("transitionend",i)}))}_createPlaceholderElement(){let o=this._placeholderTemplate,e=o?o.template:null,t;return e?(this._placeholderRef=o.viewContainer.createEmbeddedView(e,o.context),this._placeholderRef.detectChanges(),t=f8(this._placeholderRef,this._document)):t=uT(this._rootElement),t.style.pointerEvents="none",t.classList.add(p8),t}_getPointerPositionInElement(o,e,t){let i=e===this._rootElement?null:e,a=i?i.getBoundingClientRect():o,s=B0(t)?t.targetTouches[0]:t,d=this._getViewportScrollPosition(),p=s.pageX-a.left-d.left,u=s.pageY-a.top-d.top;return{x:a.left-o.left+p,y:a.top-o.top+u}}_getPointerPositionOnPage(o){let e=this._getViewportScrollPosition(),t=B0(o)?o.touches[0]||o.changedTouches[0]||{pageX:0,pageY:0}:o,i=t.pageX-e.left,a=t.pageY-e.top;if(this._ownerSVGElement){let s=this._ownerSVGElement.getScreenCTM();if(s){let d=this._ownerSVGElement.createSVGPoint();return d.x=i,d.y=a,d.matrixTransform(s.inverse())}}return{x:i,y:a}}_getConstrainedPointerPosition(o){let e=this._dropContainer?this._dropContainer.lockAxis:null,{x:t,y:i}=this.constrainPosition?this.constrainPosition(o,this,this._initialDomRect,this._pickupPositionInElement):o;if(this.lockAxis==="x"||e==="x"?i=this._pickupPositionOnPage.y-(this.constrainPosition?this._pickupPositionInElement.y:0):(this.lockAxis==="y"||e==="y")&&(t=this._pickupPositionOnPage.x-(this.constrainPosition?this._pickupPositionInElement.x:0)),this._boundaryRect){let{x:a,y:s}=this.constrainPosition?{x:0,y:0}:this._pickupPositionInElement,d=this._boundaryRect,{width:p,height:u}=this._getPreviewRect(),g=d.top+s,C=d.bottom-(u-s),M=d.left+a,x=d.right-(p-a);t=g8(t,M,x),i=g8(i,g,C)}return{x:t,y:i}}_updatePointerDirectionDelta(o){let{x:e,y:t}=o,i=this._pointerDirectionDelta,a=this._pointerPositionAtLastDirectionChange,s=Math.abs(e-a.x),d=Math.abs(t-a.y);return s>this._config.pointerDirectionChangeThreshold&&(i.x=e>a.x?1:-1,a.x=e),d>this._config.pointerDirectionChangeThreshold&&(i.y=t>a.y?1:-1,a.y=t),i}_toggleNativeDragInteractions(){if(!this._rootElement||!this._handles)return;let o=this._handles.length>0||!this.isDragging();o!==this._nativeInteractionsEnabled&&(this._nativeInteractionsEnabled=o,oh(this._rootElement,o))}_removeRootElementListeners(){this._rootElementCleanups?.forEach(o=>o()),this._rootElementCleanups=void 0}_applyRootElementTransform(o,e){let t=1/this.scale,i=$0(o*t,e*t),a=this._rootElement.style;this._initialTransform==null&&(this._initialTransform=a.transform&&a.transform!="none"?a.transform:""),a.transform=Wx(i,this._initialTransform)}_applyPreviewTransform(o,e){let t=this._previewTemplate?.template?void 0:this._initialTransform,i=$0(o,e);this._preview.setTransform(Wx(i,t))}_getDragDistance(o){let e=this._pickupPositionOnPage;return e?{x:o.x-e.x,y:o.y-e.y}:{x:0,y:0}}_cleanupCachedDimensions(){this._boundaryRect=this._previewRect=void 0,this._parentPositions.clear()}_containInsideBoundaryOnResize(){let{x:o,y:e}=this._passiveTransform;if(o===0&&e===0||this.isDragging()||!this._boundaryElement)return;let t=this._rootElement.getBoundingClientRect(),i=this._boundaryElement.getBoundingClientRect();if(i.width===0&&i.height===0||t.width===0&&t.height===0)return;let a=i.left-t.left,s=t.right-i.right,d=i.top-t.top,p=t.bottom-i.bottom;i.width>t.width?(a>0&&(o+=a),s>0&&(o-=s)):o=0,i.height>t.height?(d>0&&(e+=d),p>0&&(e-=p)):e=0,(o!==this._passiveTransform.x||e!==this._passiveTransform.y)&&this.setFreeDragPosition({y:e,x:o})}_getDragStartDelay(o){let e=this.dragStartDelay;return typeof e=="number"?e:B0(o)?e.touch:e?e.mouse:0}_updateOnScroll(o){let e=this._parentPositions.handleScroll(o);if(e){let t=Rp(o);this._boundaryRect&&t!==this._boundaryElement&&t.contains(this._boundaryElement)&&j0(this._boundaryRect,e.top,e.left),this._pickupPositionOnPage.x+=e.left,this._pickupPositionOnPage.y+=e.top,this._dropContainer||(this._activeTransform.x-=e.left,this._activeTransform.y-=e.top,this._applyRootElementTransform(this._activeTransform.x,this._activeTransform.y))}}_getViewportScrollPosition(){return this._parentPositions.positions.get(this._document)?.scrollPosition||this._parentPositions.getViewportScrollPosition()}_getShadowRoot(){return this._cachedShadowRoot===void 0&&(this._cachedShadowRoot=jC(this._rootElement)),this._cachedShadowRoot}_getPreviewInsertionPoint(o,e){let t=this._previewContainer||"global";if(t==="parent")return o;if(t==="global"){let i=this._document;return e||i.fullscreenElement||i.webkitFullscreenElement||i.mozFullScreenElement||i.msFullscreenElement||i.body}return cl(t)}_getPreviewRect(){return(!this._previewRect||!this._previewRect.width&&!this._previewRect.height)&&(this._previewRect=this._preview?this._preview.getBoundingClientRect():this._initialDomRect),this._previewRect}_nativeDragStart=o=>{if(this._handles.length){let e=this._getTargetHandle(o);e&&!this._disabledHandles.has(e)&&!this.disabled&&o.preventDefault()}else this.disabled||o.preventDefault()};_getTargetHandle(o){return this._handles.find(e=>o.target&&(o.target===e||e.contains(o.target)))}_conditionallyInsertAnchor(o,e,t){if(o===this._initialContainer)this._anchor?.remove(),this._anchor=null;else if(e===this._initialContainer&&e.hasAnchor){let i=this._anchor??=uT(this._placeholder);i.classList.remove(p8),i.classList.add("cdk-drag-anchor"),i.style.transform="",t?t.before(i):cl(e.element).appendChild(i)}}};function g8(n,o,e){return Math.max(o,Math.min(e,n))}function B0(n){return n.type[0]==="t"}function Nee(n){n.preventDefault()}function C8(n,o,e){let t=h8(o,n.length-1),i=h8(e,n.length-1);if(t===i)return;let a=n[t],s=i0)return null;let d=this.orientation==="horizontal",p=a.findIndex(k=>k.drag===o),u=a[s],g=a[p].clientRect,C=u.clientRect,M=p>s?1:-1,x=this._getItemOffsetPx(g,C,M),b=this._getSiblingOffsetPx(p,a,M),P=a.slice();return C8(a,p,s),a.forEach((k,S)=>{if(P[S]===k)return;let O=k.drag===o,A=O?x:b,D=O?o.getPlaceholderElement():k.drag.getRootElement();k.offset+=A;let F=Math.round(k.offset*(1/k.drag.scale));d?(D.style.transform=Wx(`translate3d(${F}px, 0, 0)`,k.initialTransform),j0(k.clientRect,0,A)):(D.style.transform=Wx(`translate3d(0, ${F}px, 0)`,k.initialTransform),j0(k.clientRect,A,0))}),this._previousSwap.overlaps=gT(C,e,t),this._previousSwap.drag=u.drag,this._previousSwap.delta=d?i.x:i.y,{previousIndex:p,currentIndex:s}}enter(o,e,t,i){let a=this._activeDraggables,s=a.indexOf(o),d=o.getPlaceholderElement();s>-1&&a.splice(s,1);let p=i==null||i<0?this._getItemIndexFromPointerPosition(o,e,t):i,u=a[p];if(u===o&&(u=a[p+1]),!u&&(p==null||p===-1||p{let e=o.getRootElement();if(e){let t=this._itemPositions.find(i=>i.drag===o)?.initialTransform;e.style.transform=t||""}}),this._itemPositions=[],this._activeDraggables=[],this._previousSwap.drag=null,this._previousSwap.delta=0,this._previousSwap.overlaps=!1}getActiveItemsSnapshot(){return this._activeDraggables}getItemIndex(o){return this._getVisualItemPositions().findIndex(e=>e.drag===o)}getItemAtIndex(o){return this._getVisualItemPositions()[o]?.drag||null}updateOnScroll(o,e){this._itemPositions.forEach(({clientRect:t})=>{j0(t,o,e)}),this._itemPositions.forEach(({drag:t})=>{this._dragDropRegistry.isDragging(t)&&t._sortFromLastPointerPosition()})}withElementContainer(o){this._element=o}_cacheItemPositions(){let o=this.orientation==="horizontal";this._itemPositions=this._activeDraggables.map(e=>{let t=e.getVisibleElement();return{drag:e,offset:0,initialTransform:t.style.transform||"",clientRect:bT(t)}}).sort((e,t)=>o?e.clientRect.left-t.clientRect.left:e.clientRect.top-t.clientRect.top)}_getVisualItemPositions(){return this.orientation==="horizontal"&&this.direction==="rtl"?this._itemPositions.slice().reverse():this._itemPositions}_getItemOffsetPx(o,e,t){let i=this.orientation==="horizontal",a=i?e.left-o.left:e.top-o.top;return t===-1&&(a+=i?e.width-o.width:e.height-o.height),a}_getSiblingOffsetPx(o,e,t){let i=this.orientation==="horizontal",a=e[o].clientRect,s=e[o+t*-1],d=a[i?"width":"height"]*t;if(s){let p=i?"left":"top",u=i?"right":"bottom";t===-1?d-=s.clientRect[p]-a[u]:d+=a[p]-s.clientRect[u]}return d}_shouldEnterAsFirstChild(o,e){if(!this._activeDraggables.length)return!1;let t=this._itemPositions,i=this.orientation==="horizontal";if(t[0].drag!==this._activeDraggables[0]){let s=t[t.length-1].clientRect;return i?o>=s.right:e>=s.bottom}else{let s=t[0].clientRect;return i?o<=s.left:e<=s.top}}_getItemIndexFromPointerPosition(o,e,t,i){let a=this.orientation==="horizontal",s=this._itemPositions.findIndex(({drag:d,clientRect:p})=>{if(d===o)return!1;if(i){let u=a?i.x:i.y;if(d===this._previousSwap.drag&&this._previousSwap.overlaps&&u===this._previousSwap.delta)return!1}return a?e>=Math.floor(p.left)&&e=Math.floor(p.top)&&tp?g.after(u):g.before(u),C8(this._activeItems,p,a);let C=this._getRootNode().elementFromPoint(e,t);return s.deltaX=i.x,s.deltaY=i.y,s.drag=d,s.overlaps=g===C||g.contains(C),{previousIndex:p,currentIndex:a}}enter(o,e,t,i){let a=this._activeItems.indexOf(o);a>-1&&this._activeItems.splice(a,1);let s=i==null||i<0?this._getItemIndexFromPointerPosition(o,e,t):i;s===-1&&(s=this._getClosestItemIndexToPointer(o,e,t));let d=this._activeItems[s];d&&!this._dragDropRegistry.isDragging(d)?(this._activeItems.splice(s,0,o),d.getRootElement().before(o.getPlaceholderElement())):(this._activeItems.push(o),this._element.appendChild(o.getPlaceholderElement()))}withItems(o){this._activeItems=o.slice()}withSortPredicate(o){this._sortPredicate=o}reset(){let o=this._element,e=this._previousSwap;for(let t=this._relatedNodes.length-1;t>-1;t--){let[i,a]=this._relatedNodes[t];i.parentNode===o&&i.nextSibling!==a&&(a===null?o.appendChild(i):a.parentNode===o&&o.insertBefore(i,a))}this._relatedNodes=[],this._activeItems=[],e.drag=null,e.deltaX=e.deltaY=0,e.overlaps=!1}getActiveItemsSnapshot(){return this._activeItems}getItemIndex(o){return this._activeItems.indexOf(o)}getItemAtIndex(o){return this._activeItems[o]||null}updateOnScroll(){this._activeItems.forEach(o=>{this._dragDropRegistry.isDragging(o)&&o._sortFromLastPointerPosition()})}withElementContainer(o){o!==this._element&&(this._element=o,this._rootNode=void 0)}_getItemIndexFromPointerPosition(o,e,t){let i=this._getRootNode().elementFromPoint(Math.floor(e),Math.floor(t)),a=i?this._activeItems.findIndex(s=>{let d=s.getRootElement();return i===d||d.contains(i)}):-1;return a===-1||!this._sortPredicate(a,o)?-1:a}_getRootNode(){return this._rootNode||(this._rootNode=jC(this._element)||this._document),this._rootNode}_getClosestItemIndexToPointer(o,e,t){if(this._activeItems.length===0)return-1;if(this._activeItems.length===1)return 0;let i=1/0,a=-1;for(let s=0;s!0;sortPredicate=()=>!0;beforeStarted=new Ye;entered=new Ye;exited=new Ye;dropped=new Ye;sorted=new Ye;receivingStarted=new Ye;receivingStopped=new Ye;data;_container;_isDragging=!1;_parentPositions;_sortStrategy;_domRect;_draggables=[];_siblings=[];_activeSiblings=new Set;_viewportScrollSubscription=Oo.EMPTY;_verticalScrollDirection=Ml.NONE;_horizontalScrollDirection=as.NONE;_scrollNode;_stopScrollTimers=new Ye;_cachedShadowRoot=null;_document;_scrollableElements=[];_initialScrollSnap;_direction="ltr";constructor(o,e,t,i,a){this._dragDropRegistry=e,this._ngZone=i,this._viewportRuler=a;let s=this.element=cl(o);this._document=t,this.withOrientation("vertical").withElementContainer(s),e.registerDropContainer(this),this._parentPositions=new Ux(t)}dispose(){this._stopScrolling(),this._stopScrollTimers.complete(),this._viewportScrollSubscription.unsubscribe(),this.beforeStarted.complete(),this.entered.complete(),this.exited.complete(),this.dropped.complete(),this.sorted.complete(),this.receivingStarted.complete(),this.receivingStopped.complete(),this._activeSiblings.clear(),this._scrollNode=null,this._parentPositions.clear(),this._dragDropRegistry.removeDropContainer(this)}isDragging(){return this._isDragging}start(){this._draggingStarted(),this._notifyReceivingSiblings()}enter(o,e,t,i){this._draggingStarted(),i==null&&this.sortingDisabled&&(i=this._draggables.indexOf(o)),this._sortStrategy.enter(o,e,t,i),this._cacheParentPositions(),this._notifyReceivingSiblings(),this.entered.next({item:o,container:this,currentIndex:this.getItemIndex(o)})}exit(o){this._reset(),this.exited.next({item:o,container:this})}drop(o,e,t,i,a,s,d,p={}){this._reset(),this.dropped.next({item:o,currentIndex:e,previousIndex:t,container:this,previousContainer:i,isPointerOverContainer:a,distance:s,dropPoint:d,event:p})}withItems(o){let e=this._draggables;return this._draggables=o,o.forEach(t=>t._withDropContainer(this)),this.isDragging()&&(e.filter(i=>i.isDragging()).every(i=>o.indexOf(i)===-1)?this._reset():this._sortStrategy.withItems(this._draggables)),this}withDirection(o){return this._direction=o,this._sortStrategy instanceof Gx&&(this._sortStrategy.direction=o),this}connectedTo(o){return this._siblings=o.slice(),this}withOrientation(o){if(o==="mixed")this._sortStrategy=new fT(this._document,this._dragDropRegistry);else{let e=new Gx(this._dragDropRegistry);e.direction=this._direction,e.orientation=o,this._sortStrategy=e}return this._sortStrategy.withElementContainer(this._container),this._sortStrategy.withSortPredicate((e,t)=>this.sortPredicate(e,t,this)),this}withScrollableParents(o){let e=this._container;return this._scrollableElements=o.indexOf(e)===-1?[e,...o]:o.slice(),this}withElementContainer(o){if(o===this._container)return this;let e=cl(this.element),t=this._scrollableElements.indexOf(this._container),i=this._scrollableElements.indexOf(o);return t>-1&&this._scrollableElements.splice(t,1),i>-1&&this._scrollableElements.splice(i,1),this._sortStrategy&&this._sortStrategy.withElementContainer(o),this._cachedShadowRoot=null,this._scrollableElements.unshift(o),this._container=o,this}getScrollableParents(){return this._scrollableElements}getItemIndex(o){return this._isDragging?this._sortStrategy.getItemIndex(o):this._draggables.indexOf(o)}getItemAtIndex(o){return this._isDragging?this._sortStrategy.getItemAtIndex(o):this._draggables[o]||null}isReceiving(){return this._activeSiblings.size>0}_sortItem(o,e,t,i){if(this.sortingDisabled||!this._domRect||!r8(this._domRect,_8,e,t))return;let a=this._sortStrategy.sort(o,e,t,i);a&&this.sorted.next({previousIndex:a.previousIndex,currentIndex:a.currentIndex,container:this,item:o})}_startScrollingIfNecessary(o,e){if(this.autoScrollDisabled)return;let t,i=Ml.NONE,a=as.NONE;if(this._parentPositions.positions.forEach((s,d)=>{d===this._document||!s.clientRect||t||r8(s.clientRect,_8,o,e)&&([i,a]=Ree(d,s.clientRect,this._direction,o,e),(i||a)&&(t=d))}),!i&&!a){let{width:s,height:d}=this._viewportRuler.getViewportSize(),p={width:s,height:d,top:0,right:s,bottom:d,left:0};i=x8(p,e),a=y8(p,o),t=window}t&&(i!==this._verticalScrollDirection||a!==this._horizontalScrollDirection||t!==this._scrollNode)&&(this._verticalScrollDirection=i,this._horizontalScrollDirection=a,this._scrollNode=t,(i||a)&&t?this._ngZone.runOutsideAngular(this._startScrollInterval):this._stopScrolling())}_stopScrolling(){this._stopScrollTimers.next()}_draggingStarted(){let o=this._container.style;this.beforeStarted.next(),this._isDragging=!0,this._initialScrollSnap=o.msScrollSnapType||o.scrollSnapType||"",o.scrollSnapType=o.msScrollSnapType="none",this._sortStrategy.start(this._draggables),this._cacheParentPositions(),this._viewportScrollSubscription.unsubscribe(),this._listenToScrollEvents()}_cacheParentPositions(){this._parentPositions.cache(this._scrollableElements),this._domRect=this._parentPositions.positions.get(this._container).clientRect}_reset(){this._isDragging=!1;let o=this._container.style;o.scrollSnapType=o.msScrollSnapType=this._initialScrollSnap,this._siblings.forEach(e=>e._stopReceiving(this)),this._sortStrategy.reset(),this._stopScrolling(),this._viewportScrollSubscription.unsubscribe(),this._parentPositions.clear()}_startScrollInterval=()=>{this._stopScrolling(),DC(0,rl).pipe(He(this._stopScrollTimers)).subscribe(()=>{let o=this._scrollNode,e=this.autoScrollStep;this._verticalScrollDirection===Ml.UP?o.scrollBy(0,-e):this._verticalScrollDirection===Ml.DOWN&&o.scrollBy(0,e),this._horizontalScrollDirection===as.LEFT?o.scrollBy(-e,0):this._horizontalScrollDirection===as.RIGHT&&o.scrollBy(e,0)})};_isOverContainer(o,e){return this._domRect!=null&&gT(this._domRect,o,e)}_getSiblingContainerFromPosition(o,e,t){return this._siblings.find(i=>i._canReceive(o,e,t))}_canReceive(o,e,t){if(!this._domRect||!gT(this._domRect,e,t)||!this.enterPredicate(o,this))return!1;let i=this._getShadowRoot().elementFromPoint(e,t);return i?i===this._container||this._container.contains(i):!1}_startReceiving(o,e){let t=this._activeSiblings;!t.has(o)&&e.every(i=>this.enterPredicate(i,this)||this._draggables.indexOf(i)>-1)&&(t.add(o),this._cacheParentPositions(),this._listenToScrollEvents(),this.receivingStarted.next({initiator:o,receiver:this,items:e}))}_stopReceiving(o){this._activeSiblings.delete(o),this._viewportScrollSubscription.unsubscribe(),this.receivingStopped.next({initiator:o,receiver:this})}_listenToScrollEvents(){this._viewportScrollSubscription=this._dragDropRegistry.scrolled(this._getShadowRoot()).subscribe(o=>{if(this.isDragging()){let e=this._parentPositions.handleScroll(o);e&&this._sortStrategy.updateOnScroll(e.top,e.left)}else this.isReceiving()&&this._cacheParentPositions()})}_getShadowRoot(){if(!this._cachedShadowRoot){let o=jC(this._container);this._cachedShadowRoot=o||this._document}return this._cachedShadowRoot}_notifyReceivingSiblings(){let o=this._sortStrategy.getActiveItemsSnapshot().filter(e=>e.isDragging());this._siblings.forEach(e=>e._startReceiving(this,o))}};function x8(n,o){let{top:e,bottom:t,height:i}=n,a=i*b8;return o>=e-a&&o<=e+a?Ml.UP:o>=t-a&&o<=t+a?Ml.DOWN:Ml.NONE}function y8(n,o){let{left:e,right:t,width:i}=n,a=i*b8;return o>=e-a&&o<=e+a?as.LEFT:o>=t-a&&o<=t+a?as.RIGHT:as.NONE}function Ree(n,o,e,t,i){let a=x8(o,i),s=y8(o,t),d=Ml.NONE,p=as.NONE;if(a){let u=n.scrollTop;a===Ml.UP?u>0&&(d=Ml.UP):n.scrollHeight-u>n.clientHeight&&(d=Ml.DOWN)}if(s){let u=n.scrollLeft;e==="rtl"?s===as.RIGHT?u<0&&(p=as.RIGHT):n.scrollWidth+u>n.clientWidth&&(p=as.LEFT):s===as.LEFT?u>0&&(p=as.LEFT):n.scrollWidth-u>n.clientWidth&&(p=as.RIGHT)}return[d,p]}var zee=(()=>{class n{_injector=f(xa);constructor(){}createDrag(e,t){return v8(this._injector,e,t)}createDropList(e){return Fee(this._injector,e)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=J({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),CT=new mn("CDK_DRAG_PARENT");var w8=new mn("CdkDragHandle"),M8=(()=>{class n{element=f(Kt);_parentDrag=f(CT,{optional:!0,skipSelf:!0});_dragDropRegistry=f(qx);_stateChanges=new Ye;get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._stateChanges.next(this)}_disabled=!1;constructor(){this._parentDrag?._addHandle(this)}ngAfterViewInit(){if(!this._parentDrag){let e=this.element.nativeElement.parentElement;for(;e;){let t=this._dragDropRegistry.getDragDirectiveForNode(e);if(t){this._parentDrag=t,t._addHandle(this);break}e=e.parentElement}}}ngOnDestroy(){this._parentDrag?._removeHandle(this),this._stateChanges.complete()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkDragHandle",""]],hostAttrs:[1,"cdk-drag-handle"],inputs:{disabled:[2,"cdkDragHandleDisabled","disabled",zt]},features:[un([{provide:w8,useExisting:n}])]})}return n})(),Lee=new mn("CDK_DRAG_CONFIG"),Vee=new mn("CdkDropList"),S8=(()=>{class n{element=f(Kt);dropContainer=f(Vee,{optional:!0,skipSelf:!0});_ngZone=f(Gi);_viewContainerRef=f(Wo);_dir=f(Kr,{optional:!0});_changeDetectorRef=f(oe);_selfHandle=f(w8,{optional:!0,self:!0});_parentDrag=f(CT,{optional:!0,skipSelf:!0});_dragDropRegistry=f(qx);_destroyed=new Ye;_handles=new cn([]);_previewTemplate=null;_placeholderTemplate=null;_dragRef;data;lockAxis=null;rootElementSelector;boundaryElement;dragStartDelay;freeDragPosition;get disabled(){return this._disabled||!!(this.dropContainer&&this.dropContainer.disabled)}set disabled(e){this._disabled=e,this._dragRef.disabled=this._disabled}_disabled=!1;constrainPosition;previewClass;previewContainer;scale=1;started=new be;released=new be;ended=new be;entered=new be;exited=new be;dropped=new be;moved=new Sr(e=>{let t=this._dragRef.moved.pipe(Pt(i=>({source:this,pointerPosition:i.pointerPosition,event:i.event,delta:i.delta,distance:i.distance}))).subscribe(e);return()=>{t.unsubscribe()}});_injector=f(xa);constructor(){let e=this.dropContainer,t=f(Lee,{optional:!0});this._dragRef=v8(this._injector,this.element,{dragStartThreshold:t&&t.dragStartThreshold!=null?t.dragStartThreshold:5,pointerDirectionChangeThreshold:t&&t.pointerDirectionChangeThreshold!=null?t.pointerDirectionChangeThreshold:5,zIndex:t?.zIndex}),this._dragRef.data=this,this._dragDropRegistry.registerDirectiveNode(this.element.nativeElement,this),t&&this._assignDefaults(t),e&&(e.addItem(this),e._dropListRef.beforeStarted.pipe(He(this._destroyed)).subscribe(()=>{this._dragRef.scale=this.scale})),this._syncInputs(this._dragRef),this._handleEvents(this._dragRef)}getPlaceholderElement(){return this._dragRef.getPlaceholderElement()}getRootElement(){return this._dragRef.getRootElement()}reset(){this._dragRef.reset()}resetToBoundary(){this._dragRef.resetToBoundary()}getFreeDragPosition(){return this._dragRef.getFreeDragPosition()}setFreeDragPosition(e){this._dragRef.setFreeDragPosition(e)}ngAfterViewInit(){Ya(()=>{this._updateRootElement(),this._setupHandlesListener(),this._dragRef.scale=this.scale,this.freeDragPosition&&this._dragRef.setFreeDragPosition(this.freeDragPosition)},{injector:this._injector})}ngOnChanges(e){let t=e.rootElementSelector,i=e.freeDragPosition;t&&!t.firstChange&&this._updateRootElement(),this._dragRef.scale=this.scale,i&&!i.firstChange&&this.freeDragPosition&&this._dragRef.setFreeDragPosition(this.freeDragPosition)}ngOnDestroy(){this.dropContainer&&this.dropContainer.removeItem(this),this._dragDropRegistry.removeDirectiveNode(this.element.nativeElement),this._ngZone.runOutsideAngular(()=>{this._handles.complete(),this._destroyed.next(),this._destroyed.complete(),this._dragRef.dispose()})}_addHandle(e){let t=this._handles.getValue();t.push(e),this._handles.next(t)}_removeHandle(e){let t=this._handles.getValue(),i=t.indexOf(e);i>-1&&(t.splice(i,1),this._handles.next(t))}_setPreviewTemplate(e){this._previewTemplate=e}_resetPreviewTemplate(e){e===this._previewTemplate&&(this._previewTemplate=null)}_setPlaceholderTemplate(e){this._placeholderTemplate=e}_resetPlaceholderTemplate(e){e===this._placeholderTemplate&&(this._placeholderTemplate=null)}_updateRootElement(){let e=this.element.nativeElement,t=e;this.rootElementSelector&&(t=e.closest!==void 0?e.closest(this.rootElementSelector):e.parentElement?.closest(this.rootElementSelector)),this._dragRef.withRootElement(t||e)}_getBoundaryElement(){let e=this.boundaryElement;return e?typeof e=="string"?this.element.nativeElement.closest(e):cl(e):null}_syncInputs(e){e.beforeStarted.subscribe(()=>{if(!e.isDragging()){let t=this._dir,i=this.dragStartDelay,a=this._placeholderTemplate?{template:this._placeholderTemplate.templateRef,context:this._placeholderTemplate.data,viewContainer:this._viewContainerRef}:null,s=this._previewTemplate?{template:this._previewTemplate.templateRef,context:this._previewTemplate.data,matchSize:this._previewTemplate.matchSize,viewContainer:this._viewContainerRef}:null;e.disabled=this.disabled,e.lockAxis=this.lockAxis,e.scale=this.scale,e.dragStartDelay=typeof i=="object"&&i?i:mm(i),e.constrainPosition=this.constrainPosition,e.previewClass=this.previewClass,e.withBoundaryElement(this._getBoundaryElement()).withPlaceholderTemplate(a).withPreviewTemplate(s).withPreviewContainer(this.previewContainer||"global"),t&&e.withDirection(t.value)}}),e.beforeStarted.pipe(Gr(1)).subscribe(()=>{if(this._parentDrag){e.withParent(this._parentDrag._dragRef);return}let t=this.element.nativeElement.parentElement;for(;t;){let i=this._dragDropRegistry.getDragDirectiveForNode(t);if(i){e.withParent(i._dragRef);break}t=t.parentElement}})}_handleEvents(e){e.started.subscribe(t=>{this.started.emit({source:this,event:t.event}),this._changeDetectorRef.markForCheck()}),e.released.subscribe(t=>{this.released.emit({source:this,event:t.event})}),e.ended.subscribe(t=>{this.ended.emit({source:this,distance:t.distance,dropPoint:t.dropPoint,event:t.event}),this._changeDetectorRef.markForCheck()}),e.entered.subscribe(t=>{this.entered.emit({container:t.container.data,item:this,currentIndex:t.currentIndex})}),e.exited.subscribe(t=>{this.exited.emit({container:t.container.data,item:this})}),e.dropped.subscribe(t=>{this.dropped.emit({previousIndex:t.previousIndex,currentIndex:t.currentIndex,previousContainer:t.previousContainer.data,container:t.container.data,isPointerOverContainer:t.isPointerOverContainer,item:this,distance:t.distance,dropPoint:t.dropPoint,event:t.event})})}_assignDefaults(e){let{lockAxis:t,dragStartDelay:i,constrainPosition:a,previewClass:s,boundaryElement:d,draggingDisabled:p,rootElementSelector:u,previewContainer:g}=e;this.disabled=p??!1,this.dragStartDelay=i||0,this.lockAxis=t||null,a&&(this.constrainPosition=a),s&&(this.previewClass=s),d&&(this.boundaryElement=d),u&&(this.rootElementSelector=u),g&&(this.previewContainer=g)}_setupHandlesListener(){this._handles.pipe(Qn(e=>{let t=e.map(i=>i.element);this._selfHandle&&this.rootElementSelector&&t.push(this.element),this._dragRef.withHandles(t)}),Dn(e=>ro(...e.map(t=>t._stateChanges.pipe(Di(t))))),He(this._destroyed)).subscribe(e=>{let t=this._dragRef,i=e.element.nativeElement;e.disabled?t.disableHandle(i):t.enableHandle(i)})}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkDrag",""]],hostAttrs:[1,"cdk-drag"],hostVars:4,hostBindings:function(t,i){t&2&&ne("cdk-drag-disabled",i.disabled)("cdk-drag-dragging",i._dragRef.isDragging())},inputs:{data:[0,"cdkDragData","data"],lockAxis:[0,"cdkDragLockAxis","lockAxis"],rootElementSelector:[0,"cdkDragRootElement","rootElementSelector"],boundaryElement:[0,"cdkDragBoundary","boundaryElement"],dragStartDelay:[0,"cdkDragStartDelay","dragStartDelay"],freeDragPosition:[0,"cdkDragFreeDragPosition","freeDragPosition"],disabled:[2,"cdkDragDisabled","disabled",zt],constrainPosition:[0,"cdkDragConstrainPosition","constrainPosition"],previewClass:[0,"cdkDragPreviewClass","previewClass"],previewContainer:[0,"cdkDragPreviewContainer","previewContainer"],scale:[2,"cdkDragScale","scale",qo]},outputs:{started:"cdkDragStarted",released:"cdkDragReleased",ended:"cdkDragEnded",entered:"cdkDragEntered",exited:"cdkDragExited",dropped:"cdkDragDropped",moved:"cdkDragMoved"},exportAs:["cdkDrag"],features:[un([{provide:CT,useExisting:n}]),Nn]})}return n})();var Qx=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({providers:[zee],imports:[Lp]})}return n})();var jee=[[["caption"]],[["colgroup"],["col"]],"*"],$ee=["caption","colgroup, col","*"];function Hee(n,o){n&1&&Zt(0,2)}function Uee(n,o){n&1&&(r(0,"thead",0),li(1,1),l(),r(2,"tbody",0),li(3,2)(4,3),l(),r(5,"tfoot",0),li(6,4),l())}function Wee(n,o){n&1&&li(0,1)(1,2)(2,3)(3,4)}var sc=new mn("CDK_TABLE");var Yx=(()=>{class n{template=f(pa);constructor(){}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkCellDef",""]]})}return n})(),Zx=(()=>{class n{template=f(pa);constructor(){}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkHeaderCellDef",""]]})}return n})(),T8=(()=>{class n{template=f(pa);constructor(){}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkFooterCellDef",""]]})}return n})(),$m=(()=>{class n{_table=f(sc,{optional:!0});_hasStickyChanged=!1;get name(){return this._name}set name(e){this._setNameInput(e)}_name;get sticky(){return this._sticky}set sticky(e){e!==this._sticky&&(this._sticky=e,this._hasStickyChanged=!0)}_sticky=!1;get stickyEnd(){return this._stickyEnd}set stickyEnd(e){e!==this._stickyEnd&&(this._stickyEnd=e,this._hasStickyChanged=!0)}_stickyEnd=!1;cell;headerCell;footerCell;cssClassFriendlyName;_columnCssClassName;constructor(){}hasStickyChanged(){let e=this._hasStickyChanged;return this.resetStickyChanged(),e}resetStickyChanged(){this._hasStickyChanged=!1}_updateColumnCssClassName(){this._columnCssClassName=[`cdk-column-${this.cssClassFriendlyName}`]}_setNameInput(e){e&&(this._name=e,this.cssClassFriendlyName=e.replace(/[^a-z0-9_-]/gi,"-"),this._updateColumnCssClassName())}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkColumnDef",""]],contentQueries:function(t,i,a){if(t&1&&Zi(a,Yx,5)(a,Zx,5)(a,T8,5),t&2){let s;gt(s=ht())&&(i.cell=s.first),gt(s=ht())&&(i.headerCell=s.first),gt(s=ht())&&(i.footerCell=s.first)}},inputs:{name:[0,"cdkColumnDef","name"],sticky:[2,"sticky","sticky",zt],stickyEnd:[2,"stickyEnd","stickyEnd",zt]}})}return n})(),Xx=class{constructor(o,e){e.nativeElement.classList.add(...o._columnCssClassName)}},E8=(()=>{class n extends Xx{constructor(){super(f($m),f(Kt))}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["cdk-header-cell"],["th","cdk-header-cell",""]],hostAttrs:["role","columnheader",1,"cdk-header-cell"],features:[mi]})}return n})();var O8=(()=>{class n extends Xx{constructor(){let e=f($m),t=f(Kt);super(e,t);let i=e._table?._getCellRole();i&&t.nativeElement.setAttribute("role",i)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["cdk-cell"],["td","cdk-cell",""]],hostAttrs:[1,"cdk-cell"],features:[mi]})}return n})();var wT=(()=>{class n{template=f(pa);_differs=f(Sd);columns;_columnsDiffer;constructor(){}ngOnChanges(e){if(!this._columnsDiffer){let t=e.columns&&e.columns.currentValue||[];this._columnsDiffer=this._differs.find(t).create(),this._columnsDiffer.diff(t)}}getColumnsDiff(){return this._columnsDiffer.diff(this.columns)}extractCellTemplate(e){return this instanceof U0?e.headerCell.template:this instanceof MT?e.footerCell.template:e.cell.template}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,features:[Nn]})}return n})(),U0=(()=>{class n extends wT{_table=f(sc,{optional:!0});_hasStickyChanged=!1;get sticky(){return this._sticky}set sticky(e){e!==this._sticky&&(this._sticky=e,this._hasStickyChanged=!0)}_sticky=!1;constructor(){super(f(pa),f(Sd))}ngOnChanges(e){super.ngOnChanges(e)}hasStickyChanged(){let e=this._hasStickyChanged;return this.resetStickyChanged(),e}resetStickyChanged(){this._hasStickyChanged=!1}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkHeaderRowDef",""]],inputs:{columns:[0,"cdkHeaderRowDef","columns"],sticky:[2,"cdkHeaderRowDefSticky","sticky",zt]},features:[mi,Nn]})}return n})(),MT=(()=>{class n extends wT{_table=f(sc,{optional:!0});_hasStickyChanged=!1;get sticky(){return this._sticky}set sticky(e){e!==this._sticky&&(this._sticky=e,this._hasStickyChanged=!0)}_sticky=!1;constructor(){super(f(pa),f(Sd))}ngOnChanges(e){super.ngOnChanges(e)}hasStickyChanged(){let e=this._hasStickyChanged;return this.resetStickyChanged(),e}resetStickyChanged(){this._hasStickyChanged=!1}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkFooterRowDef",""]],inputs:{columns:[0,"cdkFooterRowDef","columns"],sticky:[2,"cdkFooterRowDefSticky","sticky",zt]},features:[mi,Nn]})}return n})(),Jx=(()=>{class n extends wT{_table=f(sc,{optional:!0});when;constructor(){super(f(pa),f(Sd))}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkRowDef",""]],inputs:{columns:[0,"cdkRowDefColumns","columns"],when:[0,"cdkRowDefWhen","when"]},features:[mi]})}return n})(),bu=(()=>{class n{_viewContainer=f(Wo);cells;context;static mostRecentCellOutlet=null;constructor(){n.mostRecentCellOutlet=this}ngOnDestroy(){n.mostRecentCellOutlet===this&&(n.mostRecentCellOutlet=null)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","cdkCellOutlet",""]]})}return n})(),ST=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["cdk-header-row"],["tr","cdk-header-row",""]],hostAttrs:["role","row",1,"cdk-header-row"],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(t,i){t&1&&li(0,0)},dependencies:[bu],encapsulation:2})}return n})();var kT=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["cdk-row"],["tr","cdk-row",""]],hostAttrs:["role","row",1,"cdk-row"],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(t,i){t&1&&li(0,0)},dependencies:[bu],encapsulation:2})}return n})(),D8=(()=>{class n{templateRef=f(pa);_contentClassNames=["cdk-no-data-row","cdk-row"];_cellClassNames=["cdk-cell","cdk-no-data-cell"];_cellSelector="td, cdk-cell, [cdk-cell], .cdk-cell";constructor(){}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["ng-template","cdkNoDataRow",""]]})}return n})(),k8=["top","bottom","left","right"],yT=class{_isNativeHtmlTable;_stickCellCss;_isBrowser;_needsPositionStickyOnElement;direction;_positionListener;_tableInjector;_elemSizeCache=new WeakMap;_resizeObserver=globalThis?.ResizeObserver?new globalThis.ResizeObserver(o=>this._updateCachedSizes(o)):null;_updatedStickyColumnsParamsToReplay=[];_stickyColumnsReplayTimeout=null;_cachedCellWidths=[];_borderCellCss;_destroyed=!1;constructor(o,e,t=!0,i=!0,a,s,d){this._isNativeHtmlTable=o,this._stickCellCss=e,this._isBrowser=t,this._needsPositionStickyOnElement=i,this.direction=a,this._positionListener=s,this._tableInjector=d,this._borderCellCss={top:`${e}-border-elem-top`,bottom:`${e}-border-elem-bottom`,left:`${e}-border-elem-left`,right:`${e}-border-elem-right`}}clearStickyPositioning(o,e){(e.includes("left")||e.includes("right"))&&this._removeFromStickyColumnReplayQueue(o);let t=[];for(let i of o)i.nodeType===i.ELEMENT_NODE&&t.push(i,...Array.from(i.children));Ya({write:()=>{for(let i of t)this._removeStickyStyle(i,e)}},{injector:this._tableInjector})}updateStickyColumns(o,e,t,i=!0,a=!0){if(!o.length||!this._isBrowser||!(e.some(k=>k)||t.some(k=>k))){this._positionListener?.stickyColumnsUpdated({sizes:[]}),this._positionListener?.stickyEndColumnsUpdated({sizes:[]});return}let s=o[0],d=s.children.length,p=this.direction==="rtl",u=p?"right":"left",g=p?"left":"right",C=e.lastIndexOf(!0),M=t.indexOf(!0),x,b,P;a&&this._updateStickyColumnReplayQueue({rows:[...o],stickyStartStates:[...e],stickyEndStates:[...t]}),Ya({earlyRead:()=>{x=this._getCellWidths(s,i),b=this._getStickyStartColumnPositions(x,e),P=this._getStickyEndColumnPositions(x,t)},write:()=>{for(let k of o)for(let S=0;S!!k)&&(this._positionListener.stickyColumnsUpdated({sizes:C===-1?[]:x.slice(0,C+1).map((k,S)=>e[S]?k:null)}),this._positionListener.stickyEndColumnsUpdated({sizes:M===-1?[]:x.slice(M).map((k,S)=>t[S+M]?k:null).reverse()}))}},{injector:this._tableInjector})}stickRows(o,e,t){if(!this._isBrowser)return;let i=t==="bottom"?o.slice().reverse():o,a=t==="bottom"?e.slice().reverse():e,s=[],d=[],p=[];Ya({earlyRead:()=>{for(let u=0,g=0;u{let u=a.lastIndexOf(!0);for(let g=0;g{let t=o.querySelector("tfoot");t&&(e.some(i=>!i)?this._removeStickyStyle(t,["bottom"]):this._addStickyStyle(t,"bottom",0,!1))}},{injector:this._tableInjector})}destroy(){this._stickyColumnsReplayTimeout&&clearTimeout(this._stickyColumnsReplayTimeout),this._resizeObserver?.disconnect(),this._destroyed=!0}_removeStickyStyle(o,e){if(!o.classList.contains(this._stickCellCss))return;for(let i of e)o.style[i]="",o.classList.remove(this._borderCellCss[i]);k8.some(i=>e.indexOf(i)===-1&&o.style[i])?o.style.zIndex=this._getCalculatedZIndex(o):(o.style.zIndex="",this._needsPositionStickyOnElement&&(o.style.position=""),o.classList.remove(this._stickCellCss))}_addStickyStyle(o,e,t,i){o.classList.add(this._stickCellCss),i&&o.classList.add(this._borderCellCss[e]),o.style[e]=`${t}px`,o.style.zIndex=this._getCalculatedZIndex(o),this._needsPositionStickyOnElement&&(o.style.cssText+="position: -webkit-sticky; position: sticky; ")}_getCalculatedZIndex(o){let e={top:100,bottom:10,left:1,right:1},t=0;for(let i of k8)o.style[i]&&(t+=e[i]);return t?`${t}`:""}_getCellWidths(o,e=!0){if(!e&&this._cachedCellWidths.length)return this._cachedCellWidths;let t=[],i=o.children;for(let a=0;a0;a--)e[a]&&(t[a]=i,i+=o[a]);return t}_retrieveElementSize(o){let e=this._elemSizeCache.get(o);if(e)return e;let t=o.getBoundingClientRect(),i={width:t.width,height:t.height};return this._resizeObserver&&(this._elemSizeCache.set(o,i),this._resizeObserver.observe(o,{box:"border-box"})),i}_updateStickyColumnReplayQueue(o){this._removeFromStickyColumnReplayQueue(o.rows),this._stickyColumnsReplayTimeout||this._updatedStickyColumnsParamsToReplay.push(o)}_removeFromStickyColumnReplayQueue(o){let e=new Set(o);for(let t of this._updatedStickyColumnsParamsToReplay)t.rows=t.rows.filter(i=>!e.has(i));this._updatedStickyColumnsParamsToReplay=this._updatedStickyColumnsParamsToReplay.filter(t=>!!t.rows.length)}_updateCachedSizes(o){let e=!1;for(let t of o){let i=t.borderBoxSize?.length?{width:t.borderBoxSize[0].inlineSize,height:t.borderBoxSize[0].blockSize}:{width:t.contentRect.width,height:t.contentRect.height};i.width!==this._elemSizeCache.get(t.target)?.width&&Gee(t.target)&&(e=!0),this._elemSizeCache.set(t.target,i)}e&&this._updatedStickyColumnsParamsToReplay.length&&(this._stickyColumnsReplayTimeout&&clearTimeout(this._stickyColumnsReplayTimeout),this._stickyColumnsReplayTimeout=setTimeout(()=>{if(!this._destroyed){for(let t of this._updatedStickyColumnsParamsToReplay)this.updateStickyColumns(t.rows,t.stickyStartStates,t.stickyEndStates,!0,!1);this._updatedStickyColumnsParamsToReplay=[],this._stickyColumnsReplayTimeout=null}},0))}};function Gee(n){return["cdk-cell","cdk-header-cell","cdk-footer-cell"].some(o=>n.classList.contains(o))}var H0=new mn("STICKY_POSITIONING_LISTENER");var PT=(()=>{class n{viewContainer=f(Wo);elementRef=f(Kt);constructor(){let e=f(sc);e._rowOutlet=this,e._outletAssigned()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","rowOutlet",""]]})}return n})(),TT=(()=>{class n{viewContainer=f(Wo);elementRef=f(Kt);constructor(){let e=f(sc);e._headerRowOutlet=this,e._outletAssigned()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","headerRowOutlet",""]]})}return n})(),ET=(()=>{class n{viewContainer=f(Wo);elementRef=f(Kt);constructor(){let e=f(sc);e._footerRowOutlet=this,e._outletAssigned()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","footerRowOutlet",""]]})}return n})(),OT=(()=>{class n{viewContainer=f(Wo);elementRef=f(Kt);constructor(){let e=f(sc);e._noDataRowOutlet=this,e._outletAssigned()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["","noDataRowOutlet",""]]})}return n})(),DT=(()=>{class n{_differs=f(Sd);_changeDetectorRef=f(oe);_elementRef=f(Kt);_dir=f(Kr,{optional:!0});_platform=f(ja);_viewRepeater;_viewportRuler=f(kd);_injector=f(xa);_virtualScrollViewport=f(FA,{optional:!0,host:!0});_positionListener=f(H0,{optional:!0})||f(H0,{optional:!0,skipSelf:!0});_document=f(Do);_data;_renderedRange;_onDestroy=new Ye;_renderRows;_renderChangeSubscription=null;_columnDefsByName=new Map;_rowDefs;_headerRowDefs;_footerRowDefs;_dataDiffer;_defaultRowDef=null;_customColumnDefs=new Set;_customRowDefs=new Set;_customHeaderRowDefs=new Set;_customFooterRowDefs=new Set;_customNoDataRow=null;_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;_headerRowStickyUpdates=new Ye;_footerRowStickyUpdates=new Ye;_disableVirtualScrolling=!1;_getCellRole(){if(this._cellRoleInternal===void 0){let e=this._elementRef.nativeElement.getAttribute("role");return e==="grid"||e==="treegrid"?"gridcell":"cell"}return this._cellRoleInternal}_cellRoleInternal=void 0;get trackBy(){return this._trackByFn}set trackBy(e){this._trackByFn=e}_trackByFn;get dataSource(){return this._dataSource}set dataSource(e){this._dataSource!==e&&(this._switchDataSource(e),this._changeDetectorRef.markForCheck())}_dataSource;_dataSourceChanges=new Ye;_dataStream=new Ye;get multiTemplateDataRows(){return this._multiTemplateDataRows}set multiTemplateDataRows(e){this._multiTemplateDataRows=e,this._rowOutlet&&this._rowOutlet.viewContainer.length&&(this._forceRenderDataRows(),this.updateStickyColumnStyles())}_multiTemplateDataRows=!1;get fixedLayout(){return this._virtualScrollEnabled()?!0:this._fixedLayout}set fixedLayout(e){this._fixedLayout=e,this._forceRecalculateCellWidths=!0,this._stickyColumnStylesNeedReset=!0}_fixedLayout=!1;recycleRows=!1;contentChanged=new be;viewChange=new cn({start:0,end:Number.MAX_VALUE});_rowOutlet;_headerRowOutlet;_footerRowOutlet;_noDataRowOutlet;_contentColumnDefs;_contentRowDefs;_contentHeaderRowDefs;_contentFooterRowDefs;_noDataRow;constructor(){f(new cm("role"),{optional:!0})||this._elementRef.nativeElement.setAttribute("role","table"),this._isServer=!this._platform.isBrowser,this._isNativeHtmlTable=this._elementRef.nativeElement.nodeName==="TABLE",this._dataDiffer=this._differs.find([]).create((t,i)=>this.trackBy?this.trackBy(i.dataIndex,i.data):i)}ngOnInit(){this._setupStickyStyler(),this._viewportRuler.change().pipe(He(this._onDestroy)).subscribe(()=>{this._forceRecalculateCellWidths=!0})}ngAfterContentInit(){this._viewRepeater=this.recycleRows||this._virtualScrollEnabled()?new NA:new $A,this._virtualScrollEnabled()&&this._setupVirtualScrolling(this._virtualScrollViewport),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(e=>{e?.clear()}),this._headerRowDefs=[],this._footerRowDefs=[],this._defaultRowDef=null,this._headerRowStickyUpdates.complete(),this._footerRowStickyUpdates.complete(),this._onDestroy.next(),this._onDestroy.complete(),sg(this.dataSource)&&this.dataSource.disconnect(this)}renderRows(){this._renderRows=this._getAllRenderRows();let e=this._dataDiffer.diff(this._renderRows);if(!e){this._updateNoDataRow(),this.contentChanged.next();return}let t=this._rowOutlet.viewContainer;this._viewRepeater.applyChanges(e,t,(i,a,s)=>this._getEmbeddedViewArgs(i.item,s),i=>i.item.data,i=>{i.operation===AA.INSERTED&&i.context&&this._renderCellTemplateForItem(i.record.item.rowDef,i.context)}),this._updateRowIndexContext(),e.forEachIdentityChange(i=>{let a=t.get(i.currentIndex);a.context.$implicit=i.item.data}),this._updateNoDataRow(),this.contentChanged.next(),this.updateStickyColumnStyles()}addColumnDef(e){this._customColumnDefs.add(e)}removeColumnDef(e){this._customColumnDefs.delete(e)}addRowDef(e){this._customRowDefs.add(e)}removeRowDef(e){this._customRowDefs.delete(e)}addHeaderRowDef(e){this._customHeaderRowDefs.add(e),this._headerRowDefChanged=!0}removeHeaderRowDef(e){this._customHeaderRowDefs.delete(e),this._headerRowDefChanged=!0}addFooterRowDef(e){this._customFooterRowDefs.add(e),this._footerRowDefChanged=!0}removeFooterRowDef(e){this._customFooterRowDefs.delete(e),this._footerRowDefChanged=!0}setNoDataRow(e){this._customNoDataRow=e}updateStickyHeaderRowStyles(){let e=this._getRenderedRows(this._headerRowOutlet);if(this._isNativeHtmlTable){let i=P8(this._headerRowOutlet,"thead");i&&(i.style.display=e.length?"":"none")}let t=this._headerRowDefs.map(i=>i.sticky);this._stickyStyler.clearStickyPositioning(e,["top"]),this._stickyStyler.stickRows(e,t,"top"),this._headerRowDefs.forEach(i=>i.resetStickyChanged())}updateStickyFooterRowStyles(){let e=this._getRenderedRows(this._footerRowOutlet);if(this._isNativeHtmlTable){let i=P8(this._footerRowOutlet,"tfoot");i&&(i.style.display=e.length?"":"none")}let t=this._footerRowDefs.map(i=>i.sticky);this._stickyStyler.clearStickyPositioning(e,["bottom"]),this._stickyStyler.stickRows(e,t,"bottom"),this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement,t),this._footerRowDefs.forEach(i=>i.resetStickyChanged())}updateStickyColumnStyles(){let e=this._getRenderedRows(this._headerRowOutlet),t=this._getRenderedRows(this._rowOutlet),i=this._getRenderedRows(this._footerRowOutlet);(this._isNativeHtmlTable&&!this.fixedLayout||this._stickyColumnStylesNeedReset)&&(this._stickyStyler.clearStickyPositioning([...e,...t,...i],["left","right"]),this._stickyColumnStylesNeedReset=!1),e.forEach((a,s)=>{this._addStickyColumnStyles([a],this._headerRowDefs[s])}),this._rowDefs.forEach(a=>{let s=[];for(let d=0;d{this._addStickyColumnStyles([a],this._footerRowDefs[s])}),Array.from(this._columnDefsByName.values()).forEach(a=>a.resetStickyChanged())}stickyColumnsUpdated(e){this._positionListener?.stickyColumnsUpdated(e)}stickyEndColumnsUpdated(e){this._positionListener?.stickyEndColumnsUpdated(e)}stickyHeaderRowsUpdated(e){this._headerRowStickyUpdates.next(e),this._positionListener?.stickyHeaderRowsUpdated(e)}stickyFooterRowsUpdated(e){this._footerRowStickyUpdates.next(e),this._positionListener?.stickyFooterRowsUpdated(e)}_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 t=this._renderUpdatedColumns()||this._headerRowDefChanged||this._footerRowDefChanged;this._stickyColumnStylesNeedReset=this._stickyColumnStylesNeedReset||t,this._forceRecalculateCellWidths=t,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(){if(!Array.isArray(this._data)||!this._renderedRange)return[];let e=[],t=Math.min(this._data.length,this._renderedRange.end),i=this._cachedRenderRowsMap;this._cachedRenderRowsMap=new Map;for(let a=this._renderedRange.start;a{let d=i&&i.has(s)?i.get(s):[];if(d.length){let p=d.shift();return p.dataIndex=t,p}else return{data:e,rowDef:s,dataIndex:t}})}_cacheColumnDefs(){this._columnDefsByName.clear(),Kx(this._getOwnDefs(this._contentColumnDefs),this._customColumnDefs).forEach(t=>{this._columnDefsByName.has(t.name),this._columnDefsByName.set(t.name,t)})}_cacheRowDefs(){this._headerRowDefs=Kx(this._getOwnDefs(this._contentHeaderRowDefs),this._customHeaderRowDefs),this._footerRowDefs=Kx(this._getOwnDefs(this._contentFooterRowDefs),this._customFooterRowDefs),this._rowDefs=Kx(this._getOwnDefs(this._contentRowDefs),this._customRowDefs);let e=this._rowDefs.filter(t=>!t.when);this._defaultRowDef=e[0]}_renderUpdatedColumns(){let e=(s,d)=>{let p=!!d.getColumnsDiff();return s||p},t=this._rowDefs.reduce(e,!1);t&&this._forceRenderDataRows();let i=this._headerRowDefs.reduce(e,!1);i&&this._forceRenderHeaderRows();let a=this._footerRowDefs.reduce(e,!1);return a&&this._forceRenderFooterRows(),t||i||a}_switchDataSource(e){this._data=[],sg(this.dataSource)&&this.dataSource.disconnect(this),this._renderChangeSubscription&&(this._renderChangeSubscription.unsubscribe(),this._renderChangeSubscription=null),e||(this._dataDiffer&&this._dataDiffer.diff([]),this._rowOutlet&&this._rowOutlet.viewContainer.clear()),this._dataSource=e}_observeRenderChanges(){if(!this.dataSource)return;let e;sg(this.dataSource)?e=this.dataSource.connect(this):af(this.dataSource)?e=this.dataSource:Array.isArray(this.dataSource)&&(e=Vt(this.dataSource)),this._renderChangeSubscription=mr([e,this.viewChange]).pipe(He(this._onDestroy)).subscribe(([t,i])=>{this._data=t||[],this._renderedRange=i,this._dataStream.next(t),this.renderRows()})}_forceRenderHeaderRows(){this._headerRowOutlet.viewContainer.length>0&&this._headerRowOutlet.viewContainer.clear(),this._headerRowDefs.forEach((e,t)=>this._renderRow(this._headerRowOutlet,e,t)),this.updateStickyHeaderRowStyles()}_forceRenderFooterRows(){this._footerRowOutlet.viewContainer.length>0&&this._footerRowOutlet.viewContainer.clear(),this._footerRowDefs.forEach((e,t)=>this._renderRow(this._footerRowOutlet,e,t)),this.updateStickyFooterRowStyles()}_addStickyColumnStyles(e,t){let i=Array.from(t?.columns||[]).map(d=>{let p=this._columnDefsByName.get(d);return p}),a=i.map(d=>d.sticky),s=i.map(d=>d.stickyEnd);this._stickyStyler.updateStickyColumns(e,a,s,!this.fixedLayout||this._forceRecalculateCellWidths)}_getRenderedRows(e){let t=[];for(let i=0;i!a.when||a.when(t,e));else{let a=this._rowDefs.find(s=>s.when&&s.when(t,e))||this._defaultRowDef;a&&i.push(a)}return i.length,i}_getEmbeddedViewArgs(e,t){let i=e.rowDef,a={$implicit:e.data};return{templateRef:i.template,context:a,index:t}}_renderRow(e,t,i,a={}){let s=e.viewContainer.createEmbeddedView(t.template,a,i);return this._renderCellTemplateForItem(t,a),s}_renderCellTemplateForItem(e,t){for(let i of this._getCellTemplates(e))bu.mostRecentCellOutlet&&bu.mostRecentCellOutlet._viewContainer.createEmbeddedView(i,t);this._changeDetectorRef.markForCheck()}_updateRowIndexContext(){let e=this._rowOutlet.viewContainer;for(let t=0,i=e.length;t{let i=this._columnDefsByName.get(t);return e.extractCellTemplate(i)})}_forceRenderDataRows(){this._dataDiffer.diff([]),this._rowOutlet.viewContainer.clear(),this.renderRows()}_checkStickyStates(){let e=(t,i)=>t||i.hasStickyChanged();this._headerRowDefs.reduce(e,!1)&&this.updateStickyHeaderRowStyles(),this._footerRowDefs.reduce(e,!1)&&this.updateStickyFooterRowStyles(),Array.from(this._columnDefsByName.values()).reduce(e,!1)&&(this._stickyColumnStylesNeedReset=!0,this.updateStickyColumnStyles())}_setupStickyStyler(){let e=this._dir?this._dir.value:"ltr",t=this._injector;this._stickyStyler=new yT(this._isNativeHtmlTable,this.stickyCssClass,this._platform.isBrowser,this.needsPositionStickyOnElement,e,this,t),(this._dir?this._dir.change:Vt()).pipe(He(this._onDestroy)).subscribe(i=>{this._stickyStyler.direction=i,this.updateStickyColumnStyles()})}_setupVirtualScrolling(e){let t=typeof requestAnimationFrame<"u"?rl:J4;this.viewChange.next({start:0,end:0}),e.renderedRangeStream.pipe(sl(0,t),He(this._onDestroy)).subscribe(this.viewChange),e.attach({dataStream:this._dataStream,measureRangeSize:(i,a)=>this._measureRangeSize(i,a)}),mr([e.renderedContentOffset,this._headerRowStickyUpdates]).pipe(He(this._onDestroy)).subscribe(([i,a])=>{if(!(!a.sizes||!a.offsets||!a.elements))for(let s=0;s{if(!(!a.sizes||!a.offsets||!a.elements))for(let s=0;s!t._table||t._table===this)}_updateNoDataRow(){let e=this._customNoDataRow||this._noDataRow;if(!e)return;let t=this._rowOutlet.viewContainer.length===0;if(t===this._isShowingNoDataRow)return;let i=this._noDataRowOutlet.viewContainer;if(t){let a=i.createEmbeddedView(e.templateRef),s=a.rootNodes[0];if(a.rootNodes.length===1&&s?.nodeType===this._document.ELEMENT_NODE){s.setAttribute("role","row"),s.classList.add(...e._contentClassNames);let d=s.querySelectorAll(e._cellSelector);for(let p=0;p=e.end||t!=="vertical")return 0;let i=this.viewChange.value,a=this._rowOutlet.viewContainer;e.starti.end;let s=e.start-i.start,d=e.end-e.start,p,u;for(let M=0;M-1;M--){let x=a.get(M+s);if(x&&x.rootNodes.length){u=x.rootNodes[x.rootNodes.length-1];break}}let g=p?.getBoundingClientRect?.(),C=u?.getBoundingClientRect?.();return g&&C?C.bottom-g.top:0}_virtualScrollEnabled(){return!this._disableVirtualScrolling&&this._virtualScrollViewport!=null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["cdk-table"],["table","cdk-table",""]],contentQueries:function(t,i,a){if(t&1&&Zi(a,D8,5)(a,$m,5)(a,Jx,5)(a,U0,5)(a,MT,5),t&2){let s;gt(s=ht())&&(i._noDataRow=s.first),gt(s=ht())&&(i._contentColumnDefs=s),gt(s=ht())&&(i._contentRowDefs=s),gt(s=ht())&&(i._contentHeaderRowDefs=s),gt(s=ht())&&(i._contentFooterRowDefs=s)}},hostAttrs:[1,"cdk-table"],hostVars:2,hostBindings:function(t,i){t&2&&ne("cdk-table-fixed-layout",i.fixedLayout)},inputs:{trackBy:"trackBy",dataSource:"dataSource",multiTemplateDataRows:[2,"multiTemplateDataRows","multiTemplateDataRows",zt],fixedLayout:[2,"fixedLayout","fixedLayout",zt],recycleRows:[2,"recycleRows","recycleRows",zt]},outputs:{contentChanged:"contentChanged"},exportAs:["cdkTable"],features:[un([{provide:sc,useExisting:n},{provide:H0,useValue:null}])],ngContentSelectors:$ee,decls:5,vars:2,consts:[["role","rowgroup"],["headerRowOutlet",""],["rowOutlet",""],["noDataRowOutlet",""],["footerRowOutlet",""]],template:function(t,i){t&1&&(pi(jee),Zt(0),Zt(1,1),T(2,Hee,1,0),T(3,Uee,7,0)(4,Wee,4,0)),t&2&&(m(2),E(i._isServer?2:-1),m(),E(i._isNativeHtmlTable?3:4))},dependencies:[TT,PT,OT,ET],styles:[`.cdk-table-fixed-layout { + table-layout: fixed; +} +`],encapsulation:2})}return n})();function Kx(n,o){return n.concat(Array.from(o))}function P8(n,o){let e=o.toUpperCase(),t=n.viewContainer.element.nativeElement;for(;t;){let i=t.nodeType===1?t.nodeName:null;if(i===e)return t;if(i==="TABLE")break;t=t.parentNode}return null}var e1=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({imports:[RA]})}return n})();var I8=["*"],qee=["content"],Qee=[[["mat-drawer"]],[["mat-drawer-content"]],"*"],Kee=["mat-drawer","mat-drawer-content","*"];function Xee(n,o){if(n&1){let e=R();r(0,"div",1),_("click",function(){y(e);let i=h();return w(i._onBackdropClicked())}),l()}if(n&2){let e=h();ne("mat-drawer-shown",e._isShowingBackdrop())}}function Yee(n,o){n&1&&(r(0,"mat-drawer-content"),Zt(1,2),l())}var Zee=new mn("MAT_DRAWER_DEFAULT_AUTOSIZE",{providedIn:"root",factory:()=>!1}),A8=new mn("MAT_DRAWER_CONTAINER"),W0=(()=>{class n extends $C{_platform=f(ja);_changeDetectorRef=f(oe);_container=f(AT);constructor(){let e=f(Kt),t=f(jk),i=f(Gi);super(e,t,i)}ngAfterContentInit(){this._container._contentMarginChanges.subscribe(()=>{this._changeDetectorRef.markForCheck()})}_shouldBeHidden(){if(this._platform.isBrowser)return!1;let{start:e,end:t}=this._container;return e!=null&&e.mode!=="over"&&e.opened||t!=null&&t.mode!=="over"&&t.opened}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["mat-drawer-content"]],hostAttrs:[1,"mat-drawer-content"],hostVars:6,hostBindings:function(t,i){t&2&&(Tt("margin-left",i._container._contentMargins.left,"px")("margin-right",i._container._contentMargins.right,"px"),ne("mat-drawer-content-hidden",i._shouldBeHidden()))},features:[un([{provide:$C,useExisting:n}]),mi],ngContentSelectors:I8,decls:1,vars:0,template:function(t,i){t&1&&(pi(),Zt(0))},encapsulation:2,changeDetection:0})}return n})(),IT=(()=>{class n{_elementRef=f(Kt);_focusTrapFactory=f(e5);_focusMonitor=f(hs);_platform=f(ja);_ngZone=f(Gi);_renderer=f(qi);_interactivityChecker=f(JA);_doc=f(Do);_container=f(A8,{optional:!0});_focusTrap=null;_elementFocusedBeforeDrawerWasOpened=null;_eventCleanups;_isAttached=!1;_anchor=null;get position(){return this._position}set position(e){e=e==="end"?"end":"start",e!==this._position&&(this._isAttached&&this._updatePositionInParent(e),this._position=e,this.onPositionChanged.emit())}_position="start";get mode(){return this._mode}set mode(e){this._mode=e,this._updateFocusTrapState(),this._modeChanged.next()}_mode="over";get disableClose(){return this._disableClose}set disableClose(e){this._disableClose=Or(e)}_disableClose=!1;get autoFocus(){let e=this._autoFocus;return e??(this.mode==="side"?"dialog":"first-tabbable")}set autoFocus(e){(e==="true"||e==="false"||e==null)&&(e=Or(e)),this._autoFocus=e}_autoFocus;get opened(){return this._opened()}set opened(e){this.toggle(Or(e))}_opened=z(!1);_openedVia=null;_animationStarted=new Ye;_animationEnd=new Ye;openedChange=new be(!0);_openedStream=this.openedChange.pipe(Yi(e=>e),Pt(()=>{}));openedStart=this._animationStarted.pipe(Yi(()=>this.opened),sf(void 0));_closedStream=this.openedChange.pipe(Yi(e=>!e),Pt(()=>{}));closedStart=this._animationStarted.pipe(Yi(()=>!this.opened),sf(void 0));_destroyed=new Ye;onPositionChanged=new be;_content;_modeChanged=new Ye;_injector=f(xa);_changeDetectorRef=f(oe);constructor(){this.openedChange.pipe(He(this._destroyed)).subscribe(e=>{e?(this._elementFocusedBeforeDrawerWasOpened=this._doc.activeElement,this._takeFocus()):this._isFocusWithinDrawer()&&this._restoreFocus(this._openedVia||"program")}),this._eventCleanups=this._ngZone.runOutsideAngular(()=>{let e=this._renderer,t=this._elementRef.nativeElement;return[e.listen(t,"keydown",i=>{i.keyCode===27&&!this.disableClose&&!gs(i)&&this._ngZone.run(()=>{this.close(),i.stopPropagation(),i.preventDefault()})}),e.listen(t,"transitionend",this._handleTransitionEvent),e.listen(t,"transitioncancel",this._handleTransitionEvent)]}),this._animationEnd.subscribe(()=>{this.openedChange.emit(this.opened)})}_forceFocus(e,t){this._interactivityChecker.isFocusable(e)||(e.tabIndex=-1,this._ngZone.runOutsideAngular(()=>{let i=()=>{a(),s(),e.removeAttribute("tabindex")},a=this._renderer.listen(e,"blur",i),s=this._renderer.listen(e,"mousedown",i)})),e.focus(t)}_focusByCssSelector(e,t){let i=this._elementRef.nativeElement.querySelector(e);i&&this._forceFocus(i,t)}_takeFocus(){if(!this._focusTrap)return;let e=this._elementRef.nativeElement;switch(this.autoFocus){case!1:case"dialog":return;case!0:case"first-tabbable":Ya(()=>{!this._focusTrap.focusInitialElement()&&typeof e.focus=="function"&&e.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(e){this.autoFocus!=="dialog"&&(this._elementFocusedBeforeDrawerWasOpened?this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened,e):this._elementRef.nativeElement.blur(),this._elementFocusedBeforeDrawerWasOpened=null)}_isFocusWithinDrawer(){let e=this._doc.activeElement;return!!e&&this._elementRef.nativeElement.contains(e)}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(e=>e()),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(e){return this.toggle(!0,e)}close(){return this.toggle(!1)}_closeViaBackdropClick(){return this._setOpen(!1,!0,"mouse")}toggle(e=!this.opened,t){e&&t&&(this._openedVia=t);let i=this._setOpen(e,!e&&this._isFocusWithinDrawer(),this._openedVia||"program");return e||(this._openedVia=null),i}_setOpen(e,t,i){return e===this.opened?Promise.resolve(e?"open":"close"):(this._opened.set(e),this._container?._transitionsEnabled?(this._setIsAnimating(!0),setTimeout(()=>this._animationStarted.next())):setTimeout(()=>{this._animationStarted.next(),this._animationEnd.next()}),this._elementRef.nativeElement.classList.toggle("mat-drawer-opened",e),!e&&t&&this._restoreFocus(i),this._changeDetectorRef.markForCheck(),this._updateFocusTrapState(),new Promise(a=>{this.openedChange.pipe(Gr(1)).subscribe(s=>a(s?"open":"close"))}))}_setIsAnimating(e){this._elementRef.nativeElement.classList.toggle("mat-drawer-animating",e)}_getWidth(){return this._elementRef.nativeElement.offsetWidth||0}_updateFocusTrapState(){this._focusTrap&&(this._focusTrap.enabled=this.opened&&!!this._container?._isShowingBackdrop())}_updatePositionInParent(e){if(!this._platform.isBrowser)return;let t=this._elementRef.nativeElement,i=t.parentNode;e==="end"?(this._anchor||(this._anchor=this._doc.createComment("mat-drawer-anchor"),i.insertBefore(this._anchor,t)),i.appendChild(t)):this._anchor&&this._anchor.parentNode.insertBefore(t,this._anchor)}_handleTransitionEvent=e=>{let t=this._elementRef.nativeElement;e.target===t&&this._ngZone.run(()=>{e.type==="transitionend"&&this._setIsAnimating(!1),this._animationEnd.next(e)})};static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["mat-drawer"]],viewQuery:function(t,i){if(t&1&&Kn(qee,5),t&2){let a;gt(a=ht())&&(i._content=a.first)}},hostAttrs:[1,"mat-drawer"],hostVars:12,hostBindings:function(t,i){t&2&&(Ce("align",null)("tabIndex",i.mode!=="side"?"-1":null),Tt("visibility",!i._container&&!i.opened?"hidden":null),ne("mat-drawer-end",i.position==="end")("mat-drawer-over",i.mode==="over")("mat-drawer-push",i.mode==="push")("mat-drawer-side",i.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:I8,decls:3,vars:0,consts:[["content",""],["cdkScrollable","",1,"mat-drawer-inner-container"]],template:function(t,i){t&1&&(pi(),r(0,"div",1,0),Zt(2),l())},dependencies:[$C],encapsulation:2,changeDetection:0})}return n})(),AT=(()=>{class n{_dir=f(Kr,{optional:!0});_element=f(Kt);_ngZone=f(Gi);_changeDetectorRef=f(oe);_animationDisabled=$a();_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(e){this._autosize=Or(e)}_autosize=f(Zee);get hasBackdrop(){return this._drawerHasBackdrop(this._start)||this._drawerHasBackdrop(this._end)}set hasBackdrop(e){this._backdropOverride=e==null?null:Or(e)}_backdropOverride=null;backdropClick=new be;_start=null;_end=null;_left=null;_right=null;_destroyed=new Ye;_doCheckSubject=new Ye;_contentMargins={left:null,right:null};_contentMarginChanges=new Ye;get scrollable(){return this._userContent||this._content}_injector=f(xa);constructor(){let e=f(ja),t=f(kd);this._dir?.change.pipe(He(this._destroyed)).subscribe(()=>{this._validateDrawers(),this.updateContentMargins()}),t.change().pipe(He(this._destroyed)).subscribe(()=>this.updateContentMargins()),!this._animationDisabled&&e.isBrowser&&this._ngZone.runOutsideAngular(()=>{setTimeout(()=>{this._element.nativeElement.classList.add("mat-drawer-transition"),this._transitionsEnabled=!0},200)})}ngAfterContentInit(){this._allDrawers.changes.pipe(Di(this._allDrawers),He(this._destroyed)).subscribe(e=>{this._drawers.reset(e.filter(t=>!t._container||t._container===this)),this._drawers.notifyOnChanges()}),this._drawers.changes.pipe(Di(null)).subscribe(()=>{this._validateDrawers(),this._drawers.forEach(e=>{this._watchDrawerToggle(e),this._watchDrawerPosition(e),this._watchDrawerMode(e)}),(!this._drawers.length||this._isDrawerOpen(this._start)||this._isDrawerOpen(this._end))&&this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),this._ngZone.runOutsideAngular(()=>{this._doCheckSubject.pipe(tg(10),He(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(e=>e.open())}close(){this._drawers.forEach(e=>e.close())}updateContentMargins(){let e=0,t=0;if(this._left&&this._left.opened){if(this._left.mode=="side")e+=this._left._getWidth();else if(this._left.mode=="push"){let i=this._left._getWidth();e+=i,t-=i}}if(this._right&&this._right.opened){if(this._right.mode=="side")t+=this._right._getWidth();else if(this._right.mode=="push"){let i=this._right._getWidth();t+=i,e-=i}}e=e||null,t=t||null,(e!==this._contentMargins.left||t!==this._contentMargins.right)&&(this._contentMargins={left:e,right:t},this._ngZone.run(()=>this._contentMarginChanges.next(this._contentMargins)))}ngDoCheck(){this._autosize&&this._isPushed()&&this._ngZone.runOutsideAngular(()=>this._doCheckSubject.next())}_watchDrawerToggle(e){e._animationStarted.pipe(He(this._drawers.changes)).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),e.mode!=="side"&&e.openedChange.pipe(He(this._drawers.changes)).subscribe(()=>this._setContainerClass(e.opened))}_watchDrawerPosition(e){e.onPositionChanged.pipe(He(this._drawers.changes)).subscribe(()=>{Ya({read:()=>this._validateDrawers()},{injector:this._injector})})}_watchDrawerMode(e){e._modeChanged.pipe(He(ro(this._drawers.changes,this._destroyed))).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()})}_setContainerClass(e){let t=this._element.nativeElement.classList,i="mat-drawer-container-has-open";e?t.add(i):t.remove(i)}_validateDrawers(){this._start=this._end=null,this._drawers.forEach(e=>{e.position=="end"?(this._end!=null,this._end=e):(this._start!=null,this._start=e)}),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(e=>e&&!e.disableClose&&this._drawerHasBackdrop(e)).forEach(e=>e._closeViaBackdropClick())}_isShowingBackdrop(){return this._isDrawerOpen(this._start)&&this._drawerHasBackdrop(this._start)||this._isDrawerOpen(this._end)&&this._drawerHasBackdrop(this._end)}_isDrawerOpen(e){return e!=null&&e.opened}_drawerHasBackdrop(e){return this._backdropOverride==null?!!e&&e.mode!=="side":this._backdropOverride}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["mat-drawer-container"]],contentQueries:function(t,i,a){if(t&1&&Zi(a,W0,5)(a,IT,5),t&2){let s;gt(s=ht())&&(i._content=s.first),gt(s=ht())&&(i._allDrawers=s)}},viewQuery:function(t,i){if(t&1&&Kn(W0,5),t&2){let a;gt(a=ht())&&(i._userContent=a.first)}},hostAttrs:[1,"mat-drawer-container"],hostVars:2,hostBindings:function(t,i){t&2&&ne("mat-drawer-container-explicit-backdrop",i._backdropOverride)},inputs:{autosize:"autosize",hasBackdrop:"hasBackdrop"},outputs:{backdropClick:"backdropClick"},exportAs:["matDrawerContainer"],features:[un([{provide:A8,useExisting:n}])],ngContentSelectors:Kee,decls:4,vars:2,consts:[[1,"mat-drawer-backdrop",3,"mat-drawer-shown"],[1,"mat-drawer-backdrop",3,"click"]],template:function(t,i){t&1&&(pi(Qee),T(0,Xee,1,2,"div",0),Zt(1),Zt(2,1),T(3,Yee,2,0,"mat-drawer-content")),t&2&&(E(i.hasBackdrop?0:-1),m(3),E(i._content?-1:3))},dependencies:[W0],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: 0.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 n})();var n1=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({imports:[Lp,Vi,Lp]})}return n})();var wi=(function(n){return n[n.State=0]="State",n[n.Transition=1]="Transition",n[n.Sequence=2]="Sequence",n[n.Group=3]="Group",n[n.Animate=4]="Animate",n[n.Keyframes=5]="Keyframes",n[n.Style=6]="Style",n[n.Trigger=7]="Trigger",n[n.Reference=8]="Reference",n[n.AnimateChild=9]="AnimateChild",n[n.AnimateRef=10]="AnimateRef",n[n.Query=11]="Query",n[n.Stagger=12]="Stagger",n})(wi||{}),lc="*";function N8(n,o=null){return{type:wi.Sequence,steps:n,options:o}}function NT(n){return{type:wi.Style,styles:n,offset:null}}var Vd=class{_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_originalOnDoneFns=[];_originalOnStartFns=[];_started=!1;_destroyed=!1;_finished=!1;_position=0;parentPlayer=null;totalTime;constructor(o=0,e=0){this.totalTime=o+e}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(o=>o()),this._onDoneFns=[])}onStart(o){this._originalOnStartFns.push(o),this._onStartFns.push(o)}onDone(o){this._originalOnDoneFns.push(o),this._onDoneFns.push(o)}onDestroy(o){this._onDestroyFns.push(o)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(o=>o()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(o=>o()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(o){this._position=this.totalTime?o*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(o){let e=o=="start"?this._onStartFns:this._onDoneFns;e.forEach(t=>t()),e.length=0}},ah=class{_onDoneFns=[];_onStartFns=[];_finished=!1;_started=!1;_destroyed=!1;_onDestroyFns=[];parentPlayer=null;totalTime=0;players;constructor(o){this.players=o;let e=0,t=0,i=0,a=this.players.length;a==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(s=>{s.onDone(()=>{++e==a&&this._onFinish()}),s.onDestroy(()=>{++t==a&&this._onDestroy()}),s.onStart(()=>{++i==a&&this._onStart()})}),this.totalTime=this.players.reduce((s,d)=>Math.max(s,d.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(o=>o()),this._onDoneFns=[])}init(){this.players.forEach(o=>o.init())}onStart(o){this._onStartFns.push(o)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(o=>o()),this._onStartFns=[])}onDone(o){this._onDoneFns.push(o)}onDestroy(o){this._onDestroyFns.push(o)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(o=>o.play())}pause(){this.players.forEach(o=>o.pause())}restart(){this.players.forEach(o=>o.restart())}finish(){this._onFinish(),this.players.forEach(o=>o.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(o=>o.destroy()),this._onDestroyFns.forEach(o=>o()),this._onDestroyFns=[])}reset(){this.players.forEach(o=>o.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(o){let e=o*this.totalTime;this.players.forEach(t=>{let i=t.totalTime?Math.min(1,e/t.totalTime):1;t.setPosition(i)})}getPosition(){let o=this.players.reduce((e,t)=>e===null||t.totalTime>e.totalTime?t:e,null);return o!=null?o.getPosition():0}beforeDestroy(){this.players.forEach(o=>{o.beforeDestroy&&o.beforeDestroy()})}triggerCallback(o){let e=o=="start"?this._onStartFns:this._onDoneFns;e.forEach(t=>t()),e.length=0}},G0="!";function F8(n){return new Ii(3e3,!1)}function ete(){return new Ii(3100,!1)}function tte(){return new Ii(3101,!1)}function nte(n){return new Ii(3001,!1)}function ite(n){return new Ii(3003,!1)}function ote(n){return new Ii(3004,!1)}function z8(n,o){return new Ii(3005,!1)}function L8(){return new Ii(3006,!1)}function V8(){return new Ii(3007,!1)}function B8(n,o){return new Ii(3008,!1)}function j8(n){return new Ii(3002,!1)}function $8(n,o,e,t,i){return new Ii(3010,!1)}function H8(){return new Ii(3011,!1)}function U8(){return new Ii(3012,!1)}function W8(){return new Ii(3200,!1)}function G8(){return new Ii(3202,!1)}function q8(){return new Ii(3013,!1)}function Q8(n){return new Ii(3014,!1)}function K8(n){return new Ii(3015,!1)}function X8(n){return new Ii(3016,!1)}function Y8(n,o){return new Ii(3404,!1)}function ate(n){return new Ii(3502,!1)}function Z8(n){return new Ii(3503,!1)}function J8(){return new Ii(3300,!1)}function eR(n){return new Ii(3504,!1)}function tR(n){return new Ii(3301,!1)}function nR(n,o){return new Ii(3302,!1)}function iR(n){return new Ii(3303,!1)}function oR(n,o){return new Ii(3400,!1)}function aR(n){return new Ii(3401,!1)}function rR(n){return new Ii(3402,!1)}function sR(n,o){return new Ii(3505,!1)}function Bd(n){switch(n.length){case 0:return new Vd;case 1:return n[0];default:return new ah(n)}}function LT(n,o,e=new Map,t=new Map){let i=[],a=[],s=-1,d=null;if(o.forEach(p=>{let u=p.get("offset"),g=u==s,C=g&&d||new Map;p.forEach((M,x)=>{let b=x,P=M;if(x!=="offset")switch(b=n.normalizePropertyName(b,i),P){case G0:P=e.get(x);break;case lc:P=t.get(x);break;default:P=n.normalizeStyleValue(x,b,P,i);break}C.set(b,P)}),g||a.push(C),d=C,s=u}),i.length)throw ate(i);return a}function i1(n,o,e,t){switch(o){case"start":n.onStart(()=>t(e&&FT(e,"start",n)));break;case"done":n.onDone(()=>t(e&&FT(e,"done",n)));break;case"destroy":n.onDestroy(()=>t(e&&FT(e,"destroy",n)));break}}function FT(n,o,e){let t=e.totalTime,i=!!e.disabled,a=o1(n.element,n.triggerName,n.fromState,n.toState,o||n.phaseName,t??n.totalTime,i),s=n._data;return s!=null&&(a._data=s),a}function o1(n,o,e,t,i="",a=0,s){return{element:n,triggerName:o,fromState:e,toState:t,phaseName:i,totalTime:a,disabled:!!s}}function Ts(n,o,e){let t=n.get(o);return t||n.set(o,t=e),t}function VT(n){let o=n.indexOf(":"),e=n.substring(1,o),t=n.slice(o+1);return[e,t]}var rte=typeof document>"u"?null:document.documentElement;function a1(n){let o=n.parentNode||n.host||null;return o===rte?null:o}function ste(n){return n.substring(1,6)=="ebkit"}var xu=null,R8=!1;function lR(n){xu||(xu=lte()||{},R8=xu.style?"WebkitAppearance"in xu.style:!1);let o=!0;return xu.style&&!ste(n)&&(o=n in xu.style,!o&&R8&&(o="Webkit"+n.charAt(0).toUpperCase()+n.slice(1)in xu.style)),o}function lte(){return typeof document<"u"?document.body:null}function BT(n,o){for(;o;){if(o===n)return!0;o=a1(o)}return!1}function jT(n,o,e){if(e)return Array.from(n.querySelectorAll(o));let t=n.querySelector(o);return t?[t]:[]}var cte=1e3,$T="{{",dte="}}",HT="ng-enter",r1="ng-leave",q0="ng-trigger",Q0=".ng-trigger",UT="ng-animating",s1=".ng-animating";function Qc(n){if(typeof n=="number")return n;let o=n.match(/^(-?[\.\d]+)(m?s)/);return!o||o.length<2?0:RT(parseFloat(o[1]),o[2])}function RT(n,o){return o==="s"?n*cte:n}function K0(n,o,e){return n.hasOwnProperty("duration")?n:pte(n,o,e)}var mte=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;function pte(n,o,e){let t,i=0,a="";if(typeof n=="string"){let s=n.match(mte);if(s===null)return o.push(F8(n)),{duration:0,delay:0,easing:""};t=RT(parseFloat(s[1]),s[2]);let d=s[3];d!=null&&(i=RT(parseFloat(d),s[4]));let p=s[5];p&&(a=p)}else t=n;if(!e){let s=!1,d=o.length;t<0&&(o.push(ete()),s=!0),i<0&&(o.push(tte()),s=!0),s&&o.splice(d,0,F8(n))}return{duration:t,delay:i,easing:a}}function cR(n){return n.length?n[0]instanceof Map?n:n.map(o=>new Map(Object.entries(o))):[]}function cc(n,o,e){o.forEach((t,i)=>{let a=l1(i);e&&!e.has(i)&&e.set(i,n.style[a]),n.style[a]=t})}function Hm(n,o){o.forEach((e,t)=>{let i=l1(t);n.style[i]=""})}function rh(n){return Array.isArray(n)?n.length==1?n[0]:N8(n):n}function dR(n,o,e){let t=o.params||{},i=WT(n);i.length&&i.forEach(a=>{t.hasOwnProperty(a)||e.push(nte(a))})}var zT=new RegExp(`${$T}\\s*(.+?)\\s*${dte}`,"g");function WT(n){let o=[];if(typeof n=="string"){let e;for(;e=zT.exec(n);)o.push(e[1]);zT.lastIndex=0}return o}function sh(n,o,e){let t=`${n}`,i=t.replace(zT,(a,s)=>{let d=o[s];return d==null&&(e.push(ite(s)),d=""),d.toString()});return i==t?n:i}var ute=/-+([a-z0-9])/g;function l1(n){return n.replace(ute,(...o)=>o[1].toUpperCase())}function mR(n,o){return n===0||o===0}function pR(n,o,e){if(e.size&&o.length){let t=o[0],i=[];if(e.forEach((a,s)=>{t.has(s)||i.push(s),t.set(s,a)}),i.length)for(let a=1;as.set(d,c1(n,d)))}}return o}function Es(n,o,e){switch(o.type){case wi.Trigger:return n.visitTrigger(o,e);case wi.State:return n.visitState(o,e);case wi.Transition:return n.visitTransition(o,e);case wi.Sequence:return n.visitSequence(o,e);case wi.Group:return n.visitGroup(o,e);case wi.Animate:return n.visitAnimate(o,e);case wi.Keyframes:return n.visitKeyframes(o,e);case wi.Style:return n.visitStyle(o,e);case wi.Reference:return n.visitReference(o,e);case wi.AnimateChild:return n.visitAnimateChild(o,e);case wi.AnimateRef:return n.visitAnimateRef(o,e);case wi.Query:return n.visitQuery(o,e);case wi.Stagger:return n.visitStagger(o,e);default:throw ote(o.type)}}function c1(n,o){return window.getComputedStyle(n)[o]}var lE=(()=>{class n{validateStyleProperty(e){return lR(e)}containsElement(e,t){return BT(e,t)}getParentElement(e){return a1(e)}query(e,t,i){return jT(e,t,i)}computeStyle(e,t,i){return i||""}animate(e,t,i,a,s,d=[],p){return new Vd(i,a)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=J({token:n,factory:n.\u0275fac})}return n})(),wu=class{static NOOP=new lE},Mu=class{};var gte=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"]),g1=class extends Mu{normalizePropertyName(o,e){return l1(o)}normalizeStyleValue(o,e,t,i){let a="",s=t.toString().trim();if(gte.has(e)&&t!==0&&t!=="0")if(typeof t=="number")a="px";else{let d=t.match(/^[+-]?[\d\.]+([a-z]*)$/);d&&d[1].length==0&&i.push(z8(o,t))}return s+a}};var h1="*";function hte(n,o){let e=[];return typeof n=="string"?n.split(/\s*,\s*/).forEach(t=>_te(t,e,o)):e.push(n),e}function _te(n,o,e){if(n[0]==":"){let p=fte(n,e);if(typeof p=="function"){o.push(p);return}n=p}let t=n.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/);if(t==null||t.length<4)return e.push(K8(n)),o;let i=t[1],a=t[2],s=t[3];o.push(uR(i,s));let d=i==h1&&s==h1;a[0]=="<"&&!d&&o.push(uR(s,i))}function fte(n,o){switch(n){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(e,t)=>parseFloat(t)>parseFloat(e);case":decrement":return(e,t)=>parseFloat(t) *"}}var d1=new Set(["true","1"]),m1=new Set(["false","0"]);function uR(n,o){let e=d1.has(n)||m1.has(n),t=d1.has(o)||m1.has(o);return(i,a)=>{let s=n==h1||n==i,d=o==h1||o==a;return!s&&e&&typeof i=="boolean"&&(s=i?d1.has(n):m1.has(n)),!d&&t&&typeof a=="boolean"&&(d=a?d1.has(o):m1.has(o)),s&&d}}var wR=":self",vte=new RegExp(`s*${wR}s*,?`,"g");function MR(n,o,e,t){return new YT(n).build(o,e,t)}var gR="",YT=class{_driver;constructor(o){this._driver=o}build(o,e,t){let i=new ZT(e);return this._resetContextStyleTimingState(i),Es(this,rh(o),i)}_resetContextStyleTimingState(o){o.currentQuerySelector=gR,o.collectedStyles=new Map,o.collectedStyles.set(gR,new Map),o.currentTime=0}visitTrigger(o,e){let t=e.queryCount=0,i=e.depCount=0,a=[],s=[];return o.name.charAt(0)=="@"&&e.errors.push(L8()),o.definitions.forEach(d=>{if(this._resetContextStyleTimingState(e),d.type==wi.State){let p=d,u=p.name;u.toString().split(/\s*,\s*/).forEach(g=>{p.name=g,a.push(this.visitState(p,e))}),p.name=u}else if(d.type==wi.Transition){let p=this.visitTransition(d,e);t+=p.queryCount,i+=p.depCount,s.push(p)}else e.errors.push(V8())}),{type:wi.Trigger,name:o.name,states:a,transitions:s,queryCount:t,depCount:i,options:null}}visitState(o,e){let t=this.visitStyle(o.styles,e),i=o.options&&o.options.params||null;if(t.containsDynamicStyles){let a=new Set,s=i||{};t.styles.forEach(d=>{d instanceof Map&&d.forEach(p=>{WT(p).forEach(u=>{s.hasOwnProperty(u)||a.add(u)})})}),a.size&&e.errors.push(B8(o.name,[...a.values()]))}return{type:wi.State,name:o.name,style:t,options:i?{params:i}:null}}visitTransition(o,e){e.queryCount=0,e.depCount=0;let t=Es(this,rh(o.animation),e),i=hte(o.expr,e.errors);return{type:wi.Transition,matchers:i,animation:t,queryCount:e.queryCount,depCount:e.depCount,options:yu(o.options)}}visitSequence(o,e){return{type:wi.Sequence,steps:o.steps.map(t=>Es(this,t,e)),options:yu(o.options)}}visitGroup(o,e){let t=e.currentTime,i=0,a=o.steps.map(s=>{e.currentTime=t;let d=Es(this,s,e);return i=Math.max(i,e.currentTime),d});return e.currentTime=i,{type:wi.Group,steps:a,options:yu(o.options)}}visitAnimate(o,e){let t=yte(o.timings,e.errors);e.currentAnimateTimings=t;let i,a=o.styles?o.styles:NT({});if(a.type==wi.Keyframes)i=this.visitKeyframes(a,e);else{let s=o.styles,d=!1;if(!s){d=!0;let u={};t.easing&&(u.easing=t.easing),s=NT(u)}e.currentTime+=t.duration+t.delay;let p=this.visitStyle(s,e);p.isEmptyStep=d,i=p}return e.currentAnimateTimings=null,{type:wi.Animate,timings:t,style:i,options:null}}visitStyle(o,e){let t=this._makeStyleAst(o,e);return this._validateStyleAst(t,e),t}_makeStyleAst(o,e){let t=[],i=Array.isArray(o.styles)?o.styles:[o.styles];for(let d of i)typeof d=="string"?d===lc?t.push(d):e.errors.push(j8(d)):t.push(new Map(Object.entries(d)));let a=!1,s=null;return t.forEach(d=>{if(d instanceof Map&&(d.has("easing")&&(s=d.get("easing"),d.delete("easing")),!a)){for(let p of d.values())if(p.toString().indexOf($T)>=0){a=!0;break}}}),{type:wi.Style,styles:t,easing:s,offset:o.offset,containsDynamicStyles:a,options:null}}_validateStyleAst(o,e){let t=e.currentAnimateTimings,i=e.currentTime,a=e.currentTime;t&&a>0&&(a-=t.duration+t.delay),o.styles.forEach(s=>{typeof s!="string"&&s.forEach((d,p)=>{let u=e.collectedStyles.get(e.currentQuerySelector),g=u.get(p),C=!0;g&&(a!=i&&a>=g.startTime&&i<=g.endTime&&(e.errors.push($8(p,g.startTime,g.endTime,a,i)),C=!1),a=g.startTime),C&&u.set(p,{startTime:a,endTime:i}),e.options&&dR(d,e.options,e.errors)})})}visitKeyframes(o,e){let t={type:wi.Keyframes,styles:[],options:null};if(!e.currentAnimateTimings)return e.errors.push(H8()),t;let i=1,a=0,s=[],d=!1,p=!1,u=0,g=o.steps.map(S=>{let O=this._makeStyleAst(S,e),A=O.offset!=null?O.offset:xte(O.styles),D=0;return A!=null&&(a++,D=O.offset=A),p=p||D<0||D>1,d=d||D0&&a{let A=M>0?O==x?1:M*O:s[O],D=A*k;e.currentTime=b+P.delay+D,P.duration=D,this._validateStyleAst(S,e),S.offset=A,t.styles.push(S)}),t}visitReference(o,e){return{type:wi.Reference,animation:Es(this,rh(o.animation),e),options:yu(o.options)}}visitAnimateChild(o,e){return e.depCount++,{type:wi.AnimateChild,options:yu(o.options)}}visitAnimateRef(o,e){return{type:wi.AnimateRef,animation:this.visitReference(o.animation,e),options:yu(o.options)}}visitQuery(o,e){let t=e.currentQuerySelector,i=o.options||{};e.queryCount++,e.currentQuery=o;let[a,s]=Cte(o.selector);e.currentQuerySelector=t.length?t+" "+a:a,Ts(e.collectedStyles,e.currentQuerySelector,new Map);let d=Es(this,rh(o.animation),e);return e.currentQuery=null,e.currentQuerySelector=t,{type:wi.Query,selector:a,limit:i.limit||0,optional:!!i.optional,includeSelf:s,animation:d,originalSelector:o.selector,options:yu(o.options)}}visitStagger(o,e){e.currentQuery||e.errors.push(q8());let t=o.timings==="full"?{duration:0,delay:0,easing:"full"}:K0(o.timings,e.errors,!0);return{type:wi.Stagger,animation:Es(this,rh(o.animation),e),timings:t,options:null}}};function Cte(n){let o=!!n.split(/\s*,\s*/).find(e=>e==wR);return o&&(n=n.replace(vte,"")),n=n.replace(/@\*/g,Q0).replace(/@\w+/g,e=>Q0+"-"+e.slice(1)).replace(/:animating/g,s1),[n,o]}function bte(n){return n?q({},n):null}var ZT=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(o){this.errors=o}};function xte(n){if(typeof n=="string")return null;let o=null;if(Array.isArray(n))n.forEach(e=>{if(e instanceof Map&&e.has("offset")){let t=e;o=parseFloat(t.get("offset")),t.delete("offset")}});else if(n instanceof Map&&n.has("offset")){let e=n;o=parseFloat(e.get("offset")),e.delete("offset")}return o}function yte(n,o){if(n.hasOwnProperty("duration"))return n;if(typeof n=="number"){let a=K0(n,o).duration;return GT(a,0,"")}let e=n;if(e.split(/\s+/).some(a=>a.charAt(0)=="{"&&a.charAt(1)=="{")){let a=GT(0,0,"");return a.dynamic=!0,a.strValue=e,a}let i=K0(e,o);return GT(i.duration,i.delay,i.easing)}function yu(n){return n?(n=q({},n),n.params&&(n.params=bte(n.params))):n={},n}function GT(n,o,e){return{duration:n,delay:o,easing:e}}function cE(n,o,e,t,i,a,s=null,d=!1){return{type:1,element:n,keyframes:o,preStyleProps:e,postStyleProps:t,duration:i,delay:a,totalTime:i+a,easing:s,subTimeline:d}}var Y0=class{_map=new Map;get(o){return this._map.get(o)||[]}append(o,e){let t=this._map.get(o);t||this._map.set(o,t=[]),t.push(...e)}has(o){return this._map.has(o)}clear(){this._map.clear()}},wte=1,Mte=":enter",Ste=new RegExp(Mte,"g"),kte=":leave",Pte=new RegExp(kte,"g");function SR(n,o,e,t,i,a=new Map,s=new Map,d,p,u=[]){return new JT().buildKeyframes(n,o,e,t,i,a,s,d,p,u)}var JT=class{buildKeyframes(o,e,t,i,a,s,d,p,u,g=[]){u=u||new Y0;let C=new eE(o,e,u,i,a,g,[]);C.options=p;let M=p.delay?Qc(p.delay):0;C.currentTimeline.delayNextStep(M),C.currentTimeline.setStyles([s],null,C.errors,p),Es(this,t,C);let x=C.timelines.filter(b=>b.containsAnimation());if(x.length&&d.size){let b;for(let P=x.length-1;P>=0;P--){let k=x[P];if(k.element===e){b=k;break}}b&&!b.allowOnlyTimelineStyles()&&b.setStyles([d],null,C.errors,p)}return x.length?x.map(b=>b.buildKeyframes()):[cE(e,[],[],[],0,M,"",!1)]}visitTrigger(o,e){}visitState(o,e){}visitTransition(o,e){}visitAnimateChild(o,e){let t=e.subInstructions.get(e.element);if(t){let i=e.createSubContext(o.options),a=e.currentTimeline.currentTime,s=this._visitSubInstructions(t,i,i.options);a!=s&&e.transformIntoNewTimeline(s)}e.previousNode=o}visitAnimateRef(o,e){let t=e.createSubContext(o.options);t.transformIntoNewTimeline(),this._applyAnimationRefDelays([o.options,o.animation.options],e,t),this.visitReference(o.animation,t),e.transformIntoNewTimeline(t.currentTimeline.currentTime),e.previousNode=o}_applyAnimationRefDelays(o,e,t){for(let i of o){let a=i?.delay;if(a){let s=typeof a=="number"?a:Qc(sh(a,i?.params??{},e.errors));t.delayNextStep(s)}}}_visitSubInstructions(o,e,t){let a=e.currentTimeline.currentTime,s=t.duration!=null?Qc(t.duration):null,d=t.delay!=null?Qc(t.delay):null;return s!==0&&o.forEach(p=>{let u=e.appendInstructionToTimeline(p,s,d);a=Math.max(a,u.duration+u.delay)}),a}visitReference(o,e){e.updateOptions(o.options,!0),Es(this,o.animation,e),e.previousNode=o}visitSequence(o,e){let t=e.subContextCount,i=e,a=o.options;if(a&&(a.params||a.delay)&&(i=e.createSubContext(a),i.transformIntoNewTimeline(),a.delay!=null)){i.previousNode.type==wi.Style&&(i.currentTimeline.snapshotCurrentStyles(),i.previousNode=_1);let s=Qc(a.delay);i.delayNextStep(s)}o.steps.length&&(o.steps.forEach(s=>Es(this,s,i)),i.currentTimeline.applyStylesToKeyframe(),i.subContextCount>t&&i.transformIntoNewTimeline()),e.previousNode=o}visitGroup(o,e){let t=[],i=e.currentTimeline.currentTime,a=o.options&&o.options.delay?Qc(o.options.delay):0;o.steps.forEach(s=>{let d=e.createSubContext(o.options);a&&d.delayNextStep(a),Es(this,s,d),i=Math.max(i,d.currentTimeline.currentTime),t.push(d.currentTimeline)}),t.forEach(s=>e.currentTimeline.mergeTimelineCollectedStyles(s)),e.transformIntoNewTimeline(i),e.previousNode=o}_visitTiming(o,e){if(o.dynamic){let t=o.strValue,i=e.params?sh(t,e.params,e.errors):t;return K0(i,e.errors)}else return{duration:o.duration,delay:o.delay,easing:o.easing}}visitAnimate(o,e){let t=e.currentAnimateTimings=this._visitTiming(o.timings,e),i=e.currentTimeline;t.delay&&(e.incrementTime(t.delay),i.snapshotCurrentStyles());let a=o.style;a.type==wi.Keyframes?this.visitKeyframes(a,e):(e.incrementTime(t.duration),this.visitStyle(a,e),i.applyStylesToKeyframe()),e.currentAnimateTimings=null,e.previousNode=o}visitStyle(o,e){let t=e.currentTimeline,i=e.currentAnimateTimings;!i&&t.hasCurrentStyleProperties()&&t.forwardFrame();let a=i&&i.easing||o.easing;o.isEmptyStep?t.applyEmptyStep(a):t.setStyles(o.styles,a,e.errors,e.options),e.previousNode=o}visitKeyframes(o,e){let t=e.currentAnimateTimings,i=e.currentTimeline.duration,a=t.duration,d=e.createSubContext().currentTimeline;d.easing=t.easing,o.styles.forEach(p=>{let u=p.offset||0;d.forwardTime(u*a),d.setStyles(p.styles,p.easing,e.errors,e.options),d.applyStylesToKeyframe()}),e.currentTimeline.mergeTimelineCollectedStyles(d),e.transformIntoNewTimeline(i+a),e.previousNode=o}visitQuery(o,e){let t=e.currentTimeline.currentTime,i=o.options||{},a=i.delay?Qc(i.delay):0;a&&(e.previousNode.type===wi.Style||t==0&&e.currentTimeline.hasCurrentStyleProperties())&&(e.currentTimeline.snapshotCurrentStyles(),e.previousNode=_1);let s=t,d=e.invokeQuery(o.selector,o.originalSelector,o.limit,o.includeSelf,!!i.optional,e.errors);e.currentQueryTotal=d.length;let p=null;d.forEach((u,g)=>{e.currentQueryIndex=g;let C=e.createSubContext(o.options,u);a&&C.delayNextStep(a),u===e.element&&(p=C.currentTimeline),Es(this,o.animation,C),C.currentTimeline.applyStylesToKeyframe();let M=C.currentTimeline.currentTime;s=Math.max(s,M)}),e.currentQueryIndex=0,e.currentQueryTotal=0,e.transformIntoNewTimeline(s),p&&(e.currentTimeline.mergeTimelineCollectedStyles(p),e.currentTimeline.snapshotCurrentStyles()),e.previousNode=o}visitStagger(o,e){let t=e.parentContext,i=e.currentTimeline,a=o.timings,s=Math.abs(a.duration),d=s*(e.currentQueryTotal-1),p=s*e.currentQueryIndex;switch(a.duration<0?"reverse":a.easing){case"reverse":p=d-p;break;case"full":p=t.currentStaggerTime;break}let g=e.currentTimeline;p&&g.delayNextStep(p);let C=g.currentTime;Es(this,o.animation,e),e.previousNode=o,t.currentStaggerTime=i.currentTime-C+(i.startTime-t.currentTimeline.startTime)}},_1={},eE=class n{_driver;element;subInstructions;_enterClassName;_leaveClassName;errors;timelines;parentContext=null;currentTimeline;currentAnimateTimings=null;previousNode=_1;subContextCount=0;options={};currentQueryIndex=0;currentQueryTotal=0;currentStaggerTime=0;constructor(o,e,t,i,a,s,d,p){this._driver=o,this.element=e,this.subInstructions=t,this._enterClassName=i,this._leaveClassName=a,this.errors=s,this.timelines=d,this.currentTimeline=p||new f1(this._driver,e,0),d.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(o,e){if(!o)return;let t=o,i=this.options;t.duration!=null&&(i.duration=Qc(t.duration)),t.delay!=null&&(i.delay=Qc(t.delay));let a=t.params;if(a){let s=i.params;s||(s=this.options.params={}),Object.keys(a).forEach(d=>{(!e||!s.hasOwnProperty(d))&&(s[d]=sh(a[d],s,this.errors))})}}_copyOptions(){let o={};if(this.options){let e=this.options.params;if(e){let t=o.params={};Object.keys(e).forEach(i=>{t[i]=e[i]})}}return o}createSubContext(o=null,e,t){let i=e||this.element,a=new n(this._driver,i,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(i,t||0));return a.previousNode=this.previousNode,a.currentAnimateTimings=this.currentAnimateTimings,a.options=this._copyOptions(),a.updateOptions(o),a.currentQueryIndex=this.currentQueryIndex,a.currentQueryTotal=this.currentQueryTotal,a.parentContext=this,this.subContextCount++,a}transformIntoNewTimeline(o){return this.previousNode=_1,this.currentTimeline=this.currentTimeline.fork(this.element,o),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(o,e,t){let i={duration:e??o.duration,delay:this.currentTimeline.currentTime+(t??0)+o.delay,easing:""},a=new tE(this._driver,o.element,o.keyframes,o.preStyleProps,o.postStyleProps,i,o.stretchStartingKeyframe);return this.timelines.push(a),i}incrementTime(o){this.currentTimeline.forwardTime(this.currentTimeline.duration+o)}delayNextStep(o){o>0&&this.currentTimeline.delayNextStep(o)}invokeQuery(o,e,t,i,a,s){let d=[];if(i&&d.push(this.element),o.length>0){o=o.replace(Ste,"."+this._enterClassName),o=o.replace(Pte,"."+this._leaveClassName);let p=t!=1,u=this._driver.query(this.element,o,p);t!==0&&(u=t<0?u.slice(u.length+t,u.length):u.slice(0,t)),d.push(...u)}return!a&&d.length==0&&s.push(Q8(e)),d}},f1=class n{_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(o,e,t,i){this._driver=o,this.element=e,this.startTime=t,this._elementTimelineStylesLookup=i,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(e),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(e,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(o){let e=this._keyframes.size===1&&this._pendingStyles.size;this.duration||e?(this.forwardTime(this.currentTime+o),e&&this.snapshotCurrentStyles()):this.startTime+=o}fork(o,e){return this.applyStylesToKeyframe(),new n(this._driver,o,e||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+=wte,this._loadKeyframe()}forwardTime(o){this.applyStylesToKeyframe(),this.duration=o,this._loadKeyframe()}_updateStyle(o,e){this._localTimelineStyles.set(o,e),this._globalTimelineStyles.set(o,e),this._styleSummary.set(o,{time:this.currentTime,value:e})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(o){o&&this._previousKeyframe.set("easing",o);for(let[e,t]of this._globalTimelineStyles)this._backFill.set(e,t||lc),this._currentKeyframe.set(e,lc);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(o,e,t,i){e&&this._previousKeyframe.set("easing",e);let a=i&&i.params||{},s=Tte(o,this._globalTimelineStyles);for(let[d,p]of s){let u=sh(p,a,t);this._pendingStyles.set(d,u),this._localTimelineStyles.has(d)||this._backFill.set(d,this._globalTimelineStyles.get(d)??lc),this._updateStyle(d,u)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((o,e)=>{this._currentKeyframe.set(e,o)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((o,e)=>{this._currentKeyframe.has(e)||this._currentKeyframe.set(e,o)}))}snapshotCurrentStyles(){for(let[o,e]of this._localTimelineStyles)this._pendingStyles.set(o,e),this._updateStyle(o,e)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let o=[];for(let e in this._currentKeyframe)o.push(e);return o}mergeTimelineCollectedStyles(o){o._styleSummary.forEach((e,t)=>{let i=this._styleSummary.get(t);(!i||e.time>i.time)&&this._updateStyle(t,e.value)})}buildKeyframes(){this.applyStylesToKeyframe();let o=new Set,e=new Set,t=this._keyframes.size===1&&this.duration===0,i=[];this._keyframes.forEach((d,p)=>{let u=new Map([...this._backFill,...d]);u.forEach((g,C)=>{g===G0?o.add(C):g===lc&&e.add(C)}),t||u.set("offset",p/this.duration),i.push(u)});let a=[...o.values()],s=[...e.values()];if(t){let d=i[0],p=new Map(d);d.set("offset",0),p.set("offset",1),i=[d,p]}return cE(this.element,i,a,s,this.duration,this.startTime,this.easing,!1)}},tE=class extends f1{keyframes;preStyleProps;postStyleProps;_stretchStartingKeyframe;timings;constructor(o,e,t,i,a,s,d=!1){super(o,e,s.delay),this.keyframes=t,this.preStyleProps=i,this.postStyleProps=a,this._stretchStartingKeyframe=d,this.timings={duration:s.duration,delay:s.delay,easing:s.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let o=this.keyframes,{delay:e,duration:t,easing:i}=this.timings;if(this._stretchStartingKeyframe&&e){let a=[],s=t+e,d=e/s,p=new Map(o[0]);p.set("offset",0),a.push(p);let u=new Map(o[0]);u.set("offset",hR(d)),a.push(u);let g=o.length-1;for(let C=1;C<=g;C++){let M=new Map(o[C]),x=M.get("offset"),b=e+x*t;M.set("offset",hR(b/s)),a.push(M)}t=s,e=0,i="",o=a}return cE(this.element,o,this.preStyleProps,this.postStyleProps,t,e,i,!0)}};function hR(n,o=3){let e=Math.pow(10,o-1);return Math.round(n*e)/e}function Tte(n,o){let e=new Map,t;return n.forEach(i=>{if(i==="*"){t??=o.keys();for(let a of t)e.set(a,lc)}else for(let[a,s]of i)e.set(a,s)}),e}function _R(n,o,e,t,i,a,s,d,p,u,g,C,M){return{type:0,element:n,triggerName:o,isRemovalTransition:i,fromState:e,fromStyles:a,toState:t,toStyles:s,timelines:d,queriedElements:p,preStyleProps:u,postStyleProps:g,totalTime:C,errors:M}}var qT={},v1=class{_triggerName;ast;_stateStyles;constructor(o,e,t){this._triggerName=o,this.ast=e,this._stateStyles=t}match(o,e,t,i){return Ete(this.ast.matchers,o,e,t,i)}buildStyles(o,e,t){let i=this._stateStyles.get("*");return o!==void 0&&(i=this._stateStyles.get(o?.toString())||i),i?i.buildStyles(e,t):new Map}build(o,e,t,i,a,s,d,p,u,g){let C=[],M=this.ast.options&&this.ast.options.params||qT,x=d&&d.params||qT,b=this.buildStyles(t,x,C),P=p&&p.params||qT,k=this.buildStyles(i,P,C),S=new Set,O=new Map,A=new Map,D=i==="void",F={params:kR(P,M),delay:this.ast.options?.delay},I=g?[]:SR(o,e,this.ast.animation,a,s,b,k,F,u,C),B=0;return I.forEach(le=>{B=Math.max(le.duration+le.delay,B)}),C.length?_R(e,this._triggerName,t,i,D,b,k,[],[],O,A,B,C):(I.forEach(le=>{let ae=le.element,W=Ts(O,ae,new Set);le.preStyleProps.forEach(ve=>W.add(ve));let G=Ts(A,ae,new Set);le.postStyleProps.forEach(ve=>G.add(ve)),ae!==e&&S.add(ae)}),_R(e,this._triggerName,t,i,D,b,k,I,[...S.values()],O,A,B))}};function Ete(n,o,e,t,i){return n.some(a=>a(o,e,t,i))}function kR(n,o){let e=q({},o);return Object.entries(n).forEach(([t,i])=>{i!=null&&(e[t]=i)}),e}var nE=class{styles;defaultParams;normalizer;constructor(o,e,t){this.styles=o,this.defaultParams=e,this.normalizer=t}buildStyles(o,e){let t=new Map,i=kR(o,this.defaultParams);return this.styles.styles.forEach(a=>{typeof a!="string"&&a.forEach((s,d)=>{s&&(s=sh(s,i,e));let p=this.normalizer.normalizePropertyName(d,e);s=this.normalizer.normalizeStyleValue(d,p,s,e),t.set(d,s)})}),t}};function Ote(n,o,e){return new iE(n,o,e)}var iE=class{name;ast;_normalizer;transitionFactories=[];fallbackTransition;states=new Map;constructor(o,e,t){this.name=o,this.ast=e,this._normalizer=t,e.states.forEach(i=>{let a=i.options&&i.options.params||{};this.states.set(i.name,new nE(i.style,a,t))}),fR(this.states,"true","1"),fR(this.states,"false","0"),e.transitions.forEach(i=>{this.transitionFactories.push(new v1(o,i,this.states))}),this.fallbackTransition=Dte(o,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(o,e,t,i){return this.transitionFactories.find(s=>s.match(o,e,t,i))||null}matchStyles(o,e,t){return this.fallbackTransition.buildStyles(o,e,t)}};function Dte(n,o,e){let t=[(s,d)=>!0],i={type:wi.Sequence,steps:[],options:null},a={type:wi.Transition,animation:i,matchers:t,options:null,queryCount:0,depCount:0};return new v1(n,a,o)}function fR(n,o,e){n.has(o)?n.has(e)||n.set(e,n.get(o)):n.has(e)&&n.set(o,n.get(e))}var Ite=new Y0,oE=class{bodyNode;_driver;_normalizer;_animations=new Map;_playersById=new Map;players=[];constructor(o,e,t){this.bodyNode=o,this._driver=e,this._normalizer=t}register(o,e){let t=[],i=[],a=MR(this._driver,e,t,i);if(t.length)throw Z8(t);this._animations.set(o,a)}_buildPlayer(o,e,t){let i=o.element,a=LT(this._normalizer,o.keyframes,e,t);return this._driver.animate(i,a,o.duration,o.delay,o.easing,[],!0)}create(o,e,t={}){let i=[],a=this._animations.get(o),s,d=new Map;if(a?(s=SR(this._driver,e,a,HT,r1,new Map,new Map,t,Ite,i),s.forEach(g=>{let C=Ts(d,g.element,new Map);g.postStyleProps.forEach(M=>C.set(M,null))})):(i.push(J8()),s=[]),i.length)throw eR(i);d.forEach((g,C)=>{g.forEach((M,x)=>{g.set(x,this._driver.computeStyle(C,x,lc))})});let p=s.map(g=>{let C=d.get(g.element);return this._buildPlayer(g,new Map,C)}),u=Bd(p);return this._playersById.set(o,u),u.onDestroy(()=>this.destroy(o)),this.players.push(u),u}destroy(o){let e=this._getPlayer(o);e.destroy(),this._playersById.delete(o);let t=this.players.indexOf(e);t>=0&&this.players.splice(t,1)}_getPlayer(o){let e=this._playersById.get(o);if(!e)throw tR(o);return e}listen(o,e,t,i){let a=o1(e,"","","");return i1(this._getPlayer(o),t,a,i),()=>{}}command(o,e,t,i){if(t=="register"){this.register(o,i[0]);return}if(t=="create"){let s=i[0]||{};this.create(o,e,s);return}let a=this._getPlayer(o);switch(t){case"play":a.play();break;case"pause":a.pause();break;case"reset":a.reset();break;case"restart":a.restart();break;case"finish":a.finish();break;case"init":a.init();break;case"setPosition":a.setPosition(parseFloat(i[0]));break;case"destroy":this.destroy(o);break}}},vR="ng-animate-queued",Ate=".ng-animate-queued",QT="ng-animate-disabled",Nte=".ng-animate-disabled",Fte="ng-star-inserted",Rte=".ng-star-inserted",zte=[],PR={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},Lte={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},dc="__ng_removed",Z0=class{namespaceId;value;options;get params(){return this.options.params}constructor(o,e=""){this.namespaceId=e;let t=o&&o.hasOwnProperty("value"),i=t?o.value:o;if(this.value=Bte(i),t){let a=o,{value:s}=a,d=EC(a,["value"]);this.options=d}else this.options={};this.options.params||(this.options.params={})}absorbOptions(o){let e=o.params;if(e){let t=this.options.params;Object.keys(e).forEach(i=>{t[i]==null&&(t[i]=e[i])})}}},X0="void",KT=new Z0(X0),aE=class{id;hostElement;_engine;players=[];_triggers=new Map;_queue=[];_elementListeners=new Map;_hostClassName;constructor(o,e,t){this.id=o,this.hostElement=e,this._engine=t,this._hostClassName="ng-tns-"+o,Sl(e,this._hostClassName)}listen(o,e,t,i){if(!this._triggers.has(e))throw nR(t,e);if(t==null||t.length==0)throw iR(e);if(!jte(t))throw oR(t,e);let a=Ts(this._elementListeners,o,[]),s={name:e,phase:t,callback:i};a.push(s);let d=Ts(this._engine.statesByElement,o,new Map);return d.has(e)||(Sl(o,q0),Sl(o,q0+"-"+e),d.set(e,KT)),()=>{this._engine.afterFlush(()=>{let p=a.indexOf(s);p>=0&&a.splice(p,1),this._triggers.has(e)||d.delete(e)})}}register(o,e){return this._triggers.has(o)?!1:(this._triggers.set(o,e),!0)}_getTrigger(o){let e=this._triggers.get(o);if(!e)throw aR(o);return e}trigger(o,e,t,i=!0){let a=this._getTrigger(e),s=new J0(this.id,e,o),d=this._engine.statesByElement.get(o);d||(Sl(o,q0),Sl(o,q0+"-"+e),this._engine.statesByElement.set(o,d=new Map));let p=d.get(e),u=new Z0(t,this.id);if(!(t&&t.hasOwnProperty("value"))&&p&&u.absorbOptions(p.options),d.set(e,u),p||(p=KT),!(u.value===X0)&&p.value===u.value){if(!Ute(p.params,u.params)){let P=[],k=a.matchStyles(p.value,p.params,P),S=a.matchStyles(u.value,u.params,P);P.length?this._engine.reportError(P):this._engine.afterFlush(()=>{Hm(o,k),cc(o,S)})}return}let M=Ts(this._engine.playersByElement,o,[]);M.forEach(P=>{P.namespaceId==this.id&&P.triggerName==e&&P.queued&&P.destroy()});let x=a.matchTransition(p.value,u.value,o,u.params),b=!1;if(!x){if(!i)return;x=a.fallbackTransition,b=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:o,triggerName:e,transition:x,fromState:p,toState:u,player:s,isFallbackTransition:b}),b||(Sl(o,vR),s.onStart(()=>{lh(o,vR)})),s.onDone(()=>{let P=this.players.indexOf(s);P>=0&&this.players.splice(P,1);let k=this._engine.playersByElement.get(o);if(k){let S=k.indexOf(s);S>=0&&k.splice(S,1)}}),this.players.push(s),M.push(s),s}deregister(o){this._triggers.delete(o),this._engine.statesByElement.forEach(e=>e.delete(o)),this._elementListeners.forEach((e,t)=>{this._elementListeners.set(t,e.filter(i=>i.name!=o))})}clearElementCache(o){this._engine.statesByElement.delete(o),this._elementListeners.delete(o);let e=this._engine.playersByElement.get(o);e&&(e.forEach(t=>t.destroy()),this._engine.playersByElement.delete(o))}_signalRemovalForInnerTriggers(o,e){let t=this._engine.driver.query(o,Q0,!0);t.forEach(i=>{if(i[dc])return;let a=this._engine.fetchNamespacesByElement(i);a.size?a.forEach(s=>s.triggerLeaveAnimation(i,e,!1,!0)):this.clearElementCache(i)}),this._engine.afterFlushAnimationsDone(()=>t.forEach(i=>this.clearElementCache(i)))}triggerLeaveAnimation(o,e,t,i){let a=this._engine.statesByElement.get(o),s=new Map;if(a){let d=[];if(a.forEach((p,u)=>{if(s.set(u,p.value),this._triggers.has(u)){let g=this.trigger(o,u,X0,i);g&&d.push(g)}}),d.length)return this._engine.markElementAsRemoved(this.id,o,!0,e,s),t&&Bd(d).onDone(()=>this._engine.processLeaveNode(o)),!0}return!1}prepareLeaveAnimationListeners(o){let e=this._elementListeners.get(o),t=this._engine.statesByElement.get(o);if(e&&t){let i=new Set;e.forEach(a=>{let s=a.name;if(i.has(s))return;i.add(s);let p=this._triggers.get(s).fallbackTransition,u=t.get(s)||KT,g=new Z0(X0),C=new J0(this.id,s,o);this._engine.totalQueuedPlayers++,this._queue.push({element:o,triggerName:s,transition:p,fromState:u,toState:g,player:C,isFallbackTransition:!0})})}}removeNode(o,e){let t=this._engine;if(o.childElementCount&&this._signalRemovalForInnerTriggers(o,e),this.triggerLeaveAnimation(o,e,!0))return;let i=!1;if(t.totalAnimations){let a=t.players.length?t.playersByQueriedElement.get(o):[];if(a&&a.length)i=!0;else{let s=o;for(;s=s.parentNode;)if(t.statesByElement.get(s)){i=!0;break}}}if(this.prepareLeaveAnimationListeners(o),i)t.markElementAsRemoved(this.id,o,!1,e);else{let a=o[dc];(!a||a===PR)&&(t.afterFlush(()=>this.clearElementCache(o)),t.destroyInnerAnimations(o),t._onRemovalComplete(o,e))}}insertNode(o,e){Sl(o,this._hostClassName)}drainQueuedTransitions(o){let e=[];return this._queue.forEach(t=>{let i=t.player;if(i.destroyed)return;let a=t.element,s=this._elementListeners.get(a);s&&s.forEach(d=>{if(d.name==t.triggerName){let p=o1(a,t.triggerName,t.fromState.value,t.toState.value);p._data=o,i1(t.player,d.phase,p,d.callback)}}),i.markedForDestroy?this._engine.afterFlush(()=>{i.destroy()}):e.push(t)}),this._queue=[],e.sort((t,i)=>{let a=t.transition.ast.depCount,s=i.transition.ast.depCount;return a==0||s==0?a-s:this._engine.driver.containsElement(t.element,i.element)?1:-1})}destroy(o){this.players.forEach(e=>e.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,o)}},rE=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=(o,e)=>{};_onRemovalComplete(o,e){this.onRemovalComplete(o,e)}constructor(o,e,t){this.bodyNode=o,this.driver=e,this._normalizer=t}get queuedPlayers(){let o=[];return this._namespaceList.forEach(e=>{e.players.forEach(t=>{t.queued&&o.push(t)})}),o}createNamespace(o,e){let t=new aE(o,e,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,e)?this._balanceNamespaceList(t,e):(this.newHostElements.set(e,t),this.collectEnterElement(e)),this._namespaceLookup[o]=t}_balanceNamespaceList(o,e){let t=this._namespaceList,i=this.namespacesByHostElement;if(t.length-1>=0){let s=!1,d=this.driver.getParentElement(e);for(;d;){let p=i.get(d);if(p){let u=t.indexOf(p);t.splice(u+1,0,o),s=!0;break}d=this.driver.getParentElement(d)}s||t.unshift(o)}else t.push(o);return i.set(e,o),o}register(o,e){let t=this._namespaceLookup[o];return t||(t=this.createNamespace(o,e)),t}registerTrigger(o,e,t){let i=this._namespaceLookup[o];i&&i.register(e,t)&&this.totalAnimations++}destroy(o,e){o&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let t=this._fetchNamespace(o);this.namespacesByHostElement.delete(t.hostElement);let i=this._namespaceList.indexOf(t);i>=0&&this._namespaceList.splice(i,1),t.destroy(e),delete this._namespaceLookup[o]}))}_fetchNamespace(o){return this._namespaceLookup[o]}fetchNamespacesByElement(o){let e=new Set,t=this.statesByElement.get(o);if(t){for(let i of t.values())if(i.namespaceId){let a=this._fetchNamespace(i.namespaceId);a&&e.add(a)}}return e}trigger(o,e,t,i){if(p1(e)){let a=this._fetchNamespace(o);if(a)return a.trigger(e,t,i),!0}return!1}insertNode(o,e,t,i){if(!p1(e))return;let a=e[dc];if(a&&a.setForRemoval){a.setForRemoval=!1,a.setForMove=!0;let s=this.collectedLeaveElements.indexOf(e);s>=0&&this.collectedLeaveElements.splice(s,1)}if(o){let s=this._fetchNamespace(o);s&&s.insertNode(e,t)}i&&this.collectEnterElement(e)}collectEnterElement(o){this.collectedEnterElements.push(o)}markElementAsDisabled(o,e){e?this.disabledNodes.has(o)||(this.disabledNodes.add(o),Sl(o,QT)):this.disabledNodes.has(o)&&(this.disabledNodes.delete(o),lh(o,QT))}removeNode(o,e,t){if(p1(e)){let i=o?this._fetchNamespace(o):null;i?i.removeNode(e,t):this.markElementAsRemoved(o,e,!1,t);let a=this.namespacesByHostElement.get(e);a&&a.id!==o&&a.removeNode(e,t)}else this._onRemovalComplete(e,t)}markElementAsRemoved(o,e,t,i,a){this.collectedLeaveElements.push(e),e[dc]={namespaceId:o,setForRemoval:i,hasAnimation:t,removedBeforeQueried:!1,previousTriggersValues:a}}listen(o,e,t,i,a){return p1(e)?this._fetchNamespace(o).listen(e,t,i,a):()=>{}}_buildInstruction(o,e,t,i,a){return o.transition.build(this.driver,o.element,o.fromState.value,o.toState.value,t,i,o.fromState.options,o.toState.options,e,a)}destroyInnerAnimations(o){let e=this.driver.query(o,Q0,!0);e.forEach(t=>this.destroyActiveAnimationsForElement(t)),this.playersByQueriedElement.size!=0&&(e=this.driver.query(o,s1,!0),e.forEach(t=>this.finishActiveQueriedAnimationOnElement(t)))}destroyActiveAnimationsForElement(o){let e=this.playersByElement.get(o);e&&e.forEach(t=>{t.queued?t.markedForDestroy=!0:t.destroy()})}finishActiveQueriedAnimationOnElement(o){let e=this.playersByQueriedElement.get(o);e&&e.forEach(t=>t.finish())}whenRenderingDone(){return new Promise(o=>{if(this.players.length)return Bd(this.players).onDone(()=>o());o()})}processLeaveNode(o){let e=o[dc];if(e&&e.setForRemoval){if(o[dc]=PR,e.namespaceId){this.destroyInnerAnimations(o);let t=this._fetchNamespace(e.namespaceId);t&&t.clearElementCache(o)}this._onRemovalComplete(o,e.setForRemoval)}o.classList?.contains(QT)&&this.markElementAsDisabled(o,!1),this.driver.query(o,Nte,!0).forEach(t=>{this.markElementAsDisabled(t,!1)})}flush(o=-1){let e=[];if(this.newHostElements.size&&(this.newHostElements.forEach((t,i)=>this._balanceNamespaceList(t,i)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let t=0;tt()),this._flushFns=[],this._whenQuietFns.length){let t=this._whenQuietFns;this._whenQuietFns=[],e.length?Bd(e).onDone(()=>{t.forEach(i=>i())}):t.forEach(i=>i())}}reportError(o){throw rR(o)}_flushAnimations(o,e){let t=new Y0,i=[],a=new Map,s=[],d=new Map,p=new Map,u=new Map,g=new Set;this.disabledNodes.forEach(ue=>{g.add(ue);let H=this.driver.query(ue,Ate,!0);for(let te=0;te{let te=HT+P++;b.set(H,te),ue.forEach(de=>Sl(de,te))});let k=[],S=new Set,O=new Set;for(let ue=0;ueS.add(de)):O.add(H))}let A=new Map,D=xR(M,Array.from(S));D.forEach((ue,H)=>{let te=r1+P++;A.set(H,te),ue.forEach(de=>Sl(de,te))}),o.push(()=>{x.forEach((ue,H)=>{let te=b.get(H);ue.forEach(de=>lh(de,te))}),D.forEach((ue,H)=>{let te=A.get(H);ue.forEach(de=>lh(de,te))}),k.forEach(ue=>{this.processLeaveNode(ue)})});let F=[],I=[];for(let ue=this._namespaceList.length-1;ue>=0;ue--)this._namespaceList[ue].drainQueuedTransitions(e).forEach(te=>{let de=te.player,me=te.element;if(F.push(de),this.collectedEnterElements.length){let Le=me[dc];if(Le&&Le.setForMove){if(Le.previousTriggersValues&&Le.previousTriggersValues.has(te.triggerName)){let Ze=Le.previousTriggersValues.get(te.triggerName),dt=this.statesByElement.get(te.element);if(dt&&dt.has(te.triggerName)){let Ot=dt.get(te.triggerName);Ot.value=Ze,dt.set(te.triggerName,Ot)}}de.destroy();return}}let Ie=!C||!this.driver.containsElement(C,me),$e=A.get(me),tt=b.get(me),et=this._buildInstruction(te,t,tt,$e,Ie);if(et.errors&&et.errors.length){I.push(et);return}if(Ie){de.onStart(()=>Hm(me,et.fromStyles)),de.onDestroy(()=>cc(me,et.toStyles)),i.push(de);return}if(te.isFallbackTransition){de.onStart(()=>Hm(me,et.fromStyles)),de.onDestroy(()=>cc(me,et.toStyles)),i.push(de);return}let Me=[];et.timelines.forEach(Le=>{Le.stretchStartingKeyframe=!0,this.disabledNodes.has(Le.element)||Me.push(Le)}),et.timelines=Me,t.append(me,et.timelines);let Z={instruction:et,player:de,element:me};s.push(Z),et.queriedElements.forEach(Le=>Ts(d,Le,[]).push(de)),et.preStyleProps.forEach((Le,Ze)=>{if(Le.size){let dt=p.get(Ze);dt||p.set(Ze,dt=new Set),Le.forEach((Ot,si)=>dt.add(si))}}),et.postStyleProps.forEach((Le,Ze)=>{let dt=u.get(Ze);dt||u.set(Ze,dt=new Set),Le.forEach((Ot,si)=>dt.add(si))})});if(I.length){let ue=[];I.forEach(H=>{ue.push(sR(H.triggerName,H.errors))}),F.forEach(H=>H.destroy()),this.reportError(ue)}let B=new Map,le=new Map;s.forEach(ue=>{let H=ue.element;t.has(H)&&(le.set(H,H),this._beforeAnimationBuild(ue.player.namespaceId,ue.instruction,B))}),i.forEach(ue=>{let H=ue.element;this._getPreviousPlayers(H,!1,ue.namespaceId,ue.triggerName,null).forEach(de=>{Ts(B,H,[]).push(de),de.destroy()})});let ae=k.filter(ue=>yR(ue,p,u)),W=new Map;bR(W,this.driver,O,u,lc).forEach(ue=>{yR(ue,p,u)&&ae.push(ue)});let ve=new Map;x.forEach((ue,H)=>{bR(ve,this.driver,new Set(ue),p,G0)}),ae.forEach(ue=>{let H=W.get(ue),te=ve.get(ue);W.set(ue,new Map([...H?.entries()??[],...te?.entries()??[]]))});let Se=[],pe=[],Ae={};s.forEach(ue=>{let{element:H,player:te,instruction:de}=ue;if(t.has(H)){if(g.has(H)){te.onDestroy(()=>cc(H,de.toStyles)),te.disabled=!0,te.overrideTotalTime(de.totalTime),i.push(te);return}let me=Ae;if(le.size>1){let $e=H,tt=[];for(;$e=$e.parentNode;){let et=le.get($e);if(et){me=et;break}tt.push($e)}tt.forEach(et=>le.set(et,me))}let Ie=this._buildAnimation(te.namespaceId,de,B,a,ve,W);if(te.setRealPlayer(Ie),me===Ae)Se.push(te);else{let $e=this.playersByElement.get(me);$e&&$e.length&&(te.parentPlayer=Bd($e)),i.push(te)}}else Hm(H,de.fromStyles),te.onDestroy(()=>cc(H,de.toStyles)),pe.push(te),g.has(H)&&i.push(te)}),pe.forEach(ue=>{let H=a.get(ue.element);if(H&&H.length){let te=Bd(H);ue.setRealPlayer(te)}}),i.forEach(ue=>{ue.parentPlayer?ue.syncPlayerEvents(ue.parentPlayer):ue.destroy()});for(let ue=0;ue!Ie.destroyed);me.length?$te(this,H,me):this.processLeaveNode(H)}return k.length=0,Se.forEach(ue=>{this.players.push(ue),ue.onDone(()=>{ue.destroy();let H=this.players.indexOf(ue);this.players.splice(H,1)}),ue.play()}),Se}afterFlush(o){this._flushFns.push(o)}afterFlushAnimationsDone(o){this._whenQuietFns.push(o)}_getPreviousPlayers(o,e,t,i,a){let s=[];if(e){let d=this.playersByQueriedElement.get(o);d&&(s=d)}else{let d=this.playersByElement.get(o);if(d){let p=!a||a==X0;d.forEach(u=>{u.queued||!p&&u.triggerName!=i||s.push(u)})}}return(t||i)&&(s=s.filter(d=>!(t&&t!=d.namespaceId||i&&i!=d.triggerName))),s}_beforeAnimationBuild(o,e,t){let i=e.triggerName,a=e.element,s=e.isRemovalTransition?void 0:o,d=e.isRemovalTransition?void 0:i;for(let p of e.timelines){let u=p.element,g=u!==a,C=Ts(t,u,[]);this._getPreviousPlayers(u,g,s,d,e.toState).forEach(x=>{let b=x.getRealPlayer();b.beforeDestroy&&b.beforeDestroy(),x.destroy(),C.push(x)})}Hm(a,e.fromStyles)}_buildAnimation(o,e,t,i,a,s){let d=e.triggerName,p=e.element,u=[],g=new Set,C=new Set,M=e.timelines.map(b=>{let P=b.element;g.add(P);let k=P[dc];if(k&&k.removedBeforeQueried)return new Vd(b.duration,b.delay);let S=P!==p,O=Hte((t.get(P)||zte).map(B=>B.getRealPlayer())).filter(B=>{let le=B;return le.element?le.element===P:!1}),A=a.get(P),D=s.get(P),F=LT(this._normalizer,b.keyframes,A,D),I=this._buildPlayer(b,F,O);if(b.subTimeline&&i&&C.add(P),S){let B=new J0(o,d,P);B.setRealPlayer(I),u.push(B)}return I});u.forEach(b=>{Ts(this.playersByQueriedElement,b.element,[]).push(b),b.onDone(()=>Vte(this.playersByQueriedElement,b.element,b))}),g.forEach(b=>Sl(b,UT));let x=Bd(M);return x.onDestroy(()=>{g.forEach(b=>lh(b,UT)),cc(p,e.toStyles)}),C.forEach(b=>{Ts(i,b,[]).push(x)}),x}_buildPlayer(o,e,t){return e.length>0?this.driver.animate(o.element,e,o.duration,o.delay,o.easing,t):new Vd(o.duration,o.delay)}},J0=class{namespaceId;triggerName;element;_player=new Vd;_containsRealPlayer=!1;_queuedCallbacks=new Map;destroyed=!1;parentPlayer=null;markedForDestroy=!1;disabled=!1;queued=!0;totalTime=0;constructor(o,e,t){this.namespaceId=o,this.triggerName=e,this.element=t}setRealPlayer(o){this._containsRealPlayer||(this._player=o,this._queuedCallbacks.forEach((e,t)=>{e.forEach(i=>i1(o,t,void 0,i))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(o.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(o){this.totalTime=o}syncPlayerEvents(o){let e=this._player;e.triggerCallback&&o.onStart(()=>e.triggerCallback("start")),o.onDone(()=>this.finish()),o.onDestroy(()=>this.destroy())}_queueEvent(o,e){Ts(this._queuedCallbacks,o,[]).push(e)}onDone(o){this.queued&&this._queueEvent("done",o),this._player.onDone(o)}onStart(o){this.queued&&this._queueEvent("start",o),this._player.onStart(o)}onDestroy(o){this.queued&&this._queueEvent("destroy",o),this._player.onDestroy(o)}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(o){this.queued||this._player.setPosition(o)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(o){let e=this._player;e.triggerCallback&&e.triggerCallback(o)}};function Vte(n,o,e){let t=n.get(o);if(t){if(t.length){let i=t.indexOf(e);t.splice(i,1)}t.length==0&&n.delete(o)}return t}function Bte(n){return n??null}function p1(n){return n&&n.nodeType===1}function jte(n){return n=="start"||n=="done"}function CR(n,o){let e=n.style.display;return n.style.display=o??"none",e}function bR(n,o,e,t,i){let a=[];e.forEach(p=>a.push(CR(p)));let s=[];t.forEach((p,u)=>{let g=new Map;p.forEach(C=>{let M=o.computeStyle(u,C,i);g.set(C,M),(!M||M.length==0)&&(u[dc]=Lte,s.push(u))}),n.set(u,g)});let d=0;return e.forEach(p=>CR(p,a[d++])),s}function xR(n,o){let e=new Map;if(n.forEach(d=>e.set(d,[])),o.length==0)return e;let t=1,i=new Set(o),a=new Map;function s(d){if(!d)return t;let p=a.get(d);if(p)return p;let u=d.parentNode;return e.has(u)?p=u:i.has(u)?p=t:p=s(u),a.set(d,p),p}return o.forEach(d=>{let p=s(d);p!==t&&e.get(p).push(d)}),e}function Sl(n,o){n.classList?.add(o)}function lh(n,o){n.classList?.remove(o)}function $te(n,o,e){Bd(e).onDone(()=>n.processLeaveNode(o))}function Hte(n){let o=[];return TR(n,o),o}function TR(n,o){for(let e=0;ei.add(a)):o.set(n,t),e.delete(n),!0}var ch=class{_driver;_normalizer;_transitionEngine;_timelineEngine;_triggerCache={};onRemovalComplete=(o,e)=>{};constructor(o,e,t){this._driver=e,this._normalizer=t,this._transitionEngine=new rE(o.body,e,t),this._timelineEngine=new oE(o.body,e,t),this._transitionEngine.onRemovalComplete=(i,a)=>this.onRemovalComplete(i,a)}registerTrigger(o,e,t,i,a){let s=o+"-"+i,d=this._triggerCache[s];if(!d){let p=[],u=[],g=MR(this._driver,a,p,u);if(p.length)throw Y8(i,p);d=Ote(i,g,this._normalizer),this._triggerCache[s]=d}this._transitionEngine.registerTrigger(e,i,d)}register(o,e){this._transitionEngine.register(o,e)}destroy(o,e){this._transitionEngine.destroy(o,e)}onInsert(o,e,t,i){this._transitionEngine.insertNode(o,e,t,i)}onRemove(o,e,t){this._transitionEngine.removeNode(o,e,t)}disableAnimations(o,e){this._transitionEngine.markElementAsDisabled(o,e)}process(o,e,t,i){if(t.charAt(0)=="@"){let[a,s]=VT(t),d=i;this._timelineEngine.command(a,e,s,d)}else this._transitionEngine.trigger(o,e,t,i)}listen(o,e,t,i,a){if(t.charAt(0)=="@"){let[s,d]=VT(t);return this._timelineEngine.listen(s,e,d,a)}return this._transitionEngine.listen(o,e,t,i,a)}flush(o=-1){this._transitionEngine.flush(o)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(o){this._transitionEngine.afterFlushAnimationsDone(o)}};function Wte(n,o){let e=null,t=null;return Array.isArray(o)&&o.length?(e=XT(o[0]),o.length>1&&(t=XT(o[o.length-1]))):o instanceof Map&&(e=XT(o)),e||t?new Gte(n,e,t):null}var Gte=(()=>{class n{_element;_startStyles;_endStyles;static initialStylesByElement=new WeakMap;_state=0;_initialStyles;constructor(e,t,i){this._element=e,this._startStyles=t,this._endStyles=i;let a=n.initialStylesByElement.get(e);a||n.initialStylesByElement.set(e,a=new Map),this._initialStyles=a}start(){this._state<1&&(this._startStyles&&cc(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(cc(this._element,this._initialStyles),this._endStyles&&(cc(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(n.initialStylesByElement.delete(this._element),this._startStyles&&(Hm(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(Hm(this._element,this._endStyles),this._endStyles=null),cc(this._element,this._initialStyles),this._state=3)}}return n})();function XT(n){let o=null;return n.forEach((e,t)=>{qte(t)&&(o=o||new Map,o.set(t,e))}),o}function qte(n){return n==="display"||n==="position"}var C1=class{element;keyframes;options;_specialStyles;_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_duration;_delay;_initialized=!1;_finished=!1;_started=!1;_destroyed=!1;_finalKeyframe;_originalOnDoneFns=[];_originalOnStartFns=[];domPlayer=null;time=0;parentPlayer=null;currentSnapshot=new Map;constructor(o,e,t,i){this.element=o,this.keyframes=e,this.options=t,this._specialStyles=i,this._duration=t.duration,this._delay=t.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(o=>o()),this._onDoneFns=[])}init(){this._buildPlayer()&&this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return this.domPlayer;this._initialized=!0;let o=this.keyframes,e=this._triggerWebAnimation(this.element,o,this.options);if(!e)return this._onFinish(),null;this.domPlayer=e,this._finalKeyframe=o.length?o[o.length-1]:new Map;let t=()=>this._onFinish();return e.addEventListener("finish",t),this.onDestroy(()=>{e.removeEventListener("finish",t)}),e}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer?.pause()}_convertKeyframesToObject(o){let e=[];return o.forEach(t=>{e.push(Object.fromEntries(t))}),e}_triggerWebAnimation(o,e,t){let i=this._convertKeyframesToObject(e);try{return o.animate(i,t)}catch{return null}}onStart(o){this._originalOnStartFns.push(o),this._onStartFns.push(o)}onDone(o){this._originalOnDoneFns.push(o),this._onDoneFns.push(o)}onDestroy(o){this._onDestroyFns.push(o)}play(){let o=this._buildPlayer();o&&(this.hasStarted()||(this._onStartFns.forEach(e=>e()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),o.play())}pause(){this.init(),this.domPlayer?.pause()}finish(){this.init(),this.domPlayer&&(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?.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(o=>o()),this._onDestroyFns=[])}setPosition(o){this.domPlayer||this.init(),this.domPlayer&&(this.domPlayer.currentTime=o*this.time)}getPosition(){return this.domPlayer?+(this.domPlayer.currentTime??0)/this.time:this._initialized?1:0}get totalTime(){return this._delay+this._duration}beforeDestroy(){let o=new Map;this.hasStarted()&&this._finalKeyframe.forEach((t,i)=>{i!=="offset"&&o.set(i,this._finished?t:c1(this.element,i))}),this.currentSnapshot=o}triggerCallback(o){let e=o==="start"?this._onStartFns:this._onDoneFns;e.forEach(t=>t()),e.length=0}},b1=class{validateStyleProperty(o){return!0}validateAnimatableStyleProperty(o){return!0}containsElement(o,e){return BT(o,e)}getParentElement(o){return a1(o)}query(o,e,t){return jT(o,e,t)}computeStyle(o,e,t){return c1(o,e)}animate(o,e,t,i,a,s=[]){let d=i==0?"both":"forwards",p={duration:t,delay:i,fill:d};a&&(p.easing=a);let u=new Map,g=s.filter(x=>x instanceof C1);mR(t,i)&&g.forEach(x=>{x.currentSnapshot.forEach((b,P)=>u.set(P,b))});let C=cR(e).map(x=>new Map(x));C=pR(o,C,u);let M=Wte(o,C);return new C1(o,C,p,M)}};var u1="@",ER="@.disabled",x1=class{namespaceId;delegate;engine;_onDestroy;\u0275type=0;constructor(o,e,t,i){this.namespaceId=o,this.delegate=e,this.engine=t,this._onDestroy=i}get data(){return this.delegate.data}destroyNode(o){this.delegate.destroyNode?.(o)}destroy(){this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),this._onDestroy?.()}createElement(o,e){return this.delegate.createElement(o,e)}createComment(o){return this.delegate.createComment(o)}createText(o){return this.delegate.createText(o)}appendChild(o,e){this.delegate.appendChild(o,e),this.engine.onInsert(this.namespaceId,e,o,!1)}insertBefore(o,e,t,i=!0){this.delegate.insertBefore(o,e,t),this.engine.onInsert(this.namespaceId,e,o,i)}removeChild(o,e,t,i){if(i){this.delegate.removeChild(o,e,t,i);return}this.parentNode(e)&&this.engine.onRemove(this.namespaceId,e,this.delegate)}selectRootElement(o,e){return this.delegate.selectRootElement(o,e)}parentNode(o){return this.delegate.parentNode(o)}nextSibling(o){return this.delegate.nextSibling(o)}setAttribute(o,e,t,i){this.delegate.setAttribute(o,e,t,i)}removeAttribute(o,e,t){this.delegate.removeAttribute(o,e,t)}addClass(o,e){this.delegate.addClass(o,e)}removeClass(o,e){this.delegate.removeClass(o,e)}setStyle(o,e,t,i){this.delegate.setStyle(o,e,t,i)}removeStyle(o,e,t){this.delegate.removeStyle(o,e,t)}setProperty(o,e,t){e.charAt(0)==u1&&e==ER?this.disableAnimations(o,!!t):this.delegate.setProperty(o,e,t)}setValue(o,e){this.delegate.setValue(o,e)}listen(o,e,t,i){return this.delegate.listen(o,e,t,i)}disableAnimations(o,e){this.engine.disableAnimations(o,e)}},sE=class extends x1{factory;constructor(o,e,t,i,a){super(e,t,i,a),this.factory=o,this.namespaceId=e}setProperty(o,e,t){e.charAt(0)==u1?e.charAt(1)=="."&&e==ER?(t=t===void 0?!0:!!t,this.disableAnimations(o,t)):this.engine.process(this.namespaceId,o,e.slice(1),t):this.delegate.setProperty(o,e,t)}listen(o,e,t,i){if(e.charAt(0)==u1){let a=Qte(o),s=e.slice(1),d="";return s.charAt(0)!=u1&&([s,d]=Kte(s)),this.engine.listen(this.namespaceId,a,s,d,p=>{let u=p._data||-1;this.factory.scheduleListenerCallback(u,t,p)})}return this.delegate.listen(o,e,t,i)}};function Qte(n){switch(n){case"body":return document.body;case"document":return document;case"window":return window;default:return n}}function Kte(n){let o=n.indexOf("."),e=n.substring(0,o),t=n.slice(o+1);return[e,t]}var y1=class{delegate;engine;_zone;_currentId=0;_microtaskId=1;_animationCallbacksBuffer=[];_rendererCache=new Map;_cdRecurDepth=0;constructor(o,e,t){this.delegate=o,this.engine=e,this._zone=t,e.onRemovalComplete=(i,a)=>{a?.removeChild(null,i)}}createRenderer(o,e){let i=this.delegate.createRenderer(o,e);if(!o||!e?.data?.animation){let u=this._rendererCache,g=u.get(i);if(!g){let C=()=>u.delete(i);g=new x1("",i,this.engine,C),u.set(i,g)}return g}let a=e.id,s=e.id+"-"+this._currentId;this._currentId++,this.engine.register(s,o);let d=u=>{Array.isArray(u)?u.forEach(d):this.engine.registerTrigger(a,s,o,u.name,u)};return e.data.animation.forEach(d),new sE(this,s,i,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(o,e,t){if(o>=0&&oe(t));return}let i=this._animationCallbacksBuffer;i.length==0&&queueMicrotask(()=>{this._zone.run(()=>{i.forEach(a=>{let[s,d]=a;s(d)}),this._animationCallbacksBuffer=[]})}),i.push([e,t])}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(o){this.engine.flush(),this.delegate.componentReplaced?.(o)}};var Yte=(()=>{class n extends ch{constructor(e,t,i){super(e,t,i)}ngOnDestroy(){this.flush()}static \u0275fac=function(t){return new(t||n)(_e(Do),_e(wu),_e(Mu))};static \u0275prov=J({token:n,factory:n.\u0275fac})}return n})();function Zte(){return new g1}function Jte(){return new y1(f(xA),f(ch),f(Gi))}var DR=[{provide:Mu,useFactory:Zte},{provide:ch,useClass:Yte},{provide:Fp,useFactory:Jte}],ene=[{provide:wu,useClass:lE},{provide:Bk,useValue:"NoopAnimations"},...DR],OR=[{provide:wu,useFactory:()=>new b1},{provide:Bk,useFactory:()=>"BrowserAnimations"},...DR],IR=(()=>{class n{static withConfig(e){return{ngModule:n,providers:e.disableAnimations?ene:OR}}static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({providers:OR,imports:[VC]})}return n})();var AR=void 0;typeof Object.create!="function"?AR=(function(n){var o=function(){};return function(e,t){if(e!==Object(e)&&e!==null)throw TypeError("Argument must be an object, or null");o.prototype=e||{};var i=new o;return o.prototype=null,t!==n&&Object.defineProperties(i,t),e===null&&(i.__proto__=null),i}})():AR=Object.create;var ev=["webkit","moz","ms","o"],nWe=(function(){if(typeof window>"u")return function(){};for(var n=0,o=ev.length;n"u")return function(){};for(var n=0,o=ev.length;n{class n{static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275mod=on({type:n})}static{this.\u0275inj=nn({})}}return n})();function FR(n){setTimeout(()=>{throw n})}function dE(n,o){try{n()}catch(e){try{o()}catch(t){FR(t)}throw e}o()}var tv=class{constructor(o){this.rawFile=o;let e=o instanceof HTMLInputElement?o.value:o;this[`_createFrom${typeof e=="string"?"FakePath":"Object"}`](e)}_createFromFakePath(o){this.lastModifiedDate=void 0,this.size=void 0,this.type=`like/${o.slice(o.lastIndexOf(".")+1).toLowerCase()}`,this.name=o.slice(o.lastIndexOf("/")+o.lastIndexOf("\\")+2)}_createFromObject(o){this.size=o.size,this.type=o.type,this.name=o.name}},mE=class{constructor(o,e,t){this.url="/",this.headers=[],this.withCredentials=!0,this.formData=[],this.isReady=!1,this.isUploading=!1,this.isUploaded=!1,this.isSuccess=!1,this.isCancel=!1,this.isError=!1,this.progress=0,this.uploader=o,this.some=e,this.options=t,this.file=new tv(e),this._file=e,o.options&&(this.method=o.options.method||"POST",this.alias=o.options.itemAlias||"file"),this.url=o.options.url}upload(){try{this.uploader.uploadItem(this)}catch(o){try{dE(()=>this.uploader._onErrorItem(this,"",0,{}),()=>this.uploader._onCompleteItem(this,"",0,{}))}catch(e){FR(e)}throw o}}cancel(){this.uploader.cancelItem(this)}remove(){this.uploader.removeFromQueue(this)}onBeforeUpload(){}onBuildForm(o){return{form:o}}onProgress(o){return{progress:o}}onSuccess(o,e,t){return{response:o,status:e,headers:t}}onError(o,e,t){return{response:o,status:e,headers:t}}onCancel(o,e,t){return{response:o,status:e,headers:t}}onComplete(o,e,t){return{response:o,status:e,headers:t}}_onBeforeUpload(){this.isReady=!0,this.isUploading=!0,this.isUploaded=!1,this.isSuccess=!1,this.isCancel=!1,this.isError=!1,this.progress=0,this.onBeforeUpload()}_onBuildForm(o){this.onBuildForm(o)}_onProgress(o){this.progress=o,this.onProgress(o)}_onSuccess(o,e,t){this.isReady=!1,this.isUploading=!1,this.isUploaded=!0,this.isSuccess=!0,this.isCancel=!1,this.isError=!1,this.progress=100,this.index=void 0,this.onSuccess(o,e,t)}_onError(o,e,t){this.isReady=!1,this.isUploading=!1,this.isUploaded=!0,this.isSuccess=!1,this.isCancel=!1,this.isError=!0,this.progress=0,this.index=void 0,this.onError(o,e,t)}_onCancel(o,e,t){this.isReady=!1,this.isUploading=!1,this.isUploaded=!1,this.isSuccess=!1,this.isCancel=!0,this.isError=!1,this.progress=0,this.index=void 0,this.onCancel(o,e,t)}_onComplete(o,e,t){this.onComplete(o,e,t),this.uploader.options.removeAfterUpload&&this.remove()}_prepareToUploading(){this.index=this.index||++this.uploader._nextIndex,this.isReady=!0}},tne=(()=>{class n{static{this.mime_doc=["application/msword","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-word.template.macroEnabled.12"]}static{this.mime_xsl=["application/vnd.ms-excel","application/vnd.ms-excel","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-excel.template.macroEnabled.12","application/vnd.ms-excel.addin.macroEnabled.12","application/vnd.ms-excel.sheet.binary.macroEnabled.12"]}static{this.mime_ppt=["application/vnd.ms-powerpoint","application/vnd.ms-powerpoint","application/vnd.ms-powerpoint","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/vnd.ms-powerpoint.addin.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"]}static{this.mime_psd=["image/photoshop","image/x-photoshop","image/psd","application/photoshop","application/psd","zz-application/zz-winassoc-psd"]}static{this.mime_compress=["application/x-gtar","application/x-gcompress","application/compress","application/x-tar","application/x-rar-compressed","application/octet-stream","application/x-zip-compressed","application/zip-compressed","application/x-7z-compressed","application/gzip","application/x-bzip2"]}static getMimeClass(e){let t="application";return e?.type&&this.mime_psd.indexOf(e.type)!==-1||e?.type?.match("image.*")?t="image":e?.type?.match("video.*")?t="video":e?.type?.match("audio.*")?t="audio":e?.type==="application/pdf"?t="pdf":e?.type&&this.mime_compress.indexOf(e.type)!==-1?t="compress":e?.type&&this.mime_doc.indexOf(e.type)!==-1?t="doc":e?.type&&this.mime_xsl.indexOf(e.type)!==-1?t="xls":e?.type&&this.mime_ppt.indexOf(e.type)!==-1&&(t="ppt"),t==="application"&&e?.name&&(t=this.fileTypeDetection(e.name)),t}static fileTypeDetection(e){let t={jpg:"image",jpeg:"image",tif:"image",psd:"image",bmp:"image",png:"image",nef:"image",tiff:"image",cr2:"image",dwg:"image",cdr:"image",ai:"image",indd:"image",pin:"image",cdp:"image",skp:"image",stp:"image","3dm":"image",mp3:"audio",wav:"audio",wma:"audio",mod:"audio",m4a:"audio",compress:"compress",zip:"compress",rar:"compress","7z":"compress",lz:"compress",z01:"compress",bz2:"compress",gz:"compress",pdf:"pdf",xls:"xls",xlsx:"xls",ods:"xls",mp4:"video",avi:"video",wmv:"video",mpg:"video",mts:"video",flv:"video","3gp":"video",vob:"video",m4v:"video",mpeg:"video",m2ts:"video",mov:"video",doc:"doc",docx:"doc",eps:"doc",txt:"doc",odt:"doc",rtf:"doc",ppt:"ppt",pptx:"ppt",pps:"ppt",ppsx:"ppt",odp:"ppt"},i=e.split(".");if(i.length<2)return"application";let a=i[i.length-1].toLowerCase();return t[a]===void 0?"application":t[a]}}return n})();function nne(n){return File&&n instanceof File}var kl=class{constructor(o){this.isUploading=!1,this.queue=[],this.progress=0,this._nextIndex=0,this.options={autoUpload:!1,isHTML5:!0,filters:[],removeAfterUpload:!1,disableMultipart:!1,formatDataFunction:e=>e._file,formatDataFunctionIsAsync:!1,url:""},this.setOptions(o),this.response=new be}setOptions(o){this.options=Object.assign(this.options,o),this.authToken=this.options.authToken,this.authTokenHeader=this.options.authTokenHeader||"Authorization",this.autoUpload=this.options.autoUpload;let e=[this._queueLimitFilter,this._fileSizeFilter,this._fileTypeFilter,this._mimeTypeFilter];this.options.filters=this.options.filters?.filter(t=>!e.includes(t.fn)),this.options.filters?.unshift({name:"queueLimit",fn:this._queueLimitFilter}),this.options.maxFileSize&&this.options.filters?.unshift({name:"fileSize",fn:this._fileSizeFilter}),this.options.allowedFileType&&this.options.filters?.unshift({name:"fileType",fn:this._fileTypeFilter}),this.options.allowedMimeType&&this.options.filters?.unshift({name:"mimeType",fn:this._mimeTypeFilter});for(let t=0;t{i||(i=this.options);let g=new tv(u);if(this._isValidFile(g,s,i)){let C=new mE(this,u,i);p.push(C),this.queue.push(C),this._onAfterAddingFile(C)}else if(typeof this._failFilterIndex=="number"&&this._failFilterIndex>=0){let C=s[this._failFilterIndex];this._onWhenAddingFileFailed(g,C,i)}}),this.queue.length!==d&&(this._onAfterAddingAll(p),this.progress=this._getTotalProgress()),this._render(),this.options.autoUpload&&this.uploadAll()}removeFromQueue(o){let e=this.getIndexOfItem(o),t=this.queue[e];t.isUploading&&t.cancel(),this.queue.splice(e,1),this.progress=this._getTotalProgress()}clearQueue(){for(;this.queue.length;)this.queue[0].remove();this.progress=0}uploadItem(o){let e=this.getIndexOfItem(o),t=this.queue[e],i=this.options.isHTML5?"_xhrTransport":"_iframeTransport";t._prepareToUploading(),!this.isUploading&&(this.isUploading=!0,this[i](t))}cancelItem(o){let e=this.getIndexOfItem(o),t=this.queue[e];if(t){if(t.isUploading){(this.options.isHTML5?t._xhr:t._form).abort();return}t.isReady&&(this._onCancelItem(t,"",0,{}),t._onComplete("",0,{}),this.onCompleteItem(t,"",0,{}),this._render())}}uploadAll(){let o=this.getNotUploadedItems().filter(e=>!e.isUploading);o.length&&(o.map(e=>e._prepareToUploading()),o[0].upload())}cancelAll(){let o=this.getNotUploadedItems();o.filter(e=>!e.isUploading).forEach(e=>e.cancel()),o.filter(e=>e.isUploading).forEach(e=>e.cancel())}isFile(o){return nne(o)}isFileLikeObject(o){return o instanceof tv}getIndexOfItem(o){return typeof o=="number"?o:this.queue.indexOf(o)}getNotUploadedItems(){return this.queue.filter(o=>!o.isUploaded)}getReadyItems(){return this.queue.filter(o=>o.isReady&&!o.isUploading).sort((o,e)=>o.index-e.index)}onAfterAddingAll(o){return{fileItems:o}}onBuildItemForm(o,e){return{fileItem:o,form:e}}onAfterAddingFile(o){return{fileItem:o}}onWhenAddingFileFailed(o,e,t){return{item:o,filter:e,options:t}}onBeforeUploadItem(o){return{fileItem:o}}onProgressItem(o,e){return{fileItem:o,progress:e}}onProgressAll(o){return{progress:o}}onSuccessItem(o,e,t,i){return{item:o,response:e,status:t,headers:i}}onErrorItem(o,e,t,i){return{item:o,response:e,status:t,headers:i}}onCancelItem(o,e,t,i){return{item:o,response:e,status:t,headers:i}}onCompleteItem(o,e,t,i){return{item:o,response:e,status:t,headers:i}}onCompleteAll(){}_mimeTypeFilter(o){return this.options.allowedMimeType?o?.type?this.options.allowedMimeType.indexOf(o.type)!==-1:this.options.allowEmptyMimeType!==!1:!0}_fileSizeFilter(o){return!(this.options.maxFileSize&&o.size>this.options.maxFileSize)}_fileTypeFilter(o){return!(this.options.allowedFileType&&this.options.allowedFileType.indexOf(tne.getMimeClass(o))===-1)}_onErrorItem(o,e,t,i){o._onError(e,t,i),this.onErrorItem(o,e,t,i)}_onCompleteItem(o,e,t,i){dE(()=>{o._onComplete(e,t,i),this.onCompleteItem(o,e,t,i)},()=>this._uploadNext())}_finishItem(o,e,t,i,a){dE(()=>this[e](o,t,i,a),()=>this._onCompleteItem(o,t,i,a))}_uploadNext(){let o=this.getReadyItems()[0];if(this.isUploading=!1,o){o.upload();return}this.progress=this._getTotalProgress(),this.onCompleteAll(),this._render()}_headersGetter(o){return e=>e?o[e.toLowerCase()]||void 0:o}_xhrTransport(o){let e=o._xhr=new XMLHttpRequest,t;if(this._onBeforeUploadItem(o),typeof o._file.size!="number")throw new TypeError("The file specified is no longer valid");this.options.disableMultipart?this.options.formatDataFunction&&(t=this.options.formatDataFunction(o)):t=this._buildFormData(o,o._file),e.upload.onprogress=i=>{let a=Math.round(i.lengthComputable?i.loaded*100/i.total:0);this._onProgressItem(o,a)},e.onload=()=>{let i=this._parseHeaders(e.getAllResponseHeaders()),a=this._transformResponse(e.response);this._finishItem(o,this._isSuccessCode(e.status)?"_onSuccessItem":"_onErrorItem",a,e.status,i)},e.onerror=()=>{let i=this._parseHeaders(e.getAllResponseHeaders()),a=this._transformResponse(e.response);this._finishItem(o,"_onErrorItem",a,e.status,i)},e.onabort=()=>{let i=this._parseHeaders(e.getAllResponseHeaders()),a=this._transformResponse(e.response);this._finishItem(o,"_onCancelItem",a,e.status,i)},this._openRequest(e,o),this.options.formatDataFunctionIsAsync?t.then(i=>e.send(JSON.stringify(i))):e.send(t),this._render()}_buildFormData(o,e,t={}){let i=new FormData;this._onBuildItemForm(o,i),Object.keys(t).forEach(s=>i.append(s,t[s]));let a=()=>i.append(o.alias,e,o.file.name);return this.options.parametersBeforeFiles||a(),this.options.additionalParameter!==void 0&&Object.keys(this.options.additionalParameter).forEach(s=>{let d=this.options.additionalParameter?.[s];typeof d=="string"&&d.indexOf("{{file_name}}")>=0&&o.file?.name&&(d=d.replace("{{file_name}}",o.file.name)),i.append(s,d)}),a&&this.options.parametersBeforeFiles&&a(),i}_openRequest(o,e){let t=this;if(e.method&&e.url&&o.open(e.method,e.url,!0),o.withCredentials=e.withCredentials,this.options.headers)for(let i of this.options.headers)o.setRequestHeader(i.name,i.value);if(e.headers.length)for(let i of e.headers)o.setRequestHeader(i.name,i.value);this.authToken&&this.authTokenHeader&&o.setRequestHeader(this.authTokenHeader,this.authToken),o.onreadystatechange=function(){o.readyState==XMLHttpRequest.DONE&&t.response.emit(o.responseText)}}_getTotalProgress(o=0){if(this.options.removeAfterUpload)return o;let e=this.getNotUploadedItems().length,t=e?this.queue.length-e:this.queue.length,i=100/this.queue.length,a=o*i/100;return Math.round(t*i+a)}_getFilters(o){if(!o)return this.options?.filters||[];if(Array.isArray(o))return o;if(typeof o=="string"){let e=o.match(/[^\s,]+/g);return this.options?.filters||[].filter(t=>e?.indexOf(t.name)!==-1)}return this.options?.filters||[]}_render(){}_queueLimitFilter(){return this.options.queueLimit===void 0||this.queue.length(typeof this._failFilterIndex=="number"&&this._failFilterIndex++,i.fn.call(this,o,t))):!0}_isSuccessCode(o){return o>=200&&o<300||o===304}_transformResponse(o){return o}_parseHeaders(o){let e={},t,i,a;return o&&o.split(` +`).map(s=>{a=s.indexOf(":"),t=s.slice(0,a).trim().toLowerCase(),i=s.slice(a+1).trim(),t&&(e[t]=e[t]?e[t]+", "+i:i)}),e}_onWhenAddingFileFailed(o,e,t){this.onWhenAddingFileFailed(o,e,t)}_onAfterAddingFile(o){this.onAfterAddingFile(o)}_onAfterAddingAll(o){this.onAfterAddingAll(o)}_onBeforeUploadItem(o){o._onBeforeUpload(),this.onBeforeUploadItem(o)}_onBuildItemForm(o,e){o._onBuildForm(e),this.onBuildItemForm(o,e)}_onProgressItem(o,e){let t=this._getTotalProgress(e);this.progress=t,o._onProgress(e),this.onProgressItem(o,e),this.onProgressAll(t),this._render()}_onSuccessItem(o,e,t,i){o._onSuccess(e,t,i),this.onSuccessItem(o,e,t,i)}_onCancelItem(o,e,t,i){o._onCancel(e,t,i),this.onCancelItem(o,e,t,i)}};var Kc=(()=>{class n{constructor(){this.uploader=ee(),this.onFileSelected=$o(),this.element=f(Kt)}getOptions(){return this.uploader()?.options}getFilters(){return""}isEmptyAfterSelection(){return!!this.element.nativeElement.attributes.multiple}onClick(){let e=this.element.nativeElement.files?.[0];e&&!this.uploader()?.queue.some(t=>t._file===e)&&(this.element.nativeElement.value="")}onChange(){let e=this.element.nativeElement.files,t=this.getOptions(),i=this.getFilters();this.uploader()?.addToQueue(e,t,i),this.onFileSelected.emit(e),this.isEmptyAfterSelection()&&(this.element.nativeElement.value="")}static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275dir=yt({type:n,selectors:[["","ng2FileSelect",""]],hostBindings:function(t,i){t&1&&_("click",function(){return i.onClick()})("change",function(){return i.onChange()})},inputs:{uploader:[1,"uploader"]},outputs:{onFileSelected:"onFileSelected"}})}}return n})();var Pl=(()=>{class n{static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275mod=on({type:n})}static{this.\u0275inj=nn({})}}return n})();var Su=class{visible;error;clear;constructor(o,e,t=!1){this.visible=o,this.error=e,this.clear=t}},mo=(()=>{class n{state=new cn(new Su(!1));constructor(){}setError(e){this.state.next(new Su(!1,e.error))}clear(){this.state.next(new Su(!1,null,!0))}activate(){this.state.next(new Su(!0))}deactivate(){this.state.next(new Su(!1))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=J({token:n,factory:n.\u0275fac})}return n})();function ine(n,o){n&1&&(r(0,"div",1),L(1,"mat-spinner",3),l())}function one(n,o){if(n&1){let e=R();r(0,"div",2)(1,"div",4)(2,"mat-icon"),c(3,"error_outline"),l()(),r(4,"div"),c(5),l(),r(6,"div")(7,"button",5),_("click",function(){y(e);let i=h(2);return w(i.refresh())}),r(8,"mat-icon"),c(9,"refresh"),l()(),r(10,"button",6)(11,"mat-icon"),c(12,"home"),l()()()()}if(n&2){let e,t=h(2);m(5),X("Error occurred: ",(e=t.error())==null?null:e.message)}}function ane(n,o){if(n&1&&(r(0,"div",0),T(1,ine,2,0,"div",1),T(2,one,13,1,"div",2),l()),n&2){let e=h();m(),E(e.visible()&&!e.error()?1:-1),m(),E(e.error()?2:-1)}}var Um=(()=>{class n{progressService=f(mo);router=f(Ft);visible=z(!1);error=z(null);routerSubscription;ngOnInit(){this.progressService.state.subscribe(e=>{this.visible.set(e.visible),e.error&&!this.error()&&this.error.set(e.error),e.clear&&this.error.set(null)}),this.routerSubscription=this.router.events.subscribe(()=>{this.progressService.clear()})}refresh(){this.router.navigateByUrl(this.router.url)}ngOnDestroy(){this.routerSubscription.unsubscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["app-progress"]],decls:1,vars:1,consts:[[1,"overlay"],[1,"loading-spinner"],[1,"error-state"],["color","primary"],[1,"error-icon"],["mat-button","","matTooltip","Refresh page","matTooltipClass","custom-tooltip",3,"click"],["mat-button","","routerLink","/","matTooltip","Go to home","matTooltipClass","custom-tooltip"]],template:function(t,i){t&1&&T(0,ane,3,2,"div",0),t&2&&E(i.visible()||i.error()?0:-1)},dependencies:[fe,rt,mt,ie,ce,Y,he,st,pt,Co],styles:[".overlay[_ngcontent-%COMP%]{position:fixed;width:100%;height:100%;inset:0;background-color:color-mix(in srgb,var(--mat-sys-shadow) 50%,transparent);z-index:2000}.loading-spinner[_ngcontent-%COMP%], .error-state[_ngcontent-%COMP%]{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.error-state[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{text-align:center}.error-icon[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:64px;width:64px;height:64px}"],changeDetection:0})}return n})();var w1=(()=>{class n{document;router=f(Ft);controllerService=f(_t);progressService=f(mo);constructor(e){this.document=e}ngOnInit(){this.progressService.activate(),setTimeout(()=>{let e;parseInt(this.document.location.port,10)?e=parseInt(this.document.location.port,10):this.document.location.protocol=="https:"?e=443:e=80,this.controllerService.getLocalController(this.document.location.hostname,e).then(t=>{this.router.navigate(["/controller",t.id,"projects"]),this.progressService.deactivate()})},100)}static \u0275fac=function(t){return new(t||n)(Mt(Do))};static \u0275cmp=V({type:n,selectors:[["app-bundled-controller-finder"]],decls:1,vars:0,template:function(t,i){t&1&&L(0,"app-progress")},dependencies:[Um],encapsulation:2,changeDetection:0})}return n})();var rne=[[["caption"]],[["colgroup"],["col"]],"*"],sne=["caption","colgroup, col","*"];function lne(n,o){n&1&&Zt(0,2)}function cne(n,o){n&1&&(r(0,"thead",0),li(1,1),l(),r(2,"tbody",2),li(3,3)(4,4),l(),r(5,"tfoot",0),li(6,5),l())}function dne(n,o){n&1&&li(0,1)(1,3)(2,4)(3,5)}var bn=(()=>{class n extends DT{stickyCssClass="mat-mdc-table-sticky";needsPositionStickyOnElement=!1;static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275cmp=V({type:n,selectors:[["mat-table"],["table","mat-table",""]],hostAttrs:[1,"mat-mdc-table","mdc-data-table__table"],hostVars:2,hostBindings:function(t,i){t&2&&ne("mat-table-fixed-layout",i.fixedLayout)},exportAs:["matTable"],features:[un([{provide:DT,useExisting:n},{provide:sc,useExisting:n},{provide:H0,useValue:null}]),mi],ngContentSelectors:sne,decls:5,vars:2,consts:[["role","rowgroup"],["headerRowOutlet",""],["role","rowgroup",1,"mdc-data-table__content"],["rowOutlet",""],["noDataRowOutlet",""],["footerRowOutlet",""]],template:function(t,i){t&1&&(pi(rne),Zt(0),Zt(1,1),T(2,lne,1,0),T(3,cne,7,0)(4,dne,4,0)),t&2&&(m(2),E(i._isServer?2:-1),m(),E(i._isNativeHtmlTable?3:4))},dependencies:[TT,PT,OT,ET],styles:[`.mat-mdc-table-sticky { + position: sticky !important; +} + +mat-table { + display: block; +} + +mat-header-row { + min-height: var(--mat-table-header-container-height, 56px); +} + +mat-row { + min-height: var(--mat-table-row-item-container-height, 52px); +} + +mat-footer-row { + min-height: var(--mat-table-footer-container-height, 52px); +} + +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)); +} + +.mat-table-fixed-layout { + table-layout: fixed; +} + +.mdc-data-table__cell { + box-sizing: border-box; + overflow: hidden; + text-align: start; + text-overflow: ellipsis; +} + +.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: start; +} +.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 n})(),xn=(()=>{class n extends Yx{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275dir=yt({type:n,selectors:[["","matCellDef",""]],features:[un([{provide:Yx,useExisting:n}]),mi]})}return n})(),yn=(()=>{class n extends Zx{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275dir=yt({type:n,selectors:[["","matHeaderCellDef",""]],features:[un([{provide:Zx,useExisting:n}]),mi]})}return n})();var wn=(()=>{class n extends $m{get name(){return this._name}set name(e){this._setNameInput(e)}_updateColumnCssClassName(){super._updateColumnCssClassName(),this._columnCssClassName.push(`mat-column-${this.cssClassFriendlyName}`)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275dir=yt({type:n,selectors:[["","matColumnDef",""]],inputs:{name:[0,"matColumnDef","name"]},features:[un([{provide:$m,useExisting:n}]),mi]})}return n})(),Mn=(()=>{class n extends E8{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275dir=yt({type:n,selectors:[["mat-header-cell"],["th","mat-header-cell",""]],hostAttrs:["role","columnheader",1,"mat-mdc-header-cell","mdc-data-table__header-cell"],features:[mi]})}return n})();var Sn=(()=>{class n extends O8{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275dir=yt({type:n,selectors:[["mat-cell"],["td","mat-cell",""]],hostAttrs:[1,"mat-mdc-cell","mdc-data-table__cell"],features:[mi]})}return n})();var kn=(()=>{class n extends U0{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275dir=yt({type:n,selectors:[["","matHeaderRowDef",""]],inputs:{columns:[0,"matHeaderRowDef","columns"],sticky:[2,"matHeaderRowDefSticky","sticky",zt]},features:[un([{provide:U0,useExisting:n}]),mi]})}return n})();var Pn=(()=>{class n extends Jx{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275dir=yt({type:n,selectors:[["","matRowDef",""]],inputs:{columns:[0,"matRowDefColumns","columns"],when:[0,"matRowDefWhen","when"]},features:[un([{provide:Jx,useExisting:n}]),mi]})}return n})(),Tn=(()=>{class n extends ST{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275cmp=V({type:n,selectors:[["mat-header-row"],["tr","mat-header-row",""]],hostAttrs:["role","row",1,"mat-mdc-header-row","mdc-data-table__header-row"],exportAs:["matHeaderRow"],features:[un([{provide:ST,useExisting:n}]),mi],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(t,i){t&1&&li(0,0)},dependencies:[bu],encapsulation:2})}return n})();var En=(()=>{class n extends kT{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275cmp=V({type:n,selectors:[["mat-row"],["tr","mat-row",""]],hostAttrs:["role","row",1,"mat-mdc-row","mdc-data-table__row"],exportAs:["matRow"],features:[un([{provide:kT,useExisting:n}]),mi],decls:1,vars:0,consts:[["cdkCellOutlet",""]],template:function(t,i){t&1&&li(0,0)},dependencies:[bu],encapsulation:2})}return n})();var _n=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({imports:[e1,Vi]})}return n})(),mne=9007199254740991,Fr=class extends zp{_data;_renderData=new cn([]);_filter=new cn("");_internalPageChanges=new Ye;_renderChangesSubscription=null;filteredData;get data(){return this._data.value}set data(o){o=Array.isArray(o)?o:[],this._data.next(o),this._renderChangesSubscription||this._filterData(o)}get filter(){return this._filter.value}set filter(o){this._filter.next(o),this._renderChangesSubscription||this._filterData(this.data)}get sort(){return this._sort}set sort(o){this._sort=o,this._updateChangeSubscription()}_sort;get paginator(){return this._paginator}set paginator(o){this._paginator=o,this._updateChangeSubscription()}_paginator;sortingDataAccessor=(o,e)=>{let t=o[e];if(DA(t)){let i=Number(t);return i{let t=e.active,i=e.direction;return!t||i==""?o:o.sort((a,s)=>{let d=this.sortingDataAccessor(a,t),p=this.sortingDataAccessor(s,t),u=typeof d,g=typeof p;u!==g&&(u==="number"&&(d+=""),g==="number"&&(p+=""));let C=0;return d!=null&&p!=null?d>p?C=1:d{let t=e.trim().toLowerCase();return Object.values(o).some(i=>`${i}`.toLowerCase().includes(t))};constructor(o=[]){super(),this._data=new cn(o),this._updateChangeSubscription()}_updateChangeSubscription(){let o=this._sort?ro(this._sort.sortChange,this._sort.initialized):Vt(null),e=this._paginator?ro(this._paginator.page,this._internalPageChanges,this._paginator.initialized):Vt(null),t=this._data,i=mr([t,this._filter]).pipe(Pt(([d])=>this._filterData(d))),a=mr([i,o]).pipe(Pt(([d])=>this._orderData(d))),s=mr([a,e]).pipe(Pt(([d])=>this._pageData(d)));this._renderChangesSubscription?.unsubscribe(),this._renderChangesSubscription=s.subscribe(d=>this._renderData.next(d))}_filterData(o){return this.filteredData=this.filter==null||this.filter===""?o:o.filter(e=>this.filterPredicate(e,this.filter)),this.paginator&&this._updatePaginator(this.filteredData.length),this.filteredData}_orderData(o){return this.sort?this.sortData(o.slice(),this.sort):o}_pageData(o){if(!this.paginator)return o;let e=this.paginator.pageIndex*this.paginator.pageSize;return o.slice(e,e+this.paginator.pageSize)}_updatePaginator(o){Promise.resolve().then(()=>{let e=this.paginator;if(e&&(e.length=o,e.pageIndex>0)){let t=Math.ceil(e.length/e.pageSize)-1||0,i=Math.min(e.pageIndex,t);i!==e.pageIndex&&(e.pageIndex=i,this._internalPageChanges.next())}})}connect(){return this._renderChangesSubscription||this._updateChangeSubscription(),this._renderData}disconnect(){this._renderChangesSubscription?.unsubscribe(),this._renderChangesSubscription=null}};var RR=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["ng-component"]],hostAttrs:["cdk-text-field-style-loader",""],decls:0,vars:0,template:function(t,i){},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 n})(),pne={passive:!0},zR=(()=>{class n{_platform=f(ja);_ngZone=f(Gi);_renderer=f(Fp).createRenderer(null,null);_styleLoader=f(Ta);_monitoredElements=new Map;constructor(){}monitor(e){if(!this._platform.isBrowser)return eg;this._styleLoader.load(RR);let t=cl(e),i=this._monitoredElements.get(t);if(i)return i.subject;let a=new Ye,s="cdk-text-field-autofilled",d=u=>{u.animationName==="cdk-text-field-autofill-start"&&!t.classList.contains(s)?(t.classList.add(s),this._ngZone.run(()=>a.next({target:u.target,isAutofilled:!0}))):u.animationName==="cdk-text-field-autofill-end"&&t.classList.contains(s)&&(t.classList.remove(s),this._ngZone.run(()=>a.next({target:u.target,isAutofilled:!1})))},p=this._ngZone.runOutsideAngular(()=>(t.classList.add("cdk-text-field-autofill-monitored"),this._renderer.listen(t,"animationstart",d,pne)));return this._monitoredElements.set(t,{subject:a,unlisten:p}),a}stopMonitoring(e){let t=cl(e),i=this._monitoredElements.get(t);i&&(i.unlisten(),i.subject.complete(),t.classList.remove("cdk-text-field-autofill-monitored"),t.classList.remove("cdk-text-field-autofilled"),this._monitoredElements.delete(t))}ngOnDestroy(){this._monitoredElements.forEach((e,t)=>this.stopMonitoring(t))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=J({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Xc=(()=>{class n{_elementRef=f(Kt);_platform=f(ja);_ngZone=f(Gi);_renderer=f(qi);_resizeEvents=new Ye;_previousValue;_initialHeight;_destroyed=new Ye;_listenerCleanups;_minRows;_maxRows;_enabled=!0;_previousMinRows=-1;_textareaElement;get minRows(){return this._minRows}set minRows(e){this._minRows=mm(e),this._setMinHeight()}get maxRows(){return this._maxRows}set maxRows(e){this._maxRows=mm(e),this._setMaxHeight()}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&((this._enabled=e)?this.resizeToFitContent(!0):this.reset())}get placeholder(){return this._textareaElement.placeholder}set placeholder(e){this._cachedPlaceholderHeight=void 0,e?this._textareaElement.setAttribute("placeholder",e):this._textareaElement.removeAttribute("placeholder"),this._cacheTextareaPlaceholderHeight()}_cachedLineHeight;_cachedPlaceholderHeight;_document=f(Do);_hasFocus=!1;_isViewInited=!1;constructor(){f(Ta).load(RR),this._textareaElement=this._elementRef.nativeElement}_setMinHeight(){let e=this.minRows&&this._cachedLineHeight?`${this.minRows*this._cachedLineHeight}px`:null;e&&(this._textareaElement.style.minHeight=e)}_setMaxHeight(){let e=this.maxRows&&this._cachedLineHeight?`${this.maxRows*this._cachedLineHeight}px`:null;e&&(this._textareaElement.style.maxHeight=e)}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(sl(16)).subscribe(()=>{this._cachedLineHeight=this._cachedPlaceholderHeight=void 0,this.resizeToFitContent(!0)})}),this._isViewInited=!0,this.resizeToFitContent(!0))}ngOnDestroy(){this._listenerCleanups?.forEach(e=>e()),this._resizeEvents.complete(),this._destroyed.next(),this._destroyed.complete()}_cacheTextareaLineHeight(){if(this._cachedLineHeight)return;let e=this._textareaElement.cloneNode(!1),t=e.style;e.rows=1,t.position="absolute",t.visibility="hidden",t.border="none",t.padding="0",t.height="",t.minHeight="",t.maxHeight="",t.top=t.bottom=t.left=t.right="auto",t.overflow="hidden",this._textareaElement.parentNode.appendChild(e),this._cachedLineHeight=e.clientHeight,e.remove(),this._setMinHeight(),this._setMaxHeight()}_measureScrollHeight(){let e=this._textareaElement,t=e.style.marginBottom||"",i=this._platform.FIREFOX,a=this._hasFocus,s=i?"cdk-textarea-autosize-measuring-firefox":"cdk-textarea-autosize-measuring";a&&(e.style.marginBottom=`${e.clientHeight}px`),e.classList.add(s);let d=e.scrollHeight-4;return e.classList.remove(s),a&&(e.style.marginBottom=t),d}_cacheTextareaPlaceholderHeight(){if(!this._isViewInited||this._cachedPlaceholderHeight!=null)return;if(!this.placeholder){this._cachedPlaceholderHeight=0;return}let e=this._textareaElement.value;this._textareaElement.value=this._textareaElement.placeholder,this._cachedPlaceholderHeight=this._measureScrollHeight(),this._textareaElement.value=e}_handleFocusEvent=e=>{this._hasFocus=e.type==="focus"};ngDoCheck(){this._platform.isBrowser&&this.resizeToFitContent()}resizeToFitContent(e=!1){if(!this._enabled||(this._cacheTextareaLineHeight(),this._cacheTextareaPlaceholderHeight(),!this._cachedLineHeight))return;let t=this._elementRef.nativeElement,i=t.value;if(!e&&this._minRows===this._previousMinRows&&i===this._previousValue)return;let a=this._measureScrollHeight(),s=Math.max(a,this._cachedPlaceholderHeight||0);t.style.height=`${s}px`,this._ngZone.runOutsideAngular(()=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(()=>this._scrollToCaretPosition(t)):setTimeout(()=>this._scrollToCaretPosition(t))}),this._previousValue=i,this._previousMinRows=this._minRows}reset(){this._initialHeight!==void 0&&(this._textareaElement.style.height=this._initialHeight)}_noopInputHandler(){}_scrollToCaretPosition(e){let{selectionStart:t,selectionEnd:i}=e;!this._destroyed.isStopped&&this._hasFocus&&e.setSelectionRange(t,i)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["textarea","cdkTextareaAutosize",""]],hostAttrs:["rows","1",1,"cdk-textarea-autosize"],hostBindings:function(t,i){t&1&&_("input",function(){return i._noopInputHandler()})},inputs:{minRows:[0,"cdkAutosizeMinRows","minRows"],maxRows:[0,"cdkAutosizeMaxRows","maxRows"],enabled:[2,"cdkTextareaAutosize","enabled",zt],placeholder:"placeholder"},exportAs:["cdkTextareaAutosize"]})}return n})(),LR=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({})}return n})();var VR=new mn("MAT_INPUT_VALUE_ACCESSOR");var une=["button","checkbox","file","hidden","image","radio","range","reset","submit"],gne=new mn("MAT_INPUT_CONFIG"),Ee=(()=>{class n{_elementRef=f(Kt);_platform=f(ja);ngControl=f(qC,{optional:!0,self:!0});_autofillMonitor=f(zR);_ngZone=f(Gi);_formField=f(ug,{optional:!0});_renderer=f(qi);_uid=f(ua).getId("mat-input-");_previousNativeValue;_inputValueAccessor;_signalBasedValueAccessor;_previousPlaceholder=null;_errorStateTracker;_config=f(gne,{optional:!0});_cleanupIosKeyup;_cleanupWebkitWheel;_isServer=!1;_isNativeSelect=!1;_isTextarea=!1;_isInFormField=!1;focused=!1;stateChanges=new Ye;controlType="mat-input";autofilled=!1;get disabled(){return this._disabled}set disabled(e){this._disabled=Or(e),this.focused&&(this.focused=!1,this.stateChanges.next())}_disabled=!1;get id(){return this._id}set id(e){this._id=e||this._uid}_id;placeholder;name;get required(){return this._required??this.ngControl?.control?.hasValidator(Ue.required)??!1}set required(e){this._required=Or(e)}_required;get type(){return this._type}set type(e){this._type=e||"text",this._validateType(),!this._isTextarea&&Hk().has(this._type)&&(this._elementRef.nativeElement.type=this._type)}_type="text";get errorStateMatcher(){return this._errorStateTracker.matcher}set errorStateMatcher(e){this._errorStateTracker.matcher=e}userAriaDescribedBy;get value(){return this._signalBasedValueAccessor?this._signalBasedValueAccessor.value():this._inputValueAccessor.value}set value(e){e!==this.value&&(this._signalBasedValueAccessor?this._signalBasedValueAccessor.value.set(e):this._inputValueAccessor.value=e,this.stateChanges.next())}get readonly(){return this._readonly}set readonly(e){this._readonly=Or(e)}_readonly=!1;disabledInteractive;get errorState(){return this._errorStateTracker.errorState}set errorState(e){this._errorStateTracker.errorState=e}_neverEmptyInputTypes=["date","datetime","datetime-local","month","time","week"].filter(e=>Hk().has(e));constructor(){let e=f(Ji,{optional:!0}),t=f(Ut,{optional:!0}),i=f(Td),a=f(VR,{optional:!0,self:!0}),s=this._elementRef.nativeElement,d=s.nodeName.toLowerCase();a?dA(a.value)?this._signalBasedValueAccessor=a:this._inputValueAccessor=a:this._inputValueAccessor=s,this._previousNativeValue=this.value,this.id=this.id,this._platform.IOS&&this._ngZone.runOutsideAngular(()=>{this._cleanupIosKeyup=this._renderer.listen(s,"keyup",this._iOSKeyupListener)}),this._errorStateTracker=new ib(i,this.ngControl,t,e,this.stateChanges),this._isServer=!this._platform.isBrowser,this._isNativeSelect=d==="select",this._isTextarea=d==="textarea",this._isInFormField=!!this._formField,this.disabledInteractive=this._config?.disabledInteractive||!1,this._isNativeSelect&&(this.controlType=s.multiple?"mat-native-select-multiple":"mat-native-select"),this._signalBasedValueAccessor&&Vn(()=>{this._signalBasedValueAccessor.value(),this.stateChanges.next()})}ngAfterViewInit(){this._platform.isBrowser&&this._autofillMonitor.monitor(this._elementRef.nativeElement).subscribe(e=>{this.autofilled=e.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(e){this._elementRef.nativeElement.focus(e)}updateErrorState(){this._errorStateTracker.updateErrorState()}_focusChanged(e){if(e!==this.focused){if(!this._isNativeSelect&&e&&this.disabled&&this.disabledInteractive){let t=this._elementRef.nativeElement;t.type==="number"?(t.type="text",t.setSelectionRange(0,0),t.type="number"):t.setSelectionRange(0,0)}this.focused=e,this.stateChanges.next()}}_onInput(){}_dirtyCheckNativeValue(){let e=this._elementRef.nativeElement.value;this._previousNativeValue!==e&&(this._previousNativeValue=e,this.stateChanges.next())}_dirtyCheckPlaceholder(){let e=this._getPlaceholder();if(e!==this._previousPlaceholder){let t=this._elementRef.nativeElement;this._previousPlaceholder=e,e?t.setAttribute("placeholder",e):t.removeAttribute("placeholder")}}_getPlaceholder(){return this.placeholder||null}_validateType(){une.indexOf(this._type)>-1}_isNeverEmpty(){return this._neverEmptyInputTypes.indexOf(this._type)>-1}_isBadInput(){let e=this._elementRef.nativeElement.validity;return e&&e.badInput}get empty(){return!this._isNeverEmpty()&&!this._elementRef.nativeElement.value&&!this._isBadInput()&&!this.autofilled}get shouldLabelFloat(){if(this._isNativeSelect){let e=this._elementRef.nativeElement,t=e.options[0];return this.focused||e.multiple||!this.empty||!!(e.selectedIndex>-1&&t&&t.label)}else return this.focused&&!this.disabled||!this.empty}get describedByIds(){return this._elementRef.nativeElement.getAttribute("aria-describedby")?.split(" ")||[]}setDescribedByIds(e){let t=this._elementRef.nativeElement;e.length?t.setAttribute("aria-describedby",e.join(" ")):t.removeAttribute("aria-describedby")}onContainerClick(){this.focused||this.focus()}_isInlineSelect(){let e=this._elementRef.nativeElement;return this._isNativeSelect&&(e.multiple||e.size>1)}_iOSKeyupListener=e=>{let t=e.target;!t.value&&t.selectionStart===0&&t.selectionEnd===0&&(t.setSelectionRange(1,1),t.setSelectionRange(0,0))};_getReadonlyAttribute(){return this._isNativeSelect?null:this.readonly||this.disabled&&this.disabledInteractive?"true":null}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["input","matInput",""],["textarea","matInput",""],["select","matNativeControl",""],["input","matNativeControl",""],["textarea","matNativeControl",""]],hostAttrs:[1,"mat-mdc-input-element"],hostVars:21,hostBindings:function(t,i){t&1&&_("focus",function(){return i._focusChanged(!0)})("blur",function(){return i._focusChanged(!1)})("input",function(){return i._onInput()}),t&2&&(pr("id",i.id)("disabled",i.disabled&&!i.disabledInteractive)("required",i.required),Ce("name",i.name||null)("readonly",i._getReadonlyAttribute())("aria-disabled",i.disabled&&i.disabledInteractive?"true":null)("aria-invalid",i.empty&&i.required?null:i.errorState)("aria-required",i.required)("id",i.id),ne("mat-input-server",i._isServer)("mat-mdc-form-field-textarea-control",i._isInFormField&&i._isTextarea)("mat-mdc-form-field-input-control",i._isInFormField)("mat-mdc-input-disabled-interactive",i.disabledInteractive)("mdc-text-field__input",i._isInFormField)("mat-mdc-native-select-inline",i._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",zt]},exportAs:["matInput"],features:[un([{provide:nb,useExisting:n}]),Nn]})}return n})(),ye=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({imports:[we,we,LR,Vi]})}return n})();var hne=["switch"],_ne=["*"];function fne(n,o){n&1&&(r(0,"span",11),Mi(),r(1,"svg",13),L(2,"path",14),l(),r(3,"svg",15),L(4,"path",16),l()())}var vne=new mn("mat-slide-toggle-default-options",{providedIn:"root",factory:()=>({disableToggleValue:!1,hideIcon:!1,disabledInteractive:!1})}),M1=class{source;checked;constructor(o,e){this.source=o,this.checked=e}},Yc=(()=>{class n{_elementRef=f(Kt);_focusMonitor=f(hs);_changeDetectorRef=f(oe);defaults=f(vne);_onChange=e=>{};_onTouched=()=>{};_validatorOnChange=()=>{};_uniqueId;_checked=!1;_createChangeEvent(e){return new M1(this,e)}_labelId;get buttonId(){return`${this.id||this._uniqueId}-button`}_switchElement;focus(){this._switchElement.nativeElement.focus()}_noopAnimations=$a();_focused=!1;name=null;id;labelPosition="after";ariaLabel=null;ariaLabelledby=null;ariaDescribedby;required=!1;color;disabled=!1;disableRipple=!1;tabIndex=0;get checked(){return this._checked}set checked(e){this._checked=e,this._changeDetectorRef.markForCheck()}hideIcon;disabledInteractive;change=new be;toggleChange=new be;get inputId(){return`${this.id||this._uniqueId}-input`}constructor(){f(Ta).load(Xr);let e=f(new cm("tabindex"),{optional:!0}),t=this.defaults;this.tabIndex=e==null?0:parseInt(e)||0,this.color=t.color||"accent",this.id=this._uniqueId=f(ua).getId("mat-mdc-slide-toggle-"),this.hideIcon=t.hideIcon??!1,this.disabledInteractive=t.disabledInteractive??!1,this._labelId=this._uniqueId+"-label"}ngAfterContentInit(){this._focusMonitor.monitor(this._elementRef,!0).subscribe(e=>{e==="keyboard"||e==="program"?(this._focused=!0,this._changeDetectorRef.markForCheck()):e||Promise.resolve().then(()=>{this._focused=!1,this._onTouched(),this._changeDetectorRef.markForCheck()})})}ngOnChanges(e){e.required&&this._validatorOnChange()}ngOnDestroy(){this._focusMonitor.stopMonitoring(this._elementRef)}writeValue(e){this.checked=!!e}registerOnChange(e){this._onChange=e}registerOnTouched(e){this._onTouched=e}validate(e){return this.required&&e.value!==!0?{required:!0}:null}registerOnValidatorChange(e){this._validatorOnChange=e}setDisabledState(e){this.disabled=e,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 M1(this,this.checked))))}_getAriaLabelledBy(){return this.ariaLabelledby?this.ariaLabelledby:this.ariaLabel?null:this._labelId}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["mat-slide-toggle"]],viewQuery:function(t,i){if(t&1&&Kn(hne,5),t&2){let a;gt(a=ht())&&(i._switchElement=a.first)}},hostAttrs:[1,"mat-mdc-slide-toggle"],hostVars:13,hostBindings:function(t,i){t&2&&(pr("id",i.id),Ce("tabindex",null)("aria-label",null)("name",null)("aria-labelledby",null),Za(i.color?"mat-"+i.color:""),ne("mat-mdc-slide-toggle-focused",i._focused)("mat-mdc-slide-toggle-checked",i.checked)("_mat-animation-noopable",i._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",zt],color:"color",disabled:[2,"disabled","disabled",zt],disableRipple:[2,"disableRipple","disableRipple",zt],tabIndex:[2,"tabIndex","tabIndex",e=>e==null?0:qo(e)],checked:[2,"checked","checked",zt],hideIcon:[2,"hideIcon","hideIcon",zt],disabledInteractive:[2,"disabledInteractive","disabledInteractive",zt]},outputs:{change:"change",toggleChange:"toggleChange"},exportAs:["matSlideToggle"],features:[un([{provide:Pd,useExisting:Pc(()=>n),multi:!0},{provide:HA,useExisting:n,multi:!0}]),Nn],ngContentSelectors:_ne,decls:14,vars:27,consts:[["switch",""],["mat-internal-form-field","",3,"labelPosition"],["role","switch","type","button",1,"mdc-switch",3,"click","tabIndex","disabled"],[1,"mat-mdc-slide-toggle-touch-target"],[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(t,i){if(t&1&&(pi(),r(0,"div",1)(1,"button",2,0),_("click",function(){return i._handleClick()}),L(3,"div",3)(4,"span",4),r(5,"span",5)(6,"span",6)(7,"span",7),L(8,"span",8),l(),r(9,"span",9),L(10,"span",10),l(),T(11,fne,5,0,"span",11),l()()(),r(12,"label",12),_("click",function(s){return s.stopPropagation()}),Zt(13),l()()),t&2){let a=Te(2);v("labelPosition",i.labelPosition),m(),ne("mdc-switch--selected",i.checked)("mdc-switch--unselected",!i.checked)("mdc-switch--checked",i.checked)("mdc-switch--disabled",i.disabled)("mat-mdc-slide-toggle-disabled-interactive",i.disabledInteractive),v("tabIndex",i.disabled&&!i.disabledInteractive?-1:i.tabIndex)("disabled",i.disabled&&!i.disabledInteractive),Ce("id",i.buttonId)("name",i.name)("aria-label",i.ariaLabel)("aria-labelledby",i._getAriaLabelledBy())("aria-describedby",i.ariaDescribedby)("aria-required",i.required||null)("aria-checked",i.checked)("aria-disabled",i.disabled&&i.disabledInteractive?"true":null),m(9),v("matRippleTrigger",a)("matRippleDisabled",i.disableRipple||i.disabled)("matRippleCentered",!0),m(),E(i.hideIcon?-1:11),m(),v("for",i.buttonId),Ce("id",i._labelId)}},dependencies:[um,ob],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(--mat-slide-toggle-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(--mat-slide-toggle-track-height, 32px); + border-radius: var(--mat-slide-toggle-track-shape, var(--mat-sys-corner-full)); +} +.mdc-switch--disabled.mdc-switch .mdc-switch__track { + opacity: var(--mat-slide-toggle-disabled-track-opacity, 0.12); +} +.mdc-switch__track::before, .mdc-switch__track::after { + border: 1px solid transparent; + border-radius: inherit; + box-sizing: border-box; + content: ""; + height: 100%; + left: 0; + position: absolute; + width: 100%; + border-width: var(--mat-slide-toggle-track-outline-width, 2px); + border-color: var(--mat-slide-toggle-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-slide-toggle-selected-track-outline-width, 2px); + border-color: var(--mat-slide-toggle-selected-track-outline-color, transparent); +} +.mdc-switch--disabled .mdc-switch__track::before, .mdc-switch--disabled .mdc-switch__track::after { + border-width: var(--mat-slide-toggle-disabled-unselected-track-outline-width, 2px); + border-color: var(--mat-slide-toggle-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(--mat-slide-toggle-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-slide-toggle-hidden-track-opacity, 0); + transition: var(--mat-slide-toggle-hidden-track-transition, opacity 75ms); +} +.mdc-switch--unselected .mdc-switch__track::before { + opacity: var(--mat-slide-toggle-visible-track-opacity, 1); + transition: var(--mat-slide-toggle-visible-track-transition, opacity 75ms); +} +.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::before { + background: var(--mat-slide-toggle-unselected-hover-track-color, var(--mat-sys-surface-variant)); +} +.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::before { + background: var(--mat-slide-toggle-unselected-focus-track-color, var(--mat-sys-surface-variant)); +} +.mdc-switch:enabled:active .mdc-switch__track::before { + background: var(--mat-slide-toggle-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(--mat-slide-toggle-disabled-unselected-track-color, var(--mat-sys-surface-variant)); +} +.mdc-switch__track::after { + transform: translateX(-100%); + background: var(--mat-slide-toggle-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-slide-toggle-visible-track-opacity, 1); + transition: var(--mat-slide-toggle-visible-track-transition, opacity 75ms); +} +.mdc-switch--unselected .mdc-switch__track::after { + opacity: var(--mat-slide-toggle-hidden-track-opacity, 0); + transition: var(--mat-slide-toggle-hidden-track-transition, opacity 75ms); +} +.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::after { + background: var(--mat-slide-toggle-selected-hover-track-color, var(--mat-sys-primary)); +} +.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::after { + background: var(--mat-slide-toggle-selected-focus-track-color, var(--mat-sys-primary)); +} +.mdc-switch:enabled:active .mdc-switch__track::after { + background: var(--mat-slide-toggle-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(--mat-slide-toggle-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(--mat-slide-toggle-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(--mat-slide-toggle-handle-width); + height: var(--mat-slide-toggle-handle-height); + border-radius: var(--mat-slide-toggle-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-slide-toggle-unselected-handle-size, 16px); + height: var(--mat-slide-toggle-unselected-handle-size, 16px); + margin: var(--mat-slide-toggle-unselected-handle-horizontal-margin, 0 8px); +} +.mat-mdc-slide-toggle .mdc-switch--unselected .mdc-switch__handle:has(.mdc-switch__icons) { + margin: var(--mat-slide-toggle-unselected-with-icon-handle-horizontal-margin, 0 4px); +} +.mat-mdc-slide-toggle .mdc-switch--selected .mdc-switch__handle { + width: var(--mat-slide-toggle-selected-handle-size, 24px); + height: var(--mat-slide-toggle-selected-handle-size, 24px); + margin: var(--mat-slide-toggle-selected-handle-horizontal-margin, 0 24px); +} +.mat-mdc-slide-toggle .mdc-switch--selected .mdc-switch__handle:has(.mdc-switch__icons) { + margin: var(--mat-slide-toggle-selected-with-icon-handle-horizontal-margin, 0 24px); +} +.mat-mdc-slide-toggle .mdc-switch__handle:has(.mdc-switch__icons) { + width: var(--mat-slide-toggle-with-icon-handle-size, 24px); + height: var(--mat-slide-toggle-with-icon-handle-size, 24px); +} +.mat-mdc-slide-toggle .mdc-switch:active:not(.mdc-switch--disabled) .mdc-switch__handle { + width: var(--mat-slide-toggle-pressed-handle-size, 28px); + height: var(--mat-slide-toggle-pressed-handle-size, 28px); +} +.mat-mdc-slide-toggle .mdc-switch--selected:active:not(.mdc-switch--disabled) .mdc-switch__handle { + margin: var(--mat-slide-toggle-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-slide-toggle-unselected-pressed-handle-horizontal-margin, 0 2px); +} +.mdc-switch--disabled.mdc-switch--selected .mdc-switch__handle::after { + opacity: var(--mat-slide-toggle-disabled-selected-handle-opacity, 1); +} +.mdc-switch--disabled.mdc-switch--unselected .mdc-switch__handle::after { + opacity: var(--mat-slide-toggle-disabled-unselected-handle-opacity, 0.38); +} +.mdc-switch__handle::before, .mdc-switch__handle::after { + border: 1px solid transparent; + 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(--mat-slide-toggle-selected-handle-color, var(--mat-sys-on-primary)); +} +.mdc-switch--selected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after { + background: var(--mat-slide-toggle-selected-hover-handle-color, var(--mat-sys-primary-container)); +} +.mdc-switch--selected:enabled:focus:not(:active) .mdc-switch__handle::after { + background: var(--mat-slide-toggle-selected-focus-handle-color, var(--mat-sys-primary-container)); +} +.mdc-switch--selected:enabled:active .mdc-switch__handle::after { + background: var(--mat-slide-toggle-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(--mat-slide-toggle-disabled-selected-handle-color, var(--mat-sys-surface)); +} +.mdc-switch--unselected:enabled .mdc-switch__handle::after { + background: var(--mat-slide-toggle-unselected-handle-color, var(--mat-sys-outline)); +} +.mdc-switch--unselected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after { + background: var(--mat-slide-toggle-unselected-hover-handle-color, var(--mat-sys-on-surface-variant)); +} +.mdc-switch--unselected:enabled:focus:not(:active) .mdc-switch__handle::after { + background: var(--mat-slide-toggle-unselected-focus-handle-color, var(--mat-sys-on-surface-variant)); +} +.mdc-switch--unselected:enabled:active .mdc-switch__handle::after { + background: var(--mat-slide-toggle-unselected-pressed-handle-color, var(--mat-sys-on-surface-variant)); +} +.mdc-switch--unselected.mdc-switch--disabled .mdc-switch__handle::after { + background: var(--mat-slide-toggle-disabled-unselected-handle-color, var(--mat-sys-on-surface)); +} +.mdc-switch__handle::before { + background: var(--mat-slide-toggle-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(--mat-slide-toggle-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(--mat-slide-toggle-disabled-handle-elevation-shadow); +} + +.mdc-switch__ripple { + left: 50%; + position: absolute; + top: 50%; + transform: translate(-50%, -50%); + z-index: -1; + width: var(--mat-slide-toggle-state-layer-size, 40px); + height: var(--mat-slide-toggle-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 { + transition: 75ms opacity cubic-bezier(0, 0, 0.2, 1); +} +.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(--mat-slide-toggle-unselected-hover-state-layer-color, var(--mat-sys-on-surface)); + opacity: var(--mat-slide-toggle-unselected-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity)); +} +.mdc-switch--unselected:enabled:focus .mdc-switch__ripple::after { + background: var(--mat-slide-toggle-unselected-focus-state-layer-color, var(--mat-sys-on-surface)); + opacity: var(--mat-slide-toggle-unselected-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity)); +} +.mdc-switch--unselected:enabled:active .mdc-switch__ripple::after { + background: var(--mat-slide-toggle-unselected-pressed-state-layer-color, var(--mat-sys-on-surface)); + opacity: var(--mat-slide-toggle-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(--mat-slide-toggle-selected-hover-state-layer-color, var(--mat-sys-primary)); + opacity: var(--mat-slide-toggle-selected-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity)); +} +.mdc-switch--selected:enabled:focus .mdc-switch__ripple::after { + background: var(--mat-slide-toggle-selected-focus-state-layer-color, var(--mat-sys-primary)); + opacity: var(--mat-slide-toggle-selected-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity)); +} +.mdc-switch--selected:enabled:active .mdc-switch__ripple::after { + background: var(--mat-slide-toggle-selected-pressed-state-layer-color, var(--mat-sys-primary)); + opacity: var(--mat-slide-toggle-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; + transform: translateZ(0); +} +.mdc-switch--disabled.mdc-switch--unselected .mdc-switch__icons { + opacity: var(--mat-slide-toggle-disabled-unselected-icon-opacity, 0.38); +} +.mdc-switch--disabled.mdc-switch--selected .mdc-switch__icons { + opacity: var(--mat-slide-toggle-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(--mat-slide-toggle-unselected-icon-size, 16px); + height: var(--mat-slide-toggle-unselected-icon-size, 16px); + fill: var(--mat-slide-toggle-unselected-icon-color, var(--mat-sys-surface-variant)); +} +.mdc-switch--unselected.mdc-switch--disabled .mdc-switch__icon { + fill: var(--mat-slide-toggle-disabled-unselected-icon-color, var(--mat-sys-surface-variant)); +} +.mdc-switch--selected .mdc-switch__icon { + width: var(--mat-slide-toggle-selected-icon-size, 16px); + height: var(--mat-slide-toggle-selected-icon-size, 16px); + fill: var(--mat-slide-toggle-selected-icon-color, var(--mat-sys-on-primary-container)); +} +.mdc-switch--selected.mdc-switch--disabled .mdc-switch__icon { + fill: var(--mat-slide-toggle-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: transparent; + 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-slide-toggle-label-text-color, var(--mat-sys-on-surface)); + font-family: var(--mat-slide-toggle-label-text-font, var(--mat-sys-body-medium-font)); + line-height: var(--mat-slide-toggle-label-text-line-height, var(--mat-sys-body-medium-line-height)); + font-size: var(--mat-slide-toggle-label-text-size, var(--mat-sys-body-medium-size)); + letter-spacing: var(--mat-slide-toggle-label-text-tracking, var(--mat-sys-body-medium-tracking)); + font-weight: var(--mat-slide-toggle-label-text-weight, var(--mat-sys-body-medium-weight)); +} +.mat-mdc-slide-toggle .mat-ripple-element { + opacity: 0.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(--mat-slide-toggle-disabled-label-text-color, var(--mat-sys-on-surface)); +} +.mat-mdc-slide-toggle label:empty { + display: none; +} + +.mat-mdc-slide-toggle-touch-target { + position: absolute; + top: 50%; + left: 50%; + height: var(--mat-slide-toggle-touch-target-size, 48px); + width: 100%; + transform: translate(-50%, -50%); + display: var(--mat-slide-toggle-touch-target-display, block); +} +[dir=rtl] .mat-mdc-slide-toggle-touch-target { + left: auto; + right: 50%; + transform: translate(50%, -50%); +} +`],encapsulation:2,changeDetection:0})}return n})(),mc=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({imports:[Yc,Vi]})}return n})();function Cne(n,o){if(n&1&&(r(0,"li"),c(1),l()),n&2){let e=o.$implicit;m(),N(e)}}function bne(n,o){if(n&1&&(r(0,"ul",4),Q(1,Cne,2,1,"li",null,Oe),l()),n&2){let e=h();m(),K(e.data.details)}}function xne(n,o){if(n&1){let e=R();r(0,"mat-checkbox",9),_("change",function(i){let a=y(e);return w(a.checked=i.checked)}),c(1),l()}if(n&2){let e=o;v("checked",e.checked),m(),X(" ",e.label," ")}}function yne(n,o){if(n&1&&(r(0,"p",6),c(1),l()),n&2){let e=h();m(),N(e.data.note)}}function wne(n,o){if(n&1){let e=R();r(0,"button",12),_("click",function(){y(e);let i=h(2);return w(i.onYesClick())}),c(1),l()}if(n&2){let e=h(2);m(),X(" ",e.confirmButtonText," ")}}function Mne(n,o){if(n&1){let e=R();r(0,"button",13),_("click",function(){y(e);let i=h(2);return w(i.onYesClick())}),c(1),l()}if(n&2){let e=h(2);m(),X(" ",e.confirmButtonText," ")}}function Sne(n,o){if(n&1&&T(0,wne,2,1,"button",10)(1,Mne,2,1,"button",11),n&2){let e=h();E(e.tone==="danger"?0:1)}}var jt=(()=>{class n{dialogRef;data;constructor(e,t){this.dialogRef=e,this.data=t}get title(){return this.data.title||"Confirm action"}get confirmButtonText(){return this.data.confirmButtonText||"Confirm"}get cancelButtonText(){return this.data.cancelButtonText||"Cancel"}get tone(){return this.data.tone||"danger"}get icon(){return this.data.icon?this.data.icon:this.tone==="danger"?"delete_forever":this.tone==="warning"?"warning":"help"}onNoClick(){this.dialogRef.close(!1)}onYesClick(){this.dialogRef.close(!0)}static \u0275fac=function(t){return new(t||n)(Mt(We),Mt(Wt))};static \u0275cmp=V({type:n,selectors:[["app-confirmation-dialog"]],decls:17,vars:12,consts:[[1,"confirmation-dialog"],["mat-dialog-title","",1,"confirmation-dialog__header"],["aria-hidden","true",1,"confirmation-dialog__icon"],[1,"confirmation-dialog__content"],[1,"confirmation-dialog__details"],[1,"confirmation-dialog__checkbox",3,"checked"],[1,"confirmation-dialog__note"],["align","end",1,"confirmation-dialog__actions"],["mat-stroked-button","","type","button","cdkFocusInitial","",1,"cancel-button",3,"click"],[1,"confirmation-dialog__checkbox",3,"change","checked"],["mat-flat-button","","type","button",1,"confirm-button","destructive-button"],["mat-flat-button","","type","button",1,"confirm-button"],["mat-flat-button","","type","button",1,"confirm-button","destructive-button",3,"click"],["mat-flat-button","","type","button",1,"confirm-button",3,"click"]],template:function(t,i){if(t&1&&(r(0,"div",0)(1,"div",1)(2,"span",2)(3,"mat-icon"),c(4),l()(),r(5,"h2"),c(6),l()(),r(7,"mat-dialog-content",3)(8,"p"),c(9),l(),T(10,bne,3,0,"ul",4),T(11,xne,2,2,"mat-checkbox",5),T(12,yne,2,1,"p",6),l(),r(13,"mat-dialog-actions",7)(14,"button",8),_("click",function(){return i.onNoClick()}),c(15),l(),T(16,Sne,2,1),l()()),t&2){let a;ne("confirmation-dialog--danger",i.tone==="danger")("confirmation-dialog--warning",i.tone==="warning"),m(4),N(i.icon),m(2),N(i.title),m(3),N(i.data.message),m(),E(i.data.details!=null&&i.data.details.length?10:-1),m(),E((a=i.data.checkbox)?11:-1,a),m(),E(i.data.note?12:-1),m(3),X(" ",i.cancelButtonText," "),m(),E(i.data.hideConfirm?-1:16)}},dependencies:[fe,ke,qe,Qe,bt,ie,ce,Y,he,Rt,Gt],styles:[".confirmation-dialog[_ngcontent-%COMP%]{--confirmation-accent: var(--mat-sys-primary);color:var(--mat-sys-on-surface)}.confirmation-dialog--danger[_ngcontent-%COMP%]{--confirmation-accent: var(--mat-sys-error)}.confirmation-dialog--warning[_ngcontent-%COMP%]{--confirmation-accent: var(--mat-sys-tertiary)}.confirmation-dialog__header[_ngcontent-%COMP%]{min-height:var(--gns3-density-section-header-height);margin:0;padding:var(--gns3-density-section-header-padding);display:flex;align-items:center;gap:var(--gns3-density-space-3);box-sizing:border-box;color:var(--mat-sys-on-primary-container);background:var(--mat-sys-primary-container);border-bottom:1px solid var(--mat-sys-outline-variant)}.confirmation-dialog__header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;color:var(--mat-sys-on-primary-container);font-family:var(--gns3-density-section-header-font);font-size:var(--gns3-density-section-header-title-size);font-weight:650;line-height:1.2;letter-spacing:-.01em}.confirmation-dialog__icon[_ngcontent-%COMP%]{width:var(--gns3-density-dialog-icon-container);height:var(--gns3-density-dialog-icon-container);display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;color:var(--confirmation-accent);background:color-mix(in srgb,var(--confirmation-accent) 12%,transparent);border-radius:var(--gns3-density-radius-sm)}.confirmation-dialog__icon[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:var(--gns3-density-dialog-icon-size);height:var(--gns3-density-dialog-icon-size);font-size:var(--gns3-density-dialog-icon-size)}.confirmation-dialog__content[_ngcontent-%COMP%]{padding:var(--gns3-density-space-4);color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-medium);font-size:var(--gns3-density-dialog-body-size);line-height:1.45}.confirmation-dialog__content[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;white-space:pre-line}.confirmation-dialog__checkbox[_ngcontent-%COMP%]{display:block;margin-top:var(--gns3-density-space-3)}.confirmation-dialog__details[_ngcontent-%COMP%]{max-height:180px;margin:var(--gns3-density-space-3) 0 0;padding:var(--gns3-density-space-2) var(--gns3-density-space-3) var(--gns3-density-space-2) calc(var(--gns3-density-space-5) + var(--gns3-density-space-2));overflow-y:auto;background:var(--mat-sys-surface-container);border:1px solid var(--mat-sys-outline-variant);border-radius:var(--gns3-density-radius-sm)}.confirmation-dialog__content[_ngcontent-%COMP%] .confirmation-dialog__note[_ngcontent-%COMP%]{margin-top:var(--gns3-density-space-3);color:var(--confirmation-accent);font-weight:600}.confirmation-dialog__actions[_ngcontent-%COMP%] .confirm-button[_ngcontent-%COMP%]:not(.destructive-button){color:var(--mat-sys-on-primary);background:var(--mat-sys-primary)}html[data-density=compact][_nghost-%COMP%] .confirmation-dialog__header[_ngcontent-%COMP%], html[data-density=compact] [_nghost-%COMP%] .confirmation-dialog__header[_ngcontent-%COMP%]{gap:var(--gns3-density-space-2)}html[data-density=compact][_nghost-%COMP%] .confirmation-dialog__content[_ngcontent-%COMP%], html[data-density=compact] [_nghost-%COMP%] .confirmation-dialog__content[_ngcontent-%COMP%]{padding:var(--gns3-density-space-3) var(--gns3-density-space-4)}"],changeDetection:0})}return n})();function kne(n,o){n&1&&(r(0,"div",21),L(1,"mat-progress-spinner",24),r(2,"span"),c(3,"Loading computes\u2026"),l()())}function Pne(n,o){n&1&&(r(0,"mat-header-cell"),c(1,"Name"),l())}function Tne(n,o){if(n&1&&(r(0,"mat-cell")(1,"div",36)(2,"span",37)(3,"mat-icon"),c(4),l()(),r(5,"span",38)(6,"strong"),c(7),l(),r(8,"small"),c(9),l()()()()),n&2){let e=o.$implicit;m(4),N(e.compute_id==="local"?"computer":"dns"),m(3),N(e.name||e.compute_id),m(2),N(e.compute_id==="local"?"Local compute":e.compute_id)}}function Ene(n,o){n&1&&(r(0,"mat-header-cell"),c(1,"Status"),l())}function One(n,o){if(n&1&&(r(0,"mat-cell")(1,"span",39),L(2,"span"),c(3),l()()),n&2){let e=o.$implicit;m(),ne("computes-page__status--connected",e.connected),v("matTooltip",e.last_error||""),m(2),X(" ",e.connected?"Connected":"Disconnected"," ")}}function Dne(n,o){n&1&&(r(0,"mat-header-cell"),c(1,"Host"),l())}function Ine(n,o){if(n&1&&(r(0,"mat-cell")(1,"span",40),c(2),l()()),n&2){let e=o.$implicit,t=h(2);m(),v("matTooltip",e.protocol+"//"+t.formatHost(e)),m(),X(" ",t.formatHost(e)," ")}}function Ane(n,o){n&1&&(r(0,"mat-header-cell"),c(1,"Platform"),l())}function Nne(n,o){if(n&1&&(r(0,"mat-cell")(1,"span",41)(2,"mat-icon"),c(3,"memory"),l(),c(4),l()()),n&2){let e=o.$implicit,t=h(2);m(4),X(" ",t.getPlatform(e)," ")}}function Fne(n,o){n&1&&(r(0,"mat-header-cell"),c(1,"Resources"),l())}function Rne(n,o){if(n&1&&(r(0,"div",42)(1,"span",44)(2,"mat-icon"),c(3,"developer_board"),l(),c(4),l(),r(5,"span",45)(6,"mat-icon"),c(7,"memory"),l(),c(8),l(),r(9,"span",46)(10,"mat-icon"),c(11,"storage"),l(),c(12),l()()),n&2){let e=h().$implicit,t=h(2);m(4),N(t.formatPercent(e.cpu_usage_percent)),m(4),N(t.formatPercent(e.memory_usage_percent)),m(4),N(t.formatPercent(e.disk_usage_percent))}}function zne(n,o){n&1&&(r(0,"span",43),c(1,"Unavailable"),l())}function Lne(n,o){if(n&1&&(r(0,"mat-cell"),T(1,Rne,13,3,"div",42)(2,zne,2,0,"span",43),l()),n&2){let e=o.$implicit;m(),E(e.connected?1:2)}}function Vne(n,o){n&1&&(r(0,"mat-header-cell"),c(1,"Auto-connect"),l())}function Bne(n,o){if(n&1){let e=R();r(0,"mat-slide-toggle",49),_("change",function(i){y(e);let a=h().$implicit,s=h(2);return w(s.toggleAutoConnect(a,i.checked))}),l()}if(n&2){let e=h().$implicit;v("checked",e.auto_connect),Ce("aria-label","Auto connect "+(e.name||e.compute_id))}}function jne(n,o){n&1&&(r(0,"span",48),c(1,"\u2014"),l())}function $ne(n,o){if(n&1&&(r(0,"mat-cell"),T(1,Bne,1,2,"mat-slide-toggle",47)(2,jne,2,0,"span",48),l()),n&2){let e=o.$implicit;m(),E(e.compute_id!=="local"&&e.auto_connect!==void 0?1:2)}}function Hne(n,o){n&1&&(r(0,"mat-header-cell"),c(1,"Actions"),l())}function Une(n,o){if(n&1){let e=R();r(0,"button",56),_("click",function(){y(e);let i=h(2).$implicit,a=h(2);return w(a.disconnectCompute(i))}),r(1,"mat-icon"),c(2,"link_off"),l()()}if(n&2){let e=h(2).$implicit;Ce("aria-label","Disconnect "+(e.name||e.compute_id))}}function Wne(n,o){if(n&1){let e=R();r(0,"div",50)(1,"button",52),_("click",function(){y(e);let i=h().$implicit,a=h(2);return w(a.connectCompute(i))}),r(2,"mat-icon"),c(3,"link"),l()(),T(4,Une,3,1,"button",53),r(5,"button",54),_("click",function(){y(e);let i=h().$implicit,a=h(2);return w(a.openEditDialog(i))}),r(6,"mat-icon"),c(7,"edit"),l()(),r(8,"button",55),_("click",function(){y(e);let i=h().$implicit,a=h(2);return w(a.deleteCompute(i))}),r(9,"mat-icon"),c(10,"delete"),l()()()}if(n&2){let e=h().$implicit;m(),Ce("aria-label","Connect "+(e.name||e.compute_id)),m(3),E(e.connected&&e.auto_connect!==void 0?4:-1),m(),Ce("aria-label","Edit "+(e.name||e.compute_id)),m(3),Ce("aria-label","Delete "+(e.name||e.compute_id))}}function Gne(n,o){n&1&&(r(0,"span",51),c(1," Controller managed "),l())}function qne(n,o){if(n&1&&(r(0,"mat-cell"),T(1,Wne,11,4,"div",50)(2,Gne,2,0,"span",51),l()),n&2){let e=o.$implicit;m(),E(e.compute_id!=="local"?1:2)}}function Qne(n,o){n&1&&L(0,"mat-header-row")}function Kne(n,o){if(n&1&&L(0,"mat-row"),n&2){let e=o.$implicit;ne("computes-page__row--connected",e.connected)}}function Xne(n,o){if(n&1&&(r(0,"mat-table",22),Fe(1,25),se(2,Pne,2,0,"mat-header-cell",26)(3,Tne,10,3,"mat-cell",27),Re(),Fe(4,28),se(5,Ene,2,0,"mat-header-cell",26)(6,One,4,4,"mat-cell",27),Re(),Fe(7,29),se(8,Dne,2,0,"mat-header-cell",26)(9,Ine,3,2,"mat-cell",27),Re(),Fe(10,30),se(11,Ane,2,0,"mat-header-cell",26)(12,Nne,5,1,"mat-cell",27),Re(),Fe(13,31),se(14,Fne,2,0,"mat-header-cell",26)(15,Lne,3,1,"mat-cell",27),Re(),Fe(16,32),se(17,Vne,2,0,"mat-header-cell",26)(18,$ne,3,1,"mat-cell",27),Re(),Fe(19,33),se(20,Hne,2,0,"mat-header-cell",26)(21,qne,3,1,"mat-cell",27),Re(),se(22,Qne,1,0,"mat-header-row",34)(23,Kne,1,2,"mat-row",35),l()),n&2){let e=h();v("dataSource",e.filteredComputes())("trackBy",e.trackCompute),m(22),v("matHeaderRowDef",e.displayedColumns)("matHeaderRowDefSticky",!0),m(),v("matRowDefColumns",e.displayedColumns)}}function Yne(n,o){n&1&&c(0," Try changing the search or status filter. ")}function Zne(n,o){n&1&&c(0," Add a compute server to extend the controller's resources. ")}function Jne(n,o){if(n&1){let e=R();r(0,"button",58),_("click",function(){y(e);let i=h(2);return w(i.openAddDialog())}),r(1,"mat-icon"),c(2,"add"),l(),c(3," Add Compute "),l()}}function eie(n,o){if(n&1&&(r(0,"div",23)(1,"mat-icon"),c(2,"dns"),l(),r(3,"h3"),c(4,"No computes found"),l(),r(5,"p"),T(6,Yne,1,0)(7,Zne,1,0),l(),T(8,Jne,4,0,"button",57),l()),n&2){let e=h();m(6),E(e.searchText()||e.statusFilter()!=="all"?6:7),m(2),E(!e.searchText()&&e.statusFilter()==="all"?8:-1)}}var tie=(n,o)=>o.key;function nie(n,o){if(n&1&&(r(0,"mat-option",6),c(1),l()),n&2){let e=o.$implicit;v("value",e.key),m(),N(e.name)}}function iie(n,o){n&1&&(r(0,"mat-error"),c(1,"You must select a protocol"),l())}function oie(n,o){n&1&&(r(0,"mat-error"),c(1,"You must enter a host"),l())}function aie(n,o){n&1&&(r(0,"mat-error"),c(1,"You must enter a port"),l())}function rie(n,o){n&1&&(r(0,"mat-error"),c(1,"Port must be between 1 and 65535"),l())}var jR=(()=>{class n{route=f($t);controllerService=f(_t);computeService=f(ml);notificationService=f(_s);toasterService=f(re);dialog=f(Xe);cd=f(oe);controller;_computes=z([]);computes=Ne(()=>[...this._computes()].sort((t,i)=>t.compute_id==="local"?-1:i.compute_id==="local"?1:(t.name||"").localeCompare(i.name||"")));searchText=z("");statusFilter=z("all");filteredComputes=Ne(()=>{let e=this.searchText().trim().toLowerCase(),t=this.statusFilter();return this.computes().filter(i=>{let a=t==="all"||t==="connected"&&i.connected||t==="disconnected"&&!i.connected,s=[i.name,i.compute_id,i.host,i.port,i.protocol,i.capabilities?.platform,...i.capabilities?.node_types||[]].filter(d=>d!=null).join(" ").toLowerCase();return a&&(!e||s.includes(e))})});connectedCount=Ne(()=>this.computes().filter(e=>e.connected).length);displayedColumns=["name","status","host","platform","resources","autoConnect","actions"];loading=z(!0);subscription=new Oo;ngOnInit(){this.loadControllerAndComputes()}ngOnDestroy(){this.subscription.unsubscribe()}loadControllerAndComputes(){let e=this.route.snapshot.paramMap.get("controller_id");this.controllerService.get(parseInt(e,10)).then(t=>{if(this.controller=t,this.cd.markForCheck(),this.notificationService.hasCachedData()){let i=this.notificationService.getCachedComputes();this._computes.set(i),this.loading.set(!1),this.cd.markForCheck()}else this.loadComputes();this.subscription.add(this.notificationService.computeNotificationEmitter.subscribe(i=>{this.handleComputeNotification(i)})),this.subscription.add(this.notificationService.computeCacheUpdated.subscribe(i=>{this._computes.set(i),this.loading.set(!1),this.cd.markForCheck()}))},t=>{let i=t.error?.message||t.message||"Failed to load controller";this.toasterService.error(i),this.loading.set(!1),this.cd.markForCheck()})}handleComputeNotification(e){switch(e.action){case"compute.created":this._computes.update(t=>[...t,e.event]),this.toasterService.success(`Compute "${e.event.name}" added`);break;case"compute.updated":this._computes.update(t=>t.map(i=>i.compute_id===e.event.compute_id?e.event:i));break;case"compute.deleted":this._computes.update(t=>t.filter(i=>i.compute_id!==e.event.compute_id)),this.toasterService.success(`Compute "${e.event.name}" deleted`);break}this.cd.markForCheck()}loadComputes(){this.loading.set(!0),this.computeService.getComputes(this.controller).subscribe({next:e=>{this.notificationService.setInitialComputes(e),this._computes.set(e),this.loading.set(!1),this.cd.markForCheck()},error:e=>{let t=e.error?.message||e.message||"Failed to load computes";this.loading.set(!1),this.toasterService.error(t),this.cd.markForCheck()}})}openAddDialog(){this.dialog.open(BR,{panelClass:["base-dialog-panel","simple-dialog-panel","dialog-medium-panel"],autoFocus:!1,disableClose:!0,data:{controller:this.controller}}).afterClosed().subscribe(t=>{t&&this.computeService.createCompute(this.controller,t).subscribe({next:()=>{this.toasterService.success("Compute added successfully"),this.loadComputes()},error:i=>{let a=i.error?.message||i.message||"Failed to add compute";this.toasterService.error(a),this.cd.markForCheck()}})})}openEditDialog(e){this.computeService.getCompute(this.controller,e.compute_id).subscribe({next:t=>{this.dialog.open(BR,{panelClass:["base-dialog-panel","simple-dialog-panel","dialog-medium-panel"],autoFocus:!1,disableClose:!0,data:{controller:this.controller,compute:t}}).afterClosed().subscribe(a=>{a&&this.computeService.updateCompute(this.controller,e.compute_id,a).subscribe({next:()=>{this.toasterService.success("Compute updated successfully"),this.loadComputes()},error:s=>{let d=s.error?.message||s.message||"Failed to update compute";this.toasterService.error(d),this.cd.markForCheck()}})})},error:t=>{let i=t.error?.message||t.message||"Failed to load compute details";this.toasterService.error(i),this.cd.markForCheck()}})}deleteCompute(e){this.dialog.open(jt,{panelClass:["base-confirmation-dialog-panel","confirmation-danger-panel","dialog-small-panel"],autoFocus:".cancel-button",disableClose:!0,data:{title:"Delete compute?",message:`Compute "${e.name||e.compute_id}" will be permanently deleted.`,note:"This action cannot be undone.",confirmButtonText:"Delete compute",tone:"danger"}}).afterClosed().subscribe(i=>{i&&this.computeService.deleteCompute(this.controller,e.compute_id).subscribe({next:()=>{this.toasterService.success("Compute deleted successfully"),this.loadComputes()},error:a=>{let s=a.error?.message||a.message||"Failed to delete compute";this.toasterService.error(s),this.cd.markForCheck()}})})}connectCompute(e){this.computeService.connectCompute(this.controller,e.compute_id).subscribe({next:()=>{this.toasterService.success("Connection request sent"),this.computeService.getCompute(this.controller,e.compute_id).subscribe({next:t=>{let i=this.computes().map(a=>a.compute_id===t.compute_id?t:a);this._computes.set(i),this.cd.markForCheck()},error:()=>{this.loadComputes()}})},error:t=>{let i=t.error?.message||t.message||"Failed to connect compute";this.toasterService.error(i),this.cd.markForCheck()}})}toggleAutoConnect(e,t){let i=e.auto_connect??!1;this._computes.update(a=>a.map(s=>s.compute_id===e.compute_id?ze(q({},s),{auto_connect:t}):s)),this.computeService.updateCompute(this.controller,e.compute_id,{auto_connect:t}).subscribe({error:a=>{this._computes.update(d=>d.map(p=>p.compute_id===e.compute_id?ze(q({},p),{auto_connect:i}):p));let s=a.error?.message||a.message||"Failed to update auto-connect setting";this.toasterService.error(s),this.cd.markForCheck()}})}disconnectCompute(e,t=!1){this.computeService.disconnectCompute(this.controller,e.compute_id,t).subscribe({next:()=>{this.toasterService.success("Disconnect request sent")},error:i=>{if(i.status===409)this.confirmForceDisconnect(e);else{let a=i.error?.message||i.message||"Failed to disconnect compute";this.toasterService.error(a),this.cd.markForCheck()}}})}confirmForceDisconnect(e){this.dialog.open(jt,{panelClass:["base-confirmation-dialog-panel","confirmation-danger-panel","dialog-small-panel"],autoFocus:".cancel-button",disableClose:!0,data:{title:"Force disconnect?",message:`Compute "${e.name||e.compute_id}" is used by opened projects.`,note:"Only the controller connection is closed \u2014 nodes keep running unmanaged.",confirmButtonText:"Force disconnect",tone:"danger"}}).afterClosed().subscribe(i=>{i&&this.disconnectCompute(e,!0)})}getStatusIcon(e){return e.connected?"check_circle":"cancel"}getStatusColor(e){return e.connected?"var(--mat-sys-primary)":"var(--mat-sys-error)"}formatPercent(e){return e!=null?`${e.toFixed(1)}%`:"--"}formatHost(e){return`${e.host}:${e.port}`}onSearchChange(e){this.searchText.set(e)}onStatusFilterChange(e){this.statusFilter.set(e)}trackCompute(e,t){return t.compute_id}getPlatform(e){return e.capabilities?.platform||"Unknown"}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["app-computes"]],decls:56,vars:10,consts:[[1,"computes-page"],[1,"computes-page__header"],[1,"computes-page__heading"],[1,"computes-page__title"],[1,"computes-page__header-actions"],["mat-raised-button","","color","primary",1,"computes-page__button",3,"click","disabled"],[1,"computes-page__toolbar"],["subscriptSizing","dynamic",1,"computes-page__search"],["matPrefix",""],["matInput","","placeholder","Search by name, host, platform, or node type",3,"input","value"],["subscriptSizing","dynamic",1,"computes-page__filter"],[3,"valueChange","value"],["value","all"],["value","connected"],["value","disconnected"],[1,"computes-page__main"],["aria-label","Compute summary",1,"computes-page__summary"],[1,"computes-page__summary-item"],[1,"computes-page__summary-item","computes-page__summary-item--connected"],[1,"computes-page__summary-item","computes-page__summary-item--disconnected"],[1,"computes-page__table-container"],[1,"computes-page__loading"],[3,"dataSource","trackBy"],[1,"computes-page__empty"],["diameter","42","mode","indeterminate"],["matColumnDef","name"],[4,"matHeaderCellDef"],[4,"matCellDef"],["matColumnDef","status"],["matColumnDef","host"],["matColumnDef","platform"],["matColumnDef","resources"],["matColumnDef","autoConnect"],["matColumnDef","actions"],[4,"matHeaderRowDef","matHeaderRowDefSticky"],[3,"computes-page__row--connected",4,"matRowDef","matRowDefColumns"],[1,"computes-page__name-cell"],[1,"computes-page__compute-icon"],[1,"computes-page__name-copy"],[1,"computes-page__status",3,"matTooltip"],[1,"computes-page__host",3,"matTooltip"],[1,"computes-page__platform"],[1,"computes-page__resources"],[1,"computes-page__unavailable"],["matTooltip","CPU usage"],["matTooltip","Memory usage"],["matTooltip","Disk usage"],["matTooltip","Automatically connect when the controller starts",3,"checked"],[1,"computes-page__auto-connect-na"],["matTooltip","Automatically connect when the controller starts",3,"change","checked"],[1,"computes-page__actions-cell"],["matTooltip","The local compute is managed by the controller",1,"computes-page__managed-label"],["mat-icon-button","","matTooltip","Connect compute",1,"computes-page__action","computes-page__action--connect",3,"click"],["mat-icon-button","","matTooltip","Disconnect compute",1,"computes-page__action","computes-page__action--disconnect"],["mat-icon-button","","matTooltip","Edit compute",1,"computes-page__action","computes-page__action--edit",3,"click"],["mat-icon-button","","matTooltip","Delete compute",1,"computes-page__action","computes-page__action--delete",3,"click"],["mat-icon-button","","matTooltip","Disconnect compute",1,"computes-page__action","computes-page__action--disconnect",3,"click"],["mat-raised-button","","color","primary",1,"computes-page__button"],["mat-raised-button","","color","primary",1,"computes-page__button",3,"click"]],template:function(t,i){t&1&&(r(0,"div",0)(1,"header",1)(2,"div",2)(3,"h1",3),c(4,"Computes"),l()(),r(5,"div",4)(6,"button",5),_("click",function(){return i.loadComputes()}),r(7,"mat-icon"),c(8,"refresh"),l(),c(9," Refresh "),l(),r(10,"button",5),_("click",function(){return i.openAddDialog()}),r(11,"mat-icon"),c(12,"add"),l(),c(13," Add Compute "),l()()(),r(14,"section",6)(15,"mat-form-field",7)(16,"mat-icon",8),c(17,"search"),l(),r(18,"input",9),_("input",function(s){return i.onSearchChange(s.target.value)}),l()(),r(19,"mat-form-field",10)(20,"mat-label"),c(21,"Status"),l(),r(22,"mat-select",11),_("valueChange",function(s){return i.onStatusFilterChange(s)}),r(23,"mat-option",12),c(24,"All statuses"),l(),r(25,"mat-option",13),c(26,"Connected"),l(),r(27,"mat-option",14),c(28,"Disconnected"),l()()()(),r(29,"main",15)(30,"section",16)(31,"div",17)(32,"mat-icon"),c(33,"dns"),l(),r(34,"span")(35,"strong"),c(36),l(),c(37," Total "),l()(),r(38,"div",18)(39,"mat-icon"),c(40,"check_circle"),l(),r(41,"span")(42,"strong"),c(43),l(),c(44," Connected "),l()(),r(45,"div",19)(46,"mat-icon"),c(47,"error_outline"),l(),r(48,"span")(49,"strong"),c(50),l(),c(51," Disconnected "),l()()(),r(52,"div",20),T(53,kne,4,0,"div",21)(54,Xne,24,5,"mat-table",22)(55,eie,9,2,"div",23),l()()()),t&2&&(m(6),v("disabled",i.loading()),m(4),v("disabled",!i.controller),m(8),v("value",i.searchText()),m(4),v("value",i.statusFilter()),m(14),N(i.computes().length),m(7),N(i.connectedCount()),m(7),N(i.computes().length-i.connectedCount()),m(2),ne("computes-page__table-container--loading",i.loading()),m(),E(i.loading()?53:i.filteredComputes().length?54:55))},dependencies:[fe,vn,Y,he,Be,ie,ce,it,_n,bn,yn,kn,wn,xn,Pn,Mn,Sn,Tn,En,st,pt,ke,we,Pe,Ve,Bi,ye,Ee,ot,ct,nt,rt,mt,mc,Yc,It],styles:["[_nghost-%COMP%]{display:block;width:100%;background:transparent}.computes-page[_ngcontent-%COMP%]{animation:none}.computes-page__header[_ngcontent-%COMP%], .computes-page__toolbar[_ngcontent-%COMP%], .computes-page__main[_ngcontent-%COMP%]{max-width:1600px;margin-inline:auto}.computes-page__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:24px 20px 16px}.computes-page__heading[_ngcontent-%COMP%]{min-width:0}.computes-page__title[_ngcontent-%COMP%]{margin:0;color:var(--mat-sys-on-surface);font-size:var(--gns3-density-page-title-size);font-weight:500;font-family:var(--mat-sys-title-large-font, Roboto),sans-serif;line-height:1.2;letter-spacing:normal}.computes-page__header-actions[_ngcontent-%COMP%], .computes-page__toolbar[_ngcontent-%COMP%], .computes-page__resources[_ngcontent-%COMP%], .computes-page__actions-cell[_ngcontent-%COMP%]{display:flex;align-items:center}.computes-page__header-actions[_ngcontent-%COMP%]{flex:0 0 auto;gap:var(--gns3-density-space-3)}button.computes-page__button[_ngcontent-%COMP%]{height:var(--gns3-density-control-height);min-height:var(--gns3-density-control-height);padding-inline:var(--gns3-density-space-4);border-radius:var(--gns3-density-radius-lg);font-family:var(--mat-sys-label-large-font, Roboto),sans-serif;font-size:var(--gns3-button-label-size);font-weight:var(--gns3-button-label-weight);line-height:var(--gns3-button-label-line-height);letter-spacing:var(--gns3-button-label-spacing);text-transform:none;--mat-button-filled-container-height: var(--gns3-density-control-height);--mat-button-filled-label-text-size: var(--gns3-button-label-size);--mat-button-filled-label-text-weight: var(--gns3-button-label-weight);--mat-button-filled-label-text-tracking: var(--gns3-button-label-spacing);--mat-button-outlined-container-height: var(--gns3-density-control-height);--mat-button-outlined-label-text-size: var(--gns3-button-label-size);--mat-button-outlined-label-text-weight: var(--gns3-button-label-weight);--mat-button-outlined-label-text-tracking: var(--gns3-button-label-spacing);--mat-button-protected-container-height: var(--gns3-density-control-height);--mat-button-protected-label-text-size: var(--gns3-button-label-size);--mat-button-protected-label-text-weight: var(--gns3-button-label-weight);--mat-button-protected-label-text-tracking: var(--gns3-button-label-spacing);--mat-button-text-container-height: var(--gns3-density-control-height);--mat-button-text-label-text-size: var(--gns3-button-label-size);--mat-button-text-label-text-weight: var(--gns3-button-label-weight);--mat-button-text-label-text-tracking: var(--gns3-button-label-spacing)}.computes-page__toolbar[_ngcontent-%COMP%]{gap:var(--gns3-density-card-gap);padding:0 20px 8px}.computes-page__search[_ngcontent-%COMP%]{flex:1;min-width:260px}.computes-page__filter[_ngcontent-%COMP%]{flex:0 0 190px}.computes-page__main[_ngcontent-%COMP%]{padding:0 20px 24px}.computes-page__summary[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--gns3-density-space-3);margin-bottom:var(--gns3-density-card-gap)}.computes-page__summary-item[_ngcontent-%COMP%]{display:flex;align-items:center;min-width:0;gap:var(--gns3-density-space-3);padding:14px 16px;border:1px solid var(--mat-sys-outline-variant);border-radius:14px;color:var(--mat-sys-on-surface-variant);background:var(--mat-sys-surface-container)}.computes-page__summary-item[_ngcontent-%COMP%] > mat-icon[_ngcontent-%COMP%]{display:grid;flex:0 0 38px;width:38px;height:38px;place-items:center;border-radius:10px;color:var(--mat-sys-on-primary-container);background:var(--mat-sys-primary-container)}.computes-page__summary-item[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{display:flex;min-width:0;flex-direction:column;font-size:12px}.computes-page__summary-item[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface);font-size:20px;line-height:1.15}.computes-page__summary-item--connected[_ngcontent-%COMP%] > mat-icon[_ngcontent-%COMP%]{color:var(--mat-sys-on-primary-container);background:var(--mat-sys-primary-container)}.computes-page__summary-item--disconnected[_ngcontent-%COMP%] > mat-icon[_ngcontent-%COMP%]{color:var(--mat-sys-on-error-container);background:var(--mat-sys-error-container)}.computes-page__table-container[_ngcontent-%COMP%]{position:relative;min-width:0;border-radius:16px;background:var(--mat-sys-surface);border:var(--gns3-surface-border);box-shadow:none;overflow-x:auto}.computes-page__table-container--loading[_ngcontent-%COMP%]{min-height:320px}.computes-page__loading[_ngcontent-%COMP%]{position:absolute;z-index:2;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:320px;gap:var(--gns3-density-card-gap);color:var(--mat-sys-on-surface-variant);background:var(--mat-sys-surface)}mat-table[_ngcontent-%COMP%]{width:100%;min-width:1120px}.mat-mdc-row[_ngcontent-%COMP%], .mat-row[_ngcontent-%COMP%]{height:var(--mat-table-row-item-container-height);min-height:var(--mat-table-row-item-container-height)}.mat-header-row[_ngcontent-%COMP%], .mat-mdc-header-row[_ngcontent-%COMP%]{position:sticky;z-index:10;top:0;background:color-mix(in srgb,var(--mat-sys-primary-container) 72%,var(--mat-sys-surface))}.mat-header-row[_ngcontent-%COMP%] mat-header-cell[_ngcontent-%COMP%], .mat-mdc-header-row[_ngcontent-%COMP%] mat-header-cell[_ngcontent-%COMP%]{color:var(--mat-sys-on-primary-container);font-size:13px;font-weight:650;letter-spacing:.5px;text-transform:uppercase}mat-row[_ngcontent-%COMP%]{border-left:3px solid var(--mat-sys-error);transition:background-color var(--gns3-motion-duration-standard) ease}mat-row[_ngcontent-%COMP%]:nth-child(2n){background:color-mix(in srgb,var(--mat-sys-on-surface) 1%,transparent)}mat-row[_ngcontent-%COMP%]:hover{background:color-mix(in srgb,var(--mat-sys-primary) 5%,transparent)}mat-row.computes-page__row--connected[_ngcontent-%COMP%]{border-left-color:var(--mat-sys-primary)}mat-cell[_ngcontent-%COMP%], mat-header-cell[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:inherit;overflow:hidden;color:var(--mat-sys-on-surface);text-overflow:ellipsis;white-space:nowrap}.mat-column-name[_ngcontent-%COMP%]{flex:24 1 0;min-width:235px}.mat-column-status[_ngcontent-%COMP%]{flex:14 1 0;min-width:135px;justify-content:center}.mat-column-host[_ngcontent-%COMP%]{flex:17 1 0;min-width:150px;justify-content:center}.mat-column-platform[_ngcontent-%COMP%]{flex:14 1 0;min-width:130px;justify-content:center}.mat-column-resources[_ngcontent-%COMP%]{flex:20 1 0;min-width:225px;justify-content:center}.mat-column-autoConnect[_ngcontent-%COMP%]{flex:10 1 0;min-width:104px;justify-content:center}.mat-column-actions[_ngcontent-%COMP%]{flex:14 1 0;min-width:190px;justify-content:center}.computes-page__name-cell[_ngcontent-%COMP%], .computes-page__platform[_ngcontent-%COMP%]{display:flex;align-items:center}.computes-page__name-cell[_ngcontent-%COMP%]{min-width:0;gap:var(--gns3-density-space-3)}.computes-page__compute-icon[_ngcontent-%COMP%]{display:grid;flex:0 0 38px;width:38px;height:38px;place-items:center;border-radius:10px;color:var(--mat-sys-on-primary-container);background:color-mix(in srgb,var(--mat-sys-primary-container) 82%,var(--mat-sys-surface))}.computes-page__compute-icon[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:21px;height:21px;font-size:21px}.computes-page__name-copy[_ngcontent-%COMP%]{display:flex;min-width:0;flex-direction:column}.computes-page__name-copy[_ngcontent-%COMP%] strong[_ngcontent-%COMP%], .computes-page__name-copy[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.computes-page__name-copy[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:14px;font-weight:600}.computes-page__name-copy[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface-variant);font-size:11px}.computes-page__status[_ngcontent-%COMP%]{display:inline-flex;align-items:center;width:fit-content;gap:var(--gns3-density-space-2);padding:4px 10px;border:1px solid var(--mat-sys-error);border-radius:18px;color:var(--mat-sys-on-error-container);background:var(--mat-sys-error-container);font-size:12px;font-weight:600}.computes-page__status[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{width:7px;height:7px;border-radius:50%;background:currentColor}.computes-page__status--connected[_ngcontent-%COMP%]{border-color:var(--mat-sys-primary);color:var(--mat-sys-on-primary-container);background:var(--mat-sys-primary-container)}.computes-page__host[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis}.computes-page__platform[_ngcontent-%COMP%]{gap:var(--gns3-density-space-2);color:var(--mat-sys-on-surface-variant);font-size:13px}.computes-page__platform[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:17px;height:17px;font-size:17px}.computes-page__resources[_ngcontent-%COMP%]{gap:var(--gns3-density-space-3)}.computes-page__resources[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:4px;font-size:12px}.computes-page__resources[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:16px;height:16px;color:var(--mat-sys-on-surface-variant);font-size:16px}.computes-page__unavailable[_ngcontent-%COMP%], .computes-page__managed-label[_ngcontent-%COMP%], .computes-page__auto-connect-na[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface-variant);font-size:12px}.computes-page__actions-cell[_ngcontent-%COMP%]{gap:4px}button.computes-page__action[_ngcontent-%COMP%]{--compute-action-color: var(--mat-sys-on-surface-variant);width:var(--gns3-density-control-height-sm);height:var(--gns3-density-control-height-sm);--mat-icon-button-state-layer-size: var(--gns3-density-control-height-sm);border-radius:var(--gns3-density-radius-lg);display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;padding:0;--mat-icon-button-icon-size: var(--gns3-action-icon-size);--mat-icon-button-touch-target-size: var(--gns3-density-control-height-sm)}button.computes-page__action[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:var(--gns3-action-icon-size);height:var(--gns3-action-icon-size);font-size:var(--gns3-action-icon-size);line-height:var(--gns3-action-icon-size)}button.computes-page__action[_ngcontent-%COMP%]{color:var(--compute-action-color);--mat-icon-button-state-layer-color: var(--compute-action-color)}button.computes-page__action[_ngcontent-%COMP%]:not(:disabled) mat-icon[_ngcontent-%COMP%]{color:var(--compute-action-color)}button.computes-page__action[_ngcontent-%COMP%]:disabled mat-icon[_ngcontent-%COMP%]{color:var(--gns3-button-disabled-label-color)}button.computes-page__action--connect[_ngcontent-%COMP%]{--compute-action-color: var(--mat-sys-secondary)}button.computes-page__action--edit[_ngcontent-%COMP%]{--compute-action-color: var(--mat-sys-primary)}button.computes-page__action--delete[_ngcontent-%COMP%], button.computes-page__action--disconnect[_ngcontent-%COMP%]{--compute-action-color: var(--mat-sys-error)}.computes-page__empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:260px;padding:32px;color:var(--mat-sys-on-surface-variant);text-align:center}.computes-page__empty[_ngcontent-%COMP%] > mat-icon[_ngcontent-%COMP%]{width:48px;height:48px;font-size:48px;opacity:.55}.computes-page__empty[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:12px 0 0;color:var(--mat-sys-on-surface);font-size:17px}.computes-page__empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:5px 0 16px;font-size:14px}[data-density=compact][_nghost-%COMP%] button.computes-page__button[_ngcontent-%COMP%], [data-density=compact] [_nghost-%COMP%] button.computes-page__button[_ngcontent-%COMP%]{min-height:40px;height:40px}@media(max-width:900px){.computes-page__header[_ngcontent-%COMP%], .computes-page__toolbar[_ngcontent-%COMP%]{align-items:stretch;flex-direction:column}.computes-page__header-actions[_ngcontent-%COMP%]{width:100%}.computes-page__filter[_ngcontent-%COMP%]{flex:1}}@media(max-width:600px){.computes-page__header[_ngcontent-%COMP%]{padding:20px 16px 12px}.computes-page__toolbar[_ngcontent-%COMP%], .computes-page__main[_ngcontent-%COMP%]{padding-inline:16px}.computes-page__header-actions[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}button.computes-page__button[_ngcontent-%COMP%]{width:100%}.computes-page__summary[_ngcontent-%COMP%]{grid-template-columns:1fr}}"],changeDetection:0})}return n})(),BR=(()=>{class n{dialogRef=f(We);data=f(Wt);protocols=[{key:"http",name:"HTTP"},{key:"https",name:"HTTPS"}];computeForm=new Qo({name:new Ge(""),protocol:new Ge("http",[Ue.required]),host:new Ge("",[Ue.required]),port:new Ge(3080,[Ue.required,Ue.min(1),Ue.max(65535)]),user:new Ge("gns3"),password:new Ge("gns3"),autoConnect:new Ge(!1)});isEditMode=!1;constructor(){this.data.compute&&(this.isEditMode=!0,this.computeForm.patchValue({name:this.data.compute.name,protocol:this.data.compute.protocol,host:this.data.compute.host,port:this.data.compute.port,user:this.data.compute.user,password:"",autoConnect:this.data.compute.auto_connect??!1}))}onSaveClick(){if(!this.computeForm.valid)return;let e=this.computeForm.value,t={protocol:e.protocol,host:e.host,port:e.port,user:e.user||void 0,name:e.name||void 0,auto_connect:!!e.autoConnect};e.password&&e.password.trim()!==""&&(t.password=e.password),this.dialogRef.close(t)}onCancelClick(){this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["app-add-compute-dialog"]],decls:41,vars:8,consts:[["mat-dialog-title",""],[3,"formGroup"],["mat-dialog-content","",1,"gns3-form-stack","gns3-form-layout-fixed"],["appearance","outline",1,"full-width-field"],["matInput","","tabindex","1","formControlName","name","placeholder","My Compute"],["formControlName","protocol"],[3,"value"],["matInput","","tabindex","1","formControlName","host","placeholder","192.168.1.100"],["matInput","","type","number","tabindex","1","formControlName","port","placeholder","3080"],["matInput","","tabindex","1","formControlName","user","placeholder","gns3"],["matInput","","type","password","tabindex","1","formControlName","password","placeholder","gns3"],["formControlName","autoConnect",1,"add-compute-dialog__auto-connect"],["mat-dialog-actions","","align","end"],["mat-button","","tabindex","-1","color","accent",3,"click"],["mat-button","","tabindex","2","mat-raised-button","","color","primary",3,"click","disabled"]],template:function(t,i){t&1&&(r(0,"h2",0),c(1),l(),r(2,"form",1)(3,"div",2)(4,"mat-form-field",3)(5,"mat-label"),c(6,"Name (optional)"),l(),L(7,"input",4),l(),r(8,"mat-form-field",3)(9,"mat-label"),c(10,"Protocol"),l(),r(11,"mat-select",5),Q(12,nie,2,2,"mat-option",6,tie),l(),T(14,iie,2,0,"mat-error"),l(),r(15,"mat-form-field",3)(16,"mat-label"),c(17,"Host"),l(),L(18,"input",7),T(19,oie,2,0,"mat-error"),l(),r(20,"mat-form-field",3)(21,"mat-label"),c(22,"Port"),l(),L(23,"input",8),T(24,aie,2,0,"mat-error"),T(25,rie,2,0,"mat-error"),l(),r(26,"mat-form-field",3)(27,"mat-label"),c(28,"User"),l(),L(29,"input",9),l(),r(30,"mat-form-field",3)(31,"mat-label"),c(32,"Password"),l(),L(33,"input",10),l(),r(34,"mat-slide-toggle",11),c(35," Automatically connect "),l()(),r(36,"div",12)(37,"button",13),_("click",function(){return i.onCancelClick()}),c(38,"Cancel"),l(),r(39,"button",14),_("click",function(){return i.onSaveClick()}),c(40),l()()()),t&2&&(m(),N(i.isEditMode?"Edit Compute":"Add Compute"),m(),v("formGroup",i.computeForm),m(10),K(i.protocols),m(2),E(i.computeForm.get("protocol").hasError("required")?14:-1),m(5),E(i.computeForm.get("host").hasError("required")?19:-1),m(5),E(i.computeForm.get("port").hasError("required")?24:-1),m(),E(i.computeForm.get("port").hasError("min")||i.computeForm.get("port").hasError("max")?25:-1),m(14),v("disabled",i.computeForm.invalid),m(),X(" ",i.isEditMode?"Update":"Add"," "))},dependencies:[fe,It,Ct,At,No,Nt,vt,Ut,Yt,ke,qe,Qe,bt,Y,he,we,Pe,Ve,Wn,ye,Ee,ot,ct,nt,mc,Yc],encapsulation:2,changeDetection:0})}return n})();var sie=["*"];var lie=[[["","mat-card-avatar",""],["","matCardAvatar",""]],[["mat-card-title"],["mat-card-subtitle"],["","mat-card-title",""],["","mat-card-subtitle",""],["","matCardTitle",""],["","matCardSubtitle",""]],"*"],cie=["[mat-card-avatar], [matCardAvatar]",`mat-card-title, mat-card-subtitle, + [mat-card-title], [mat-card-subtitle], + [matCardTitle], [matCardSubtitle]`,"*"],die=new mn("MAT_CARD_CONFIG"),Zn=(()=>{class n{appearance;constructor(){let e=f(die,{optional:!0});this.appearance=e?.appearance||"raised"}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["mat-card"]],hostAttrs:[1,"mat-mdc-card","mdc-card"],hostVars:8,hostBindings:function(t,i){t&2&&ne("mat-mdc-card-outlined",i.appearance==="outlined")("mdc-card--outlined",i.appearance==="outlined")("mat-mdc-card-filled",i.appearance==="filled")("mdc-card--filled",i.appearance==="filled")},inputs:{appearance:"appearance"},exportAs:["matCard"],ngContentSelectors:sie,decls:1,vars:0,template:function(t,i){t&1&&(pi(),Zt(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(--mat-card-elevated-container-color, var(--mat-sys-surface-container-low)); + border-color: var(--mat-card-elevated-container-color, var(--mat-sys-surface-container-low)); + border-radius: var(--mat-card-elevated-container-shape, var(--mat-sys-corner-medium)); + box-shadow: var(--mat-card-elevated-container-elevation, var(--mat-sys-level1)); +} +.mat-mdc-card::after { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border: solid 1px transparent; + content: ""; + display: block; + pointer-events: none; + box-sizing: border-box; + border-radius: var(--mat-card-elevated-container-shape, var(--mat-sys-corner-medium)); +} + +.mat-mdc-card-outlined { + background-color: var(--mat-card-outlined-container-color, var(--mat-sys-surface)); + border-radius: var(--mat-card-outlined-container-shape, var(--mat-sys-corner-medium)); + border-width: var(--mat-card-outlined-outline-width, 1px); + border-color: var(--mat-card-outlined-outline-color, var(--mat-sys-outline-variant)); + box-shadow: var(--mat-card-outlined-container-elevation, var(--mat-sys-level0)); +} +.mat-mdc-card-outlined::after { + border: none; +} + +.mat-mdc-card-filled { + background-color: var(--mat-card-filled-container-color, var(--mat-sys-surface-container-highest)); + border-radius: var(--mat-card-filled-container-shape, var(--mat-sys-corner-medium)); + box-shadow: var(--mat-card-filled-container-elevation, var(--mat-sys-level0)); +} + +.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 n})(),Zc=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["mat-card-title"],["","mat-card-title",""],["","matCardTitle",""]],hostAttrs:[1,"mat-mdc-card-title"]})}return n})();var Tl=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["mat-card-content"]],hostAttrs:[1,"mat-mdc-card-content"]})}return n})();var k1=(()=>{class n{align="start";static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["mat-card-actions"]],hostAttrs:[1,"mat-mdc-card-actions","mdc-card__actions"],hostVars:2,hostBindings:function(t,i){t&2&&ne("mat-mdc-card-actions-align-end",i.align==="end")},inputs:{align:"align"},exportAs:["matCardActions"]})}return n})(),Jc=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["mat-card-header"]],hostAttrs:[1,"mat-mdc-card-header"],ngContentSelectors:cie,decls:4,vars:0,consts:[[1,"mat-mdc-card-header-text"]],template:function(t,i){t&1&&(pi(lie),Zt(0),ii(1,"div",0),Zt(2,1),Si(),Zt(3,2))},encapsulation:2,changeDetection:0})}return n})();var hn=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({imports:[Vi]})}return n})();var dh=(()=>{class n{dataChange=new cn([]);constructor(){}get data(){return this.dataChange.value}addController(e){let t=this.data.slice();t.push(e),this.dataChange.next(t)}addControllers(e){this.dataChange.next(e)}remove(e){let t=this.data.indexOf(e);t>=0&&(this.data.splice(t,1),this.dataChange.next(this.data.slice()))}find(e){return this.data.find(t=>t.name===e)}findById(e){return this.data.find(t=>t.id===e)}findIndex(e){return this.data.findIndex(t=>t.name===e)}findIndexById(e){return this.data.findIndex(t=>t.id===e)}update(e){let t=this.findIndexById(e.id);t>=0&&(this.data[t]=e,this.dataChange.next(this.data.slice()))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=J({token:n,factory:n.\u0275fac})}return n})();var $R=(n,o)=>o.key;function mie(n,o){n&1&&(r(0,"mat-error"),c(1,"You must enter a value"),l())}function pie(n,o){if(n&1&&(r(0,"mat-option",10),c(1),l()),n&2){let e=o.$implicit;v("value",e.key),m(),X(" ",e.name," ")}}function uie(n,o){if(n&1&&(r(0,"mat-option",10),c(1),l()),n&2){let e=o.$implicit;v("value",e.key),m(),X(" ",e.name," ")}}var P1=(()=>{class n{controllerService=f(_t);controllerDatabase=f(dh);route=f($t);router=f(Ft);toasterService=f(re);cdr=f(oe);controllerOptionsVisibility=z(!1);controllerIp;controllerPort;projectId;protocols=[{key:"http:",name:"HTTP"},{key:"https:",name:"HTTPS"}];locations=[{key:"local",name:"Local"},{key:"remote",name:"Remote"}];controllerForm=new Qo({name:new Ge("",[Ue.required]),location:new Ge(""),protocol:new Ge("http:")});constructor(){}async ngOnInit(){this.controllerService.isServiceInitialized&&this.getControllers(),this.controllerService.serviceInitialized.subscribe(async e=>{e&&this.getControllers()})}async getControllers(){this.controllerIp=this.route.snapshot.paramMap.get("controller_ip"),this.controllerPort=+this.route.snapshot.paramMap.get("controller_port"),this.projectId=this.route.snapshot.paramMap.get("project_id");try{let t=(await this.controllerService.findAll()).filter(i=>i.host===this.controllerIp&&i.port===this.controllerPort)[0];t?this.router.navigate(["/controller",t.id,"project",this.projectId]):(this.controllerOptionsVisibility.set(!0),this.cdr.markForCheck())}catch(e){let t=e.error?.message||e.message||"Failed to load controllers";this.toasterService.error(t),this.cdr.markForCheck()}}createController(){if(!this.controllerForm.get("name").hasError&&!this.controllerForm.get("location").hasError&&!this.controllerForm.get("protocol").hasError){this.toasterService.error("Please use correct values");return}let e=new m5;e.host=this.controllerIp,e.port=this.controllerPort,e.name=this.controllerForm.get("name").value,e.location=this.controllerForm.get("location").value,e.protocol=this.controllerForm.get("protocol").value,this.controllerService.create(e).then(t=>{this.toasterService.success(`Controller "${t.name}" added.`),this.router.navigate(["/controller",t.id,"project",this.projectId])},t=>{let i=t.error?.message||t.message||"Failed to create controller";this.toasterService.error(i),this.cdr.markForCheck()})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["app-direct-link"]],decls:22,vars:3,consts:[[1,"content",3,"hidden"],[1,"default-header"],[1,"row"],[1,"col"],[1,"default-content"],[1,"matCard"],[1,"gns3-form-stack","gns3-form-layout-fixed",3,"formGroup"],["appearance","outline"],["matInput","","tabindex","1","formControlName","name","placeholder","Name"],["placeholder","Location","formControlName","location"],[3,"value"],["placeholder","Protocol","formControlName","protocol"],[1,"buttons-bar"],["mat-raised-button","","color","primary",3,"click"]],template:function(t,i){t&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"h1",3),c(4,"Add new controller"),l()()(),r(5,"div",4)(6,"mat-card",5)(7,"form",6)(8,"mat-form-field",7),L(9,"input",8),T(10,mie,2,0,"mat-error"),l(),r(11,"mat-form-field",7)(12,"mat-select",9),Q(13,pie,2,2,"mat-option",10,$R),l()(),r(15,"mat-form-field",7)(16,"mat-select",11),Q(17,uie,2,2,"mat-option",10,$R),l()()()(),r(19,"div",12)(20,"button",13),_("click",function(){return i.createController()}),c(21,"Add controller"),l()()()()),t&2&&(v("hidden",!i.controllerOptionsVisibility()),m(7),v("formGroup",i.controllerForm),m(3),E(i.controllerForm.get("name").hasError("required")?10:-1),m(3),K(i.locations),m(4),K(i.protocols))},dependencies:[fe,It,Ct,At,Nt,vt,Ut,Yt,vn,hn,Zn,we,Pe,Wn,ye,Ee,ot,ct,nt,Ho,Y,he],styles:["mat-form-field[_ngcontent-%COMP%]{width:100%}"],changeDetection:0})}return n})();var pE=new mn("CdkAccordion"),HR=(()=>{class n{_stateChanges=new Ye;_openCloseAllActions=new Ye;id=f(ua).getId("cdk-accordion-");multi=!1;openAll(){this.multi&&this._openCloseAllActions.next(!0)}closeAll(){this._openCloseAllActions.next(!1)}ngOnChanges(e){this._stateChanges.next(e)}ngOnDestroy(){this._stateChanges.complete(),this._openCloseAllActions.complete()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["cdk-accordion"],["","cdkAccordion",""]],inputs:{multi:[2,"multi","multi",zt]},exportAs:["cdkAccordion"],features:[un([{provide:pE,useExisting:n}]),Nn]})}return n})(),UR=(()=>{class n{accordion=f(pE,{optional:!0,skipSelf:!0});_changeDetectorRef=f(oe);_expansionDispatcher=f(pg);_openCloseAllSubscription=Oo.EMPTY;closed=new be;opened=new be;destroyed=new be;expandedChange=new be;id=f(ua).getId("cdk-accordion-child-");get expanded(){return this._expanded}set expanded(e){if(this._expanded!==e){if(this._expanded=e,this.expandedChange.emit(e),e){this.opened.emit();let t=this.accordion?this.accordion.id:this.id;this._expansionDispatcher.notify(this.id,t)}else this.closed.emit();this._changeDetectorRef.markForCheck()}}_expanded=!1;get disabled(){return this._disabled()}set disabled(e){this._disabled.set(e)}_disabled=z(!1);_removeUniqueSelectionListener=()=>{};constructor(){}ngOnInit(){this._removeUniqueSelectionListener=this._expansionDispatcher.listen((e,t)=>{this.accordion&&!this.accordion.multi&&this.accordion.id===t&&this.id!==e&&(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(e=>{this.disabled||(this.expanded=e)})}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["cdk-accordion-item"],["","cdkAccordionItem",""]],inputs:{expanded:[2,"expanded","expanded",zt],disabled:[2,"disabled","disabled",zt]},outputs:{closed:"closed",opened:"opened",destroyed:"destroyed",expandedChange:"expandedChange"},exportAs:["cdkAccordionItem"],features:[un([{provide:pE,useValue:void 0}])]})}return n})(),T1=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({})}return n})();var gie=["body"],hie=["bodyWrapper"],_ie=[[["mat-expansion-panel-header"]],"*",[["mat-action-row"]]],fie=["mat-expansion-panel-header","*","mat-action-row"];function vie(n,o){}var Cie=[[["mat-panel-title"]],[["mat-panel-description"]],"*"],bie=["mat-panel-title","mat-panel-description","*"];function xie(n,o){n&1&&(ii(0,"span",1),Mi(),ii(1,"svg",2),kr(2,"path",3),Si()())}var uE=new mn("MAT_ACCORDION"),WR=new mn("MAT_EXPANSION_PANEL"),yie=(()=>{class n{_template=f(pa);_expansionPanel=f(WR,{optional:!0});constructor(){}static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["ng-template","matExpansionPanelContent",""]]})}return n})(),GR=new mn("MAT_EXPANSION_PANEL_DEFAULT_OPTIONS"),jd=(()=>{class n extends UR{_viewContainerRef=f(Wo);_animationsDisabled=$a();_document=f(Do);_ngZone=f(Gi);_elementRef=f(Kt);_renderer=f(qi);_cleanupTransitionEnd;get hideToggle(){return this._hideToggle||this.accordion&&this.accordion.hideToggle}set hideToggle(e){this._hideToggle=e}_hideToggle=!1;get togglePosition(){return this._togglePosition||this.accordion&&this.accordion.togglePosition}set togglePosition(e){this._togglePosition=e}_togglePosition;afterExpand=new be;afterCollapse=new be;_inputChanges=new Ye;accordion=f(uE,{optional:!0,skipSelf:!0});_lazyContent;_body;_bodyWrapper;_portal;_headerId=f(ua).getId("mat-expansion-panel-header-");constructor(){super();let e=f(GR,{optional:!0});this._expansionDispatcher=f(pg),e&&(this.hideToggle=e.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(Di(null),Yi(()=>this.expanded&&!this._portal),Gr(1)).subscribe(()=>{this._portal=new lg(this._lazyContent._template,this._viewContainerRef)}),this._setupAnimationEvents()}ngOnChanges(e){this._inputChanges.next(e)}ngOnDestroy(){super.ngOnDestroy(),this._cleanupTransitionEnd?.(),this._inputChanges.complete()}_containsFocus(){if(this._body){let e=this._document.activeElement,t=this._body.nativeElement;return e===t||t.contains(e)}return!1}_transitionEndListener=({target:e,propertyName:t})=>{e===this._bodyWrapper?.nativeElement&&t==="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 e=this._elementRef.nativeElement;this._cleanupTransitionEnd=this._renderer.listen(e,"transitionend",this._transitionEndListener),e.classList.add("mat-expansion-panel-animations-enabled")},200)})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["mat-expansion-panel"]],contentQueries:function(t,i,a){if(t&1&&Zi(a,yie,5),t&2){let s;gt(s=ht())&&(i._lazyContent=s.first)}},viewQuery:function(t,i){if(t&1&&Kn(gie,5)(hie,5),t&2){let a;gt(a=ht())&&(i._body=a.first),gt(a=ht())&&(i._bodyWrapper=a.first)}},hostAttrs:[1,"mat-expansion-panel"],hostVars:4,hostBindings:function(t,i){t&2&&ne("mat-expanded",i.expanded)("mat-expansion-panel-spacing",i._hasSpacing())},inputs:{hideToggle:[2,"hideToggle","hideToggle",zt],togglePosition:"togglePosition"},outputs:{afterExpand:"afterExpand",afterCollapse:"afterCollapse"},exportAs:["matExpansionPanel"],features:[un([{provide:uE,useValue:void 0},{provide:WR,useExisting:n}]),mi,Nn],ngContentSelectors:fie,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(t,i){t&1&&(pi(_ie),Zt(0),r(1,"div",2,0)(3,"div",3,1)(5,"div",4),Zt(6,1),se(7,vie,0,0,"ng-template",5),l(),Zt(8,2),l()()),t&2&&(m(),Ce("inert",i.expanded?null:""),m(2),v("id",i.id),Ce("aria-labelledby",i._headerId),m(4),v("cdkPortalOutlet",i._portal))},dependencies:[HC],styles:[`.mat-expansion-panel { + box-sizing: content-box; + display: block; + margin: 0; + overflow: hidden; +} +.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 { + 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:not([class*=mat-elevation-z]) { + box-shadow: var(--mat-expansion-container-elevation-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; + } +} +@media print { + .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; +} +.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-content { + 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-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 n})();var $d=(()=>{class n{panel=f(jd,{host:!0});_element=f(Kt);_focusMonitor=f(hs);_changeDetectorRef=f(oe);_parentChangeSubscription=Oo.EMPTY;constructor(){f(Ta).load(Xr);let e=this.panel,t=f(GR,{optional:!0}),i=f(new cm("tabindex"),{optional:!0}),a=e.accordion?e.accordion._stateChanges.pipe(Yi(s=>!!(s.hideToggle||s.togglePosition))):eg;this.tabIndex=parseInt(i||"")||0,this._parentChangeSubscription=ro(e.opened,e.closed,a,e._inputChanges.pipe(Yi(s=>!!(s.hideToggle||s.disabled||s.togglePosition)))).subscribe(()=>this._changeDetectorRef.markForCheck()),e.closed.pipe(Yi(()=>e._containsFocus())).subscribe(()=>this._focusMonitor.focusVia(this._element,"program")),t&&(this.expandedHeight=t.expandedHeight,this.collapsedHeight=t.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 e=this._isExpanded();return e&&this.expandedHeight?this.expandedHeight:!e&&this.collapsedHeight?this.collapsedHeight:null}_keydown(e){switch(e.keyCode){case 32:case 13:gs(e)||(e.preventDefault(),this._toggle());break;default:this.panel.accordion&&this.panel.accordion._handleHeaderKeydown(e);return}}focus(e,t){e?this._focusMonitor.focusVia(this._element,e,t):this._element.nativeElement.focus(t)}ngAfterViewInit(){this._focusMonitor.monitor(this._element).subscribe(e=>{e&&this.panel.accordion&&this.panel.accordion._handleHeaderFocus(this)})}ngOnDestroy(){this._parentChangeSubscription.unsubscribe(),this._focusMonitor.stopMonitoring(this._element)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["mat-expansion-panel-header"]],hostAttrs:["role","button",1,"mat-expansion-panel-header","mat-focus-indicator"],hostVars:13,hostBindings:function(t,i){t&1&&_("click",function(){return i._toggle()})("keydown",function(s){return i._keydown(s)}),t&2&&(Ce("id",i.panel._headerId)("tabindex",i.disabled?-1:i.tabIndex)("aria-controls",i._getPanelId())("aria-expanded",i._isExpanded())("aria-disabled",i.panel.disabled),Tt("height",i._getHeaderHeight()),ne("mat-expanded",i._isExpanded())("mat-expansion-toggle-indicator-after",i._getTogglePosition()==="after")("mat-expansion-toggle-indicator-before",i._getTogglePosition()==="before"))},inputs:{expandedHeight:"expandedHeight",collapsedHeight:"collapsedHeight",tabIndex:[2,"tabIndex","tabIndex",e=>e==null?0:qo(e)]},ngContentSelectors:bie,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(t,i){t&1&&(pi(Cie),ii(0,"span",0),Zt(1),Zt(2,1),Zt(3,2),Si(),T(4,xie,3,0,"span",1)),t&2&&(ne("mat-content-hide-toggle",!i._showToggle()),m(4),E(i._showToggle()?4:-1))},styles:[`.mat-expansion-panel-header { + display: flex; + flex-direction: row; + align-items: center; + padding: 0 24px; + border-radius: inherit; +} +.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 { + 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-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: ""; + 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 n})(),qR=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["mat-panel-description"]],hostAttrs:[1,"mat-expansion-panel-header-description"]})}return n})(),Wm=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275dir=yt({type:n,selectors:[["mat-panel-title"]],hostAttrs:[1,"mat-expansion-panel-header-title"]})}return n})(),ph=(()=>{class n extends HR{_keyManager;_ownHeaders=new ec;_headers;hideToggle=!1;displayMode="default";togglePosition="after";ngAfterContentInit(){this._headers.changes.pipe(Di(this._headers)).subscribe(e=>{this._ownHeaders.reset(e.filter(t=>t.panel.accordion===this)),this._ownHeaders.notifyOnChanges()}),this._keyManager=new dg(this._ownHeaders).withWrap().withHomeAndEnd()}_handleHeaderKeydown(e){this._keyManager.onKeydown(e)}_handleHeaderFocus(e){this._keyManager.updateActiveItem(e)}ngOnDestroy(){super.ngOnDestroy(),this._keyManager?.destroy(),this._ownHeaders.destroy()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=yi(n)))(i||n)}})();static \u0275dir=yt({type:n,selectors:[["mat-accordion"]],contentQueries:function(t,i,a){if(t&1&&Zi(a,$d,5),t&2){let s;gt(s=ht())&&(i._headers=s)}},hostAttrs:[1,"mat-accordion"],hostVars:2,hostBindings:function(t,i){t&2&&ne("mat-accordion-multi",i.multi)},inputs:{hideToggle:[2,"hideToggle","hideToggle",zt],displayMode:"displayMode",togglePosition:"togglePosition"},exportAs:["matAccordion"],features:[un([{provide:uE,useExisting:n}]),mi]})}return n})(),El=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=on({type:n});static \u0275inj=nn({imports:[T1,UC,Vi]})}return n})();var O1=(()=>{class n{httpClient=f(us);sanitizer=f(Pr);toasterService=f(re);cd=f(oe);thirdpartylicenses=z("");releasenotes=z("");ngOnInit(){this.httpClient.get(window.location.href+"/3rdpartylicenses.txt",{responseType:"text"}).subscribe({next:e=>{let t=e.replace(new RegExp(` +`,"g"),"
");this.thirdpartylicenses.set(this.sanitizer.bypassSecurityTrustHtml(t))},error:e=>{if(e.status===404)this.thirdpartylicenses.set("Download Solar-PuTTY");else{let t=e.error?.message||e.message||"Failed to load third party licenses";this.toasterService.error(t)}this.cd.markForCheck()}}),this.httpClient.get("ReleaseNotes.txt",{responseType:"text"}).subscribe({next:e=>{let t=e.replace(new RegExp(` +`,"g"),"
");this.releasenotes.set(this.sanitizer.bypassSecurityTrustHtml(t))},error:e=>{let t=e.error?.message||e.message||"Failed to load release notes";this.toasterService.error(t),this.cd.markForCheck()}})}goToDocumentation(){window.location.href="https://docs.gns3.com/docs-3.1-en"}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=V({type:n,selectors:[["app-help"]],decls:107,vars:2,consts:[[1,"help-page"],[1,"help-page__header"],[1,"help-page__title"],["mat-raised-button","","color","primary",1,"help-page__button",3,"click"],[1,"help-page__main"],[1,"help-page__overview"],[1,"help-page__overview-icon"],[1,"help-page__panel"],["multi",""],[1,"help-page__panel-title"],[1,"help-page__shortcuts"],[1,"help-page__shortcut"],["href","https://downloads.solarwinds.com/solarwinds/GNS3/Solar-PuTTY/Solar-PuTTY-Optional.exe",1,"help-page__link"],[3,"innerHTML"],[1,"help-page__release-notes",3,"innerHTML"]],template:function(t,i){t&1&&(r(0,"div",0)(1,"header",1)(2,"h1",2),c(3,"Help"),l(),r(4,"button",3),_("click",function(){return i.goToDocumentation()}),r(5,"mat-icon"),c(6,"open_in_new"),l(),c(7," Documentation "),l()(),r(8,"main",4)(9,"section",5)(10,"span",6)(11,"mat-icon"),c(12,"help_outline"),l()(),r(13,"div")(14,"h2"),c(15,"GNS3 Web UI help"),l(),r(16,"p"),c(17,"Find keyboard shortcuts, third-party component information, and release notes."),l()()(),r(18,"section",7)(19,"mat-accordion",8)(20,"mat-expansion-panel")(21,"mat-expansion-panel-header")(22,"mat-panel-title")(23,"span",9)(24,"mat-icon"),c(25,"keyboard"),l(),c(26," Useful shortcuts "),l()()(),r(27,"div",10)(28,"div",11)(29,"span")(30,"kbd"),c(31,"Ctrl"),l(),r(32,"kbd"),c(33,"+"),l()(),r(34,"span"),c(35,"Zoom in"),l()(),r(36,"div",11)(37,"span")(38,"kbd"),c(39,"Ctrl"),l(),r(40,"kbd"),c(41,"-"),l()(),r(42,"span"),c(43,"Zoom out"),l()(),r(44,"div",11)(45,"span")(46,"kbd"),c(47,"Ctrl"),l(),r(48,"kbd"),c(49,"0"),l()(),r(50,"span"),c(51,"Reset zoom"),l()(),r(52,"div",11)(53,"span")(54,"kbd"),c(55,"Ctrl"),l(),r(56,"kbd"),c(57,"H"),l()(),r(58,"span"),c(59,"Hide toolbar"),l()(),r(60,"div",11)(61,"span")(62,"kbd"),c(63,"Ctrl"),l(),r(64,"kbd"),c(65,"A"),l()(),r(66,"span"),c(67,"Select all map items"),l()(),r(68,"div",11)(69,"span")(70,"kbd"),c(71,"Ctrl"),l(),r(72,"kbd"),c(73,"Shift"),l(),r(74,"kbd"),c(75,"A"),l()(),r(76,"span"),c(77,"Deselect all map items"),l()(),r(78,"div",11)(79,"span")(80,"kbd"),c(81,"Ctrl"),l(),r(82,"kbd"),c(83,"Shift"),l(),r(84,"kbd"),c(85,"S"),l()(),r(86,"span"),c(87,"Open preferences"),l()()()(),r(88,"mat-expansion-panel")(89,"mat-expansion-panel-header")(90,"mat-panel-title")(91,"span",9)(92,"mat-icon"),c(93,"extension"),l(),c(94," Third-party components "),l()()(),r(95,"a",12)(96,"mat-icon"),c(97,"download"),l(),L(98,"span",13),l()(),r(99,"mat-expansion-panel")(100,"mat-expansion-panel-header")(101,"mat-panel-title")(102,"span",9)(103,"mat-icon"),c(104,"description"),l(),c(105," Release notes "),l()()(),L(106,"div",14),l()()()()()),t&2&&(m(98),v("innerHTML",i.thirdpartylicenses(),lf),m(8),v("innerHTML",i.releasenotes(),lf))},dependencies:[Y,he,El,ph,jd,$d,Wm,ie,ce],styles:["[_nghost-%COMP%]{display:block;width:100%;background:transparent}.help-page[_ngcontent-%COMP%]{animation:none}.help-page__header[_ngcontent-%COMP%], .help-page__main[_ngcontent-%COMP%]{max-width:1600px;margin-inline:auto}.help-page__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:24px 20px 16px}.help-page__title[_ngcontent-%COMP%]{margin:0;color:var(--mat-sys-on-surface);font-size:var(--gns3-density-page-title-size);font-weight:500;font-family:var(--mat-sys-title-large-font, Roboto),sans-serif;line-height:1.2;letter-spacing:normal;white-space:nowrap}button.help-page__button[_ngcontent-%COMP%]{height:var(--gns3-density-control-height);min-height:var(--gns3-density-control-height);padding-inline:var(--gns3-density-space-4);border-radius:var(--gns3-density-radius-lg);font-family:var(--mat-sys-label-large-font, Roboto),sans-serif;font-size:var(--gns3-button-label-size);font-weight:var(--gns3-button-label-weight);line-height:var(--gns3-button-label-line-height);letter-spacing:var(--gns3-button-label-spacing);text-transform:none;--mat-button-filled-container-height: var(--gns3-density-control-height);--mat-button-filled-label-text-size: var(--gns3-button-label-size);--mat-button-filled-label-text-weight: var(--gns3-button-label-weight);--mat-button-filled-label-text-tracking: var(--gns3-button-label-spacing);--mat-button-outlined-container-height: var(--gns3-density-control-height);--mat-button-outlined-label-text-size: var(--gns3-button-label-size);--mat-button-outlined-label-text-weight: var(--gns3-button-label-weight);--mat-button-outlined-label-text-tracking: var(--gns3-button-label-spacing);--mat-button-protected-container-height: var(--gns3-density-control-height);--mat-button-protected-label-text-size: var(--gns3-button-label-size);--mat-button-protected-label-text-weight: var(--gns3-button-label-weight);--mat-button-protected-label-text-tracking: var(--gns3-button-label-spacing);--mat-button-text-container-height: var(--gns3-density-control-height);--mat-button-text-label-text-size: var(--gns3-button-label-size);--mat-button-text-label-text-weight: var(--gns3-button-label-weight);--mat-button-text-label-text-tracking: var(--gns3-button-label-spacing)}.help-page__main[_ngcontent-%COMP%]{padding:0 20px 24px}.help-page__overview[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--gns3-density-card-gap);margin-bottom:var(--gns3-density-card-gap);padding:16px 18px;border:1px solid var(--mat-sys-outline-variant);border-radius:14px;background:var(--mat-sys-surface-container)}.help-page__overview[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;color:var(--mat-sys-on-surface);font-size:17px;font-weight:600}.help-page__overview[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:3px 0 0;color:var(--mat-sys-on-surface-variant);font-size:14px}.help-page__overview-icon[_ngcontent-%COMP%]{display:grid;flex:0 0 42px;width:42px;height:42px;place-items:center;border-radius:11px;color:var(--mat-sys-on-primary-container);background:var(--mat-sys-primary-container)}.help-page__panel[_ngcontent-%COMP%]{overflow:hidden;border-radius:16px;background:var(--mat-sys-surface);border:var(--gns3-surface-border);box-shadow:none}.mat-expansion-panel[_ngcontent-%COMP%]{border-bottom:1px solid var(--mat-sys-outline-variant);border-radius:0;background:var(--mat-sys-surface);box-shadow:none}.mat-expansion-panel[_ngcontent-%COMP%]:last-child{border-bottom:0}.mat-expansion-panel-header[_ngcontent-%COMP%]{min-height:var(--gns3-density-section-header-height);padding-inline:20px;color:var(--mat-sys-on-surface);background:color-mix(in srgb,var(--mat-sys-primary-container) 28%,var(--mat-sys-surface))}.mat-expansion-panel[_ngcontent-%COMP%] .mat-expansion-panel-header[_ngcontent-%COMP%]:hover{background:color-mix(in srgb,var(--mat-sys-primary-container) 45%,var(--mat-sys-surface))}.mat-expansion-panel-header-title[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface)}.help-page__panel-title[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--gns3-density-space-3);font-size:15px;font-weight:600}.help-page__panel-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--mat-sys-primary)}.help-page__shortcuts[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;overflow:hidden;margin:4px 0 8px;border:1px solid var(--mat-sys-outline-variant);border-radius:12px;background:var(--mat-sys-outline-variant)}.help-page__shortcut[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;min-height:54px;gap:var(--gns3-density-card-gap);padding:10px 14px;color:var(--mat-sys-on-surface);background:var(--mat-sys-surface-container-low);font-size:14px}.help-page__shortcut[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:first-child{display:flex;flex:0 0 auto;align-items:center;gap:5px}kbd[_ngcontent-%COMP%]{min-width:25px;padding:4px 7px;border:1px solid var(--mat-sys-outline-variant);border-bottom-width:2px;border-radius:6px;color:var(--mat-sys-on-surface);background:var(--mat-sys-surface-container-highest);font:inherit;font-size:12px;font-weight:600;line-height:1;text-align:center}.help-page__link[_ngcontent-%COMP%]{display:inline-flex;align-items:flex-start;max-width:100%;gap:8px;padding-block:8px;color:var(--mat-sys-primary);font-size:14px;text-decoration:none}.help-page__link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{flex:0 0 auto;width:19px;height:19px;font-size:19px}.help-page__link[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{min-width:0;overflow-wrap:anywhere}.help-page__link[_ngcontent-%COMP%]:hover{text-decoration:underline}.help-page__release-notes[_ngcontent-%COMP%]{max-height:min(60vh,640px);overflow:auto;padding:8px 4px 12px;color:var(--mat-sys-on-surface);font-size:14px;line-height:1.6;overflow-wrap:anywhere}[data-density=compact][_nghost-%COMP%] button.help-page__button[_ngcontent-%COMP%], [data-density=compact] [_nghost-%COMP%] button.help-page__button[_ngcontent-%COMP%]{min-height:40px;height:40px}[data-density=compact][_nghost-%COMP%] .mat-expansion-panel-header[_ngcontent-%COMP%], [data-density=compact] [_nghost-%COMP%] .mat-expansion-panel-header[_ngcontent-%COMP%]{min-height:52px}@media(max-width:800px){.help-page__shortcuts[_ngcontent-%COMP%]{grid-template-columns:1fr}}@media(max-width:600px){.help-page__header[_ngcontent-%COMP%]{align-items:stretch;flex-direction:column;padding:20px 16px 12px}.help-page__main[_ngcontent-%COMP%]{padding-inline:16px}button.help-page__button[_ngcontent-%COMP%]{width:100%}.help-page__overview[_ngcontent-%COMP%]{align-items:flex-start}.help-page__shortcut[_ngcontent-%COMP%]{align-items:flex-start;flex-direction:column;gap:8px}}"],changeDetection:0})}return n})();var D1=(()=>{class n{constructor(){}isWindows(){return navigator.platform.indexOf("Win")>-1}isLinux(){return navigator.platform.indexOf("Linux")>-1}isDarwin(){return navigator.platform.indexOf("Mac")>-1}static \u0275fac=function(t){return new(t||n)};static \u0275prov=J({token:n,factory:n.\u0275fac})}return n})();var I1=(()=>{class n{platformService;constructor(e){this.platformService=e}get(){return this.platformService.isWindows()?this.getForWindows():this.platformService.isDarwin()?this.getForDarwin():this.getForLinux()}getForWindows(){let e=[{name:"Wireshark",locations:["C:\\Program Files\\Wireshark\\Wireshark.exe"],type:"web",resource:"https://1.na.dl.wireshark.org/win64/all-versions/Wireshark-win64-2.6.3.exe",binary:"Wireshark.exe",sudo:!0,installation_arguments:[],installed:!1,installer:!0}],t={name:"SolarPuTTY",locations:["SolarPuTTY.exe","external\\SolarPuTTY.exe"],type:"web",resource:"",binary:"SolarPuTTY.exe",sudo:!1,installation_arguments:["--only-ask"],installed:!1,installer:!1};return zi.solarputty_download_url&&(t.resource=zi.solarputty_download_url,e.push(t)),e}getForLinux(){return[]}getForDarwin(){return[]}static \u0275fac=function(t){return new(t||n)(_e(D1))};static \u0275prov=J({token:n,factory:n.\u0275fac})}return n})();var A1=(()=>{class n{externalSoftwareDefinition;constructor(e){this.externalSoftwareDefinition=e}list(){return this.externalSoftwareDefinition.get().map(t=>(t.installed=!1,t))}static \u0275fac=function(t){return new(t||n)(_e(I1))};static \u0275prov=J({token:n,factory:n.\u0275fac})}return n})();var Sie=(n,o)=>({hidden:n,lightTheme:o}),kie=/(.*)<\/a>(.*)\s*